Refactor media overview activity to display documents

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-09-25 08:32:45 -07:00
parent c6b2e785a5
commit 8ce914a344
19 changed files with 504 additions and 155 deletions

View File

@@ -1,24 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
android:layout_height="?android:attr/actionBarSize"
android:background="?attr/media_overview_toolbar_background"
android:titleTextColor="?attr/media_overview_toolbar_foreground"
android:foreground="?attr/media_overview_toolbar_foreground"
app:layout_scrollFlags="scroll|enterAlways"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/media_grid"
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
app:tabBackground="?attr/media_overview_toolbar_background"
app:tabIndicatorColor="@color/textsecure_primary"
app:tabSelectedTextColor="@color/textsecure_primary"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<TextView android:id="@+id/no_images"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="24sp"
android:gravity="center"
android:paddingTop="30dp"
android:visibility="gone"
android:text="@string/media_overview_activity__no_media" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<org.thoughtcrime.securesms.components.DocumentView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/document_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
app:documentForegroundTintColor="?attr/media_overview_document_foreground"
app:documentBackgroundTintColor="?attr/media_overview_document_background"
android:visibility="visible"
tools:visibility="visible"/>
<TextView android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="12sp"
android:textColor="?attr/media_overview_document_foreground"
android:paddingTop="20dp"
tools:text="Jun 1"/>
</LinearLayout>

View File

@@ -3,14 +3,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:background="?attr/media_overview_toolbar_background"
android:padding="16dp">
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:textColor="@color/gray50"
android:textColor="?attr/media_overview_header_foreground"
android:textSize="14sp"
android:textStyle="bold"
android:textAllCaps="true"

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/media_overview_toolbar_background">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
<TextView android:id="@+id/no_documents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="24sp"
android:gravity="center"
android:visibility="gone"
android:text="@string/media_overview_documents_fragment__no_documents_found" />
</RelativeLayout>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/media_overview_toolbar_background">
<android.support.v7.widget.RecyclerView
android:id="@+id/media_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
<TextView android:id="@+id/no_images"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="24sp"
android:gravity="center"
android:paddingTop="30dp"
android:visibility="gone"
android:text="@string/media_overview_activity__no_media" />
</RelativeLayout>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/media_overview_toolbar_background"
android:padding="16dp">
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:textColor="?attr/media_overview_header_foreground"
android:textSize="14sp"
android:textStyle="bold"
android:textAllCaps="true"
tools:text="March 1, 2015" />
</FrameLayout>

View File

@@ -3,6 +3,5 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/save"
android:title="@string/media_overview__save_all"
android:icon="@drawable/ic_save_all_white_24dp"
app:showAsAction="ifRoom"/>
app:showAsAction="never"/>
</menu>

View File

@@ -130,6 +130,12 @@
<attr name="verification_background" format="color"/>
<attr name="media_overview_toolbar_background" format="color"/>
<attr name="media_overview_toolbar_foreground" format="color"/>
<attr name="media_overview_header_foreground" format="color"/>
<attr name="media_overview_document_background" format="color"/>
<attr name="media_overview_document_foreground" format="color"/>
<declare-styleable name="ColorPreference">
<attr name="itemLayout" format="reference" />
<attr name="choices" format="reference" />

View File

@@ -1473,6 +1473,9 @@
<string name="BucketedThreadMedia_Yesterday">Yesterday</string>
<string name="BucketedThreadMedia_This_week">This week</string>
<string name="BucketedThreadMedia_This_month">This month</string>
<string name="MediaOverviewActivity_Media">Media</string>
<string name="MediaOverviewActivity_Documents">Documents</string>
<string name="media_overview_documents_fragment__no_documents_found">No documents found</string>
<!-- EOF -->

View File

@@ -20,6 +20,12 @@
<item name="dialog_background_color">@color/background_material_light</item>
<item name="pref_divider">@drawable/preference_divider_light</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Fix</item>
<item name="media_overview_toolbar_background">@color/white</item>
<item name="media_overview_toolbar_foreground">@color/gray70</item>
<item name="media_overview_header_foreground">@color/gray50</item>
<item name="media_overview_document_foreground">@color/gray70</item>
<item name="media_overview_document_background">@color/white</item>
</style>
<style name="TextSecure.DarkNoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
@@ -38,6 +44,12 @@
<item name="dialog_background_color">@color/background_material_dark</item>
<item name="pref_divider">@drawable/preference_divider_dark</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Fix</item>
<item name="media_overview_toolbar_background">@color/black</item>
<item name="media_overview_toolbar_foreground">@color/white</item>
<item name="media_overview_header_foreground">@color/gray10</item>
<item name="media_overview_document_foreground">@color/white</item>
<item name="media_overview_document_background">@color/black</item>
</style>
<style name="TextSecure.HighlightTheme" parent="@style/TextSecure.LightTheme">