Change main settings fragment base class
This commit is contained in:
parent
e3059e3aa2
commit
7088846e09
16 changed files with 70 additions and 450 deletions
|
@ -1,293 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?attr/activity_background_color"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
|
||||||
android:id="@+id/appbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
android:minHeight="56dp"
|
|
||||||
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
|
||||||
|
|
||||||
</android.support.v7.widget.Toolbar>
|
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/list_background_color"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/personal_account_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="72dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/personal_account_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:src="@drawable/ic_person"
|
|
||||||
android:tint="?attr/default_icon_color" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/personal_account_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/personal_account"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textSize="@dimen/default_list_text_size" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/personal_account_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/personal_account_descr"
|
|
||||||
android:textColor="@color/description_font_and_bottom_sheet_icons" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/global_settings_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="72dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/global_settings_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:src="@drawable/ic_action_settings"
|
|
||||||
android:tint="?attr/default_icon_color" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/global_settings_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/osmand_settings"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textSize="@dimen/default_list_text_size" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/global_settings_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/osmand_settings_descr"
|
|
||||||
android:textColor="@color/description_font_and_bottom_sheet_icons" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<include layout="@layout/list_item_divider" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/list_background_color"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="36dp"
|
|
||||||
android:paddingLeft="64dp"
|
|
||||||
android:paddingRight="64dp"
|
|
||||||
android:text="@string/application_profiles"
|
|
||||||
android:textColor="#7E33FF"
|
|
||||||
osmand:typeface="@string/font_roboto_medium" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/browse_map_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="72dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/browse_map_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:src="@drawable/ic_action_car_dark"
|
|
||||||
android:tint="?attr/default_icon_color" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/browse_map_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/rendering_value_browse_map_name"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textSize="@dimen/default_list_text_size" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/browse_map_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/osmand_settings_descr"
|
|
||||||
android:textColor="@color/description_font_and_bottom_sheet_icons" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="?attr/divider_color_basic" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/configure_profile_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="72dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/configure_profile_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
tools:src="@drawable/ic_world_globe_dark"
|
|
||||||
tools:tint="?attr/default_icon_color" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/configure_profile_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textSize="@dimen/default_list_text_size"
|
|
||||||
tools:text="Off Road" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/configure_profile_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="@color/description_font_and_bottom_sheet_icons"
|
|
||||||
tools:text="@string/osmand_settings_descr" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/manage_profiles_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="72dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/manage_profiles_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:src="@drawable/ic_action_copy"
|
|
||||||
android:tint="?attr/default_icon_color" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="@dimen/list_content_padding"
|
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manage_profiles_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/manage_profiles"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textSize="@dimen/default_list_text_size" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/manage_profiles_description"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/manage_profiles_descr"
|
|
||||||
android:textColor="@color/description_font_and_bottom_sheet_icons" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<include layout="@layout/card_bottom_divider" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -10,7 +10,7 @@
|
||||||
app:contentInsetStart="4dp">
|
app:contentInsetStart="4dp">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/toolbar_back"
|
android:id="@+id/close_button"
|
||||||
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
|
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
|
||||||
android:layout_width="56dp"
|
android:layout_width="56dp"
|
||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
android:src="@drawable/ic_action_mode_back" />
|
android:src="@drawable/ic_action_mode_back" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/toolbar_text"
|
android:id="@+id/toolbar_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:summary="@string/map_look_descr"
|
android:summary="@string/map_look_descr"
|
||||||
android:title="@string/map_look"
|
android:title="@string/map_look"
|
||||||
app:fragment="net.osmand.plus.settings.RouteParametersFragment"
|
|
||||||
tools:icon="@drawable/ic_action_layers_dark" />
|
tools:icon="@drawable/ic_action_layers_dark" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:summary="@string/personal_account_descr"
|
android:summary="@string/personal_account_descr"
|
||||||
android:title="@string/personal_account"
|
android:title="@string/personal_account"
|
||||||
app:fragment="net.osmand.plus.settings.ProfileGeneralSettings"
|
|
||||||
tools:icon="@drawable/ic_person" />
|
tools:icon="@drawable/ic_person" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
|
@ -16,7 +15,6 @@
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:summary="@string/osmand_settings_descr"
|
android:summary="@string/osmand_settings_descr"
|
||||||
android:title="@string/osmand_settings"
|
android:title="@string/osmand_settings"
|
||||||
app:fragment="net.osmand.plus.settings.NavigationFragment"
|
|
||||||
tools:icon="@drawable/ic_action_settings" />
|
tools:icon="@drawable/ic_action_settings" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
|
@ -30,7 +28,6 @@
|
||||||
android:layout="@layout/preference_with_descr"
|
android:layout="@layout/preference_with_descr"
|
||||||
android:summary="@string/map_look_descr"
|
android:summary="@string/map_look_descr"
|
||||||
android:title="@string/rendering_value_browse_map_name"
|
android:title="@string/rendering_value_browse_map_name"
|
||||||
app:fragment="net.osmand.plus.settings.RouteParametersFragment"
|
|
||||||
tools:icon="@drawable/ic_world_globe_dark" />
|
tools:icon="@drawable/ic_world_globe_dark" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
|
|
|
@ -125,7 +125,7 @@ import net.osmand.plus.routing.TransportRoutingHelper.TransportRouteCalculationP
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment;
|
import net.osmand.plus.search.QuickSearchDialogFragment;
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
|
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||||
import net.osmand.plus.settings.BaseProfileSettingsFragment;
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
import net.osmand.plus.settings.SettingsMainFragment;
|
import net.osmand.plus.settings.SettingsMainFragment;
|
||||||
import net.osmand.plus.settings.profiles.EditProfileFragment;
|
import net.osmand.plus.settings.profiles.EditProfileFragment;
|
||||||
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
||||||
|
@ -1926,8 +1926,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
|
public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) {
|
||||||
if (caller instanceof BaseProfileSettingsFragment) {
|
if (caller instanceof BaseSettingsFragment) {
|
||||||
BaseProfileSettingsFragment baseFragment = (BaseProfileSettingsFragment) caller;
|
BaseSettingsFragment baseFragment = (BaseSettingsFragment) caller;
|
||||||
|
|
||||||
ApplicationMode mode = baseFragment.getSelectedMode();
|
ApplicationMode mode = baseFragment.getSelectedMode();
|
||||||
if (mode != null) {
|
if (mode != null) {
|
||||||
|
|
|
@ -43,9 +43,7 @@ import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.profiles.SettingsProfileFragment.PROFILE_STRING_KEY;
|
public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
|
||||||
|
|
||||||
public abstract class BaseProfileSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
|
|
||||||
|
|
||||||
protected OsmandApplication app;
|
protected OsmandApplication app;
|
||||||
protected OsmandSettings settings;
|
protected OsmandSettings settings;
|
||||||
|
@ -61,12 +59,7 @@ public abstract class BaseProfileSettingsFragment extends PreferenceFragmentComp
|
||||||
app = requireMyApplication();
|
app = requireMyApplication();
|
||||||
settings = app.getSettings();
|
settings = app.getSettings();
|
||||||
nightMode = !settings.isLightContent();
|
nightMode = !settings.isLightContent();
|
||||||
String modeName = "";
|
selectedAppMode = settings.APPLICATION_MODE.get();
|
||||||
if (getArguments() != null) {
|
|
||||||
modeName = getArguments().getString(PROFILE_STRING_KEY, ApplicationMode.CAR.getStringKey());
|
|
||||||
}
|
|
||||||
selectedAppMode = ApplicationMode.valueOfStringKey(modeName, ApplicationMode.DEFAULT);
|
|
||||||
settings.APPLICATION_MODE.set(selectedAppMode);
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
modes.clear();
|
modes.clear();
|
||||||
for (ApplicationMode a : ApplicationMode.values(app)) {
|
for (ApplicationMode a : ApplicationMode.values(app)) {
|
||||||
|
@ -123,12 +116,15 @@ public abstract class BaseProfileSettingsFragment extends PreferenceFragmentComp
|
||||||
getActivity().getSupportFragmentManager().popBackStack();
|
getActivity().getSupportFragmentManager().popBackStack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view.findViewById(R.id.switch_profile_button).setOnClickListener(new View.OnClickListener() {
|
View switchProfile = view.findViewById(R.id.switch_profile_button);
|
||||||
@Override
|
if (switchProfile != null) {
|
||||||
public void onClick(View v) {
|
switchProfile.setOnClickListener(new View.OnClickListener() {
|
||||||
selectAppModeDialog().show();
|
@Override
|
||||||
}
|
public void onClick(View v) {
|
||||||
});
|
selectAppModeDialog().show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
updateToolbar(view);
|
updateToolbar(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,6 +210,7 @@ public abstract class BaseProfileSettingsFragment extends PreferenceFragmentComp
|
||||||
protected void registerPreference(Preference preference) {
|
protected void registerPreference(Preference preference) {
|
||||||
if (preference != null) {
|
if (preference != null) {
|
||||||
preference.setOnPreferenceChangeListener(this);
|
preference.setOnPreferenceChangeListener(this);
|
||||||
|
preference.setOnPreferenceClickListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.settings.profiles.SettingsProfileFragment.PROFILE_STRING_KEY;
|
import static net.osmand.plus.settings.profiles.SettingsProfileFragment.PROFILE_STRING_KEY;
|
||||||
|
|
||||||
public class ConfigureProfileFragment extends BaseProfileSettingsFragment {
|
public class ConfigureProfileFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "ConfigureProfileFragment";
|
public static final String TAG = "ConfigureProfileFragment";
|
||||||
|
|
||||||
|
@ -99,12 +99,6 @@ public class ConfigureProfileFragment extends BaseProfileSettingsFragment {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
Toast.makeText(getActivity(), "Click " + preference.getKey(), Toast.LENGTH_LONG).show();
|
|
||||||
return super.onPreferenceClick(preference);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean showInstance(FragmentManager fragmentManager, ApplicationMode mode) {
|
public static boolean showInstance(FragmentManager fragmentManager, ApplicationMode mode) {
|
||||||
try {
|
try {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.views.ListFloatPreference;
|
import net.osmand.plus.views.ListFloatPreference;
|
||||||
import net.osmand.plus.views.ListIntPreference;
|
import net.osmand.plus.views.ListIntPreference;
|
||||||
|
|
||||||
public class MapDuringNavigationFragment extends BaseProfileSettingsFragment {
|
public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "MapDuringNavigationFragment";
|
public static final String TAG = "MapDuringNavigationFragment";
|
||||||
|
|
||||||
|
@ -94,15 +94,6 @@ public class MapDuringNavigationFragment extends BaseProfileSettingsFragment {
|
||||||
super.onDisplayPreferenceDialog(preference);
|
super.onDisplayPreferenceDialog(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
String key = preference.getKey();
|
|
||||||
if (key != null && key.equals(settings.AUTO_ZOOM_MAP.getId())) {
|
|
||||||
Toast.makeText(getContext(), "onPreferenceClick AUTO_ZOOM_MAP", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
return super.onPreferenceClick(preference);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean showInstance(FragmentManager fragmentManager) {
|
public static boolean showInstance(FragmentManager fragmentManager) {
|
||||||
try {
|
try {
|
||||||
MapDuringNavigationFragment settingsNavigationFragment = new MapDuringNavigationFragment();
|
MapDuringNavigationFragment settingsNavigationFragment = new MapDuringNavigationFragment();
|
||||||
|
|
|
@ -8,14 +8,13 @@ import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
import static net.osmand.plus.settings.profiles.SettingsProfileFragment.PROFILE_STRING_KEY;
|
import static net.osmand.plus.settings.profiles.SettingsProfileFragment.PROFILE_STRING_KEY;
|
||||||
|
|
||||||
public class NavigationFragment extends BaseProfileSettingsFragment {
|
public class NavigationFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "NavigationFragment";
|
public static final String TAG = "NavigationFragment";
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand.plus.settings;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.preference.Preference;
|
|
||||||
import android.support.v7.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -14,7 +13,7 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.views.ListIntPreference;
|
import net.osmand.plus.views.ListIntPreference;
|
||||||
|
|
||||||
public class ProfileGeneralSettings extends BaseProfileSettingsFragment {
|
public class ProfileGeneralSettings extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "ProfileGeneralSettings";
|
public static final String TAG = "ProfileGeneralSettings";
|
||||||
|
|
||||||
|
@ -75,20 +74,6 @@ public class ProfileGeneralSettings extends BaseProfileSettingsFragment {
|
||||||
coordinatesFormat.setEntryValues(cvls);
|
coordinatesFormat.setEntryValues(cvls);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisplayPreferenceDialog(Preference preference) {
|
|
||||||
String key = preference.getKey();
|
|
||||||
|
|
||||||
super.onDisplayPreferenceDialog(preference);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
String key = preference.getKey();
|
|
||||||
|
|
||||||
return super.onPreferenceClick(preference);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean showInstance(FragmentManager fragmentManager) {
|
public static boolean showInstance(FragmentManager fragmentManager) {
|
||||||
try {
|
try {
|
||||||
ProfileGeneralSettings profileGeneralSettingsSettings = new ProfileGeneralSettings();
|
ProfileGeneralSettings profileGeneralSettingsSettings = new ProfileGeneralSettings();
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import static net.osmand.plus.activities.SettingsNavigationActivity.getRouter;
|
import static net.osmand.plus.activities.SettingsNavigationActivity.getRouter;
|
||||||
|
|
||||||
public class RouteParametersFragment extends BaseProfileSettingsFragment {
|
public class RouteParametersFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "RouteParametersFragment";
|
public static final String TAG = "RouteParametersFragment";
|
||||||
private List<GeneralRouter.RoutingParameter> avoidParameters = new ArrayList<GeneralRouter.RoutingParameter>();
|
private List<GeneralRouter.RoutingParameter> avoidParameters = new ArrayList<GeneralRouter.RoutingParameter>();
|
||||||
|
@ -154,7 +154,7 @@ public class RouteParametersFragment extends BaseProfileSettingsFragment {
|
||||||
String key = preference.getKey();
|
String key = preference.getKey();
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "avoid_in_routing": {
|
case "avoid_in_routing": {
|
||||||
AvoidRoadsBottomSheetDialogFragment avoidRoadsFragment = new AvoidRoadsBottomSheetDialogFragment(false);
|
AvoidRoadsBottomSheetDialogFragment avoidRoadsFragment = new AvoidRoadsBottomSheetDialogFragment(true);
|
||||||
avoidRoadsFragment.setTargetFragment(RouteParametersFragment.this, AvoidRoadsBottomSheetDialogFragment.REQUEST_CODE);
|
avoidRoadsFragment.setTargetFragment(RouteParametersFragment.this, AvoidRoadsBottomSheetDialogFragment.REQUEST_CODE);
|
||||||
avoidRoadsFragment.show(getActivity().getSupportFragmentManager(), AvoidRoadsBottomSheetDialogFragment.TAG);
|
avoidRoadsFragment.show(getActivity().getSupportFragmentManager(), AvoidRoadsBottomSheetDialogFragment.TAG);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import android.view.ViewGroup;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
public class ScreenAlertsFragment extends BaseProfileSettingsFragment {
|
public class ScreenAlertsFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "ScreenAlertsFragment";
|
public static final String TAG = "ScreenAlertsFragment";
|
||||||
|
|
||||||
|
|
|
@ -1,127 +1,73 @@
|
||||||
package net.osmand.plus.settings;
|
package net.osmand.plus.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.preference.Preference;
|
||||||
import android.util.TypedValue;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
|
||||||
import net.osmand.plus.settings.profiles.SettingsProfileFragment;
|
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
public class SettingsMainFragment extends BaseOsmAndFragment {
|
public class SettingsMainFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "SettingsMainFragment";
|
public static final String TAG = "SettingsMainFragment";
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
protected int getPreferenceResId() {
|
||||||
View view = inflater.inflate(R.layout.fragment_settings_main, null);
|
return R.xml.settings_main_screen;
|
||||||
|
}
|
||||||
|
|
||||||
AndroidUtils.addStatusBarPadding21v(getContext(), view);
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
|
||||||
Toolbar tb = (Toolbar) view.findViewById(R.id.toolbar);
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
tb.setTitle(R.string.shared_string_settings);
|
@Override
|
||||||
tb.setClickable(true);
|
protected int getToolbarResId() {
|
||||||
tb.setNavigationIcon(getIcon(R.drawable.ic_arrow_back));
|
return R.layout.global_preference_toolbar;
|
||||||
tb.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
}
|
||||||
tb.setBackgroundColor(getResources().getColor(resolveResourceId(getActivity(), R.attr.pstsTabBackground)));
|
|
||||||
tb.setTitleTextColor(getResources().getColor(resolveResourceId(getActivity(), R.attr.pstsTextColor)));
|
|
||||||
tb.setNavigationOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(final View v) {
|
|
||||||
getActivity().getSupportFragmentManager().popBackStack();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
View personal_account_container = view.findViewById(R.id.personal_account_container);
|
protected String getToolbarTitle() {
|
||||||
personal_account_container.setOnClickListener(new View.OnClickListener() {
|
return getString(R.string.shared_string_settings);
|
||||||
@Override
|
}
|
||||||
public void onClick(View v) {
|
|
||||||
getMyApplication().showShortToastMessage("personal_account_container");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
View global_settings_container = view.findViewById(R.id.global_settings_container);
|
|
||||||
global_settings_container.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
getMyApplication().showShortToastMessage("global_settings_container");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
View browse_map_container = view.findViewById(R.id.browse_map_container);
|
|
||||||
browse_map_container.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
getMyApplication().showShortToastMessage("browse_map_container");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final ApplicationMode selectedMode = getSettings().APPLICATION_MODE.get();
|
@Override
|
||||||
View configure_profile_container = view.findViewById(R.id.configure_profile_container);
|
protected void createUI() {
|
||||||
|
PreferenceScreen screen = getPreferenceScreen();
|
||||||
|
|
||||||
|
Preference personal_account = findAndRegisterPreference("personal_account");
|
||||||
|
Preference global_settings = findAndRegisterPreference("global_settings");
|
||||||
|
Preference browse_map = findAndRegisterPreference("browse_map");
|
||||||
|
Preference configure_profile = findAndRegisterPreference("configure_profile");
|
||||||
|
Preference manage_profiles = findAndRegisterPreference("manage_profiles");
|
||||||
|
|
||||||
|
personal_account.setIcon(getContentIcon(R.drawable.ic_person));
|
||||||
|
global_settings.setIcon(getContentIcon(R.drawable.ic_action_settings));
|
||||||
|
browse_map.setIcon(getContentIcon(R.drawable.ic_world_globe_dark));
|
||||||
|
manage_profiles.setIcon(getContentIcon(R.drawable.ic_action_manage_profiles));
|
||||||
|
|
||||||
|
final ApplicationMode selectedMode = getSelectedMode();
|
||||||
|
|
||||||
int iconRes = selectedMode.getIconRes();
|
int iconRes = selectedMode.getIconRes();
|
||||||
int iconColor = selectedMode.getIconColorInfo().getColor(!getSettings().isLightContent());
|
int iconColor = selectedMode.getIconColorInfo().getColor(!getSettings().isLightContent());
|
||||||
String title = selectedMode.isCustomProfile() ? selectedMode.getCustomProfileName() : getResources().getString(selectedMode.getNameKeyResource());
|
String title = selectedMode.isCustomProfile() ? selectedMode.getCustomProfileName() : getResources().getString(selectedMode.getNameKeyResource());
|
||||||
|
|
||||||
TextView profileTitle = (TextView) view.findViewById(R.id.configure_profile_title);
|
String profileType;
|
||||||
profileTitle.setText(title);
|
|
||||||
|
|
||||||
String profileType = null;
|
|
||||||
if (selectedMode.isCustomProfile()) {
|
if (selectedMode.isCustomProfile()) {
|
||||||
profileType = String.format(getString(R.string.profile_type_descr_string), Algorithms.capitalizeFirstLetterAndLowercase(selectedMode.getParent().toHumanString(getContext())));
|
profileType = String.format(getString(R.string.profile_type_descr_string), Algorithms.capitalizeFirstLetterAndLowercase(selectedMode.getParent().toHumanString(getContext())));
|
||||||
} else {
|
} else {
|
||||||
profileType = getString(R.string.profile_type_base_string);
|
profileType = getString(R.string.profile_type_base_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView profileDescription = (TextView) view.findViewById(R.id.configure_profile_description);
|
configure_profile.setIcon(getIcon(iconRes, iconColor));
|
||||||
profileDescription.setText(profileType);
|
configure_profile.setTitle(title);
|
||||||
|
configure_profile.setSummary(profileType);
|
||||||
ImageView profileIcon = (ImageView) view.findViewById(R.id.configure_profile_icon);
|
|
||||||
profileIcon.setImageDrawable(getIcon(iconRes, iconColor));
|
|
||||||
|
|
||||||
configure_profile_container.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
ConfigureProfileFragment.showInstance(getActivity().getSupportFragmentManager(), selectedMode);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
View manage_profiles_container = view.findViewById(R.id.manage_profiles_container);
|
|
||||||
manage_profiles_container.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
SettingsProfileFragment profileFragment = new SettingsProfileFragment();
|
|
||||||
getActivity().getSupportFragmentManager()
|
|
||||||
.beginTransaction()
|
|
||||||
.replace(R.id.fragmentContainer, profileFragment, SettingsProfileFragment.TAG)
|
|
||||||
.addToBackStack(SettingsProfileFragment.TAG)
|
|
||||||
.commit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getStatusBarColorId() {
|
|
||||||
return getSettings().isLightContent() ? R.color.status_bar_color_light : R.color.status_bar_color_dark;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int resolveResourceId(final Activity activity, final int attr) {
|
|
||||||
final TypedValue typedvalueattr = new TypedValue();
|
|
||||||
activity.getTheme().resolveAttribute(attr, typedvalueattr, true);
|
|
||||||
return typedvalueattr.resourceId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(FragmentManager fragmentManager) {
|
public static boolean showInstance(FragmentManager fragmentManager) {
|
||||||
|
@ -136,4 +82,9 @@ public class SettingsMainFragment extends BaseOsmAndFragment {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return getSettings().isLightContent() ? R.color.status_bar_color_light : R.color.status_bar_color_dark;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ import android.view.ViewGroup;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.views.ListIntPreference;
|
import net.osmand.plus.views.ListIntPreference;
|
||||||
|
|
||||||
public class TurnScreenOnFragment extends BaseProfileSettingsFragment {
|
public class TurnScreenOnFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "TurnScreenOnFragment";
|
public static final String TAG = "TurnScreenOnFragment";
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Map;
|
||||||
import static net.osmand.plus.activities.SettingsNavigationActivity.getRouter;
|
import static net.osmand.plus.activities.SettingsNavigationActivity.getRouter;
|
||||||
import static net.osmand.plus.activities.SettingsNavigationActivity.setupSpeedSlider;
|
import static net.osmand.plus.activities.SettingsNavigationActivity.setupSpeedSlider;
|
||||||
|
|
||||||
public class VehicleParametersFragment extends BaseProfileSettingsFragment {
|
public class VehicleParametersFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "VehicleParametersFragment";
|
public static final String TAG = "VehicleParametersFragment";
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import static net.osmand.plus.activities.SettingsNavigationActivity.MORE_VALUE;
|
import static net.osmand.plus.activities.SettingsNavigationActivity.MORE_VALUE;
|
||||||
|
|
||||||
public class VoiceAnnouncesFragment extends BaseProfileSettingsFragment {
|
public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = "VoiceAnnouncesFragment";
|
public static final String TAG = "VoiceAnnouncesFragment";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue