Skip to content

Commit

Permalink
prefernces base menu dark mode support. fix basemap menu crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
jclark118 committed Jul 3, 2023
1 parent 05ac3e5 commit d59303c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 39 deletions.
3 changes: 2 additions & 1 deletion mapcache/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@

<activity
android:name=".preferences.PreferencesActivity"
android:label="@string/title_activity_preferences">
android:label="@string/title_activity_preferences"
android:theme="@style/PreferenceStyle">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="mil.nga.mapcache.MainActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import android.widget.Switch;
import android.widget.TextView;

import androidx.appcompat.widget.SwitchCompat;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -102,7 +104,7 @@ public View getGroupView(int i, boolean b, View view, ViewGroup viewGroup) {
serverModel.getLayers().addObserver(this);

ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
Switch simpleSwitch = (Switch) view.findViewById(R.id.simpleSwitch);
SwitchCompat simpleSwitch = (SwitchCompat) view.findViewById(R.id.simpleSwitch);
if (serverModel.getLayers().getLayers() == null) {
progressBar.setVisibility(View.VISIBLE);
simpleSwitch.setVisibility(View.INVISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ public void onCreatePreferences(Bundle bundle, String s) {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.AppTheme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
return super.onCreateView(localInflater, container, savedInstanceState);
return super.onCreateView(inflater, container, savedInstanceState);
}

@Override
Expand Down
34 changes: 0 additions & 34 deletions mapcache/src/main/res/layout/settings_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<!--<FrameLayout-->
<!--android:id="@+id/settingsContainer"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:paddingTop="16dp"-->
<!--android:background="@color/nga_primary_bright">-->

<!--<ImageButton-->
<!--android:id="@+id/closeSettingsButton"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="@android:color/transparent"-->
<!--android:paddingRight="16dp"-->
<!--android:layout_gravity="right"-->
<!--android:src="@drawable/ic_clear_grey_800_24dp" />-->

<!--<LinearLayout-->
<!--android:id="@+id/settingsLayout"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical">-->

<!--&lt;!&ndash;Title&ndash;&gt;-->
<!--<android.support.v7.widget.AppCompatTextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Settings"-->
<!--android:layout_marginBottom="8dp"-->
<!--android:layout_marginLeft="16dp"-->
<!--android:textAppearance="@style/textAppearanceSubtitle1"-->
<!--android:textStyle="bold" />-->
<!--</LinearLayout>-->
<!--</FrameLayout>-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
7 changes: 7 additions & 0 deletions mapcache/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<color name="accent_material_light">#3b779a</color>

<!-- Preferences styles -->
<color name="primaryColor">@color/darkSecondaryBackground</color>
<color name="primaryColorDark">@color/nga_primary_primary_dark</color>
<color name="accentColor">@color/nga_accent_primary</color>
<color name="prefTextSecondaryColor">@color/white50</color>
<color name="titleBackgroundColor">@color/darkSecondaryBackground</color>

<color name="backgroundPrimaryColor">@color/darkPrimaryBackground</color>
<color name="backgroundSecondaryColor">@color/darkSecondaryBackground</color>

Expand Down
1 change: 1 addition & 0 deletions mapcache/src/main/res/values/color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<color name="transparent">#00ffffff</color>
<color name="status_bar">#4E97C2</color>
<color name="status_bar_light">#cce0ec</color>
<color name="status_bar_dark">#4C606C</color>

<color name="light_blue_bg">#B4E2E9EC</color>
<color name="dark_blue_text">#0B1F2C</color>
Expand Down
7 changes: 7 additions & 0 deletions mapcache/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<color name="accent_material_light">#3b779a</color>

<!-- Preferences styles -->
<color name="primaryColor">@color/nga_primary_bright</color>
<color name="primaryColorDark">@color/nga_primary_light</color>
<color name="accentColor">@color/nga_primary_light</color>
<color name="prefTextSecondaryColor">@color/black50</color>
<color name="titleBackgroundColor">@color/nga_primary_bright</color>

<color name="backgroundPrimaryColor">@color/offwhite</color>
<color name="backgroundSecondaryColor">@color/offwhite</color>

Expand Down
10 changes: 10 additions & 0 deletions mapcache/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
<item name="colorPrimary">@color/status_bar_light</item>
</style>

<!-- Preferences menu style -->
<style name="PreferenceStyle" parent="AppBaseTheme">
<item name="colorPrimary">@color/titleBackgroundColor</item>
<item name="android:textColorPrimary">@color/textPrimaryColor</item>
<item name="android:textColorSecondary">@color/prefTextSecondaryColor</item>
<item name="android:windowBackground">@color/backgroundPrimaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
<item name="colorAccent">@color/accentColor</item>
</style>

<!-- Alert dialog for things like create new GeoPackage, or rename/copy -->
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorOnPrimary">@color/textPrimaryColor</item>
Expand Down

0 comments on commit d59303c

Please sign in to comment.