mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Fix 4615: Option for editing caption and description (#4672)
* DescriptionEditHelper implemented * Description extracted * Description editable * No description condition handled * Code cleanup * Added javadocs * toolbar added * API call done * Caption edit available * Progress dialog added * Log * Problem with ButterKnife * Caption is editable * Removed unused import * Manifest file reverted * Manifest file reverted * Manifest file reverted * View binding added * Post operation test added * Java docs added * Java docs added * MediaDetailFragment unit tests added * Test added
This commit is contained in:
parent
e910b1d14f
commit
0269894c64
20 changed files with 855 additions and 14 deletions
80
app/src/main/res/layout/activity_description_edit.xml
Normal file
80
app/src/main/res/layout/activity_description_edit.xml
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".description.DescriptionEditActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/primaryColor"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbar_text_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="72dp"
|
||||
android:text="@string/description_activity_title"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:contentDescription="@string/exit_location_picker"
|
||||
android:tint="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_arrow_back_white" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_descriptions_captions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/edit_bottom_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/edit_bottom_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btn_add_description"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="@dimen/fragment_height"
|
||||
android:text="+" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btn_edit_submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@android:color/white" />
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -204,16 +204,44 @@
|
|||
android:textSize="@dimen/description_text_size"
|
||||
android:textIsSelectable="true"
|
||||
tools:text="Description of the media goes here. This can potentially be fairly long, and will need to wrap across multiple lines. We hope it looks nice though." />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show_caption_description_textview"
|
||||
style="@style/MediaDetailTextLabelGeneric"
|
||||
<LinearLayout
|
||||
android:paddingStart="@dimen/quarter_standard_height"
|
||||
android:paddingEnd="@dimen/quarter_standard_height"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dimen_10"
|
||||
android:text="@string/media_detail_in_all_languages" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show_caption_description_textview"
|
||||
style="@style/MediaDetailTextLabelGeneric"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dimen_10"
|
||||
android:text="@string/media_detail_in_all_languages" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/description_edit"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/ic_baseline_edit_24" />
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBarEdit"
|
||||
style="?android:progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/tiny_gap"
|
||||
android:layout_marginRight="@dimen/tiny_gap"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateOnly="true"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:background="?attr/mediaDetailSpacerColor"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
<string name="signup">Sign up</string>
|
||||
<string name="logging_in_title">Logging in</string>
|
||||
<string name="logging_in_message">Please wait…</string>
|
||||
<string name="updating_caption_title">Updating captions and descriptions</string>
|
||||
<string name="updating_caption_message">Please wait…</string>
|
||||
<string name="login_success">Login success!</string>
|
||||
<string name="login_failed">Login failed!</string>
|
||||
<string name="upload_failed">File not found. Please try another file.</string>
|
||||
|
|
@ -371,7 +373,7 @@
|
|||
<string name="next">Next</string>
|
||||
<string name="previous">Previous</string>
|
||||
<string name="submit">Submit</string>
|
||||
<string formatted="true" name="upload_title_duplicate">A file with the file name %1$s exists. Are you sure you want to proceed?\n\nNote: A suitable suffix will be added to the file name automatically.</string>
|
||||
<string name="upload_title_duplicate" formatted="true">A file with the file name %1$s exists. Are you sure you want to proceed?\n\nNote: A suitable suffix will be added to the file name automatically.</string>
|
||||
<string name="map_application_missing">No compatible map application could be found on your device. Please install a map application to use this feature.</string>
|
||||
<string name="title_page_bookmarks_pictures">Pictures</string>
|
||||
<string name="title_page_bookmarks_locations">Locations</string>
|
||||
|
|
@ -521,10 +523,18 @@ Upload your first media by tapping on the add button.</string>
|
|||
|
||||
<string name="coordinates_edit_helper_make_edit_toast">Trying to update coordinates.</string>
|
||||
<string name="coordinates_edit_helper_show_edit_title">Coordinates update</string>
|
||||
<string name="description_edit_helper_show_edit_title">Description update</string>
|
||||
<string name="caption_edit_helper_show_edit_title">Caption update</string>
|
||||
<string name="coordinates_edit_helper_show_edit_title_success">Success</string>
|
||||
<string name="coordinates_edit_helper_show_edit_message">Coordinates %1$s are added.</string>
|
||||
<string name="description_edit_helper_show_edit_message">Descriptions are added.</string>
|
||||
<string name="caption_edit_helper_show_edit_message">Caption is added.</string>
|
||||
<string name="coordinates_edit_helper_edit_message_else">Could not add coordinates.</string>
|
||||
<string name="description_edit_helper_edit_message_else">Could not add descriptions.</string>
|
||||
<string name="caption_edit_helper_edit_message_else">Could not add caption.</string>
|
||||
<string name="coordinates_picking_unsuccessful">Unable to get coordinates.</string>
|
||||
<string name="descriptions_picking_unsuccessful">Unable to get descriptions.</string>
|
||||
<string name="description_activity_title">Edit descriptions and captions</string>
|
||||
|
||||
<string name="share_image_via">Share image via</string>
|
||||
<string name="you_have_no_achievements_yet">You haven\'t made any contributions yet</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue