From 15cc5dd1bb82f731702bd6a8d20ebb57d7f8e2a6 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Mon, 21 Mar 2016 16:55:09 +0200 Subject: [PATCH] Refactoring --- OsmAnd/res/layout-v14/check_item_rel.xml | 2 +- OsmAnd/res/layout/check_item_rel.xml | 2 +- .../dialog_live_updates_item_settings.xml | 2 +- .../res/layout/download_item_list_section.xml | 9 +-- OsmAnd/res/layout/drawer_list_doubleitem.xml | 2 +- OsmAnd/res/layout/drawer_list_item.xml | 2 +- .../layout/expandable_list_item_category.xml | 2 +- OsmAnd/res/layout/favorites_list_item.xml | 2 +- .../res/layout/layers_list_activity_item.xml | 2 +- .../layout/list_group_title_with_switch.xml | 4 +- OsmAnd/res/layout/list_item_icon_and_menu.xml | 2 +- OsmAnd/res/layout/list_menu_item.xml | 2 +- OsmAnd/res/layout/list_menu_item_native.xml | 2 +- .../net/osmand/plus/ContextMenuAdapter.java | 6 +- .../activities/FavoritesListFragment.java | 2 +- .../activities/FavoritesTreeFragment.java | 10 ++-- .../osmand/plus/activities/HelpActivity.java | 29 +++++----- .../activities/IntermediatePointsDialog.java | 2 +- .../plus/activities/MapActivityActions.java | 2 +- .../activities/actions/StartGPSStatus.java | 2 +- .../osmand/plus/dashboard/DashboardOnMap.java | 55 +++++++------------ .../DashboardSettingsDialogFragment.java | 8 +-- .../ui/DownloadResourceGroupFragment.java | 2 +- .../download/ui/LocalIndexesFragment.java | 2 +- .../net/osmand/plus/helpers/GpxUiHelper.java | 2 +- .../plus/helpers/MapMarkerDialogHelper.java | 2 +- .../plus/helpers/WaypointDialogHelper.java | 2 +- .../plus/liveupdates/LiveUpdatesFragment.java | 4 +- .../LiveUpdatesSettingsDialogFragment.java | 2 +- .../other/RoutePreferencesMenu.java | 18 +++--- .../plus/myplaces/AvailableGPXFragment.java | 6 +- .../osmand/plus/osmo/DashOsMoFragment.java | 8 +-- .../osmand/plus/osmo/OsMoGroupsActivity.java | 4 +- .../views/mapwidgets/MapWidgetRegistry.java | 6 +- 34 files changed, 97 insertions(+), 112 deletions(-) diff --git a/OsmAnd/res/layout-v14/check_item_rel.xml b/OsmAnd/res/layout-v14/check_item_rel.xml index d7fcdaca96..d7821443ef 100644 --- a/OsmAnd/res/layout-v14/check_item_rel.xml +++ b/OsmAnd/res/layout-v14/check_item_rel.xml @@ -2,7 +2,7 @@ + tools:visibility="visible"/> \ No newline at end of file diff --git a/OsmAnd/res/layout/drawer_list_doubleitem.xml b/OsmAnd/res/layout/drawer_list_doubleitem.xml index 55ddb815c5..7f0a295f7a 100644 --- a/OsmAnd/res/layout/drawer_list_doubleitem.xml +++ b/OsmAnd/res/layout/drawer_list_doubleitem.xml @@ -39,7 +39,7 @@ android:textSize="@dimen/default_desc_text_size"/> adapter, View view, int itemId, int pos) { - CompoundButton btn = (CompoundButton) view.findViewById(R.id.check_item); + CompoundButton btn = (CompoundButton) view.findViewById(R.id.toggle_item); if (btn != null && btn.getVisibility() == View.VISIBLE) { btn.setChecked(!btn.isChecked()); return false; @@ -422,8 +422,8 @@ public class ContextMenuAdapter { tv.setTypeface(null); } - if (convertView.findViewById(R.id.check_item) != null) { - final CompoundButton ch = (CompoundButton) convertView.findViewById(R.id.check_item); + if (convertView.findViewById(R.id.toggle_item) != null) { + final CompoundButton ch = (CompoundButton) convertView.findViewById(R.id.toggle_item); if (selectedList.get(position) != -1) { ch.setOnCheckedChangeListener(null); ch.setVisibility(View.VISIBLE); diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java index 5b8df5e411..50f0248430 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java @@ -234,7 +234,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA favorite.getLatitude(), favorite.getLongitude(), screenOrientation, app, activity); name.setText(getName(favorite)); - final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item); + final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item); icon.setVisibility(View.VISIBLE); ch.setVisibility(View.GONE); return row; diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 27990f182f..b71428e589 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -171,7 +171,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { IconsCache iconsCache = getMyApplication().getIconsCache(); if (selectionMode) { - CheckBox ch = (CheckBox) v.findViewById(R.id.check_item); + CheckBox ch = (CheckBox) v.findViewById(R.id.toggle_item); FavouritePoint model = favouritesAdapter.getChild(groupPosition, childPosition); ch.setChecked(!ch.isChecked()); if (ch.isChecked()) { @@ -722,7 +722,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { View row = convertView; - boolean checkBox = row != null && row.findViewById(R.id.check_item) instanceof CheckBox; + boolean checkBox = row != null && row.findViewById(R.id.toggle_item) instanceof CheckBox; boolean same = (selectionMode && checkBox) || (!selectionMode && !checkBox); if (row == null || !same) { LayoutInflater inflater = getActivity().getLayoutInflater(); @@ -735,7 +735,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { label.setText(model.name.length() == 0 ? getString(R.string.shared_string_favorites) : model.name); if (selectionMode) { - final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item); + final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item); ch.setVisibility(View.VISIBLE); ch.setChecked(groupsToDelete.contains(model)); @@ -756,7 +756,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { } }); } else { - final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item); + final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item); ch.setVisibility(View.GONE); } final View ch = row.findViewById(R.id.options); @@ -821,7 +821,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { direction.setVisibility(View.VISIBLE); direction.setImageDrawable(arrowImage); - final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item); + final CheckBox ch = (CheckBox) row.findViewById(R.id.toggle_item); if (selectionMode) { ch.setVisibility(View.VISIBLE); ch.setChecked(favoritesSelected.contains(model)); diff --git a/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java b/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java index be606480f3..258166474d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java @@ -1,24 +1,12 @@ package net.osmand.plus.activities; -import java.util.ArrayList; -import java.util.List; - -import net.osmand.PlatformUtil; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.OsmandSettings; -import net.osmand.plus.R; -import net.osmand.plus.Version; -import net.osmand.plus.dialogs.HelpArticleDialogFragment; - -import org.apache.commons.logging.Log; - import android.content.Intent; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.support.annotation.DrawableRes; +import android.support.annotation.IdRes; import android.support.annotation.NonNull; import android.support.annotation.StringRes; import android.support.v4.app.Fragment; @@ -36,10 +24,23 @@ import android.widget.FrameLayout.LayoutParams; import android.widget.ImageView; import android.widget.TextView; +import net.osmand.PlatformUtil; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.R; +import net.osmand.plus.Version; +import net.osmand.plus.dialogs.HelpArticleDialogFragment; + +import org.apache.commons.logging.Log; + +import java.util.ArrayList; +import java.util.List; + public class HelpActivity extends OsmandActionBarActivity { // public static final String DIALOG = "dialog"; + @IdRes public static final int DIALOG = 5; final static HelpMenuCategory[] categories = HelpMenuCategory.values(); public static final String OSMAND_POLL_HTML = "http://osmand.net/android-poll.html"; @@ -274,7 +275,7 @@ public class HelpActivity extends OsmandActionBarActivity { LayoutInflater inflater = LayoutInflater.from(ctx); v = inflater.inflate(R.layout.download_item_list_section, parent, false); } - TextView nameView = ((TextView) v.findViewById(R.id.section_name)); + TextView nameView = ((TextView) v.findViewById(R.id.title)); nameView.setText(titleId); v.setOnClickListener(null); TypedValue typedValue = new TypedValue(); diff --git a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java index 34e8de5f01..4fb2e53245 100644 --- a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java @@ -255,7 +255,7 @@ public class IntermediatePointsDialog { R.drawable.ic_action_intermediate; tv.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getContentIcon(icon), null, null, null); tv.setCompoundDrawablePadding(padding); - final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item)); + final CheckBox ch = ((CheckBox) v.findViewById(R.id.toggle_item)); ch.setVisibility(View.VISIBLE); ch.setOnCheckedChangeListener(null); ch.setChecked(checkedIntermediates[position]); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 30bc2a3e0d..6feba92d90 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -385,7 +385,7 @@ public class MapActivityActions implements DialogProvider { String name = path.substring(path.lastIndexOf("/") + 1, path.length()); ((TextView) convertView.findViewById(R.id.title)).setText(name); convertView.findViewById(R.id.icon).setVisibility(View.GONE); - convertView.findViewById(R.id.check_item).setVisibility(View.GONE); + convertView.findViewById(R.id.toggle_item).setVisibility(View.GONE); return convertView; } }; diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java b/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java index 8c762c5037..8e32dadf8f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java +++ b/OsmAnd/src/net/osmand/plus/activities/actions/StartGPSStatus.java @@ -126,7 +126,7 @@ public class StartGPSStatus extends OsmAndAction { View v = mapActivity.getLayoutInflater().inflate(layout, null); TextView tv = (TextView)v.findViewById(R.id.title); tv.setText(getItem(position).stringRes); - v.findViewById(R.id.check_item).setVisibility(View.INVISIBLE); + v.findViewById(R.id.toggle_item).setVisibility(View.INVISIBLE); return v; } }; diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index 295384b581..ad2f7c10f0 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -863,43 +863,26 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis } private void applyDayNightMode() { - if (nightMode) { - if (listBackgroundView != null) { - listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); - } else { - listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); - listEmptyTextView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); - } - if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS - && visibleType != DashboardType.MAP_MARKERS_SELECTION) { - Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_dark)); - listView.setDivider(d); - listView.setDividerHeight(dpToPx(1f)); - } else { - listView.setDivider(null); - } + int backgroundColor = mapActivity.getResources().getColor( + nightMode ? R.color.ctx_menu_info_view_bg_dark + : R.color.ctx_menu_info_view_bg_light); + Drawable dividerDrawable = new ColorDrawable(mapActivity.getResources().getColor( + nightMode ? R.color.dashboard_divider_dark : R.color.dashboard_divider_dark)); + + if (listBackgroundView != null) { + listBackgroundView.setBackgroundColor(backgroundColor); } else { - if (listBackgroundView != null) { - listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); - } else { - listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); - listEmptyTextView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); - } - if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS - && visibleType != DashboardType.MAP_MARKERS_SELECTION) { - Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light)); - listView.setDivider(d); - listView.setDividerHeight(dpToPx(1f)); - } else { - listView.setDivider(null); - } + listView.setBackgroundColor(backgroundColor); + listEmptyTextView.setBackgroundColor(backgroundColor); + } + if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS + && visibleType != DashboardType.MAP_MARKERS_SELECTION) { + listView.setDivider(dividerDrawable); + listView.setDividerHeight(dpToPx(1f)); + } else { + listView.setDivider(null); } AndroidUtils.setTextSecondaryColor(mapActivity, listEmptyTextView, nightMode); - /* - listView.setOverscrollFooter(new ColorDrawable( - nightMode ? mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark) - : mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light))); - */ } private int dpToPx(float dp) { @@ -1031,7 +1014,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis hideDashboard(); } } else if (click != null) { - CompoundButton btn = (CompoundButton) view.findViewById(R.id.check_item); + CompoundButton btn = (CompoundButton) view.findViewById(R.id.toggle_item); if (btn != null && btn.getVisibility() == View.VISIBLE) { btn.setChecked(!btn.isChecked()); } else { @@ -1594,7 +1577,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis } else if (listBackgroundView != null) { tileBoxHeightPx = 3 * (mFlexibleSpaceImageHeight - mFlexibleBlurSpaceHeight) / 4; } - mapView.fitRectToMap(left, right, top, bottom, tileBoxWidthPx, tileBoxHeightPx, mFlexibleBlurSpaceHeight * 3/2); + mapView.fitRectToMap(left, right, top, bottom, tileBoxWidthPx, tileBoxHeightPx, mFlexibleBlurSpaceHeight * 3 / 2); } } } diff --git a/OsmAnd/src/net/osmand/plus/dashboard/tools/DashboardSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/tools/DashboardSettingsDialogFragment.java index aedd73f46d..dab6bb3ab3 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/tools/DashboardSettingsDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/tools/DashboardSettingsDialogFragment.java @@ -99,9 +99,9 @@ public class DashboardSettingsDialogFragment extends DialogFragment } mapActivity.getDashboard().refreshDashboardFragments(); settings.SHOW_DASHBOARD_ON_START.set( - ((CompoundButton) showDashboardOnStart.findViewById(R.id.check_item)).isChecked()); + ((CompoundButton) showDashboardOnStart.findViewById(R.id.toggle_item)).isChecked()); settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set( - ((CompoundButton) accessFromMap.findViewById(R.id.check_item)).isChecked()); + ((CompoundButton) accessFromMap.findViewById(R.id.toggle_item)).isChecked()); mapActivity.getMapLayers().getMapControlsLayer().initDasboardRelatedControls(); } }) @@ -121,7 +121,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment final TextView subtextView = (TextView) view.findViewById(R.id.subtext); textView.setText(text); subtextView.setText(description); - final CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.check_item); + final CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.toggle_item); compoundButton.setChecked(pref.get()); textView.setTextColor(pref.get() ? textColorPrimary : textColorSecondary); @@ -247,7 +247,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment this.dashFragmentAdapter = dashFragmentAdapter; this.numberOfRowsTextView = (TextView) view.findViewById(R.id.numberOfRowsTextView); this.textView = (TextView) view.findViewById(R.id.text); - this.compoundButton = (CompoundButton) view.findViewById(R.id.check_item); + this.compoundButton = (CompoundButton) view.findViewById(R.id.toggle_item); colorBlue = ctx.getResources().getColor(R.color.dashboard_blue); } diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java index 804e3cd2bb..5e0021c986 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java @@ -399,7 +399,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow LayoutInflater inflater = LayoutInflater.from(ctx); v = inflater.inflate(R.layout.download_item_list_section, parent, false); } - TextView nameView = ((TextView) v.findViewById(R.id.section_name)); + TextView nameView = ((TextView) v.findViewById(R.id.title)); nameView.setText(section); v.setOnClickListener(null); TypedValue typedValue = new TypedValue(); diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index 99abe57ccb..6b424e13ef 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -955,7 +955,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement if (group.getSubfolder() != null) { name.append(" ").append(group.getSubfolder()); } - TextView nameView = ((TextView) v.findViewById(R.id.section_name)); + TextView nameView = ((TextView) v.findViewById(R.id.title)); TextView sizeView = ((TextView) v.findViewById(R.id.section_description)); List list = data.get(group); int size = 0; diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index a0a72aadf7..636438f143 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -302,7 +302,7 @@ public class GpxUiHelper { // tv.setCompoundDrawablesWithIntrinsicBounds(adapter.getImageId(position, light), 0, 0, 0); // } // tv.setCompoundDrawablePadding(padding); - final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item)); + final CheckBox ch = ((CheckBox) v.findViewById(R.id.toggle_item)); if (adapter.getSelection(position) == -1) { ch.setVisibility(View.INVISIBLE); } else { diff --git a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java index 1395aa1f51..d5e055d300 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java @@ -271,7 +271,7 @@ public class MapMarkerDialogHelper { protected View createItemForCategory(final ArrayAdapter listAdapter, final int type) { View v = mapActivity.getLayoutInflater().inflate(R.layout.waypoint_header, null); - v.findViewById(R.id.check_item).setVisibility(View.GONE); + v.findViewById(R.id.toggle_item).setVisibility(View.GONE); v.findViewById(R.id.ProgressBar).setVisibility(View.GONE); if (type == MARKERS_HISTORY) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java index ed52eb7a21..5233554f8d 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java @@ -649,7 +649,7 @@ public class WaypointDialogHelper { final int position, final ArrayAdapter thisAdapter, boolean nightMode) { View v; v = ctx.getLayoutInflater().inflate(R.layout.waypoint_header, null); - final CompoundButton btn = (CompoundButton) v.findViewById(R.id.check_item); + final CompoundButton btn = (CompoundButton) v.findViewById(R.id.toggle_item); btn.setVisibility(waypointHelper.isTypeConfigurable(type) ? View.VISIBLE : View.GONE); btn.setOnCheckedChangeListener(null); final boolean checked = waypointHelper.isTypeEnabled(type); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index f14180473f..d28c5ac7b8 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -352,12 +352,12 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList LayoutInflater inflater = LayoutInflater.from(ctx); view = inflater.inflate(R.layout.list_group_title_with_switch, parent, false); } - TextView nameView = ((TextView) view.findViewById(R.id.section_name)); + TextView nameView = ((TextView) view.findViewById(R.id.title)); nameView.setText(group); view.setOnClickListener(null); - final SwitchCompat liveUpdatesSwitch = (SwitchCompat) view.findViewById(R.id.liveUpdatesSwitch); + final SwitchCompat liveUpdatesSwitch = (SwitchCompat) view.findViewById(R.id.toggle_item); View topShadowView = view.findViewById(R.id.bottomShadowView); if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) { topShadowView.setVisibility(View.GONE); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java index a88e1d21b6..b6232744b5 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java @@ -62,7 +62,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment { final TextView regionNameTextView = (TextView) view.findViewById(R.id.regionNameTextView); final TextView lastMapChangeTextView = (TextView) view.findViewById(R.id.lastMapChangeTextView); final TextView lastUpdateTextView = (TextView) view.findViewById(R.id.lastUpdateTextView); - final SwitchCompat liveUpdatesSwitch = (SwitchCompat) view.findViewById(R.id.liveUpdatesSwitch); + final SwitchCompat liveUpdatesSwitch = (SwitchCompat) view.findViewById(R.id.toggle_item); final CheckBox downloadOverWiFiCheckBox = (CheckBox) view.findViewById(R.id.downloadOverWiFiSwitch); final Spinner updateFrequencySpinner = (Spinner) view.findViewById(R.id.updateFrequencySpinner); final Spinner updateTimesOfDaySpinner = (Spinner) view.findViewById(R.id.updateTimesOfDaySpinner); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/RoutePreferencesMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/RoutePreferencesMenu.java index 8a364a96c9..372ed6f84f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/RoutePreferencesMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/RoutePreferencesMenu.java @@ -295,19 +295,19 @@ public class RoutePreferencesMenu { settings.putExtra(SettingsBaseActivity.INTENT_APP_MODE, routingHelper.getAppMode().getStringKey()); mapActivity.startActivity(settings); } else if (obj instanceof MuteSoundRoutingParameter) { - final CompoundButton btn = (CompoundButton) view.findViewById(R.id.check_item); + final CompoundButton btn = (CompoundButton) view.findViewById(R.id.toggle_item); btn.performClick(); } else if (obj instanceof VoiceGuidanceRoutingParameter) { doSelectVoiceGuidance(); } else if (obj instanceof InterruptMusicRoutingParameter) { - final CompoundButton btn = (CompoundButton) view.findViewById(R.id.check_item); + final CompoundButton btn = (CompoundButton) view.findViewById(R.id.toggle_item); btn.performClick(); } else if (obj instanceof AvoidRoadsRoutingParameter) { selectRestrictedRoads(); } else if (view.findViewById(R.id.GPXRouteSpinner) != null) { showOptionsMenu((TextView) view.findViewById(R.id.GPXRouteSpinner)); } else { - CheckBox ch = (CheckBox) view.findViewById(R.id.check_item); + CheckBox ch = (CheckBox) view.findViewById(R.id.toggle_item); if (ch != null) { ch.setChecked(!ch.isChecked()); } @@ -330,7 +330,7 @@ public class RoutePreferencesMenu { v.findViewById(R.id.select_button).setVisibility(View.GONE); ((ImageView) v.findViewById(R.id.icon)) .setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_volume_up, !nightMode)); - final CompoundButton btn = (CompoundButton) v.findViewById(R.id.check_item); + final CompoundButton btn = (CompoundButton) v.findViewById(R.id.toggle_item); btn.setVisibility(View.VISIBLE); btn.setChecked(!routingHelper.getVoiceRouter().isMute()); btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @@ -350,7 +350,7 @@ public class RoutePreferencesMenu { AndroidUtils.setListItemBackground(mapActivity, v, nightMode); ((ImageView) v.findViewById(R.id.icon)) .setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_road_works_dark, !nightMode)); - v.findViewById(R.id.check_item).setVisibility(View.GONE); + v.findViewById(R.id.toggle_item).setVisibility(View.GONE); final TextView btn = (TextView) v.findViewById(R.id.select_button); btn.setTextColor(btn.getLinkTextColors()); btn.setOnClickListener(new View.OnClickListener() { @@ -375,7 +375,7 @@ public class RoutePreferencesMenu { AndroidUtils.setListItemBackground(mapActivity, v, nightMode); v.findViewById(R.id.icon).setVisibility(View.GONE); v.findViewById(R.id.description_text).setVisibility(View.GONE); - v.findViewById(R.id.check_item).setVisibility(View.GONE); + v.findViewById(R.id.toggle_item).setVisibility(View.GONE); final TextView btn = (TextView) v.findViewById(R.id.select_button); btn.setTextColor(btn.getLinkTextColors()); String voiceProvider = settings.VOICE_PROVIDER.get(); @@ -409,7 +409,7 @@ public class RoutePreferencesMenu { AndroidUtils.setListItemBackground(mapActivity, v, nightMode); v.findViewById(R.id.select_button).setVisibility(View.GONE); v.findViewById(R.id.icon).setVisibility(View.GONE); - final CompoundButton btn = (CompoundButton) v.findViewById(R.id.check_item); + final CompoundButton btn = (CompoundButton) v.findViewById(R.id.toggle_item); btn.setVisibility(View.VISIBLE); btn.setChecked(settings.INTERRUPT_MUSIC.get()); btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @@ -448,7 +448,7 @@ public class RoutePreferencesMenu { TextView titleView = (TextView) v.findViewById(R.id.title); titleView.setText(R.string.routing_settings_2); AndroidUtils.setTextPrimaryColor(mapActivity, titleView, nightMode); - v.findViewById(R.id.check_item).setVisibility(View.GONE); + v.findViewById(R.id.toggle_item).setVisibility(View.GONE); return v; } return inflateRoutingParameter(position); @@ -458,7 +458,7 @@ public class RoutePreferencesMenu { View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null); AndroidUtils.setListItemBackground(mapActivity, v, nightMode); final TextView tv = (TextView) v.findViewById(R.id.title); - final CheckBox ch = ((CheckBox) v.findViewById(R.id.check_item)); + final CheckBox ch = ((CheckBox) v.findViewById(R.id.toggle_item)); final LocalRoutingParameter rp = getItem(position); AndroidUtils.setTextPrimaryColor(mapActivity, tv, nightMode); tv.setText(rp.getText(mapActivity)); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index cc714bdcd6..83e468ba40 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -276,7 +276,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { v.findViewById(R.id.divider).setVisibility(View.GONE); v.findViewById(R.id.options).setVisibility(View.GONE); v.findViewById(R.id.stop).setVisibility(View.VISIBLE); - v.findViewById(R.id.check_item).setVisibility(View.GONE); + v.findViewById(R.id.toggle_item).setVisibility(View.GONE); } @Override @@ -801,7 +801,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { options.setVisibility(View.VISIBLE); } - final CompoundButton checkItem = (CompoundButton) v.findViewById(R.id.check_item); + final CompoundButton checkItem = (CompoundButton) v.findViewById(R.id.toggle_item); if (isSelectedGroup(groupPosition)) { checkItem.setVisibility(View.VISIBLE); v.findViewById(R.id.options).setVisibility(View.GONE); @@ -1356,6 +1356,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { TextView descr = ((TextView) v.findViewById(R.id.description)); descr.setVisibility(View.GONE); - v.findViewById(R.id.check_item).setVisibility(View.GONE); + v.findViewById(R.id.toggle_item).setVisibility(View.GONE); } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/osmo/DashOsMoFragment.java b/OsmAnd/src/net/osmand/plus/osmo/DashOsMoFragment.java index 4ccca64e8a..b4f0cc0263 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/DashOsMoFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmo/DashOsMoFragment.java @@ -148,7 +148,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups } private void setupHader(final View header) { - trackr = (CompoundButton) header.findViewById(R.id.card_content).findViewById(R.id.check_item); + trackr = (CompoundButton) header.findViewById(R.id.card_content).findViewById(R.id.toggle_item); ImageButton share = (ImageButton) header.findViewById(R.id.share); IconsCache cache = getMyApplication().getIconsCache(); @@ -170,7 +170,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups } View cardContent = header.findViewById(R.id.card_content); - View enableOsmo = header.findViewById(R.id.header_layout).findViewById(R.id.check_item); + View enableOsmo = header.findViewById(R.id.header_layout).findViewById(R.id.toggle_item); View manage = header.findViewById(R.id.manage); if (plugin != null && plugin.getService().isEnabled() ) { cardContent.setVisibility(View.VISIBLE); @@ -184,7 +184,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups return; } - CompoundButton trackr = (CompoundButton) header.findViewById(R.id.check_item); + CompoundButton trackr = (CompoundButton) header.findViewById(R.id.toggle_item); if (plugin != null && plugin.getTracker() != null) { trackr.setChecked(plugin.getTracker().isEnabledTracker()); } @@ -286,7 +286,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups loc.getLongitude()) : null); distances.add(dv); - final CompoundButton enableDevice = (CompoundButton) v.findViewById(R.id.check_item); + final CompoundButton enableDevice = (CompoundButton) v.findViewById(R.id.toggle_item); enableDevice.setVisibility(View.GONE); ImageView icon = (ImageView) v.findViewById(R.id.icon); if (device.isEnabled()) { diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java index 47cf79b397..9386749b4d 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java @@ -544,7 +544,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements } else if (item.getItemId() == SHARE_ID) { shareOsMoGroup(group.getVisibleName(app), group.getGroupId()); } else if (item.getItemId() == ON_OFF_ACTION_ID) { - CompoundButton bt = ((CompoundButton) MenuItemCompat.getActionView(item).findViewById(R.id.check_item)); + CompoundButton bt = ((CompoundButton) MenuItemCompat.getActionView(item).findViewById(R.id.toggle_item)); onOffAction(bt); } return true; @@ -1228,7 +1228,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements } }); } - CompoundButton ci = (CompoundButton) row.findViewById(R.id.check_item); + CompoundButton ci = (CompoundButton) row.findViewById(R.id.toggle_item); if (model.isMainGroup()) { ci.setVisibility(View.GONE); } else { diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java index 5fd0b33844..01712b55eb 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapWidgetRegistry.java @@ -353,13 +353,13 @@ public class MapWidgetRegistry { public void addControls(MapActivity map, ContextMenuAdapter cm, ApplicationMode mode) { - cm.item(R.string.map_widget_right).setCategory(true).layout(R.layout.drawer_list_sub_header).reg(); + cm.item(R.string.map_widget_right).setCategory(true).layout(R.layout.list_group_title_with_switch).reg(); addControls(map, cm, right, mode); if(mode != ApplicationMode.DEFAULT) { - cm.item(R.string.map_widget_left).setCategory(true).layout(R.layout.drawer_list_sub_header).reg(); + cm.item(R.string.map_widget_left).setCategory(true).layout(R.layout.list_group_title_with_switch).reg(); addControls(map, cm, left, mode); } - cm.item(R.string.map_widget_appearance_rem).setCategory(true).layout(R.layout.drawer_list_sub_header).reg(); + cm.item(R.string.map_widget_appearance_rem).setCategory(true).layout(R.layout.list_group_title_with_switch).reg(); addControlsAppearance(map, cm, mode); }