Merge branch 'custom-picture-selector' of https://github.com/4D17Y4/apps-android-commons into gsoc21-custom-picture-selector

This commit is contained in:
Nicolas Raoul 2021-06-05 19:58:36 +09:00
commit 3463a19446
15 changed files with 378 additions and 1 deletions

View file

@ -203,7 +203,7 @@ android {
} }
} }
debug { debug {
minifyEnabled true minifyEnabled false
testCoverageEnabled project.hasProperty('coverage') testCoverageEnabled project.hasProperty('coverage')
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
testProguardFile 'test-proguard-rules.txt' testProguardFile 'test-proguard-rules.txt'

View file

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<solid android:color="@color/white" />
</shape>

View file

@ -0,0 +1,62 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="1639.375"
android:viewportHeight="1640">
<group android:translateX="514.6875"
android:translateY="410">
<path
android:pathData="M305,516m-100,0a100,100 0,1 1,200 0a100,100 0,1 1,-200 0"
android:fillColor="#900"/>
<path
android:pathData="m294,696v118h22v-118"
android:fillColor="#069"/>
<path
android:pathData="m262,701l43,-75 43,75"
android:fillColor="#069"/>
<path
android:pathData="m169.943,635.501l-83.439,83.439l15.556,15.556l83.439,-83.439"
android:fillColor="#069"/>
<path
android:pathData="m143.78,616.409l83.439,-22.627 -22.627,83.439"
android:fillColor="#069"/>
<path
android:pathData="m125,505l-118,0l-0,22l118,0"
android:fillColor="#069"/>
<path
android:pathData="m120,473l75,43 -75,43"
android:fillColor="#069"/>
<path
android:pathData="m185.499,380.943l-83.439,-83.439l-15.556,15.556l83.439,83.439"
android:fillColor="#069"/>
<path
android:pathData="m204.591,354.78l22.627,83.439 -83.439,-22.627"
android:fillColor="#069"/>
<path
android:pathData="m424.501,651.057l83.439,83.439l15.556,-15.556l-83.439,-83.439"
android:fillColor="#069"/>
<path
android:pathData="m405.409,677.22l-22.627,-83.439 83.439,22.627"
android:fillColor="#069"/>
<path
android:pathData="m485,527l118,-0l0,-22l-118,-0"
android:fillColor="#069"/>
<path
android:pathData="m490,559l-75,-43 75,-43"
android:fillColor="#069"/>
<path
android:pathData="m440.057,396.499l83.439,-83.439l-15.556,-15.556l-83.439,83.439"
android:fillColor="#069"/>
<path
android:pathData="m466.22,415.591l-83.439,22.627 22.627,-83.439"
android:fillColor="#069"/>
<path
android:pathData="M123.981,334.981A256,256 0,1 0,486.019 334.981C415.309,264.27 308.536,300.332 287.322,144.769"
android:strokeWidth="84"
android:fillColor="#00000000"
android:strokeColor="#069"/>
<path
android:pathData="m282,1s-36,135 -80,185 116,-62 170,-5 -90,-180 -90,-180z"
android:fillColor="#069"/>
</group>
</vector>

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/black"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/black"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
</vector>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_constraintTop_toTopOf="parent">
<include
layout="@layout/custom_selector_toolbar"
android:id="@+id/toolbar"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<include
layout="@layout/fragment_custom_selector"
app:layout_constraintTop_toBottomOf="@+id/toolbar_layout"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/standard_gap"
app:srcCompat="?attr/custom_selector_back" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginHorizontal="@dimen/standard_gap"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/custom_selector_title"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" />
<ImageView
android:id="@+id/done"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/standard_gap"
app:srcCompat="?attr/custom_selector_done"/>
</merge>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/selector_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<TextView
android:id="@+id/empty_text"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="@dimen/normal_text"
android:padding="@dimen/standard_gap"
android:text="@string/custom_selector_empty_text"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<ProgressBar
android:id="@+id/loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="visible"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
app:cardCornerRadius="@dimen/dimen_6"
app:cardElevation="@dimen/dimen_2"
android:id="@+id/view"
app:cardUseCompatPadding="true"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="match_parent">
<ImageView
android:id="@+id/folder_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/album_overlay"
android:alpha="0.05"
/>
<LinearLayout
android:id="@+id/folder_details"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/album_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_margin="@dimen/dimen_6"
android:padding="@dimen/dimen_6"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_weight="1"
android:textSize="16sp"
android:singleLine="true"
android:ellipsize="end"/>
<TextView
android:id="@+id/album_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_margin="5dp"
android:padding="5dp"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="16sp"
/>
</LinearLayout>
<androidx.constraintlayout.widget.Group
android:id="@+id/v_album"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="folder_details,album_overlay"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
app:cardCornerRadius="@dimen/dimen_6"
app:cardElevation="@dimen/dimen_2"
android:id="@+id/view"
app:cardUseCompatPadding="true"
app:layout_constraintDimensionRatio="H,1:1"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<View
android:id="@+id/selected_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.4"
android:background="@color/divider_grey"
/>
<TextView
android:id="@+id/selected_count"
android:layout_width="@dimen/dimen_20"
android:layout_height="@dimen/dimen_20"
app:layout_constraintDimensionRatio="H,1:1"
android:layout_margin="@dimen/dimen_10"
android:gravity="center|center_vertical"
android:includeFontPadding="false"
android:textStyle="bold"
android:textColor="@color/black"
android:background="@drawable/circle_shape"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/selected_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="selected_overlay,selected_count"/>
<View
android:id="@+id/uploaded_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.15"
android:background="@color/black"/>
<ImageView
android:id="@+id/uploaded_overlay_icon"
android:layout_width="@dimen/dimen_140"
android:layout_height="@dimen/dimen_140"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:srcCompat="@drawable/commons"
/>
<androidx.constraintlayout.widget.Group
android:id="@+id/uploaded"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="uploaded_overlay,uploaded_overlay_icon"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -48,6 +48,8 @@
<attr name="contributionsListTextPrimary" format="reference"/> <attr name="contributionsListTextPrimary" format="reference"/>
<attr name="menu_item_tint" format="reference"/> <attr name="menu_item_tint" format="reference"/>
<attr name="search_icon" format="reference"/> <attr name="search_icon" format="reference"/>
<attr name="custom_selector_done" format="reference"/>
<attr name="custom_selector_back" format="reference"/>
<declare-styleable name="Badge"> <declare-styleable name="Badge">
<attr name="boundary" format="color"/> <attr name="boundary" format="color"/>

View file

@ -58,6 +58,7 @@
<!-- Commonly used dimensions --> <!-- Commonly used dimensions -->
<dimen name="dimen_0">0dp</dimen> <dimen name="dimen_0">0dp</dimen>
<dimen name="dimen_2">2dp</dimen>
<dimen name="dimen_6">6dp</dimen> <dimen name="dimen_6">6dp</dimen>
<dimen name="dimen_10">10dp</dimen> <dimen name="dimen_10">10dp</dimen>
<dimen name="dimen_20">20dp</dimen> <dimen name="dimen_20">20dp</dimen>

View file

@ -616,5 +616,7 @@ Upload your first media by tapping on the add button.</string>
<string name="app_ui_language">App user interface language</string> <string name="app_ui_language">App user interface language</string>
<string name="remove">Removes a caption and description</string> <string name="remove">Removes a caption and description</string>
<string name="read_help_link">Read more</string> <string name="read_help_link">Read more</string>
<string name="custom_selector_title">Custom Selector</string>
<string name="custom_selector_empty_text">No Images</string>
</resources> </resources>

View file

@ -54,6 +54,8 @@
<item name="contributionsListTextSecondary">@color/white</item> <item name="contributionsListTextSecondary">@color/white</item>
<item name="menu_item_tint">@color/white</item> <item name="menu_item_tint">@color/white</item>
<item name="search_icon">@drawable/ic_search_white_24dp</item> <item name="search_icon">@drawable/ic_search_white_24dp</item>
<item name="custom_selector_done">@drawable/ic_done_white</item>
<item name="custom_selector_back">@drawable/ic_arrow_back_white</item>
<item name="android:windowEnableSplitTouch">false</item> <item name="android:windowEnableSplitTouch">false</item>
<item name="android:splitMotionEvents">false</item> <item name="android:splitMotionEvents">false</item>
</style> </style>
@ -111,6 +113,8 @@
<item name="contributionsListTextSecondary">@color/disabled_button_text_color_dark</item> <item name="contributionsListTextSecondary">@color/disabled_button_text_color_dark</item>
<item name="menu_item_tint">@color/primaryDarkColor</item> <item name="menu_item_tint">@color/primaryDarkColor</item>
<item name="search_icon">@drawable/ic_search_blue_24dp</item> <item name="search_icon">@drawable/ic_search_blue_24dp</item>
<item name="custom_selector_done">@drawable/ic_done_black</item>
<item name="custom_selector_back">@drawable/ic_arrow_back_black</item>
<item name="android:windowEnableSplitTouch">false</item> <item name="android:windowEnableSplitTouch">false</item>
<item name="android:splitMotionEvents">false</item> <item name="android:splitMotionEvents">false</item>
</style> </style>