Merge branch 'typography' into 'develop'

Use material typography, cleanup themes

See merge request ultrasonic/ultrasonic!816
This commit is contained in:
Nite 2022-09-18 08:12:37 +00:00
commit 6addee8068
14 changed files with 115 additions and 142 deletions

View File

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 7.2.2" type="baseline" client="gradle" dependencies="false" name="AGP (7.2.2)" variant="all" version="7.2.2">
<issue
id="InflateParams"
message="Avoid passing `null` as the view root (needed to resolve layout parameters on the inflated layout&apos;s root element)"
errorLine1=" val view = inflater.inflate(R.layout.jukebox_volume, null)"
errorLine2=" ~~~~">
<location
file="src/main/kotlin/org/moire/ultrasonic/service/JukeboxMediaPlayer.kt"
line="331"
column="66"/>
</issue>
<issue
id="PluralsCandidate"
message="Formatting %d followed by words (&quot;tracks&quot;): This should probably be a plural rather than a string"
@ -55,7 +44,7 @@
errorLine2=" ~~~~~~~~">
<location
file="src/main/AndroidManifest.xml"
line="155"
line="164"
column="10"/>
</issue>
@ -66,7 +55,7 @@
errorLine2=" ~~~~~~~~">
<location
file="src/main/AndroidManifest.xml"
line="160"
line="169"
column="10"/>
</issue>
@ -77,7 +66,7 @@
errorLine2=" ~~~~~~~~">
<location
file="src/main/AndroidManifest.xml"
line="79"
line="88"
column="10"/>
</issue>
@ -88,7 +77,7 @@
errorLine2=" ~~~~~~~">
<location
file="src/main/AndroidManifest.xml"
line="68"
line="77"
column="10"/>
</issue>
@ -116,7 +105,7 @@
<issue
id="Overdraw"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/NoActionBar`)"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/Theme.Material3.DynamicColors.Dark`)"
errorLine1=" a:background=&quot;@drawable/appwidget_dark_bg_trans&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@ -127,7 +116,7 @@
<issue
id="Overdraw"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/NoActionBar`)"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/Theme.Material3.DynamicColors.Dark`)"
errorLine1=" a:background=&quot;@drawable/appwidget_dark_bg_trans&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@ -138,7 +127,7 @@
<issue
id="Overdraw"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/NoActionBar`)"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/Theme.Material3.DynamicColors.Dark`)"
errorLine1=" a:background=&quot;@drawable/appwidget_dark_bg_trans&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@ -149,7 +138,7 @@
<issue
id="Overdraw"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/NoActionBar`)"
message="Possible overdraw: Root element paints background `@drawable/appwidget_dark_bg_trans` with a theme that also paints a background (inferred theme is `@style/Theme.Material3.DynamicColors.Dark`)"
errorLine1=" a:background=&quot;@drawable/appwidget_dark_bg_trans&quot; >"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location

View File

@ -25,7 +25,7 @@
android:dataExtractionRules="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/NoActionBar"
android:theme="@style/Theme.Material3.DynamicColors.Dark"
android:name=".app.UApp"
android:label="@string/common.appname"
android:usesCleartextTraffic="true"
@ -53,6 +53,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<nav-graph android:value="@navigation/navigation_graph" />
<meta-data android:name="android.app.default_searchable"
android:value=".SearchableActivity" />
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable"/>

View File

@ -43,16 +43,6 @@ object Utils {
lateinit var playingImage: Drawable
var theme: String
fun rebuild(context: Context, force: Boolean = false) {
val currentTheme = Settings.theme
val themesMatch = theme == currentTheme
if (!themesMatch) theme = currentTheme
if (!themesMatch || force) {
getDrawables(context)
}
}
init {
theme = Settings.theme
getDrawables(context)

View File

@ -2,7 +2,8 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="#FFF"
android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/>

View File

@ -9,12 +9,11 @@
a:text="@string/search.artists"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:textAppearance="?android:attr/textAppearanceSmall"
a:textColor="#EFEFEF"
a:textStyle="bold"
a:background="#ff555555"
a:gravity="center_vertical"
a:paddingStart="4dp"/>
a:paddingStart="6dp"
a:textAllCaps="true"
a:textAppearance="?android:attr/textAppearanceSmall"
a:textColor="?attr/colorPrimary"
a:textStyle="bold" />
</LinearLayout>

View File

@ -45,7 +45,6 @@
a:layout_gravity="start"
a:fitsSystemWindows="true"
a:background="?attr/color_menu_background"
a:theme="@style/ThemeOverlay.AppCompat.navTheme"
app:headerLayout="@layout/navigation_header"
app:menu="@menu/navigation" />
</androidx.drawerlayout.widget.DrawerLayout>

View File

@ -32,8 +32,8 @@
android:layout_gravity="start"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
/>
<TextView
android:id="@+id/now_playing_artist"
@ -43,7 +43,7 @@
android:ellipsize="end"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />
</LinearLayout>
<Button
@ -60,6 +60,6 @@
android:scaleType="fitCenter"
app:icon="@drawable/media_pause_normal"
app:iconGravity="textTop"
app:iconSize="38dp" />
app:iconSize="42dp" />
</LinearLayout>

View File

@ -1,102 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:a="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
a:id="@+id/download_button_bar_flipper"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:layout_marginTop="10dp"
a:layout_marginStart="12dp"
a:layout_marginEnd="12dp" >
a:layout_marginTop="10dp"
a:layout_marginEnd="12dp">
<LinearLayout
<TextView
a:id="@+id/current_playing_song"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_alignParentLeft="true"
a:orientation="vertical">
a:ellipsize="marquee"
a:gravity="left"
a:paddingRight="30dip"
a:singleLine="true"
a:textAppearance="@style/TextAppearance.Material3.TitleLarge"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Title" />
<TextView
a:id="@+id/current_playing_song"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_marginEnd="10dip"
a:ellipsize="marquee"
a:gravity="left"
a:paddingRight="30dip"
a:singleLine="true"
a:textAppearance="?android:attr/textAppearanceLarge"
a:textStyle="bold"
tools:text="Title" />
<TextView
a:id="@+id/current_playing_artist"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="marquee"
a:gravity="left"
a:singleLine="true"
a:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Artist" />
<TextView
a:id="@+id/current_playing_album"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:singleLine="true"
a:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Album" />
<TextView
a:id="@+id/current_playing_genre"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:singleLine="true"
a:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Genre" />
</LinearLayout>
<LinearLayout
<TextView
a:id="@+id/current_playing_artist"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:layout_alignParentRight="true"
a:layout_centerVertical="true"
a:ellipsize="marquee"
a:gravity="left"
a:singleLine="true"
a:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/current_playing_song"
tools:text="Artist" />
<TextView
a:id="@+id/current_playing_album"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:orientation="vertical"
tools:ignore="RelativeOverlap">
a:singleLine="true"
a:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="@+id/current_playing_artist"
app:layout_constraintTop_toBottomOf="@+id/current_playing_artist"
tools:text="Album" />
<TextView
a:id="@+id/current_playing_track"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:text="0 / 0"
a:textAppearance="?android:attr/textAppearanceSmall"
tools:ignore="HardcodedText" />
<TextView
a:id="@+id/current_playing_genre"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:singleLine="true"
a:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="@+id/current_playing_album"
app:layout_constraintTop_toBottomOf="@+id/current_playing_album"
tools:text="Genre" />
<TextView
a:id="@+id/current_total_duration"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:text="@string/util.no_time"
a:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
a:id="@+id/current_playing_bitrate_format"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:singleLine="true"
a:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Details" />
<TextView
a:id="@+id/current_playing_track"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:text="0 / 0"
a:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/current_playing_song"
tools:ignore="HardcodedText" />
</LinearLayout>
<TextView
a:id="@+id/current_total_duration"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:text="@string/util.no_time"
a:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/current_playing_track" />
</RelativeLayout>
<TextView
a:id="@+id/current_playing_bitrate_format"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:ellipsize="start"
a:gravity="right"
a:singleLine="true"
a:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/current_total_duration"
tools:text="Details" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -18,7 +18,7 @@
<item
a:id="@+id/searchFragment"
a:checkable="true"
a:icon="@drawable/ic_menu_search_holo"
a:icon="@drawable/ic_menu_search"
a:title="@string/button_bar.search" />
<item
a:id="@+id/playlistsFragment"

View File

@ -3,7 +3,7 @@
xmlns:a="http://schemas.android.com/apk/res/android">
<item a:id="@+id/search_item"
a:title="@string/search.label"
a:icon="@drawable/ic_menu_search_holo"
a:icon="@drawable/ic_menu_search"
app:showAsAction="always"
app:actionViewClass="androidx.appcompat.widget.SearchView" />
</menu>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Do not forget to match string ressources with constants
Do not forget to match string resources with constants
-->
<string translatable="false" name="preferences_key_theme_light">light</string>
<string translatable="false" name="preferences_key_theme_dark">dark</string>

View File

@ -1,10 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="NoActionBar" parent="@style/Theme.MaterialComponents">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="MenuDrawer"/>
<style name="MenuDrawer.Widget"/>
@ -30,11 +25,6 @@
<item name="cornerSize">2dp</item>
</style>
<style name="ThemeOverlay.AppCompat.navTheme">
<item name="colorPrimary">?attr/color_menu_selected</item>
<item name="colorControlHighlight">?attr/color_selected</item>
</style>
<attr name="color_background" format="reference"/>
<attr name="color_selected" format="reference"/>
<attr name="color_menu_background" format="reference"/>

View File

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CleanSearchStyle" parent="Widget.AppCompat.SearchView">
<item name="queryBackground">@null</item>
<item name="submitBackground">@null</item>
</style>
<style name="UltrasonicTheme.Black" parent="Theme.Material3.Dark">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimaryDark">?attr/backgroundColor</item>
<item name="android:colorBackground">@color/background_color_black</item>
@ -10,10 +15,10 @@
<item name="color_menu_background">?attr/colorSurface</item>
<item name="color_menu_selected">?attr/colorOnSurface</item>
<item name="colorControlNormal">?attr/colorOnSurface</item>
<item name="searchViewStyle">@style/CleanSearchStyle</item>
</style>
<style name="UltrasonicTheme.Dark" parent="Theme.Material3.DynamicColors.Dark">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimaryDark">?attr/backgroundColor</item>
<item name="color_background">?attr/colorSurface</item>
@ -21,15 +26,16 @@
<item name="color_menu_background">?attr/colorSurface</item>
<item name="color_menu_selected">?attr/colorOnSurface</item>
<item name="colorControlNormal">?attr/colorOnSurface</item>
<item name="searchViewStyle">@style/CleanSearchStyle</item>
</style>
<style name="UltrasonicTheme.Light" parent="Theme.Material3.DynamicColors.Light">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="color_background">?attr/colorSurface</item>
<item name="color_selected">?attr/colorPrimaryContainer</item>
<item name="color_menu_background">?attr/colorSurface</item>
<item name="color_menu_selected">?attr/colorOnSurface</item>
<item name="colorControlNormal">?attr/colorOnSurface</item>
<item name="searchViewStyle">@style/CleanSearchStyle</item>
</style>
</resources>