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">
<Switch
android:id="@+id/check_item"
android:id="@+id/toggle_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -40,7 +40,7 @@
<!-- android:button="@drawable/ic_btn_wocheckbox" -->
<CheckBox
android:id="@+id/check_item"
android:id="@+id/toggle_item"
android:layout_width="wrap_content"
android:layout_height="match_parent"
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
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) {
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);

View file

@ -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;

View file

@ -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));

View file

@ -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();

View file

@ -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]);

View file

@ -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;
}
};

View file

@ -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;
}
};

View file

@ -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);
}
}
}

View file

@ -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);
}

View file

@ -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();

View file

@ -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<LocalIndexInfo> list = data.get(group);
int size = 0;

View file

@ -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 {

View file

@ -271,7 +271,7 @@ public class MapMarkerDialogHelper {
protected View createItemForCategory(final ArrayAdapter<Object> 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) {

View file

@ -649,7 +649,7 @@ public class WaypointDialogHelper {
final int position, final ArrayAdapter<Object> 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);

View file

@ -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);

View file

@ -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);

View file

@ -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));

View file

@ -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);
}
}

View file

@ -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()) {

View file

@ -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 {

View file

@ -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);
}