quick action dark mode
This commit is contained in:
parent
0f31e291d8
commit
7fad600bc4
12 changed files with 55 additions and 30 deletions
|
@ -19,7 +19,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="16dp"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="@color/icon_color"
|
||||
android:tint="?attr/primary_icon_color"
|
||||
android:src="@drawable/ic_action_flag_dark" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="@color/icon_color"
|
||||
android:tint="?attr/primary_icon_color"
|
||||
android:src="@drawable/ic_action_fav_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -149,7 +149,7 @@
|
|||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="@color/icon_color"
|
||||
android:tint="?attr/primary_icon_color"
|
||||
android:src="@drawable/ic_action_folder"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="@color/icon_color"
|
||||
android:tint="?attr/primary_icon_color"
|
||||
android:src="@drawable/ic_action_fav_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -149,7 +149,7 @@
|
|||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="@color/icon_color"
|
||||
android:tint="?attr/primary_icon_color"
|
||||
android:src="@drawable/ic_action_folder"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -32,12 +32,14 @@
|
|||
android:contentInsetLeft="72dp"
|
||||
app:contentInsetLeft="72dp"
|
||||
app:contentInsetStart="72dp"
|
||||
android:background="@color/actionbar_light_color"/>
|
||||
android:background="?attr/actionModeBackground"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
android:background="@color/actionbar_light_color">
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="?attr/actionModeBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
|
@ -89,7 +91,7 @@
|
|||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/dashboard_background"
|
||||
android:background="?attr/spinnerListBackground"
|
||||
android:layout_marginBottom="56dp">
|
||||
|
||||
<FrameLayout
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="4dp"
|
||||
android:focusable="false"
|
||||
android:tint="@color/icon_color"
|
||||
android:tint="?attr/secondary_icon_color"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_action_reorder"/>
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="@color/icon_color_light"
|
||||
android:tint="?attr/secondary_icon_color"
|
||||
android:src="@drawable/ic_action_remove_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:id="@+id/custom_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:background="@color/actionbar_light_color"/>
|
||||
android:background="?attr/actionModeBackground"/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
android:layout_marginRight="4dp"
|
||||
android:focusable="false"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="?attr/secondary_icon_color"
|
||||
android:src="@drawable/ic_action_reorder"/>
|
||||
|
||||
<ImageView
|
||||
|
@ -70,6 +71,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="?attr/secondary_icon_color"
|
||||
android:src="@drawable/ic_action_remove_dark"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -442,10 +442,22 @@
|
|||
<item name="android:background">@color/xmas_blue</item>
|
||||
</style>
|
||||
|
||||
<style name="Dialog90" parent="Base.Theme.AppCompat.Light.Dialog">
|
||||
<style name="Dialog90Light" parent="Base.Theme.AppCompat.Light.Dialog">
|
||||
|
||||
<item name="android:windowMinWidthMajor">90%</item>
|
||||
<item name="android:windowMinWidthMinor">90%</item>
|
||||
|
||||
<item name="secondary_icon_color">@color/icon_color_light</item>
|
||||
<item name="primary_icon_color">@color/icon_color</item>
|
||||
</style>
|
||||
|
||||
<style name="Dialog90Dark" parent="Base.Theme.AppCompat.Dialog">
|
||||
|
||||
<item name="android:windowMinWidthMajor">90%</item>
|
||||
<item name="android:windowMinWidthMinor">90%</item>
|
||||
|
||||
<item name="secondary_icon_color">@color/dialog_inactive_text_color_dark</item>
|
||||
<item name="primary_icon_color">@color/color_white</item>
|
||||
</style>
|
||||
|
||||
<style name="WhiteControls" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.widget.Button;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
||||
|
@ -32,7 +33,13 @@ public class AddQuickActionDialog extends DialogFragment {
|
|||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
return new Dialog(new ContextThemeWrapper(getActivity(), R.style.Dialog90), getTheme());
|
||||
|
||||
OsmandApplication application = (OsmandApplication) getActivity().getApplication();
|
||||
boolean light = application.getSettings().isLightContent() && !application.getDaynightHelper().isNightMode();
|
||||
|
||||
return new Dialog(new ContextThemeWrapper(getActivity(), light
|
||||
? R.style.Dialog90Light
|
||||
: R.style.Dialog90Dark), getTheme());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -70,7 +70,13 @@ public class CreateEditActionDialog extends DialogFragment {
|
|||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
Dialog dialog = new Dialog(new ContextThemeWrapper(getActivity(), R.style.OsmandLightTheme), getTheme());
|
||||
OsmandApplication application = (OsmandApplication) getActivity().getApplication();
|
||||
boolean light = application.getSettings().isLightContent() && !application.getDaynightHelper().isNightMode();
|
||||
|
||||
Dialog dialog = new Dialog(new ContextThemeWrapper(getActivity(), light
|
||||
? R.style.Dialog90Light
|
||||
: R.style.Dialog90Dark), getTheme());
|
||||
|
||||
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
dialog.getWindow().setLayout(
|
||||
|
@ -86,7 +92,12 @@ public class CreateEditActionDialog extends DialogFragment {
|
|||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setStyle(DialogFragment.STYLE_NORMAL, R.style.OsmandLightTheme);
|
||||
OsmandApplication application = (OsmandApplication) getActivity().getApplication();
|
||||
boolean light = application.getSettings().isLightContent() && !application.getDaynightHelper().isNightMode();
|
||||
|
||||
setStyle(DialogFragment.STYLE_NORMAL, light
|
||||
? R.style.OsmandLightTheme
|
||||
: R.style.OsmandDarkTheme);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -180,7 +191,7 @@ public class CreateEditActionDialog extends DialogFragment {
|
|||
}
|
||||
});
|
||||
|
||||
name.setEnabled(!action.isSingle() && !action.toggle);
|
||||
name.setEnabled(!action.autogeneratedTitle);
|
||||
action.setAutoGeneratedTitle(name);
|
||||
|
||||
if (savedInstanceState == null) name.setText(action.getName(getContext()));
|
||||
|
|
|
@ -35,8 +35,7 @@ public class QuickAction {
|
|||
protected @StringRes int nameRes;
|
||||
protected @DrawableRes int iconRes;
|
||||
|
||||
protected boolean toggle;
|
||||
protected boolean single;
|
||||
protected boolean autogeneratedTitle;
|
||||
|
||||
private String name;
|
||||
private HashMap<String, String> params;
|
||||
|
@ -62,8 +61,7 @@ public class QuickAction {
|
|||
this.iconRes = quickAction.iconRes;
|
||||
this.name = quickAction.name;
|
||||
this.params = quickAction.params;
|
||||
this.single = quickAction.single;
|
||||
this.toggle = quickAction.toggle;
|
||||
this.autogeneratedTitle = quickAction.autogeneratedTitle;
|
||||
}
|
||||
|
||||
public int getNameRes() {
|
||||
|
@ -82,10 +80,6 @@ public class QuickAction {
|
|||
return name == null || name.isEmpty() ? nameRes > 0 ? context.getString(nameRes) : "" : name;
|
||||
}
|
||||
|
||||
public boolean isSingle() {
|
||||
return single;
|
||||
}
|
||||
|
||||
public HashMap<String, String> getParams() {
|
||||
|
||||
if (params == null) params = new HashMap<>();
|
||||
|
|
|
@ -587,8 +587,7 @@ public class QuickActionFactory {
|
|||
type = TYPE;
|
||||
nameRes = R.string.quick_action_showhide_favorites_title;
|
||||
iconRes = R.drawable.ic_action_fav_dark;
|
||||
single = true;
|
||||
toggle = true;
|
||||
autogeneratedTitle = true;
|
||||
}
|
||||
|
||||
public ShowHideFavoritesAction(QuickAction quickAction) {
|
||||
|
@ -644,7 +643,7 @@ public class QuickActionFactory {
|
|||
type = TYPE;
|
||||
nameRes = R.string.quick_action_showhide_poi_title;
|
||||
iconRes = R.drawable.ic_action_gabout_dark;
|
||||
toggle = true;
|
||||
autogeneratedTitle = true;
|
||||
}
|
||||
|
||||
public ShowHidePoiAction(QuickAction quickAction) {
|
||||
|
@ -1271,8 +1270,7 @@ public class QuickActionFactory {
|
|||
type = TYPE;
|
||||
nameRes = R.string.quick_action_navigation_voice;
|
||||
iconRes = R.drawable.ic_action_volume_up;
|
||||
toggle = true;
|
||||
single = true;
|
||||
autogeneratedTitle = true;
|
||||
}
|
||||
|
||||
public NavigationVoiceAction(QuickAction quickAction) {
|
||||
|
@ -1581,7 +1579,6 @@ public class QuickActionFactory {
|
|||
type = TYPE;
|
||||
nameRes = R.string.quick_action_map_style;
|
||||
iconRes = R.drawable.ic_map;
|
||||
toggle = true;
|
||||
}
|
||||
|
||||
public MapStyleAction(QuickAction quickAction) {
|
||||
|
|
Loading…
Reference in a new issue