Refactoring

This commit is contained in:
GaidamakUA 2016-03-21 16:55:09 +02:00
parent fe70c29b0d
commit 15cc5dd1bb
34 changed files with 97 additions and 112 deletions

View file

@ -2,7 +2,7 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<Switch <Switch
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="4dp" android:paddingTop="4dp"

View file

@ -2,7 +2,7 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:text="@string/osmo_connect_menu" android:text="@string/osmo_connect_menu"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -68,7 +68,7 @@
android:textSize="16sp"/> android:textSize="16sp"/>
<android.support.v7.widget.SwitchCompat <android.support.v7.widget.SwitchCompat
android:id="@+id/liveUpdatesSwitch" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -4,14 +4,15 @@
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="40dp"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="@dimen/list_header_padding" android:paddingLeft="@dimen/list_header_padding"
android:paddingRight="@dimen/list_header_padding"> android:paddingRight="@dimen/list_header_padding">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/section_name" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="12dp" android:layout_marginLeft="12dp"
@ -30,9 +31,9 @@
android:layout_marginRight="12dp" android:layout_marginRight="12dp"
android:maxLines="1" android:maxLines="1"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
android:visibility="gone"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
tools:text="600Mb" tools:text="600Mb"
tools:visibility="visible" tools:visibility="visible"/>
android:visibility="gone"/>
</LinearLayout> </LinearLayout>

View file

@ -39,7 +39,7 @@
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_desc_text_size"/>
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -30,7 +30,7 @@
tools:text="Some title text" /> tools:text="Some title text" />
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="11dp" android:layout_marginLeft="11dp"

View file

@ -8,7 +8,7 @@
android:paddingLeft="@dimen/list_header_padding"> android:paddingLeft="@dimen/list_header_padding">
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -23,7 +23,7 @@
android:paddingLeft="@dimen/list_content_padding"> android:paddingLeft="@dimen/list_content_padding">
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -28,7 +28,7 @@
android:textSize="@dimen/default_list_text_size" /> android:textSize="@dimen/default_list_text_size" />
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -26,7 +26,7 @@
android:paddingRight="16dp"> android:paddingRight="16dp">
<TextView <TextView
android:id="@+id/section_name" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@ -34,7 +34,7 @@
tools:text="Live updates"/> tools:text="Live updates"/>
<android.support.v7.widget.SwitchCompat <android.support.v7.widget.SwitchCompat
android:id="@+id/liveUpdatesSwitch" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"

View file

@ -36,7 +36,7 @@
tools:src="@drawable/ic_action_gabout_dark" /> tools:src="@drawable/ic_action_gabout_dark" />
<android.support.v7.widget.SwitchCompat <android.support.v7.widget.SwitchCompat
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"

View file

@ -49,7 +49,7 @@
android:focusable="false" /> android:focusable="false" />
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="6dip" android:layout_marginRight="6dip"

View file

@ -40,7 +40,7 @@
<!-- android:button="@drawable/ic_btn_wocheckbox" --> <!-- android:button="@drawable/ic_btn_wocheckbox" -->
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/toggle_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginRight="24dp" android:layout_marginRight="24dp"

View file

@ -51,7 +51,7 @@ public class ContextMenuAdapter {
//boolean return type needed to desribe if drawer needed to be close or not //boolean return type needed to desribe if drawer needed to be close or not
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) { public boolean onRowItemClick(ArrayAdapter<?> 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) { if (btn != null && btn.getVisibility() == View.VISIBLE) {
btn.setChecked(!btn.isChecked()); btn.setChecked(!btn.isChecked());
return false; return false;
@ -422,8 +422,8 @@ public class ContextMenuAdapter {
tv.setTypeface(null); tv.setTypeface(null);
} }
if (convertView.findViewById(R.id.check_item) != null) { if (convertView.findViewById(R.id.toggle_item) != null) {
final CompoundButton ch = (CompoundButton) convertView.findViewById(R.id.check_item); final CompoundButton ch = (CompoundButton) convertView.findViewById(R.id.toggle_item);
if (selectedList.get(position) != -1) { if (selectedList.get(position) != -1) {
ch.setOnCheckedChangeListener(null); ch.setOnCheckedChangeListener(null);
ch.setVisibility(View.VISIBLE); ch.setVisibility(View.VISIBLE);

View file

@ -234,7 +234,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
favorite.getLatitude(), favorite.getLongitude(), screenOrientation, app, activity); favorite.getLatitude(), favorite.getLongitude(), screenOrientation, app, activity);
name.setText(getName(favorite)); 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); icon.setVisibility(View.VISIBLE);
ch.setVisibility(View.GONE); ch.setVisibility(View.GONE);
return row; return row;

View file

@ -171,7 +171,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
IconsCache iconsCache = getMyApplication().getIconsCache(); IconsCache iconsCache = getMyApplication().getIconsCache();
if (selectionMode) { 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); FavouritePoint model = favouritesAdapter.getChild(groupPosition, childPosition);
ch.setChecked(!ch.isChecked()); ch.setChecked(!ch.isChecked());
if (ch.isChecked()) { if (ch.isChecked()) {
@ -722,7 +722,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
@Override @Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
View row = convertView; 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); boolean same = (selectionMode && checkBox) || (!selectionMode && !checkBox);
if (row == null || !same) { if (row == null || !same) {
LayoutInflater inflater = getActivity().getLayoutInflater(); 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); label.setText(model.name.length() == 0 ? getString(R.string.shared_string_favorites) : model.name);
if (selectionMode) { 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.setVisibility(View.VISIBLE);
ch.setChecked(groupsToDelete.contains(model)); ch.setChecked(groupsToDelete.contains(model));
@ -756,7 +756,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
} }
}); });
} else { } 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); ch.setVisibility(View.GONE);
} }
final View ch = row.findViewById(R.id.options); final View ch = row.findViewById(R.id.options);
@ -821,7 +821,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
direction.setVisibility(View.VISIBLE); direction.setVisibility(View.VISIBLE);
direction.setImageDrawable(arrowImage); 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) { if (selectionMode) {
ch.setVisibility(View.VISIBLE); ch.setVisibility(View.VISIBLE);
ch.setChecked(favoritesSelected.contains(model)); ch.setChecked(favoritesSelected.contains(model));

View file

@ -1,24 +1,12 @@
package net.osmand.plus.activities; 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.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -36,10 +24,23 @@ import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; 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 class HelpActivity extends OsmandActionBarActivity {
// public static final String DIALOG = "dialog"; // public static final String DIALOG = "dialog";
@IdRes
public static final int DIALOG = 5; public static final int DIALOG = 5;
final static HelpMenuCategory[] categories = HelpMenuCategory.values(); final static HelpMenuCategory[] categories = HelpMenuCategory.values();
public static final String OSMAND_POLL_HTML = "http://osmand.net/android-poll.html"; 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); LayoutInflater inflater = LayoutInflater.from(ctx);
v = inflater.inflate(R.layout.download_item_list_section, parent, false); 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); nameView.setText(titleId);
v.setOnClickListener(null); v.setOnClickListener(null);
TypedValue typedValue = new TypedValue(); TypedValue typedValue = new TypedValue();

View file

@ -255,7 +255,7 @@ public class IntermediatePointsDialog {
R.drawable.ic_action_intermediate; R.drawable.ic_action_intermediate;
tv.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getContentIcon(icon), null, null, null); tv.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getContentIcon(icon), null, null, null);
tv.setCompoundDrawablePadding(padding); 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.setVisibility(View.VISIBLE);
ch.setOnCheckedChangeListener(null); ch.setOnCheckedChangeListener(null);
ch.setChecked(checkedIntermediates[position]); ch.setChecked(checkedIntermediates[position]);

View file

@ -385,7 +385,7 @@ public class MapActivityActions implements DialogProvider {
String name = path.substring(path.lastIndexOf("/") + 1, path.length()); String name = path.substring(path.lastIndexOf("/") + 1, path.length());
((TextView) convertView.findViewById(R.id.title)).setText(name); ((TextView) convertView.findViewById(R.id.title)).setText(name);
convertView.findViewById(R.id.icon).setVisibility(View.GONE); 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; return convertView;
} }
}; };

View file

@ -126,7 +126,7 @@ public class StartGPSStatus extends OsmAndAction {
View v = mapActivity.getLayoutInflater().inflate(layout, null); View v = mapActivity.getLayoutInflater().inflate(layout, null);
TextView tv = (TextView)v.findViewById(R.id.title); TextView tv = (TextView)v.findViewById(R.id.title);
tv.setText(getItem(position).stringRes); 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; return v;
} }
}; };

View file

@ -863,43 +863,26 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
} }
private void applyDayNightMode() { private void applyDayNightMode() {
if (nightMode) { int backgroundColor = mapActivity.getResources().getColor(
if (listBackgroundView != null) { nightMode ? R.color.ctx_menu_info_view_bg_dark
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); : R.color.ctx_menu_info_view_bg_light);
} else { Drawable dividerDrawable = new ColorDrawable(mapActivity.getResources().getColor(
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); nightMode ? R.color.dashboard_divider_dark : R.color.dashboard_divider_dark));
listEmptyTextView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark));
} if (listBackgroundView != null) {
if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS listBackgroundView.setBackgroundColor(backgroundColor);
&& 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);
}
} else { } else {
if (listBackgroundView != null) { listView.setBackgroundColor(backgroundColor);
listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); listEmptyTextView.setBackgroundColor(backgroundColor);
} else { }
listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS
listEmptyTextView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); && visibleType != DashboardType.MAP_MARKERS_SELECTION) {
} listView.setDivider(dividerDrawable);
if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS listView.setDividerHeight(dpToPx(1f));
&& visibleType != DashboardType.MAP_MARKERS_SELECTION) { } else {
Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light)); listView.setDivider(null);
listView.setDivider(d);
listView.setDividerHeight(dpToPx(1f));
} else {
listView.setDivider(null);
}
} }
AndroidUtils.setTextSecondaryColor(mapActivity, listEmptyTextView, nightMode); 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) { private int dpToPx(float dp) {
@ -1031,7 +1014,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
hideDashboard(); hideDashboard();
} }
} else if (click != null) { } 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) { if (btn != null && btn.getVisibility() == View.VISIBLE) {
btn.setChecked(!btn.isChecked()); btn.setChecked(!btn.isChecked());
} else { } else {
@ -1594,7 +1577,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
} else if (listBackgroundView != null) { } else if (listBackgroundView != null) {
tileBoxHeightPx = 3 * (mFlexibleSpaceImageHeight - mFlexibleBlurSpaceHeight) / 4; 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);
} }
} }
} }

View file

@ -99,9 +99,9 @@ public class DashboardSettingsDialogFragment extends DialogFragment
} }
mapActivity.getDashboard().refreshDashboardFragments(); mapActivity.getDashboard().refreshDashboardFragments();
settings.SHOW_DASHBOARD_ON_START.set( 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( 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(); mapActivity.getMapLayers().getMapControlsLayer().initDasboardRelatedControls();
} }
}) })
@ -121,7 +121,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
final TextView subtextView = (TextView) view.findViewById(R.id.subtext); final TextView subtextView = (TextView) view.findViewById(R.id.subtext);
textView.setText(text); textView.setText(text);
subtextView.setText(description); 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()); compoundButton.setChecked(pref.get());
textView.setTextColor(pref.get() ? textColorPrimary textView.setTextColor(pref.get() ? textColorPrimary
: textColorSecondary); : textColorSecondary);
@ -247,7 +247,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
this.dashFragmentAdapter = dashFragmentAdapter; this.dashFragmentAdapter = dashFragmentAdapter;
this.numberOfRowsTextView = (TextView) view.findViewById(R.id.numberOfRowsTextView); this.numberOfRowsTextView = (TextView) view.findViewById(R.id.numberOfRowsTextView);
this.textView = (TextView) view.findViewById(R.id.text); 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); colorBlue = ctx.getResources().getColor(R.color.dashboard_blue);
} }

View file

@ -399,7 +399,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
LayoutInflater inflater = LayoutInflater.from(ctx); LayoutInflater inflater = LayoutInflater.from(ctx);
v = inflater.inflate(R.layout.download_item_list_section, parent, false); 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); nameView.setText(section);
v.setOnClickListener(null); v.setOnClickListener(null);
TypedValue typedValue = new TypedValue(); TypedValue typedValue = new TypedValue();

View file

@ -955,7 +955,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
if (group.getSubfolder() != null) { if (group.getSubfolder() != null) {
name.append(" ").append(group.getSubfolder()); 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)); TextView sizeView = ((TextView) v.findViewById(R.id.section_description));
List<LocalIndexInfo> list = data.get(group); List<LocalIndexInfo> list = data.get(group);
int size = 0; int size = 0;

View file

@ -302,7 +302,7 @@ public class GpxUiHelper {
// tv.setCompoundDrawablesWithIntrinsicBounds(adapter.getImageId(position, light), 0, 0, 0); // tv.setCompoundDrawablesWithIntrinsicBounds(adapter.getImageId(position, light), 0, 0, 0);
// } // }
// tv.setCompoundDrawablePadding(padding); // 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) { if (adapter.getSelection(position) == -1) {
ch.setVisibility(View.INVISIBLE); ch.setVisibility(View.INVISIBLE);
} else { } else {

View file

@ -271,7 +271,7 @@ public class MapMarkerDialogHelper {
protected View createItemForCategory(final ArrayAdapter<Object> listAdapter, final int type) { protected View createItemForCategory(final ArrayAdapter<Object> listAdapter, final int type) {
View v = mapActivity.getLayoutInflater().inflate(R.layout.waypoint_header, null); 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); v.findViewById(R.id.ProgressBar).setVisibility(View.GONE);
if (type == MARKERS_HISTORY) { if (type == MARKERS_HISTORY) {

View file

@ -649,7 +649,7 @@ public class WaypointDialogHelper {
final int position, final ArrayAdapter<Object> thisAdapter, boolean nightMode) { final int position, final ArrayAdapter<Object> thisAdapter, boolean nightMode) {
View v; View v;
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_header, null); 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.setVisibility(waypointHelper.isTypeConfigurable(type) ? View.VISIBLE : View.GONE);
btn.setOnCheckedChangeListener(null); btn.setOnCheckedChangeListener(null);
final boolean checked = waypointHelper.isTypeEnabled(type); final boolean checked = waypointHelper.isTypeEnabled(type);

View file

@ -352,12 +352,12 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
LayoutInflater inflater = LayoutInflater.from(ctx); LayoutInflater inflater = LayoutInflater.from(ctx);
view = inflater.inflate(R.layout.list_group_title_with_switch, parent, false); 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); nameView.setText(group);
view.setOnClickListener(null); 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); View topShadowView = view.findViewById(R.id.bottomShadowView);
if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) { if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) {
topShadowView.setVisibility(View.GONE); topShadowView.setVisibility(View.GONE);

View file

@ -62,7 +62,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
final TextView regionNameTextView = (TextView) view.findViewById(R.id.regionNameTextView); final TextView regionNameTextView = (TextView) view.findViewById(R.id.regionNameTextView);
final TextView lastMapChangeTextView = (TextView) view.findViewById(R.id.lastMapChangeTextView); final TextView lastMapChangeTextView = (TextView) view.findViewById(R.id.lastMapChangeTextView);
final TextView lastUpdateTextView = (TextView) view.findViewById(R.id.lastUpdateTextView); 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 CheckBox downloadOverWiFiCheckBox = (CheckBox) view.findViewById(R.id.downloadOverWiFiSwitch);
final Spinner updateFrequencySpinner = (Spinner) view.findViewById(R.id.updateFrequencySpinner); final Spinner updateFrequencySpinner = (Spinner) view.findViewById(R.id.updateFrequencySpinner);
final Spinner updateTimesOfDaySpinner = (Spinner) view.findViewById(R.id.updateTimesOfDaySpinner); final Spinner updateTimesOfDaySpinner = (Spinner) view.findViewById(R.id.updateTimesOfDaySpinner);

View file

@ -295,19 +295,19 @@ public class RoutePreferencesMenu {
settings.putExtra(SettingsBaseActivity.INTENT_APP_MODE, routingHelper.getAppMode().getStringKey()); settings.putExtra(SettingsBaseActivity.INTENT_APP_MODE, routingHelper.getAppMode().getStringKey());
mapActivity.startActivity(settings); mapActivity.startActivity(settings);
} else if (obj instanceof MuteSoundRoutingParameter) { } 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(); btn.performClick();
} else if (obj instanceof VoiceGuidanceRoutingParameter) { } else if (obj instanceof VoiceGuidanceRoutingParameter) {
doSelectVoiceGuidance(); doSelectVoiceGuidance();
} else if (obj instanceof InterruptMusicRoutingParameter) { } 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(); btn.performClick();
} else if (obj instanceof AvoidRoadsRoutingParameter) { } else if (obj instanceof AvoidRoadsRoutingParameter) {
selectRestrictedRoads(); selectRestrictedRoads();
} else if (view.findViewById(R.id.GPXRouteSpinner) != null) { } else if (view.findViewById(R.id.GPXRouteSpinner) != null) {
showOptionsMenu((TextView) view.findViewById(R.id.GPXRouteSpinner)); showOptionsMenu((TextView) view.findViewById(R.id.GPXRouteSpinner));
} else { } else {
CheckBox ch = (CheckBox) view.findViewById(R.id.check_item); CheckBox ch = (CheckBox) view.findViewById(R.id.toggle_item);
if (ch != null) { if (ch != null) {
ch.setChecked(!ch.isChecked()); ch.setChecked(!ch.isChecked());
} }
@ -330,7 +330,7 @@ public class RoutePreferencesMenu {
v.findViewById(R.id.select_button).setVisibility(View.GONE); v.findViewById(R.id.select_button).setVisibility(View.GONE);
((ImageView) v.findViewById(R.id.icon)) ((ImageView) v.findViewById(R.id.icon))
.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_volume_up, !nightMode)); .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.setVisibility(View.VISIBLE);
btn.setChecked(!routingHelper.getVoiceRouter().isMute()); btn.setChecked(!routingHelper.getVoiceRouter().isMute());
btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@ -350,7 +350,7 @@ public class RoutePreferencesMenu {
AndroidUtils.setListItemBackground(mapActivity, v, nightMode); AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
((ImageView) v.findViewById(R.id.icon)) ((ImageView) v.findViewById(R.id.icon))
.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_road_works_dark, !nightMode)); .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); final TextView btn = (TextView) v.findViewById(R.id.select_button);
btn.setTextColor(btn.getLinkTextColors()); btn.setTextColor(btn.getLinkTextColors());
btn.setOnClickListener(new View.OnClickListener() { btn.setOnClickListener(new View.OnClickListener() {
@ -375,7 +375,7 @@ public class RoutePreferencesMenu {
AndroidUtils.setListItemBackground(mapActivity, v, nightMode); AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
v.findViewById(R.id.icon).setVisibility(View.GONE); v.findViewById(R.id.icon).setVisibility(View.GONE);
v.findViewById(R.id.description_text).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); final TextView btn = (TextView) v.findViewById(R.id.select_button);
btn.setTextColor(btn.getLinkTextColors()); btn.setTextColor(btn.getLinkTextColors());
String voiceProvider = settings.VOICE_PROVIDER.get(); String voiceProvider = settings.VOICE_PROVIDER.get();
@ -409,7 +409,7 @@ public class RoutePreferencesMenu {
AndroidUtils.setListItemBackground(mapActivity, v, nightMode); AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
v.findViewById(R.id.select_button).setVisibility(View.GONE); v.findViewById(R.id.select_button).setVisibility(View.GONE);
v.findViewById(R.id.icon).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.setVisibility(View.VISIBLE);
btn.setChecked(settings.INTERRUPT_MUSIC.get()); btn.setChecked(settings.INTERRUPT_MUSIC.get());
btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@ -448,7 +448,7 @@ public class RoutePreferencesMenu {
TextView titleView = (TextView) v.findViewById(R.id.title); TextView titleView = (TextView) v.findViewById(R.id.title);
titleView.setText(R.string.routing_settings_2); titleView.setText(R.string.routing_settings_2);
AndroidUtils.setTextPrimaryColor(mapActivity, titleView, nightMode); 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 v;
} }
return inflateRoutingParameter(position); return inflateRoutingParameter(position);
@ -458,7 +458,7 @@ public class RoutePreferencesMenu {
View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null); View v = mapActivity.getLayoutInflater().inflate(R.layout.layers_list_activity_item, null);
AndroidUtils.setListItemBackground(mapActivity, v, nightMode); AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
final TextView tv = (TextView) v.findViewById(R.id.title); 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); final LocalRoutingParameter rp = getItem(position);
AndroidUtils.setTextPrimaryColor(mapActivity, tv, nightMode); AndroidUtils.setTextPrimaryColor(mapActivity, tv, nightMode);
tv.setText(rp.getText(mapActivity)); tv.setText(rp.getText(mapActivity));

View file

@ -276,7 +276,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
v.findViewById(R.id.divider).setVisibility(View.GONE); v.findViewById(R.id.divider).setVisibility(View.GONE);
v.findViewById(R.id.options).setVisibility(View.GONE); v.findViewById(R.id.options).setVisibility(View.GONE);
v.findViewById(R.id.stop).setVisibility(View.VISIBLE); 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 @Override
@ -801,7 +801,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
options.setVisibility(View.VISIBLE); 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)) { if (isSelectedGroup(groupPosition)) {
checkItem.setVisibility(View.VISIBLE); checkItem.setVisibility(View.VISIBLE);
v.findViewById(R.id.options).setVisibility(View.GONE); 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)); TextView descr = ((TextView) v.findViewById(R.id.description));
descr.setVisibility(View.GONE); descr.setVisibility(View.GONE);
v.findViewById(R.id.check_item).setVisibility(View.GONE); v.findViewById(R.id.toggle_item).setVisibility(View.GONE);
} }
} }

View file

@ -148,7 +148,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
} }
private void setupHader(final View header) { 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); ImageButton share = (ImageButton) header.findViewById(R.id.share);
IconsCache cache = getMyApplication().getIconsCache(); IconsCache cache = getMyApplication().getIconsCache();
@ -170,7 +170,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
} }
View cardContent = header.findViewById(R.id.card_content); 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); View manage = header.findViewById(R.id.manage);
if (plugin != null && plugin.getService().isEnabled() ) { if (plugin != null && plugin.getService().isEnabled() ) {
cardContent.setVisibility(View.VISIBLE); cardContent.setVisibility(View.VISIBLE);
@ -184,7 +184,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
return; 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) { if (plugin != null && plugin.getTracker() != null) {
trackr.setChecked(plugin.getTracker().isEnabledTracker()); trackr.setChecked(plugin.getTracker().isEnabledTracker());
} }
@ -286,7 +286,7 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
loc.getLongitude()) : null); loc.getLongitude()) : null);
distances.add(dv); 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); enableDevice.setVisibility(View.GONE);
ImageView icon = (ImageView) v.findViewById(R.id.icon); ImageView icon = (ImageView) v.findViewById(R.id.icon);
if (device.isEnabled()) { if (device.isEnabled()) {

View file

@ -544,7 +544,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
} else if (item.getItemId() == SHARE_ID) { } else if (item.getItemId() == SHARE_ID) {
shareOsMoGroup(group.getVisibleName(app), group.getGroupId()); shareOsMoGroup(group.getVisibleName(app), group.getGroupId());
} else if (item.getItemId() == ON_OFF_ACTION_ID) { } 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); onOffAction(bt);
} }
return true; 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()) { if (model.isMainGroup()) {
ci.setVisibility(View.GONE); ci.setVisibility(View.GONE);
} else { } else {

View file

@ -353,13 +353,13 @@ public class MapWidgetRegistry {
public void addControls(MapActivity map, ContextMenuAdapter cm, ApplicationMode mode) { 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); addControls(map, cm, right, mode);
if(mode != ApplicationMode.DEFAULT) { 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); 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); addControlsAppearance(map, cm, mode);
} }