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:
Jimmy Shih
2012-04-23 17:49:23 -07:00
parent 2ea4b09dcc
commit 33118568bc
7 changed files with 71 additions and 29 deletions
@@ -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();
}
}