Remove choose activity type dialog beore starting a new one. Remove clear button next to text edit for api level < 11

This commit is contained in:
Jimmy Shih
2013-11-22 11:43:49 -08:00
parent 74713239fb
commit 9442416844
5 changed files with 40 additions and 9 deletions
@@ -16,6 +16,7 @@
package com.google.android.apps.mytracks.fragments;
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.apps.mytracks.util.StringUtils;
import com.google.android.apps.mytracks.util.TrackIconUtils;
@@ -106,16 +107,21 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
ImageButton imageButton = (ImageButton) view.findViewById(
R.id.choose_activity_type_weight_image_button);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
double weightDefault = PreferencesUtils.WEIGHT_DEFAULT;
if (!PreferencesUtils.isMetricUnits(activity)) {
weightDefault *= UnitConversions.KG_TO_LB;
if (ApiAdapterFactory.getApiAdapter().showEditTextClearButton()) {
imageButton.setVisibility(View.VISIBLE);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
double weightDefault = PreferencesUtils.WEIGHT_DEFAULT;
if (!PreferencesUtils.isMetricUnits(activity)) {
weightDefault *= UnitConversions.KG_TO_LB;
}
weight.setText(StringUtils.formatWeight(weightDefault));
}
weight.setText(StringUtils.formatWeight(weightDefault));
}
});
});
} else {
imageButton.setVisibility(View.GONE);
}
List<Integer> imageIds = new ArrayList<Integer>();
for (String iconValue : TrackIconUtils.getAllIconValues()) {