Preferences ui fixes
This commit is contained in:
parent
88fd3881a4
commit
6f569e9565
9 changed files with 123 additions and 49 deletions
|
@ -14,15 +14,25 @@
|
||||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||||
tools:background="?android:attr/selectableItemBackground">
|
tools:background="?android:attr/selectableItemBackground">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@android:id/icon"
|
android:id="@+id/icon_container"
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
android:layout_marginLeft="@dimen/content_padding_half"
|
||||||
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
|
android:layout_marginTop="@dimen/content_padding"
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
android:layout_marginRight="@dimen/content_padding_half"
|
||||||
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin" />
|
android:layout_marginBottom="@dimen/content_padding">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@android:id/icon"
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
tools:src="@drawable/ic_action_car_dark"
|
||||||
|
tools:tint="@color/active_color_primary_light" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -77,18 +77,20 @@
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="@dimen/content_padding"
|
android:paddingLeft="@dimen/content_padding"
|
||||||
android:paddingRight="@dimen/content_padding">
|
android:paddingTop="@dimen/content_padding_half"
|
||||||
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
android:paddingBottom="@dimen/content_padding_half">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/profile_title"
|
android:id="@+id/profile_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:letterSpacing="@dimen/title_letter_spacing"
|
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_regular"
|
||||||
tools:text="@string/profile_type_base_string" />
|
tools:text="@string/profile_type_base_string" />
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
|
@ -98,8 +100,10 @@
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:letterSpacing="@dimen/description_letter_spacing"
|
android:letterSpacing="@dimen/description_letter_spacing"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
android:paddingTop="@dimen/text_margin_small"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
android:visibility="gone"
|
||||||
osmand:typeface="@string/font_roboto_regular"
|
osmand:typeface="@string/font_roboto_regular"
|
||||||
tools:text="Item additional description" />
|
tools:text="Item additional description" />
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand;
|
package net.osmand;
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -426,6 +425,12 @@ public class AndroidUtils {
|
||||||
return outValue.resourceId;
|
return outValue.resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float getFloatValueFromRes(Context ctx, int resId) {
|
||||||
|
TypedValue outValue = new TypedValue();
|
||||||
|
ctx.getResources().getValue(resId, outValue, true);
|
||||||
|
return outValue.getFloat();
|
||||||
|
}
|
||||||
|
|
||||||
public static int getStatusBarHeight(Context ctx) {
|
public static int getStatusBarHeight(Context ctx) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int resourceId = ctx.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
int resourceId = ctx.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
|
|
|
@ -60,11 +60,11 @@ import net.osmand.plus.measurementtool.MeasurementToolFragment;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.profiles.AppModesBottomSheetDialogFragment;
|
import net.osmand.plus.profiles.AppModesBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment;
|
import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.profiles.SettingsProfileActivity;
|
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
import net.osmand.plus.settings.ConfigureProfileFragment;
|
import net.osmand.plus.settings.ConfigureProfileFragment;
|
||||||
import net.osmand.plus.views.BaseMapLayer;
|
import net.osmand.plus.views.BaseMapLayer;
|
||||||
import net.osmand.plus.views.MapControlsLayer;
|
import net.osmand.plus.views.MapControlsLayer;
|
||||||
|
@ -74,7 +74,6 @@ import net.osmand.plus.wikivoyage.WikivoyageWelcomeDialogFragment;
|
||||||
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||||
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity;
|
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -639,13 +638,8 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
//switch profile button
|
//switch profile button
|
||||||
ApplicationMode currentMode = app.getSettings().APPLICATION_MODE.get();
|
ApplicationMode currentMode = app.getSettings().APPLICATION_MODE.get();
|
||||||
String modeDescription;
|
String modeDescription = BaseSettingsFragment.getAppModeDescription(app, currentMode);
|
||||||
if (currentMode.isCustomProfile()) {
|
|
||||||
modeDescription = String.format(app.getString(R.string.profile_type_descr_string),
|
|
||||||
Algorithms.capitalizeFirstLetterAndLowercase(currentMode.getParent().toHumanString(app)));
|
|
||||||
} else {
|
|
||||||
modeDescription = getString(R.string.profile_type_base_string);
|
|
||||||
}
|
|
||||||
optionsMenuHelper.addItem(new ItemBuilder().setLayout(R.layout.main_menu_drawer_btn_switch_profile)
|
optionsMenuHelper.addItem(new ItemBuilder().setLayout(R.layout.main_menu_drawer_btn_switch_profile)
|
||||||
.setIcon(currentMode.getIconRes())
|
.setIcon(currentMode.getIconRes())
|
||||||
.setColor(currentMode.getIconColorInfo().getColor(nightMode))
|
.setColor(currentMode.getIconColorInfo().getColor(nightMode))
|
||||||
|
|
|
@ -11,16 +11,19 @@ import android.view.ViewGroup;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
public class ConfigureProfileMenuAdapter extends AbstractProfileMenuAdapter<ConfigureProfileMenuAdapter.ConfigureProfileViewHolder> {
|
public class ConfigureProfileMenuAdapter extends AbstractProfileMenuAdapter<ConfigureProfileMenuAdapter.ConfigureProfileViewHolder> {
|
||||||
|
|
||||||
|
@ -101,12 +104,7 @@ public class ConfigureProfileMenuAdapter extends AbstractProfileMenuAdapter<Conf
|
||||||
holder.menuIcon.setVisibility(View.VISIBLE);
|
holder.menuIcon.setVisibility(View.VISIBLE);
|
||||||
final ApplicationMode item = (ApplicationMode) obj;
|
final ApplicationMode item = (ApplicationMode) obj;
|
||||||
holder.title.setText(item.toHumanString(app));
|
holder.title.setText(item.toHumanString(app));
|
||||||
if (item.isCustomProfile()) {
|
holder.descr.setText(BaseSettingsFragment.getAppModeDescription(app, item));
|
||||||
holder.descr.setText(String.format(app.getString(R.string.profile_type_descr_string),
|
|
||||||
Algorithms.capitalizeFirstLetterAndLowercase(item.getParent().toHumanString(app))));
|
|
||||||
} else {
|
|
||||||
holder.descr.setText(R.string.profile_type_base_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
holder.initSwitcher = true;
|
holder.initSwitcher = true;
|
||||||
holder.switcher.setChecked(selectedItems.contains(item));
|
holder.switcher.setChecked(selectedItems.contains(item));
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -95,12 +96,7 @@ public class SelectProfileMenuAdapter extends AbstractProfileMenuAdapter<SelectP
|
||||||
holder.menuIcon.setVisibility(View.GONE);
|
holder.menuIcon.setVisibility(View.GONE);
|
||||||
final ApplicationMode item = (ApplicationMode) obj;
|
final ApplicationMode item = (ApplicationMode) obj;
|
||||||
holder.title.setText(item.toHumanString(app));
|
holder.title.setText(item.toHumanString(app));
|
||||||
if (item.isCustomProfile()) {
|
holder.descr.setText(BaseSettingsFragment.getAppModeDescription(app, item));
|
||||||
holder.descr.setText(String.format(app.getString(R.string.profile_type_descr_string),
|
|
||||||
Algorithms.capitalizeFirstLetterAndLowercase(item.getParent().toHumanString(app))));
|
|
||||||
} else {
|
|
||||||
holder.descr.setText(R.string.profile_type_base_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
int profileColorResId = item.getIconColorInfo().getColor(nightMode);
|
int profileColorResId = item.getIconColorInfo().getColor(nightMode);
|
||||||
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(profileColorResId, selectedIconColorRes));
|
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(profileColorResId, selectedIconColorRes));
|
||||||
|
|
|
@ -56,6 +56,7 @@ import net.osmand.plus.settings.bottomsheets.SingleSelectPreferenceBottomSheet;
|
||||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||||
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
|
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
|
||||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener,
|
public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener,
|
||||||
OnPreferenceClickListener, AppModeChangedListener {
|
OnPreferenceClickListener, AppModeChangedListener {
|
||||||
|
@ -306,10 +307,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
||||||
String appName = selectedAppMode.toHumanString(app);
|
String appName = selectedAppMode.toHumanString(app);
|
||||||
profileTitle.setText(appName);
|
profileTitle.setText(appName);
|
||||||
}
|
}
|
||||||
TextView profileType = (TextView) view.findViewById(R.id.profile_type);
|
|
||||||
if (profileType != null) {
|
|
||||||
profileType.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
View toolbarDivider = view.findViewById(R.id.toolbar_divider);
|
View toolbarDivider = view.findViewById(R.id.toolbar_divider);
|
||||||
if (toolbarDivider != null) {
|
if (toolbarDivider != null) {
|
||||||
toolbarDivider.setBackgroundColor(iconColor);
|
toolbarDivider.setBackgroundColor(iconColor);
|
||||||
|
@ -588,4 +585,16 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
||||||
|
|
||||||
return listPreference;
|
return listPreference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getAppModeDescription(Context ctx, ApplicationMode mode) {
|
||||||
|
String description;
|
||||||
|
if (mode.isCustomProfile()) {
|
||||||
|
description = String.format(ctx.getString(R.string.profile_type_descr_string),
|
||||||
|
Algorithms.capitalizeFirstLetterAndLowercase(mode.getParent().toHumanString(ctx)));
|
||||||
|
} else {
|
||||||
|
description = ctx.getString(R.string.profile_type_base_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return description;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,7 @@ import android.support.v7.widget.RecyclerView;
|
||||||
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.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
@ -33,6 +34,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.PluginActivity;
|
import net.osmand.plus.activities.PluginActivity;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -96,6 +98,35 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createToolbar(LayoutInflater inflater, View view) {
|
||||||
|
super.createToolbar(inflater, view);
|
||||||
|
|
||||||
|
TextView toolbarTitle = (TextView) view.findViewById(R.id.profile_title);
|
||||||
|
toolbarTitle.setTypeface(FontCache.getRobotoMedium(view.getContext()));
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
float letterSpacing = AndroidUtils.getFloatValueFromRes(view.getContext(), R.dimen.title_letter_spacing);
|
||||||
|
toolbarTitle.setLetterSpacing(letterSpacing);
|
||||||
|
}
|
||||||
|
TextView profileType = (TextView) view.findViewById(R.id.profile_type);
|
||||||
|
profileType.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateToolbar() {
|
||||||
|
super.updateToolbar();
|
||||||
|
|
||||||
|
View view = getView();
|
||||||
|
if (view != null) {
|
||||||
|
ApplicationMode selectedMode = getSelectedAppMode();
|
||||||
|
String appModeType = getAppModeDescription(view.getContext(), selectedMode);
|
||||||
|
|
||||||
|
TextView profileType = (TextView) view.findViewById(R.id.profile_type);
|
||||||
|
profileType.setText(appModeType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private RecyclerView.ItemDecoration createDividerItemDecoration() {
|
private RecyclerView.ItemDecoration createDividerItemDecoration() {
|
||||||
final Drawable dividerLight = new ColorDrawable(ContextCompat.getColor(app, R.color.list_background_color_light));
|
final Drawable dividerLight = new ColorDrawable(ContextCompat.getColor(app, R.color.list_background_color_light));
|
||||||
final Drawable dividerDark = new ColorDrawable(ContextCompat.getColor(app, R.color.list_background_color_dark));
|
final Drawable dividerDark = new ColorDrawable(ContextCompat.getColor(app, R.color.list_background_color_dark));
|
||||||
|
|
|
@ -1,19 +1,27 @@
|
||||||
package net.osmand.plus.settings;
|
package net.osmand.plus.settings;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.graphics.drawable.LayerDrawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.support.annotation.ColorRes;
|
import android.support.annotation.ColorRes;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
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.UiUtilities;
|
||||||
import net.osmand.plus.profiles.SettingsProfileActivity;
|
import net.osmand.plus.profiles.SettingsProfileActivity;
|
||||||
import net.osmand.util.Algorithms;
|
|
||||||
|
|
||||||
public class MainSettingsFragment extends BaseSettingsFragment {
|
public class MainSettingsFragment extends BaseSettingsFragment {
|
||||||
|
|
||||||
public static final String TAG = MainSettingsFragment.class.getSimpleName();
|
public static final String TAG = MainSettingsFragment.class.getSimpleName();
|
||||||
|
|
||||||
|
private static final String CONFIGURE_PROFILE = "configure_profile";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getFragmentTag() {
|
protected String getFragmentTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
|
@ -53,6 +61,31 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
||||||
setupManageProfilesPref();
|
setupManageProfilesPref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||||
|
super.onBindPreferenceViewHolder(preference, holder);
|
||||||
|
|
||||||
|
String key = preference.getKey();
|
||||||
|
if (CONFIGURE_PROFILE.equals(key)) {
|
||||||
|
View iconContainer = holder.itemView.findViewById(R.id.icon_container);
|
||||||
|
if (iconContainer != null) {
|
||||||
|
int profileColor = getActiveProfileColor();
|
||||||
|
int bgColor = UiUtilities.getColorWithAlpha(profileColor, 0.1f);
|
||||||
|
Drawable backgroundDrawable;
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
int selectedColor = UiUtilities.getColorWithAlpha(profileColor, 0.3f);
|
||||||
|
Drawable background = getPaintedIcon(R.drawable.circle_background_light, bgColor);
|
||||||
|
Drawable ripple = getPaintedIcon(R.drawable.ripple_circle, selectedColor);
|
||||||
|
backgroundDrawable = new LayerDrawable(new Drawable[] {background, ripple});
|
||||||
|
} else {
|
||||||
|
backgroundDrawable = getPaintedIcon(R.drawable.circle_background_light, bgColor);
|
||||||
|
}
|
||||||
|
AndroidUtils.setBackground(iconContainer, backgroundDrawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setupManageProfilesPref() {
|
private void setupManageProfilesPref() {
|
||||||
Preference manageProfiles = findPreference("manage_profiles");
|
Preference manageProfiles = findPreference("manage_profiles");
|
||||||
manageProfiles.setIcon(getIcon(R.drawable.ic_action_manage_profiles));
|
manageProfiles.setIcon(getIcon(R.drawable.ic_action_manage_profiles));
|
||||||
|
@ -63,16 +96,10 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
||||||
ApplicationMode selectedMode = getSelectedAppMode();
|
ApplicationMode selectedMode = getSelectedAppMode();
|
||||||
|
|
||||||
String title = selectedMode.toHumanString(getContext());
|
String title = selectedMode.toHumanString(getContext());
|
||||||
String profileType;
|
String profileType = getAppModeDescription(getContext(), selectedMode);
|
||||||
if (selectedMode.isCustomProfile()) {
|
|
||||||
profileType = String.format(getString(R.string.profile_type_descr_string), Algorithms.capitalizeFirstLetterAndLowercase(selectedMode.getParent().toHumanString(getContext())));
|
|
||||||
} else {
|
|
||||||
profileType = getString(R.string.profile_type_base_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
int iconRes = selectedMode.getIconRes();
|
int iconRes = selectedMode.getIconRes();
|
||||||
|
|
||||||
Preference configureProfile = findPreference("configure_profile");
|
Preference configureProfile = findPreference(CONFIGURE_PROFILE);
|
||||||
configureProfile.setIcon(getPaintedIcon(iconRes, getActiveProfileColor()));
|
configureProfile.setIcon(getPaintedIcon(iconRes, getActiveProfileColor()));
|
||||||
configureProfile.setTitle(title);
|
configureProfile.setTitle(title);
|
||||||
configureProfile.setSummary(profileType);
|
configureProfile.setSummary(profileType);
|
||||||
|
|
Loading…
Reference in a new issue