forked from upstream-mirrors/OpenTracks
Remove X clear button next to text widget for entering weight
This commit is contained in:
@@ -40,30 +40,16 @@ limitations under the License.
|
|||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:paddingLeft="12dp"
|
android:paddingLeft="12dp"
|
||||||
style="@style/TextMedium" />
|
style="@style/TextMedium" />
|
||||||
<FrameLayout
|
<EditText
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/choose_activity_type_weight"
|
||||||
android:layout_width="fill_parent" >
|
android:inputType="numberDecimal"
|
||||||
<EditText
|
android:layout_marginBottom="4dp"
|
||||||
android:id="@+id/choose_activity_type_weight"
|
android:layout_marginLeft="16dp"
|
||||||
android:inputType="numberDecimal"
|
android:layout_marginRight="16dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginTop="2dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginRight="16dp"
|
android:selectAllOnFocus="true"
|
||||||
android:layout_marginTop="2dp"
|
android:singleLine="true"
|
||||||
android:layout_width="match_parent"
|
style="@style/TextMedium" />
|
||||||
android:selectAllOnFocus="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<ImageButton
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:contentDescription="@string/menu_delete"
|
|
||||||
android:id="@+id/choose_activity_type_weight_image_button"
|
|
||||||
android:layout_gravity="right|center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:paddingRight="12dp"
|
|
||||||
android:src="@android:drawable/ic_menu_close_clear_cancel" />
|
|
||||||
</FrameLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
-21
@@ -16,12 +16,10 @@
|
|||||||
|
|
||||||
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.DialogUtils;
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
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;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -36,7 +34,6 @@ import android.view.View;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -106,24 +103,6 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
final TextView weight = (TextView) view.findViewById(R.id.choose_activity_type_weight);
|
final TextView weight = (TextView) view.findViewById(R.id.choose_activity_type_weight);
|
||||||
|
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(
|
|
||||||
R.id.choose_activity_type_weight_image_button);
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} 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()) {
|
||||||
imageIds.add(TrackIconUtils.getIconDrawable(iconValue));
|
imageIds.add(TrackIconUtils.getIconDrawable(iconValue));
|
||||||
|
|||||||
@@ -173,11 +173,6 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
activity.invalidateOptionsMenu();
|
activity.invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@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++) {
|
||||||
|
|||||||
@@ -145,11 +145,6 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean showEditTextClearButton() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTabBackground(TabWidget tabWidget) {
|
public void setTabBackground(TabWidget tabWidget) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|||||||
@@ -176,13 +176,6 @@ public interface ApiAdapter {
|
|||||||
*/
|
*/
|
||||||
public void invalidMenu(Activity activity);
|
public void invalidMenu(Activity activity);
|
||||||
|
|
||||||
/**
|
|
||||||
* 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>
|
* <p>
|
||||||
|
|||||||
Reference in New Issue
Block a user