Refactor theming (#1529)

* fix toolbars

* use toolbar in MainActivity

* update AccountActivity appbar

* update material design library

* remove unneeded tabs styling

* fix black theme
This commit is contained in:
Konrad Pozniak 2019-10-12 20:00:29 +02:00 committed by GitHub
commit bee10bf375
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 86 additions and 122 deletions

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="false" android:color="?attr/toolbar_icon_tint"/>
<item android:state_selected="true" android:color="?attr/tab_icon_selected_tint"/>
</selector>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_primary_dark_dark" />
<corners android:radius="14dp"/>
<size android:height="100dp" android:width="100dp"/>
</shape>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_background_light" />
<corners android:radius="14dp"/>
<size android:height="100dp" android:width="100dp"/>
</shape>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#ffffff"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z" />
</vector>

View file

@ -17,16 +17,15 @@
android:id="@+id/accountAppBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:colorBackground"
android:elevation="@dimen/actionbar_elevation">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/toolbar_background_color"
app:contentScrim="?attr/colorSurface"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:statusBarScrim="?android:attr/colorBackground"
app:statusBarScrim="?attr/colorSurface"
app:titleEnabled="false">
<ImageView
@ -64,7 +63,6 @@
android:layout_marginTop="6dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="?attr/status_text_medium"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
@ -174,7 +172,6 @@
android:id="@+id/accountNoteTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.1"
android:paddingTop="10dp"
android:textColor="?android:textColorTertiary"
@ -307,7 +304,6 @@
android:textSize="?attr/status_text_medium" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- top margin equal to statusbar size will be set programmatically -->
@ -318,7 +314,9 @@
android:layout_gravity="top"
android:background="@android:color/transparent"
app:layout_collapseMode="pin"
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="scroll|enterAlways" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
<com.google.android.material.tabs.TabLayout
@ -355,11 +353,12 @@
android:layout_width="@dimen/account_activity_avatar_size"
android:layout_height="@dimen/account_activity_avatar_size"
android:layout_marginStart="16dp"
android:background="@drawable/avatar_background"
android:padding="3dp"
app:layout_anchor="@+id/accountHeaderInfoContainer"
app:layout_anchorGravity="top"
app:layout_scrollFlags="scroll"
app:srcCompat="@drawable/avatar_default" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View file

@ -7,49 +7,38 @@
android:layout_height="match_parent"
tools:context="com.keylesspalace.tusky.MainActivity">
<RelativeLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/main_appbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false">
android:layout_height="wrap_content"
android:elevation="@dimen/actionbar_elevation">
<ImageButton
android:id="@+id/drawer_toggle"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="?android:colorBackground"
android:contentDescription="@string/action_open_drawer"
android:elevation="@dimen/actionbar_elevation"
app:srcCompat="@drawable/ic_menu_24dp" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TuskyTabAppearance"
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_toEndOf="@id/drawer_toggle"
android:background="?android:colorBackground"
android:elevation="@dimen/actionbar_elevation"
app:tabGravity="fill"
app:tabIconTint="@color/tab_icon_color"
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabPaddingEnd="1dp"
app:tabPaddingStart="1dp"
app:tabPaddingTop="4dp"
app:tabUnboundedRipple="false" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
<androidx.appcompat.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tab_layout"
android:layout_alignParentBottom="true" />
app:contentInsetStartWithNavigation="0dp">
</RelativeLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TuskyTabAppearance"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:tabGravity="fill"
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabUnboundedRipple="false" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/tab_layout"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floating_btn"

View file

@ -10,26 +10,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="@dimen/actionbar_elevation"
android:stateListAnimator="@null"
app:layout_collapseMode="pin">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/toolbar_background_color"
app:contentInsetStartWithNavigation="0dp"
android:elevation="@dimen/actionbar_elevation"
app:layout_scrollFlags="scroll|snap|enterAlways"
app:navigationIcon="?attr/homeAsUpIndicator" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
style="@style/TuskyTabAppearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/toolbar_background_color"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabTextAppearance="@style/TuskyTabAppearance"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager

View file

@ -12,8 +12,7 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/toolbar_background_color" />
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>

View file

@ -27,8 +27,7 @@
<item name="window_background">@color/window_background_dark</item>
<item name="custom_tab_toolbar">@color/custom_tab_toolbar_dark</item>
<item name="toolbar_background_color">@color/toolbar_background_dark</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_dark</item>
<item name="preference_icon_tint">@color/toolbar_icon_dark</item>
<item name="image_button_style">@style/TuskyImageButton.Dark</item>
<item name="status_reblog_small_drawable">@drawable/ic_reblog_dark_24dp</item>
<item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_dark</item>

View file

@ -12,8 +12,7 @@
<attr name="recents_background_color" format="reference|color" />
<attr name="window_background" format="reference" />
<attr name="custom_tab_toolbar" format="reference" />
<attr name="toolbar_background_color" format="reference" />
<attr name="toolbar_icon_tint" format="reference" />
<attr name="preference_icon_tint" format="reference" />
<attr name="image_button_style" format="reference" />
<attr name="status_reblog_small_drawable" format="reference" />
<attr name="status_reblog_inactive_drawable" format="reference" />

View file

@ -19,7 +19,6 @@
<color name="text_color_primary_dark">#ffffff</color>
<color name="text_color_secondary_dark">#d9e1e8</color>
<color name="text_color_tertiary_dark">#9baec8</color>
<color name="toolbar_background_dark">#4c5368</color>
<color name="toolbar_icon_dark">#d9e1e8</color>
<color name="status_reblog_button_disabled_dark">#444b5d</color>
<color name="status_divider_dark">#2f3441</color>
@ -46,7 +45,6 @@
<color name="text_color_primary_light">#CC000000</color>
<color name="text_color_secondary_light">#3c3c3c</color>
<color name="text_color_tertiary_light">#5f636f</color>
<color name="toolbar_background_light">#f6f7f7</color>
<color name="toolbar_icon_light">#7C000000</color>
<color name="status_reblog_button_disabled_light">#BFBFBF</color>
<color name="sensitive_media_warning_background_light">#b0b0b0</color>

View file

@ -40,6 +40,8 @@
<dimen name="avatar_radius_36dp">4.5dp</dimen> <!-- 1/8 of 36dp -->
<dimen name="avatar_radius_24dp">3dp</dimen> <!-- 1/8 of 24dp -->
<dimen name="min_report_button_width">160dp</dimen>
<dimen name="account_avatar_background_radius">14dp</dimen>
<dimen name="card_radius">5dp</dimen>

View file

@ -63,6 +63,8 @@
<item name="colorPrimaryDark">@color/color_primary_dark_light</item>
<item name="appBarLayoutStyle">@style/Widget.MaterialComponents.AppBarLayout.Surface</item>
<item name="android:colorBackground">@color/color_background_light</item>
<item name="recents_background_color">@color/color_primary_light</item>
<item name="android:windowBackground">@color/window_background_light</item>
@ -77,8 +79,7 @@
<item name="window_background">@color/window_background_light</item>
<item name="custom_tab_toolbar">@color/custom_tab_toolbar_light</item>
<item name="toolbar_background_color">@color/toolbar_background_light</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_light</item>
<item name="preference_icon_tint">@color/toolbar_icon_light</item>
<item name="image_button_style">@style/TuskyImageButton.Light</item>
<item name="status_reblog_small_drawable">@drawable/ic_reblog_light_24dp</item>
<item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_light</item>
@ -156,9 +157,6 @@
<item name="android:textSize">?attr/status_text_medium</item>
<item name="android:textAllCaps">true</item>
<item name="tabIndicatorHeight">3dp</item>
<item name="tabIndicatorColor">?attr/tab_icon_selected_tint</item>
<item name="tabTextColor">?android:attr/textColorSecondary</item>
<item name="tabSelectedTextColor">?attr/tab_icon_selected_tint</item>
</style>
<style name="TuskyButton" parent="Widget.MaterialComponents.Button">
@ -187,9 +185,10 @@
<item name="android:windowBackground">@color/window_background_black</item>
<item name="android:textColorPrimary">@color/text_color_primary_black</item>
<item name="colorSurface">@color/color_primary_black</item>
<item name="recents_background_color">@color/toolbar_background_black</item>
<item name="window_background">@color/window_background_black</item>
<item name="toolbar_background_color">@color/toolbar_background_black</item>
<item name="sensitive_media_warning_background_color">@color/color_background_black</item>
<item name="account_header_background_color">@color/color_background_black</item>