diff --git a/OsmAnd/res/layout/fragment_reports.xml b/OsmAnd/res/layout/fragment_reports.xml
index 46e14e9bfc..47c766d415 100644
--- a/OsmAnd/res/layout/fragment_reports.xml
+++ b/OsmAnd/res/layout/fragment_reports.xml
@@ -22,24 +22,31 @@
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
-
+ android:id="@+id/calendarImageView"
+ android:src="@drawable/ic_action_data"/>
+
-
+
@@ -51,7 +58,8 @@
android:background="?attr/dashboard_divider"/>
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
index 5c8f035798..5b8df5e411 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
@@ -27,6 +27,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
import net.osmand.plus.base.FavoriteImageDrawable;
+import net.osmand.plus.base.OsmAndListFragment;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.util.MapUtils;
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
index 0592f2714e..8fb41d5d43 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
@@ -50,6 +50,7 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.base.FavoriteImageDrawable;
+import net.osmand.plus.base.OsmandExpandableListFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.myplaces.FavoritesActivity;
diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java
index 7c8fc394ee..525f319b6c 100644
--- a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java
@@ -32,8 +32,8 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.activities.OsmAndListFragment;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
+import net.osmand.plus.base.OsmAndListFragment;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java
index ce87a51934..b99f2534cd 100644
--- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java
@@ -35,8 +35,8 @@ import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
-import net.osmand.plus.activities.OsmAndListFragment;
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.PoiFiltersHelper;
import net.osmand.plus.poi.PoiUIFilter;
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java
index 1b2ad689fa..623160e952 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java
@@ -37,9 +37,9 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.ActionBarProgressActivity;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.activities.OsmAndListFragment;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
+import net.osmand.plus.base.OsmAndListFragment;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.myplaces.FavoritesActivity;
diff --git a/OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java b/OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java
new file mode 100644
index 0000000000..2212830466
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java
@@ -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));
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/activities/OsmAndListFragment.java b/OsmAnd/src/net/osmand/plus/base/OsmAndListFragment.java
similarity index 95%
rename from OsmAnd/src/net/osmand/plus/activities/OsmAndListFragment.java
rename to OsmAnd/src/net/osmand/plus/base/OsmAndListFragment.java
index 92fe58584f..22e303ae88 100644
--- a/OsmAnd/src/net/osmand/plus/activities/OsmAndListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/base/OsmAndListFragment.java
@@ -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.support.v4.app.ListFragment;
import android.widget.ArrayAdapter;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+
public abstract class OsmAndListFragment extends ListFragment {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/activities/OsmandExpandableListFragment.java b/OsmAnd/src/net/osmand/plus/base/OsmandExpandableListFragment.java
similarity index 93%
rename from OsmAnd/src/net/osmand/plus/activities/OsmandExpandableListFragment.java
rename to OsmAnd/src/net/osmand/plus/base/OsmandExpandableListFragment.java
index f26349e7a8..1956a15dde 100644
--- a/OsmAnd/src/net/osmand/plus/activities/OsmandExpandableListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/base/OsmandExpandableListFragment.java
@@ -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.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat;
import android.view.Menu;
import android.view.MenuItem;
@@ -15,17 +12,16 @@ import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
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 {
protected ExpandableListView listView;
protected ExpandableListAdapter adapter;
-
-
- public OsmandApplication getMyApplication() {
- return (OsmandApplication) getActivity().getApplication();
- }
@Override
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java
index e93d4559ac..d2c81104a1 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java
@@ -46,7 +46,7 @@ import net.osmand.plus.activities.LocalIndexHelper;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.activities.LocalIndexInfo;
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.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivityType;
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java
index d1168e5001..feb2e274ac 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java
@@ -19,7 +19,7 @@ import android.widget.TextView;
import net.osmand.map.OsmandRegions;
import net.osmand.plus.OsmandApplication;
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.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.download.DownloadResources;
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java
index e2c8f34d13..4f02f1e136 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java
@@ -51,9 +51,9 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
-import net.osmand.plus.activities.OsmandExpandableListFragment;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.TrackActivity;
+import net.osmand.plus.base.OsmandExpandableListFragment;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.download.ui.LocalIndexesFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
@@ -1357,4 +1357,4 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
v.findViewById(R.id.check_item).setVisibility(View.GONE);
}
-}
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java
index f9ea8231ae..8e5836fe18 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/SelectedGPXFragment.java
@@ -41,9 +41,9 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.activities.OsmAndListFragment;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
+import net.osmand.plus.base.OsmAndListFragment;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.util.Algorithms;
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java
index 1e992ffcc1..71a5eb4ad7 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java
@@ -6,7 +6,6 @@ import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.TextWatcher;
@@ -28,8 +27,8 @@ import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiFilter;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.OSMSettings;
-import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
@@ -39,7 +38,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-public class AdvancedEditPoiFragment extends Fragment
+public class AdvancedEditPoiFragment extends BaseOsmAndFragment
implements EditPoiDialogFragment.OnFragmentActivatedListener {
private static final String TAG = "AdvancedEditPoiFragment";
private static final Log LOG = PlatformUtil.getLog(AdvancedEditPoiFragment.class);
@@ -68,16 +67,15 @@ public class AdvancedEditPoiFragment extends Fragment
int height = size.y;
view.findViewById(R.id.screenFiller).setMinimumHeight(height);
- deleteDrawable = ((OsmandApplication) getActivity().getApplication()).getIconsCache()
- .getPaintedContentIcon(R.drawable.ic_action_remove_dark,
- getActivity().getResources().getColor(R.color.dash_search_icon_dark));
+ deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark,
+ getActivity().getResources().getColor(R.color.dash_search_icon_dark));
nameTextView = (TextView) view.findViewById(R.id.nameTextView);
amenityTagTextView = (TextView) view.findViewById(R.id.amenityTagTextView);
amenityTextView = (TextView) view.findViewById(R.id.amenityTextView);
LinearLayout editTagsLineaLayout =
(LinearLayout) view.findViewById(R.id.editTagsList);
- final MapPoiTypes mapPoiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes();
+ final MapPoiTypes mapPoiTypes = getMyApplication().getPoiTypes();
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
// It is possible to not restart initialization every time, and probably move initialization to appInit
Map translatedTypes = getData().getAllTranslatedSubTypes();
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java
index b74642c024..f64989486f 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java
@@ -5,7 +5,6 @@ import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@@ -23,9 +22,8 @@ import android.widget.TextView;
import net.osmand.PlatformUtil;
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.base.BaseOsmAndFragment;
import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment;
import net.osmand.plus.osmedit.dialogs.OpeningHoursHoursDialogFragment;
import net.osmand.util.Algorithms;
@@ -36,7 +34,7 @@ import org.apache.commons.logging.Log;
import gnu.trove.list.array.TIntArrayList;
-public class BasicEditPoiFragment extends Fragment
+public class BasicEditPoiFragment extends BaseOsmAndFragment
implements EditPoiDialogFragment.OnFragmentActivatedListener {
private static final Log LOG = PlatformUtil.getLog(BasicEditPoiFragment.class);
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);
int iconColor = typedValue.data;
- IconsCache iconsCache = getMyApplication().getIconsCache();
-
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
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);
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);
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);
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);
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);
openingHoursImageView.setImageDrawable(
- iconsCache.getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
+ getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
houseNumberEditText = (EditText) view.findViewById(R.id.houseNumberEditText);
@@ -106,10 +102,8 @@ public class BasicEditPoiFragment extends Fragment
}
});
LinearLayout openHoursContainer = (LinearLayout) view.findViewById(R.id.openHoursContainer);
- Drawable clockDrawable = iconsCache
- .getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
- Drawable deleteDrawable = iconsCache
- .getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
+ Drawable clockDrawable = getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
+ Drawable deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
if (savedInstanceState != null && savedInstanceState.containsKey(OPENING_HOURS)) {
mOpeningHoursAdapter = new OpeningHoursAdapter(
(OpeningHoursParser.OpeningHours) savedInstanceState.getSerializable(OPENING_HOURS),
@@ -123,10 +117,6 @@ public class BasicEditPoiFragment extends Fragment
return view;
}
- private OsmandApplication getMyApplication() {
- return (OsmandApplication) getActivity().getApplication();
- }
-
protected void addTextWatcher(final String tag, final EditText e) {
e.addTextChangedListener(new TextWatcher() {
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java
index 60c2c816ac..45361d54b0 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java
@@ -37,8 +37,8 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.ActionBarProgressActivity;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.activities.OsmAndListFragment;
import net.osmand.plus.activities.OsmandActionBarActivity;
+import net.osmand.plus.base.OsmAndListFragment;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.dialogs.ProgressDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
@@ -725,4 +725,4 @@ public class OsmEditsFragment extends OsmAndListFragment
}
}
-}
+}
\ No newline at end of file