From d5b61583641c7b36a753506bb57adebc2b62379c Mon Sep 17 00:00:00 2001 From: "Daniele Verducci (Slimpenguin)" Date: Sun, 16 Jan 2022 10:32:00 +0100 Subject: [PATCH] Dark mode, styles fix --- .idea/misc.xml | 2 ++ .../activity/NextcloudMapsStyledActivity.java | 26 ++++++++++++++++ .../activity/about/AboutActivity.java | 3 +- .../detail/GeofavoriteDetailActivity.java | 3 +- .../activity/login/LoginActivity.java | 3 +- .../activity/main/MainActivity.java | 4 ++- .../activity/main/NavigationAdapter.java | 3 -- .../activity/mappicker/MapPickerActivity.java | 3 +- .../main/res/layout/activity_list_view.xml | 23 +++++++++----- app/src/main/res/layout/activity_login.xml | 3 +- .../main/res/layout/activity_map_picker.xml | 31 ++++++++++++++----- app/src/main/res/layout/item_geofav.xml | 5 +-- app/src/main/res/layout/item_navigation.xml | 4 ++- .../res/layout/sorting_order_fragment.xml | 8 ++--- app/src/main/res/values-it/strings.xml | 2 ++ app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values/colors.xml | 5 ++- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/values/styles.xml | 5 +++ 19 files changed, 101 insertions(+), 35 deletions(-) create mode 100644 app/src/main/java/it/danieleverducci/nextcloudmaps/activity/NextcloudMapsStyledActivity.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 2b5ef9f..ab4aa6d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,6 +5,7 @@ + @@ -17,6 +18,7 @@ + diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/NextcloudMapsStyledActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/NextcloudMapsStyledActivity.java new file mode 100644 index 0000000..f5b6a0a --- /dev/null +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/NextcloudMapsStyledActivity.java @@ -0,0 +1,26 @@ +package it.danieleverducci.nextcloudmaps.activity; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import org.osmdroid.views.overlay.TilesOverlay; + +public class NextcloudMapsStyledActivity extends AppCompatActivity { + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // For whatever reason, android:windowLightStatusBar is ignored in styles.xml + int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); + } + +} + + diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/about/AboutActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/about/AboutActivity.java index 8315073..e157b74 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/about/AboutActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/about/AboutActivity.java @@ -30,8 +30,9 @@ import androidx.appcompat.widget.Toolbar; import it.danieleverducci.nextcloudmaps.BuildConfig; import it.danieleverducci.nextcloudmaps.R; +import it.danieleverducci.nextcloudmaps.activity.NextcloudMapsStyledActivity; -public class AboutActivity extends AppCompatActivity { +public class AboutActivity extends NextcloudMapsStyledActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java index 3dc86dd..9d78b3a 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java @@ -53,6 +53,7 @@ import java.util.HashSet; import it.danieleverducci.nextcloudmaps.BuildConfig; import it.danieleverducci.nextcloudmaps.R; +import it.danieleverducci.nextcloudmaps.activity.NextcloudMapsStyledActivity; import it.danieleverducci.nextcloudmaps.activity.mappicker.MapPickerActivity; import it.danieleverducci.nextcloudmaps.databinding.ActivityGeofavoriteDetailBinding; import it.danieleverducci.nextcloudmaps.model.Geofavorite; @@ -60,7 +61,7 @@ import it.danieleverducci.nextcloudmaps.utils.GeoUriParser; import it.danieleverducci.nextcloudmaps.utils.IntentGenerator; import it.danieleverducci.nextcloudmaps.utils.MapUtils; -public class GeofavoriteDetailActivity extends AppCompatActivity implements LocationListener, ActivityCompat.OnRequestPermissionsResultCallback { +public class GeofavoriteDetailActivity extends NextcloudMapsStyledActivity implements LocationListener, ActivityCompat.OnRequestPermissionsResultCallback { public static final String TAG = "GeofavDetail"; public static final int MINIMUM_ACCEPTABLE_ACCURACY = 50; // In meters diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/login/LoginActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/login/LoginActivity.java index a300af0..571dc48 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/login/LoginActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/login/LoginActivity.java @@ -39,10 +39,11 @@ import com.nextcloud.android.sso.model.SingleSignOnAccount; import com.nextcloud.android.sso.ui.UiExceptionManager; import it.danieleverducci.nextcloudmaps.R; +import it.danieleverducci.nextcloudmaps.activity.NextcloudMapsStyledActivity; import it.danieleverducci.nextcloudmaps.activity.main.MainActivity; import it.danieleverducci.nextcloudmaps.api.ApiProvider; -public class LoginActivity extends AppCompatActivity { +public class LoginActivity extends NextcloudMapsStyledActivity { protected ApiProvider mApi; protected ProgressBar progress; diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java index 76691e7..3f786e2 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/MainActivity.java @@ -51,6 +51,7 @@ import java.util.ArrayList; import java.util.List; import it.danieleverducci.nextcloudmaps.R; +import it.danieleverducci.nextcloudmaps.activity.NextcloudMapsStyledActivity; import it.danieleverducci.nextcloudmaps.activity.about.AboutActivity; import it.danieleverducci.nextcloudmaps.activity.detail.GeofavoriteDetailActivity; import it.danieleverducci.nextcloudmaps.activity.login.LoginActivity; @@ -68,7 +69,7 @@ import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter. import static it.danieleverducci.nextcloudmaps.activity.main.GeofavoriteAdapter.SORT_BY_TITLE; import androidx.lifecycle.Observer; -public class MainActivity extends AppCompatActivity implements OnSortingOrderListener { +public class MainActivity extends NextcloudMapsStyledActivity implements OnSortingOrderListener { private static final String TAG = "MainActivity"; @@ -98,6 +99,7 @@ public class MainActivity extends AppCompatActivity implements OnSortingOrderLis @Override protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/NavigationAdapter.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/NavigationAdapter.java index 54d744f..040fd84 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/NavigationAdapter.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/main/NavigationAdapter.java @@ -80,15 +80,12 @@ public class NavigationAdapter extends RecyclerView.Adapter + android:src="@drawable/ic_view_module" + android:visibility="gone"/> diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index e74d47a..551825b 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -46,8 +46,7 @@ android:layout_centerVertical="true" android:layout_marginBottom="48dp" android:textSize="24sp" - android:gravity="center_horizontal" - android:textColor="@color/accent"/> + android:gravity="center_horizontal"/>