forked from upstream-mirrors/OpenTracks
A few fixes.
- use fill_parent since we are still supporting api level 7. - on the TrackListActivity, hide the empty view content until the check unit dialog has been showned. - fix the ChartView height. ChartView is no longer displayed on the full canvas. The new design has a tab bar and a zoom control. - In TrackDetailActivity, only call methods of a tab fragment if it is the current tab.
This commit is contained in:
+14
-5
@@ -17,6 +17,7 @@
|
||||
package com.google.android.apps.mytracks.fragments;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
import com.google.android.apps.mytracks.TrackListActivity;
|
||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||
import com.google.android.apps.mytracks.util.CheckUnitsUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
@@ -31,13 +32,13 @@ import android.support.v4.app.DialogFragment;
|
||||
|
||||
/**
|
||||
* A DialogFragment to check preferred units.
|
||||
*
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class CheckUnitsDialogFragment extends DialogFragment {
|
||||
|
||||
public static final String CHECK_UNITS_DIALOG_TAG = "checkUnitsDialog";
|
||||
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
@@ -46,19 +47,18 @@ public class CheckUnitsDialogFragment extends DialogFragment {
|
||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
CheckUnitsUtils.setCheckUnitsValue(getActivity());
|
||||
handleButtonClicked();
|
||||
}
|
||||
})
|
||||
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
CheckUnitsUtils.setCheckUnitsValue(getActivity());
|
||||
|
||||
int position = ((AlertDialog) dialog).getListView().getSelectedItemPosition();
|
||||
SharedPreferences sharedPreferences = getActivity()
|
||||
.getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
ApiAdapterFactory.getApiAdapter().applyPreferenceChanges(sharedPreferences.edit()
|
||||
.putBoolean(getString(R.string.metric_units_key), position == 0));
|
||||
handleButtonClicked();
|
||||
}
|
||||
})
|
||||
.setSingleChoiceItems(new CharSequence[] { getString(R.string.preferred_units_metric),
|
||||
@@ -66,4 +66,13 @@ public class CheckUnitsDialogFragment extends DialogFragment {
|
||||
.setTitle(R.string.preferred_units_title)
|
||||
.create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a button click.
|
||||
*/
|
||||
private void handleButtonClicked() {
|
||||
CheckUnitsUtils.setCheckUnitsValue(getActivity());
|
||||
TrackListActivity trackListActivity = (TrackListActivity) getActivity();
|
||||
trackListActivity.enableEmptyView();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user