Dark mode, styles fix

This commit is contained in:
Daniele Verducci (Slimpenguin) 2022-01-16 10:32:00 +01:00
parent b9980206f5
commit d5b6158364
19 changed files with 101 additions and 35 deletions

View File

@ -5,6 +5,7 @@
<map>
<entry key="../../../../layout/custom_preview.xml" value="0.5661458333333333" />
<entry key="app/src/main/res/drawable/category_listitem_background.xml" value="0.35104166666666664" />
<entry key="app/src/main/res/drawable/coordinates_label_background.xml" value="0.3614583333333333" />
<entry key="app/src/main/res/drawable/floating_semitransparent_button_background.xml" value="0.512962962962963" />
<entry key="app/src/main/res/drawable/ic_map_pin.xml" value="0.6425925925925926" />
<entry key="app/src/main/res/drawable/ic_more.xml" value="0.6166666666666667" />
@ -17,6 +18,7 @@
<entry key="app/src/main/res/layout/activity_main.xml" value="0.5307291666666667" />
<entry key="app/src/main/res/layout/activity_map_picker.xml" value="0.33016304347826086" />
<entry key="app/src/main/res/layout/item_geofav.xml" value="0.5307291666666667" />
<entry key="app/src/main/res/layout/item_navigation.xml" value="0.8" />
<entry key="app/src/main/res/layout/sorting_order_fragment.xml" value="0.4740740740740741" />
<entry key="app/src/main/res/menu/list_context_menu.xml" value="0.41944444444444445" />
</map>

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -80,15 +80,12 @@ public class NavigationAdapter extends RecyclerView.Adapter<NavigationAdapter.Vi
}
private void bind(@NonNull NavigationItem item) {
int color = view.getResources().getColor(R.color.accent);
currentItem = item;
name.setText(item.label);
name.setTextColor(color);
icon.setImageDrawable(DrawableCompat.wrap(icon.getResources().getDrawable(item.icon)));
icon.setColorFilter(color);
icon.setVisibility(View.VISIBLE);
}

View File

@ -35,12 +35,13 @@ import java.util.Locale;
import it.danieleverducci.nextcloudmaps.BuildConfig;
import it.danieleverducci.nextcloudmaps.R;
import it.danieleverducci.nextcloudmaps.activity.NextcloudMapsStyledActivity;
import it.danieleverducci.nextcloudmaps.activity.detail.GeofavoriteDetailActivity;
import it.danieleverducci.nextcloudmaps.databinding.ActivityMapPickerBinding;
import it.danieleverducci.nextcloudmaps.utils.GeoUriParser;
import it.danieleverducci.nextcloudmaps.utils.MapUtils;
public class MapPickerActivity extends AppCompatActivity {
public class MapPickerActivity extends NextcloudMapsStyledActivity {
public static final String TAG = "MapPickerActivity";
private static final int PERMISSION_REQUEST_CODE = 8888;

View File

@ -75,14 +75,15 @@
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_gravity="center_vertical|start"
android:paddingStart="@dimen/spacer_1x"
android:paddingTop="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_1x"
android:paddingBottom="@dimen/spacer_2x"
android:tint="?attr/colorAccent"
android:tint="@color/text_color"
android:src="@drawable/ic_menu_grey"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/search_text"
@ -104,8 +105,11 @@
android:layout_gravity="center_vertical|end"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/list_mode"
android:padding="@dimen/spacer_2x"
android:tint="?attr/colorAccent"
android:paddingStart="@dimen/spacer_1x"
android:paddingTop="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_1x"
android:paddingBottom="@dimen/spacer_2x"
android:tint="@color/text_color"
android:translationX="@dimen/spacer_1x"
android:src="@drawable/ic_alphabetical_asc" />
<androidx.appcompat.widget.AppCompatImageView
@ -115,10 +119,13 @@
android:layout_gravity="center_vertical|end"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/list_mode"
android:padding="@dimen/spacer_2x"
android:tint="?attr/colorAccent"
android:paddingStart="@dimen/spacer_1x"
android:paddingTop="@dimen/spacer_2x"
android:paddingEnd="@dimen/spacer_1x"
android:paddingBottom="@dimen/spacer_2x" android:tint="@color/text_color"
android:translationX="@dimen/spacer_1x"
android:src="@drawable/ic_view_module" />
android:src="@drawable/ic_view_module"
android:visibility="gone"/> <!-- TODO: Replace with Map View icon -->
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -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"/>
<Button
android:id="@+id/chose_button"

View File

@ -42,31 +42,48 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:padding="20dp"
android:orientation="horizontal">
android:padding="10dp"
android:orientation="horizontal"
android:background="@color/defaultBrandAlpha">
<EditText
android:id="@+id/lat_et"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_marginEnd="10dp"
android:textAlignment="center"
android:background="@color/whiteAlpha"
android:lines="1"
android:maxLines="1"
android:inputType="numberDecimal"/>
android:inputType="numberDecimal"
android:textColor="@color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textStyle="bold"
android:text="°N"
android:textColor="@color/white"/>
<EditText
android:id="@+id/lon_et"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:textAlignment="center"
android:background="@color/whiteAlpha"
android:lines="1"
android:maxLines="1"
android:inputType="numberDecimal"/>
android:inputType="numberDecimal"
android:textColor="@color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textStyle="bold"
android:text="°E"
android:textColor="@color/white"/>
<ImageView
android:id="@+id/latlon_confirm_btn"

View File

@ -19,6 +19,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="90dp"
@ -103,7 +104,7 @@
android:layout_weight="0"
android:padding="8dp"
android:src="@drawable/ic_nav"
android:tint="@color/secondary_text_color" /> <!-- TODO: app:tint is not working -->
app:tint="@color/secondary_text_color" /> <!-- TODO: app:tint is not working -->
<ImageView
android:id="@+id/geofav_context_menu_bt"
@ -112,6 +113,6 @@
android:layout_weight="0"
android:padding="8dp"
android:src="@drawable/ic_more"
android:tint="@color/secondary_text_color" /> <!-- TODO: app:tint is not working -->
app:tint="@color/secondary_text_color" /> <!-- TODO: app:tint is not working -->
</LinearLayout>

View File

@ -18,6 +18,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
@ -33,7 +34,8 @@
android:contentDescription="@null"
android:focusable="false"
android:scaleType="center"
android:src="@drawable/ic_time_grey"/>
android:src="@drawable/ic_time_grey"
app:tint="@color/text_color"/>
<TextView
android:id="@+id/navigationItemLabel"

View File

@ -30,8 +30,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/standard_margin"
android:text="@string/sort_by"
android:textColor="@color/defaultBrand"/>
android:text="@string/sort_by"/>
<ScrollView
android:id="@+id/scrollableSortings"
@ -76,7 +75,7 @@
android:singleLine="true"
android:text="@string/menu_item_sort_by_title_a_z"
android:textSize="@dimen/two_line_primary_text_size"
android:textColor="@color/selector_item_unselected"/>
android:textColor="@color/text_color"/>
</TableRow>
@ -206,8 +205,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/common_cancel"
android:textAllCaps="false"
android:layout_marginTop="@dimen/standard_half_margin"
style="@style/Widget.AppCompat.Button.Colored"/>
style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog"/>
</LinearLayout>

View File

@ -67,6 +67,8 @@
<!-- Map picker activity -->
<string name="coordinates_parse_error">Le coordinate dovrebbero essere nel formato xx.xxxxxx</string>
<string name="coordinates_invalid_error">Coordinate non valide</string>
<string name="coordinates_north">°N</string>
<string name="coordinates_east">°E</string>
<!-- About -->
<string name="about_version_title">Versione</string>

View File

@ -2,4 +2,5 @@
<resources>
<color name="text_color">#eee</color>
<color name="disabled">#888</color>
<color name="defaultBackground">#000</color>
</resources>

View File

@ -19,12 +19,12 @@
<resources>
<!-- Generic Colors -->
<color name="primary">#ffffff</color>
<color name="accent">#121212</color>
<color name="transparent">#00000000</color>
<color name="defaultBrand">#0082C9</color>
<color name="defaultBrandAlpha">#550082C9</color>
<color name="disabled">#666</color>
<color name="systemBar">@color/defaultBackground</color>
<color name="defaultBackground">#fff</color>
<!-- List Colors -->
<color name="text_color">#333</color>
@ -36,5 +36,4 @@
<!-- Generic Colors -->
<color name="white">#fff</color>
<color name="whiteAlpha">#cfff</color>
</resources>

View File

@ -66,6 +66,8 @@
<!-- Map picker activity -->
<string name="coordinates_parse_error">Coordinates should be in format xx.xxxxxx</string>
<string name="coordinates_invalid_error">Invalid coordinates</string>
<string name="coordinates_north">°N</string>
<string name="coordinates_east">°E</string>
<!-- About -->
<string name="about_version_title">Version</string>

View File

@ -21,6 +21,11 @@
<item name="colorAccent">@color/defaultBrand</item>
<item name="colorControlNormal">?attr/colorAccent</item>
<item name="windowActionModeOverlay">true</item>
<!-- App bar -->
<item name="colorPrimary">@color/systemBar</item>
<!-- Generic background -->
<item name="android:windowBackground">@color/defaultBackground</item>
</style>
<style name="AppTheme" parent="BaseTheme"/>