forked from upstream-mirrors/OpenTracks
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:
+15
-9
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.google.android.apps.mytracks.fragments;
|
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.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.apps.mytracks.util.TrackIconUtils;
|
import com.google.android.apps.mytracks.util.TrackIconUtils;
|
||||||
@@ -106,16 +107,21 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(
|
ImageButton imageButton = (ImageButton) view.findViewById(
|
||||||
R.id.choose_activity_type_weight_image_button);
|
R.id.choose_activity_type_weight_image_button);
|
||||||
imageButton.setOnClickListener(new View.OnClickListener() {
|
if (ApiAdapterFactory.getApiAdapter().showEditTextClearButton()) {
|
||||||
@Override
|
imageButton.setVisibility(View.VISIBLE);
|
||||||
public void onClick(View v) {
|
imageButton.setOnClickListener(new View.OnClickListener() {
|
||||||
double weightDefault = PreferencesUtils.WEIGHT_DEFAULT;
|
@Override
|
||||||
if (!PreferencesUtils.isMetricUnits(activity)) {
|
public void onClick(View v) {
|
||||||
weightDefault *= UnitConversions.KG_TO_LB;
|
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>();
|
List<Integer> imageIds = new ArrayList<Integer>();
|
||||||
for (String iconValue : TrackIconUtils.getAllIconValues()) {
|
for (String iconValue : TrackIconUtils.getAllIconValues()) {
|
||||||
|
|||||||
@@ -359,7 +359,13 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void showChooseActivityTypeDialog() {
|
public void showChooseActivityTypeDialog() {
|
||||||
|
try {
|
||||||
|
removeDialog(DIALOG_CHOOSE_ACTIVITY);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Can safely ignore.
|
||||||
|
}
|
||||||
showDialog(DIALOG_CHOOSE_ACTIVITY);
|
showDialog(DIALOG_CHOOSE_ACTIVITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,11 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showEditTextClearButton() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTabBackground(TabWidget tabWidget) {
|
public void setTabBackground(TabWidget tabWidget) {
|
||||||
for (int i = 0; i < tabWidget.getChildCount(); i++) {
|
for (int i = 0; i < tabWidget.getChildCount(); i++) {
|
||||||
|
|||||||
@@ -144,6 +144,11 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showEditTextClearButton() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTabBackground(TabWidget tabWidget) {
|
public void setTabBackground(TabWidget tabWidget) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|||||||
@@ -176,8 +176,17 @@ public interface ApiAdapter {
|
|||||||
*/
|
*/
|
||||||
public boolean isSpinnerBackgroundLight();
|
public boolean isSpinnerBackgroundLight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True to display a clear button on the right of the edit text.
|
||||||
|
* <p>
|
||||||
|
* Due to changes in API level 11.
|
||||||
|
*/
|
||||||
|
public boolean showEditTextClearButton();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tab background.
|
* Sets the tab background.
|
||||||
|
* <p>
|
||||||
|
* Due to changes in API level 11.
|
||||||
*
|
*
|
||||||
* @param tabWidget the tab widget
|
* @param tabWidget the tab widget
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user