Refactoring
This commit is contained in:
parent
71a84fcbc4
commit
180126c5c0
16 changed files with 92 additions and 55 deletions
|
@ -22,24 +22,31 @@
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:src="@drawable/widget_time"/>
|
android:id="@+id/calendarImageView"
|
||||||
<Spinner android:layout_gravity="fill_horizontal"/>
|
android:src="@drawable/ic_action_data"/>
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/montReportsSpinner"
|
||||||
|
android:layout_gravity="fill_horizontal"/>
|
||||||
<View
|
<View
|
||||||
android:layout_column="1"
|
android:layout_column="1"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/regionIconImageView"
|
||||||
android:src="@drawable/ic_world_globe_dark"
|
android:src="@drawable/ic_world_globe_dark"
|
||||||
android:layout_rowSpan="2"/>
|
android:layout_rowSpan="2"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="Report for:"/>
|
android:text="Report for:"/>
|
||||||
<Spinner android:layout_gravity="fill_horizontal"/>
|
<Spinner
|
||||||
|
android:id="@+id/regionReportsSpinner"
|
||||||
|
android:layout_gravity="fill_horizontal"/>
|
||||||
<View
|
<View
|
||||||
android:layout_columnSpan="2"
|
android:layout_columnSpan="2"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:src="@drawable/ic_world_globe_dark"
|
android:id="@+id/numberOfContributorsIcon"
|
||||||
|
android:src="@drawable/ic_group"
|
||||||
android:layout_rowSpan="2"/>
|
android:layout_rowSpan="2"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="Number of contributors"/>
|
android:text="Number of contributors"/>
|
||||||
|
@ -51,7 +58,8 @@
|
||||||
android:background="?attr/dashboard_divider"/>
|
android:background="?attr/dashboard_divider"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:src="@drawable/ic_world_globe_dark"
|
android:id="@+id/numberOfEditsIcon"
|
||||||
|
android:src="@drawable/ic_group"
|
||||||
android:layout_rowSpan="2"/>
|
android:layout_rowSpan="2"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="Number of edits"/>
|
android:text="Number of edits"/>
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.ColorDialogs;
|
import net.osmand.plus.helpers.ColorDialogs;
|
||||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||||
|
|
|
@ -32,8 +32,8 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmAndListFragment;
|
|
||||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||||
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||||
|
|
|
@ -35,8 +35,8 @@ import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.OsmAndListFragment;
|
|
||||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||||
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
import net.osmand.plus.poi.NominatimPoiFilter;
|
import net.osmand.plus.poi.NominatimPoiFilter;
|
||||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
|
|
|
@ -37,9 +37,9 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.ActionBarProgressActivity;
|
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmAndListFragment;
|
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||||
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||||
|
|
42
OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java
Normal file
42
OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.support.annotation.ColorInt;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.support.annotation.IdRes;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import net.osmand.plus.IconsCache;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by GaidamakUA on 1/12/16.
|
||||||
|
*/
|
||||||
|
public class BaseOsmAndFragment extends Fragment {
|
||||||
|
private IconsCache iconsCache;
|
||||||
|
|
||||||
|
protected OsmandApplication getMyApplication() {
|
||||||
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IconsCache getIconsCache() {
|
||||||
|
if (iconsCache == null) {
|
||||||
|
iconsCache = getMyApplication().getIconsCache();
|
||||||
|
}
|
||||||
|
return iconsCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color){
|
||||||
|
return getIconsCache().getPaintedContentIcon(id, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Drawable getContentIcon(@DrawableRes int id){
|
||||||
|
return getIconsCache().getContentIcon(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setThemedDrawable(View parent, @IdRes int viewId, @DrawableRes int iconId) {
|
||||||
|
((ImageView) parent.findViewById(viewId)).setImageDrawable(getContentIcon(iconId));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,12 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.ListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
public abstract class OsmAndListFragment extends ListFragment {
|
public abstract class OsmAndListFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,12 +1,9 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import android.graphics.Shader.TileMode;
|
import android.graphics.Shader.TileMode;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -15,18 +12,17 @@ import android.widget.ExpandableListAdapter;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.ExpandableListView.OnChildClickListener;
|
import android.widget.ExpandableListView.OnChildClickListener;
|
||||||
|
|
||||||
public abstract class OsmandExpandableListFragment extends Fragment
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
|
|
||||||
|
public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
|
||||||
implements OnChildClickListener {
|
implements OnChildClickListener {
|
||||||
|
|
||||||
|
|
||||||
protected ExpandableListView listView;
|
protected ExpandableListView listView;
|
||||||
protected ExpandableListAdapter adapter;
|
protected ExpandableListAdapter adapter;
|
||||||
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
|
||||||
return (OsmandApplication) getActivity().getApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
|
||||||
View v = createView(inflater, container);
|
View v = createView(inflater, container);
|
|
@ -46,7 +46,7 @@ import net.osmand.plus.activities.LocalIndexHelper;
|
||||||
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
||||||
import net.osmand.plus.activities.LocalIndexInfo;
|
import net.osmand.plus.activities.LocalIndexInfo;
|
||||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import android.widget.TextView;
|
||||||
import net.osmand.map.OsmandRegions;
|
import net.osmand.map.OsmandRegions;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.OsmAndListFragment;
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import net.osmand.plus.download.DownloadResources;
|
import net.osmand.plus.download.DownloadResources;
|
||||||
|
|
|
@ -51,9 +51,9 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
import net.osmand.plus.activities.TrackActivity;
|
||||||
|
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
|
|
@ -41,9 +41,9 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmAndListFragment;
|
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
import net.osmand.plus.activities.TrackActivity;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
import net.osmand.plus.helpers.ColorDialogs;
|
import net.osmand.plus.helpers.ColorDialogs;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.graphics.Point;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -28,8 +27,8 @@ import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiFilter;
|
import net.osmand.osm.PoiFilter;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.osm.edit.OSMSettings;
|
import net.osmand.osm.edit.OSMSettings;
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -39,7 +38,7 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class AdvancedEditPoiFragment extends Fragment
|
public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
||||||
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
||||||
private static final String TAG = "AdvancedEditPoiFragment";
|
private static final String TAG = "AdvancedEditPoiFragment";
|
||||||
private static final Log LOG = PlatformUtil.getLog(AdvancedEditPoiFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(AdvancedEditPoiFragment.class);
|
||||||
|
@ -68,8 +67,7 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
view.findViewById(R.id.screenFiller).setMinimumHeight(height);
|
view.findViewById(R.id.screenFiller).setMinimumHeight(height);
|
||||||
|
|
||||||
deleteDrawable = ((OsmandApplication) getActivity().getApplication()).getIconsCache()
|
deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark,
|
||||||
.getPaintedContentIcon(R.drawable.ic_action_remove_dark,
|
|
||||||
getActivity().getResources().getColor(R.color.dash_search_icon_dark));
|
getActivity().getResources().getColor(R.color.dash_search_icon_dark));
|
||||||
nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
||||||
amenityTagTextView = (TextView) view.findViewById(R.id.amenityTagTextView);
|
amenityTagTextView = (TextView) view.findViewById(R.id.amenityTagTextView);
|
||||||
|
@ -77,7 +75,7 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
LinearLayout editTagsLineaLayout =
|
LinearLayout editTagsLineaLayout =
|
||||||
(LinearLayout) view.findViewById(R.id.editTagsList);
|
(LinearLayout) view.findViewById(R.id.editTagsList);
|
||||||
|
|
||||||
final MapPoiTypes mapPoiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes();
|
final MapPoiTypes mapPoiTypes = getMyApplication().getPoiTypes();
|
||||||
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
|
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
|
||||||
// It is possible to not restart initialization every time, and probably move initialization to appInit
|
// It is possible to not restart initialization every time, and probably move initialization to appInit
|
||||||
Map<String, PoiType> translatedTypes = getData().getAllTranslatedSubTypes();
|
Map<String, PoiType> translatedTypes = getData().getAllTranslatedSubTypes();
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.graphics.Point;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -23,9 +22,8 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.osm.edit.OSMSettings;
|
import net.osmand.osm.edit.OSMSettings;
|
||||||
import net.osmand.plus.IconsCache;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment;
|
||||||
import net.osmand.plus.osmedit.dialogs.OpeningHoursHoursDialogFragment;
|
import net.osmand.plus.osmedit.dialogs.OpeningHoursHoursDialogFragment;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -36,7 +34,7 @@ import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
public class BasicEditPoiFragment extends Fragment
|
public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||||
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
||||||
private static final Log LOG = PlatformUtil.getLog(BasicEditPoiFragment.class);
|
private static final Log LOG = PlatformUtil.getLog(BasicEditPoiFragment.class);
|
||||||
private static final String OPENING_HOURS = "opening_hours";
|
private static final String OPENING_HOURS = "opening_hours";
|
||||||
|
@ -63,26 +61,24 @@ public class BasicEditPoiFragment extends Fragment
|
||||||
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
||||||
int iconColor = typedValue.data;
|
int iconColor = typedValue.data;
|
||||||
|
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
|
||||||
|
|
||||||
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
|
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
|
||||||
streetImageView.setImageDrawable(
|
streetImageView.setImageDrawable(
|
||||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_street_name, iconColor));
|
getPaintedContentIcon(R.drawable.ic_action_street_name, iconColor));
|
||||||
ImageView houseNumberImageView = (ImageView) view.findViewById(R.id.houseNumberImageView);
|
ImageView houseNumberImageView = (ImageView) view.findViewById(R.id.houseNumberImageView);
|
||||||
houseNumberImageView.setImageDrawable(
|
houseNumberImageView.setImageDrawable(
|
||||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_building_number, iconColor));
|
getPaintedContentIcon(R.drawable.ic_action_building_number, iconColor));
|
||||||
ImageView phoneImageView = (ImageView) view.findViewById(R.id.phoneImageView);
|
ImageView phoneImageView = (ImageView) view.findViewById(R.id.phoneImageView);
|
||||||
phoneImageView.setImageDrawable(
|
phoneImageView.setImageDrawable(
|
||||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_call_dark, iconColor));
|
getPaintedContentIcon(R.drawable.ic_action_call_dark, iconColor));
|
||||||
ImageView webSiteImageView = (ImageView) view.findViewById(R.id.webSiteImageView);
|
ImageView webSiteImageView = (ImageView) view.findViewById(R.id.webSiteImageView);
|
||||||
webSiteImageView.setImageDrawable(
|
webSiteImageView.setImageDrawable(
|
||||||
iconsCache.getPaintedContentIcon(R.drawable.ic_world_globe_dark, iconColor));
|
getPaintedContentIcon(R.drawable.ic_world_globe_dark, iconColor));
|
||||||
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
|
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
|
||||||
descriptionImageView.setImageDrawable(
|
descriptionImageView.setImageDrawable(
|
||||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_description, iconColor));
|
getPaintedContentIcon(R.drawable.ic_action_description, iconColor));
|
||||||
ImageView openingHoursImageView = (ImageView) view.findViewById(R.id.openingHoursImageView);
|
ImageView openingHoursImageView = (ImageView) view.findViewById(R.id.openingHoursImageView);
|
||||||
openingHoursImageView.setImageDrawable(
|
openingHoursImageView.setImageDrawable(
|
||||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
|
getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
|
||||||
|
|
||||||
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
|
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
|
||||||
houseNumberEditText = (EditText) view.findViewById(R.id.houseNumberEditText);
|
houseNumberEditText = (EditText) view.findViewById(R.id.houseNumberEditText);
|
||||||
|
@ -106,10 +102,8 @@ public class BasicEditPoiFragment extends Fragment
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
LinearLayout openHoursContainer = (LinearLayout) view.findViewById(R.id.openHoursContainer);
|
LinearLayout openHoursContainer = (LinearLayout) view.findViewById(R.id.openHoursContainer);
|
||||||
Drawable clockDrawable = iconsCache
|
Drawable clockDrawable = getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
|
||||||
.getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
|
Drawable deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
|
||||||
Drawable deleteDrawable = iconsCache
|
|
||||||
.getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
|
|
||||||
if (savedInstanceState != null && savedInstanceState.containsKey(OPENING_HOURS)) {
|
if (savedInstanceState != null && savedInstanceState.containsKey(OPENING_HOURS)) {
|
||||||
mOpeningHoursAdapter = new OpeningHoursAdapter(
|
mOpeningHoursAdapter = new OpeningHoursAdapter(
|
||||||
(OpeningHoursParser.OpeningHours) savedInstanceState.getSerializable(OPENING_HOURS),
|
(OpeningHoursParser.OpeningHours) savedInstanceState.getSerializable(OPENING_HOURS),
|
||||||
|
@ -123,10 +117,6 @@ public class BasicEditPoiFragment extends Fragment
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OsmandApplication getMyApplication() {
|
|
||||||
return (OsmandApplication) getActivity().getApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addTextWatcher(final String tag, final EditText e) {
|
protected void addTextWatcher(final String tag, final EditText e) {
|
||||||
e.addTextChangedListener(new TextWatcher() {
|
e.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.ActionBarProgressActivity;
|
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmAndListFragment;
|
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.dialogs.ProgressDialogFragment;
|
import net.osmand.plus.dialogs.ProgressDialogFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
|
Loading…
Reference in a new issue