forked from upstream-mirrors/OpenTracks
Introduced material design icons.
This commit is contained in:
+1
-11
@@ -21,8 +21,6 @@ import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.BitmapFactory.Options;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
@@ -68,15 +66,7 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
|
||||
imageIds.add(TrackIconUtils.getIconDrawable(iconValue));
|
||||
}
|
||||
|
||||
Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_track_airplane, options);
|
||||
int padding = 32;
|
||||
int width = options.outWidth + 2 * padding;
|
||||
int height = options.outHeight + 2 * padding;
|
||||
gridView.setColumnWidth(width);
|
||||
|
||||
final ChooseActivityTypeImageAdapter imageAdapter = new ChooseActivityTypeImageAdapter(activity, imageIds, width, height, padding);
|
||||
final ChooseActivityTypeImageAdapter imageAdapter = new ChooseActivityTypeImageAdapter(imageIds);
|
||||
gridView.setAdapter(imageAdapter);
|
||||
|
||||
final AlertDialog alertDialog = new AlertDialog.Builder(activity).setTitle(R.string.track_edit_activity_type_hint).setView(view).create();
|
||||
|
||||
+10
-14
@@ -16,7 +16,6 @@
|
||||
|
||||
package de.dennisguse.opentracks.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -26,6 +25,7 @@ import android.widget.ImageView;
|
||||
import java.util.List;
|
||||
|
||||
import de.dennisguse.opentracks.R;
|
||||
import de.dennisguse.opentracks.util.ResourceUtils;
|
||||
|
||||
/**
|
||||
* Image adapter for choosing an activity type.
|
||||
@@ -34,19 +34,11 @@ import de.dennisguse.opentracks.R;
|
||||
*/
|
||||
public class ChooseActivityTypeImageAdapter extends BaseAdapter {
|
||||
|
||||
private final Context context;
|
||||
private final List<Integer> imageIds;
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final int padding;
|
||||
private int selected = -1;
|
||||
|
||||
ChooseActivityTypeImageAdapter(Context context, List<Integer> imageIds, int width, int height, int padding) {
|
||||
this.context = context;
|
||||
ChooseActivityTypeImageAdapter(List<Integer> imageIds) {
|
||||
this.imageIds = imageIds;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.padding = padding;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,19 +68,23 @@ public class ChooseActivityTypeImageAdapter extends BaseAdapter {
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ImageView imageView;
|
||||
if (convertView == null) {
|
||||
imageView = new ImageView(context);
|
||||
imageView = new ImageView(parent.getContext());
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
imageView.setAdjustViewBounds(true);
|
||||
|
||||
int padding = ResourceUtils.dpToPx(parent.getContext(), 8);
|
||||
imageView.setPaddingRelative(padding, padding, padding, padding);
|
||||
} else {
|
||||
imageView = (ImageView) convertView;
|
||||
}
|
||||
|
||||
if (position == selected) {
|
||||
imageView.setBackgroundResource(R.drawable.list_selector_background_transition_holo_dark);
|
||||
} else {
|
||||
imageView.setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
imageView.setImageResource(imageIds.get(position));
|
||||
imageView.setMinimumHeight(height);
|
||||
imageView.setMinimumWidth(width);
|
||||
imageView.setPadding(padding, padding, padding, padding);
|
||||
return imageView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import de.dennisguse.opentracks.util.IntentUtils;
|
||||
import de.dennisguse.opentracks.util.ListItemUtils;
|
||||
import de.dennisguse.opentracks.util.StatsUtils;
|
||||
import de.dennisguse.opentracks.util.StringUtils;
|
||||
import de.dennisguse.opentracks.util.TrackIconUtils;
|
||||
|
||||
/**
|
||||
* A fragment to show marker details.
|
||||
@@ -179,8 +178,6 @@ public class MarkerDetailFragment extends Fragment {
|
||||
inflater.inflate(R.menu.marker_detail, menu);
|
||||
|
||||
updateWaypoint(false);
|
||||
|
||||
TrackIconUtils.setMenuIconColor(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user