mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
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;
|
||||
|
||||
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()) {
|
||||
|
||||
@@ -359,7 +359,13 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void showChooseActivityTypeDialog() {
|
||||
try {
|
||||
removeDialog(DIALOG_CHOOSE_ACTIVITY);
|
||||
} catch (Exception e) {
|
||||
// Can safely ignore.
|
||||
}
|
||||
showDialog(DIALOG_CHOOSE_ACTIVITY);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,11 @@ public class Api11Adapter extends Api10Adapter {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showEditTextClearButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTabBackground(TabWidget tabWidget) {
|
||||
for (int i = 0; i < tabWidget.getChildCount(); i++) {
|
||||
|
||||
@@ -144,6 +144,11 @@ public class Api8Adapter implements ApiAdapter {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showEditTextClearButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTabBackground(TabWidget tabWidget) {
|
||||
// Do nothing
|
||||
|
||||
@@ -176,8 +176,17 @@ public interface ApiAdapter {
|
||||
*/
|
||||
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.
|
||||
* <p>
|
||||
* Due to changes in API level 11.
|
||||
*
|
||||
* @param tabWidget the tab widget
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user