some Optimizations for tablets (#647)

* show ComposeActivity as Dialog on tablets

* limit timeline width on large devices

* limit width on large devices for thread view and search

* increase media preview size on large devices
This commit is contained in:
Konrad Pozniak 2018-05-16 19:14:53 +02:00 committed by GitHub
parent 7e1f5edeca
commit d4572a9d0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 122 additions and 34 deletions

View file

@ -15,7 +15,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:name=".TuskyApplication" android:name=".TuskyApplication"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/TuskyTheme">
<activity <activity
android:name=".SplashActivity" android:name=".SplashActivity"
@ -49,6 +49,7 @@
</activity> </activity>
<activity <activity
android:name=".ComposeActivity" android:name=".ComposeActivity"
android:theme="@style/TuskyDialogActivityTheme"
android:windowSoftInputMode="stateVisible|adjustResize"> android:windowSoftInputMode="stateVisible|adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
@ -68,14 +69,14 @@
</activity> </activity>
<activity <activity
android:name=".ViewVideoActivity" android:name=".ViewVideoActivity"
android:theme="@style/AppThemeBase" android:theme="@style/TuskyBaseTheme"
android:configChanges="orientation|keyboardHidden|screenSize" /> android:configChanges="orientation|keyboardHidden|screenSize" />
<activity <activity
android:name=".ViewThreadActivity" android:name=".ViewThreadActivity"
android:configChanges="orientation|screenSize" /> android:configChanges="orientation|screenSize" />
<activity android:name=".ViewTagActivity" /> <activity android:name=".ViewTagActivity" />
<activity android:name=".ViewMediaActivity" <activity android:name=".ViewMediaActivity"
android:theme="@style/AppThemeBase" /> android:theme="@style/TuskyBaseTheme" />
<activity android:name=".AccountActivity" /> <activity android:name=".AccountActivity" />
<activity android:name=".EditProfileActivity" /> <activity android:name=".EditProfileActivity" />
<activity android:name=".PreferencesActivity" /> <activity android:name=".PreferencesActivity" />

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp" />
<solid android:color="@color/window_background_dark" />
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp" />
<solid android:color="@color/window_background_light" />
</shape>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/tab_page_margin_drawable">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="640dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="?attr/window_background">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/tab_page_margin_drawable">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="640dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="?attr/window_background">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>

View file

@ -25,7 +25,7 @@
<android.support.v4.widget.NestedScrollView <android.support.v4.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="@dimen/compose_activity_scrollview_height"
android:layout_marginBottom="52dp" android:layout_marginBottom="52dp"
android:layout_marginTop="?attr/actionBarSize"> android:layout_marginTop="?attr/actionBarSize">
@ -257,8 +257,8 @@
<ImageButton <ImageButton
android:id="@+id/composeEmojiButton" android:id="@+id/composeEmojiButton"
style="?attr/image_button_style" style="?attr/image_button_style"
android:layout_width="40dp" android:layout_width="36dp"
android:layout_height="40dp" android:layout_height="36dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:contentDescription="@string/action_emoji_keyboard" android:contentDescription="@string/action_emoji_keyboard"
android:padding="4dp" android:padding="4dp"

View file

@ -2,13 +2,21 @@
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/tab_page_margin_drawable">
<FrameLayout
android:layout_width="@dimen/timeline_width"
android:layout_height="match_parent"
android:layout_gravity="center">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/searchRecyclerView" android:id="@+id/searchRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:listitem="@layout/item_account" /> android:layout_gravity="center"
tools:listitem="@layout/item_account"
android:background="?attr/window_background" />
<ProgressBar <ProgressBar
android:id="@+id/searchProgressBar" android:id="@+id/searchProgressBar"
@ -25,5 +33,6 @@
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/search_no_results" android:text="@string/search_no_results"
android:visibility="gone" /> android:visibility="gone" />
</FrameLayout>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View file

@ -0,0 +1,6 @@
<resources>
<dimen name="compose_activity_scrollview_height">400dp</dimen>
<dimen name="status_media_preview_height">160dp</dimen>
<dimen name="status_detail_media_preview_height">180dp</dimen>
</resources>

View file

@ -0,0 +1,12 @@
<resources>
<style name="TuskyDialogActivityTheme" parent="@style/TuskyTheme">
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@drawable/background_dialog_activity</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="android:windowActionModeOverlay">true</item>
</style>
</resources>

View file

@ -1,7 +1,7 @@
<resources> <resources>
<!--Dark Application Theme Styles--> <!--Dark Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase"> <style name="TuskyTheme" parent="TuskyBaseTheme">
<item name="android:windowLightNavigationBar">false</item> <item name="android:windowLightNavigationBar">false</item>
<item name="android:navigationBarColor">@color/window_background_dark</item> <item name="android:navigationBarColor">@color/window_background_dark</item>
<item name="android:navigationBarDividerColor">@color/status_divider_dark</item> <item name="android:navigationBarDividerColor">@color/status_divider_dark</item>

View file

@ -1,7 +1,8 @@
<resources> <resources>
<!--Dark Application Theme Styles--> <!--Dark Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase"/> <style name="TuskyTheme" parent="TuskyBaseTheme"/>
<style name="AppThemeBase" parent="Theme.AppCompat.NoActionBar"> <style name="TuskyDialogActivityTheme" parent="@style/TuskyTheme" />
<style name="TuskyBaseTheme" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/color_primary_dark</item> <item name="colorPrimary">@color/color_primary_dark</item>
<item name="colorPrimaryDark">@color/color_primary_dark_dark</item> <item name="colorPrimaryDark">@color/color_primary_dark_dark</item>
<item name="colorAccent">@color/color_accent_dark</item> <item name="colorAccent">@color/color_accent_dark</item>

View file

@ -1,7 +1,7 @@
<resources> <resources>
<!--Light Application Theme Styles--> <!--Light Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase"> <style name="TuskyTheme" parent="TuskyBaseTheme">
<item name="android:windowLightNavigationBar">true</item> <item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/color_background_light</item> <item name="android:navigationBarColor">@color/color_background_light</item>
<item name="android:navigationBarDividerColor">@color/status_divider_light</item> <item name="android:navigationBarDividerColor">@color/status_divider_light</item>

View file

@ -0,0 +1,3 @@
<resources>
<dimen name="timeline_width">640dp</dimen>
</resources>

View file

@ -31,7 +31,7 @@
<color name="sensitive_media_warning_background_dark">#303030</color> <color name="sensitive_media_warning_background_dark">#303030</color>
<color name="media_preview_unloaded_background_dark">#2F2F2F</color> <color name="media_preview_unloaded_background_dark">#2F2F2F</color>
<color name="status_divider_dark">#2f3441</color> <color name="status_divider_dark">#2f3441</color>
<color name="tab_page_margin_dark">#4C534B</color> <color name="tab_page_margin_dark">#1a1c23</color>
<color name="account_toolbar_icon_collapsed_dark">#FFFFFF</color> <color name="account_toolbar_icon_collapsed_dark">#FFFFFF</color>
<color name="account_header_background_dark">#000000</color> <color name="account_header_background_dark">#000000</color>
<color name="compose_media_button_disabled_dark">#586173</color> <color name="compose_media_button_disabled_dark">#586173</color>
@ -64,7 +64,7 @@
<color name="sensitive_media_warning_background_light">#b0b0b0</color> <color name="sensitive_media_warning_background_light">#b0b0b0</color>
<color name="media_preview_unloaded_background_light">#cfcfcf</color> <color name="media_preview_unloaded_background_light">#cfcfcf</color>
<color name="status_divider_light">#cfcfcf</color> <color name="status_divider_light">#cfcfcf</color>
<color name="tab_page_margin_light">#9F9F9F</color> <color name="tab_page_margin_light">#cfcfcf</color>
<color name="account_toolbar_icon_collapsed_light">#DE000000</color> <color name="account_toolbar_icon_collapsed_light">#DE000000</color>
<color name="account_header_background_light">#EFEFEF</color> <color name="account_header_background_light">#EFEFEF</color>
<color name="compose_media_button_disabled_light">#a3a5ab</color> <color name="compose_media_button_disabled_light">#a3a5ab</color>

View file

@ -20,4 +20,8 @@
<dimen name="compose_activity_snackbar_elevation">16dp</dimen> <dimen name="compose_activity_snackbar_elevation">16dp</dimen>
<dimen name="compose_activity_scrollview_height">-1px</dimen> <!-- match_parent -->
<dimen name="timeline_width">-1px</dimen> <!-- match_parent -->
</resources> </resources>

View file

@ -33,8 +33,9 @@
</style> </style>
<!--Light Application Theme Styles--> <!--Light Application Theme Styles-->
<style name="AppTheme" parent="AppThemeBase"/> <style name="TuskyTheme" parent="TuskyBaseTheme"/>
<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar"> <style name="TuskyDialogActivityTheme" parent="@style/TuskyTheme" />
<style name="TuskyBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/color_primary_light</item> <item name="colorPrimary">@color/color_primary_light</item>
<item name="colorPrimaryDark">@color/color_primary_dark_light</item> <item name="colorPrimaryDark">@color/color_primary_dark_light</item>
<item name="colorAccent">@color/color_accent_light</item> <item name="colorAccent">@color/color_accent_light</item>