Fixes on Edit button, there is + sign overlayed over letter E #5388 (#5464)

* Fixed Grey empty screen at Upload wizard caption step after denying files permission

* Empty commit

* Fixed loop issue

* Created docs for earlier commits

* Fixed javadoc

* Fixed spaces

* Added added basic features to OSM Maps

* Added search location feature

* Added filter to Open Street Maps

* Fixed chipGroup in Open Street Maps

* Removed mapBox code

* Removed mapBox's code

* Reformat code

* Reformatted code

* Removed rotation feature to map

* Removed rotation files and Fixed Marker click problem

* Ignored failing tests

* Added voice input feature

* Fixed test cases

* Changed caption and description text

* Replaced mapbox to osmdroid in upload activity

* Fixed Unit Tests

* Made selected marker to be fixed on map

* Changed color of map marker

* Fixes #5439 by capitalizing first letter of voice input

* Made UI changes in UploadMediaDetailAdapter

* Added javadoc

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
Kanahia 2024-01-23 19:33:38 +05:30 committed by GitHub
parent ab3540312a
commit 3d0e65c92c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 263 additions and 112 deletions

View file

@ -73,7 +73,6 @@ class DescriptionEditActivity : BaseActivity(), UploadMediaDetailAdapter.EventLi
savedLanguageValue = bundle.getString(Prefs.DESCRIPTION_LANGUAGE)!!
initRecyclerView(descriptionAndCaptions)
binding.btnAddDescription.setOnClickListener(::onButtonAddDescriptionClicked)
binding.btnEditSubmit.setOnClickListener(::onSubmitButtonClicked)
binding.toolbarBackButton.setOnClickListener(::onBackButtonClicked)
}
@ -112,17 +111,20 @@ class DescriptionEditActivity : BaseActivity(), UploadMediaDetailAdapter.EventLi
override fun onPrimaryCaptionTextChange(isNotEmpty: Boolean) {}
private fun onBackButtonClicked(view: View) {
onBackPressed()
}
private fun onButtonAddDescriptionClicked(view: View) {
/**
* Adds new language item to RecyclerView
*/
override fun addLanguage() {
val uploadMediaDetail = UploadMediaDetail()
uploadMediaDetail.isManuallyAdded = true //This was manually added by the user
uploadMediaDetailAdapter.addDescription(uploadMediaDetail)
rvDescriptions!!.smoothScrollToPosition(uploadMediaDetailAdapter.itemCount - 1)
}
private fun onBackButtonClicked(view: View) {
onBackPressed()
}
private fun onSubmitButtonClicked(view: View) {
showLoggingProgressBar()
val uploadMediaDetails = uploadMediaDetailAdapter.items

View file

@ -15,12 +15,14 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
@ -190,6 +192,7 @@ public class UploadMediaDetailAdapter extends
}
notifyItemRemoved(position);
notifyItemRangeChanged(position, uploadMediaDetails.size() - position);
updateAddButtonVisibility();
}
public class ViewHolder extends RecyclerView.ViewHolder {
@ -213,6 +216,12 @@ public class UploadMediaDetailAdapter extends
@BindView(R.id.btn_remove)
ImageView removeButton;
@BindView(R.id.btn_add)
ImageView addButton;
@BindView(R.id.cl_parent)
ConstraintLayout clParent;
@BindView(R.id.ll_write_better_caption)
LinearLayout betterCaptionLinearLayout;
@ -292,6 +301,17 @@ public class UploadMediaDetailAdapter extends
descItemEditText.addTextChangedListener(descriptionListener);
initLanguage(position, uploadMediaDetail);
if (fragment != null) {
FrameLayout.LayoutParams newLayoutParams = (FrameLayout.LayoutParams) clParent.getLayoutParams();
newLayoutParams.topMargin = 0;
newLayoutParams.leftMargin = 0;
newLayoutParams.rightMargin = 0;
newLayoutParams.bottomMargin = 0;
clParent.setLayoutParams(newLayoutParams);
}
updateAddButtonVisibility();
addButton.setOnClickListener(v -> eventListener.addLanguage());
//If the description was manually added by the user, it deserves focus, if not, let the user decide
if (uploadMediaDetail.isManuallyAdded()) {
captionItemEditText.requestFocus();
@ -557,6 +577,55 @@ public class UploadMediaDetailAdapter extends
}
/**
* Hides the visibility of the "Add" button for all items in the RecyclerView except
* the last item in RecyclerView
*/
private void updateAddButtonVisibility() {
int lastItemPosition = getItemCount() - 1;
// Hide Add Button for all items
for (int i = 0; i < getItemCount(); i++) {
if (fragment != null) {
if (fragment.getView() != null) {
ViewHolder holder = (ViewHolder) ((RecyclerView) fragment.getView()
.findViewById(R.id.rv_descriptions)).findViewHolderForAdapterPosition(i);
if (holder != null) {
holder.addButton.setVisibility(View.GONE);
}
}
} else {
if (this.activity != null) {
ViewHolder holder = (ViewHolder) ((RecyclerView) activity.findViewById(
R.id.rv_descriptions_captions)).findViewHolderForAdapterPosition(i);
if (holder != null) {
holder.addButton.setVisibility(View.GONE);
}
}
}
}
// Show Add Button for the last item
if (fragment != null) {
if (fragment.getView() != null) {
ViewHolder lastItemHolder = (ViewHolder) ((RecyclerView) fragment.getView()
.findViewById(R.id.rv_descriptions)).findViewHolderForAdapterPosition(
lastItemPosition);
if (lastItemHolder != null) {
lastItemHolder.addButton.setVisibility(View.VISIBLE);
}
}
} else {
if (this.activity != null) {
ViewHolder lastItemHolder = (ViewHolder) ((RecyclerView) activity
.findViewById(R.id.rv_descriptions_captions)).findViewHolderForAdapterPosition(
lastItemPosition);
if (lastItemHolder != null) {
lastItemHolder.addButton.setVisibility(View.VISIBLE);
}
}
}
}
public interface Callback {
void showAlert(int mediaDetailDescription, int descriptionInfo);
@ -565,6 +634,8 @@ public class UploadMediaDetailAdapter extends
public interface EventListener {
void onPrimaryCaptionTextChange(boolean isNotEmpty);
void addLanguage();
}
enum SelectedVoiceIcon {

View file

@ -76,8 +76,12 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
public static final String LAST_ZOOM = "last_zoom_level_while_uploading";
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.ib_map)
AppCompatImageButton ibMap;
@BindView(R.id.location_image_view)
ImageView locationImageView;
@BindView(R.id.location_text_view)
TextView locationTextView;
@BindView(R.id.ll_location_status)
LinearLayout llLocationStatus;
@BindView(R.id.ib_expand_collapse)
AppCompatImageButton ibExpandCollapse;
@BindView(R.id.ll_container_media_detail)
@ -90,8 +94,8 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
AppCompatButton btnNext;
@BindView(R.id.btn_previous)
AppCompatButton btnPrevious;
@BindView(R.id.edit_image)
AppCompatButton editImage;
@BindView(R.id.ll_edit_image)
LinearLayout llEditImage;
@BindView(R.id.tooltip)
ImageView tooltip;
@ -195,13 +199,15 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
// If the image EXIF data contains the location, show the map icon with a green tick
if (inAppPictureLocation != null ||
(uploadableFile != null && uploadableFile.hasLocation())) {
Drawable mapTick = getResources().getDrawable(R.drawable.ic_map_tick_white_24dp);
ibMap.setImageDrawable(mapTick);
Drawable mapTick = getResources().getDrawable(R.drawable.ic_map_available_20dp);
locationImageView.setImageDrawable(mapTick);
locationTextView.setText(R.string.edit_location);
} else {
// Otherwise, show the map icon with a red question mark
Drawable mapQuestionMark =
getResources().getDrawable(R.drawable.ic_map_question_white_24dp);
ibMap.setImageDrawable(mapQuestionMark);
getResources().getDrawable(R.drawable.ic_map_not_available_20dp);
locationImageView.setImageDrawable(mapQuestionMark);
locationTextView.setText(R.string.add_location);
}
//If this is the last media, we have nothing to copy, lets not show the button
@ -269,15 +275,7 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
callback.onPreviousButtonClicked(callback.getIndexInViewFlipper(this));
}
@OnClick(R.id.btn_add_description)
public void onButtonAddDescriptionClicked() {
UploadMediaDetail uploadMediaDetail = new UploadMediaDetail();
uploadMediaDetail.setManuallyAdded(true);//This was manually added by the user
uploadMediaDetailAdapter.addDescription(uploadMediaDetail);
rvDescriptions.smoothScrollToPosition(uploadMediaDetailAdapter.getItemCount()-1);
}
@OnClick(R.id.edit_image)
@OnClick(R.id.ll_edit_image)
public void onEditButtonClicked() {
presenter.onEditButtonClicked(callback.getIndexInViewFlipper(this));
}
@ -619,8 +617,9 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
editableUploadItem.getGpsCoords().setZoomLevel(zoom);
// Replace the map icon using the one with a green tick
Drawable mapTick = getResources().getDrawable(R.drawable.ic_map_tick_white_24dp);
ibMap.setImageDrawable(mapTick);
Drawable mapTick = getResources().getDrawable(R.drawable.ic_map_available_20dp);
locationImageView.setImageDrawable(mapTick);
locationTextView.setText(R.string.edit_location);
Toast.makeText(getContext(), "Location Updated", Toast.LENGTH_LONG).show();
@ -682,8 +681,8 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
presenter.onDetachView();
}
@OnClick(R.id.rl_container_title)
public void onRlContainerTitleClicked() {
@OnClick(R.id.ll_container_title)
public void onLlContainerTitleClicked() {
expandCollapseLlMediaDetail(!isExpanded);
}
@ -697,7 +696,7 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
ibExpandCollapse.setRotation(ibExpandCollapse.getRotation() + 180);
}
@OnClick(R.id.ib_map) public void onIbMapClicked() {
@OnClick(R.id.ll_location_status) public void onIbMapClicked() {
presenter.onMapIconClicked(callback.getIndexInViewFlipper(this));
}
@ -711,6 +710,17 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
btnNext.setAlpha(isNotEmpty ? 1.0f : 0.5f);
}
/**
* Adds new language item to RecyclerView
*/
@Override
public void addLanguage() {
UploadMediaDetail uploadMediaDetail = new UploadMediaDetail();
uploadMediaDetail.setManuallyAdded(true);//This was manually added by the user
uploadMediaDetailAdapter.addDescription(uploadMediaDetail);
rvDescriptions.smoothScrollToPosition(uploadMediaDetailAdapter.getItemCount()-1);
}
public interface UploadMediaDetailFragmentCallback extends Callback {
void deletePictureAtIndex(int index);

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector android:height="24dp" android:tint="?attr/editTextColor"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#8F000000" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

View file

@ -0,0 +1,4 @@
<vector android:height="16dp" android:viewportHeight="28"
android:viewportWidth="28" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#2D8BA4" android:pathData="M14,0L11.533,2.467L21.298,12.25H0V15.75H21.298L11.533,25.532L14,28L28,14L14,0Z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#2D8BA4"
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="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="20dp" android:viewportHeight="35"
android:viewportWidth="40" android:width="22.857143dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#2D8BA4" android:pathData="M12,0C5.374,0 0,5.374 0,12C0,21 12,34.286 12,34.286C12,34.286 24,21 24,12C24,5.374 18.626,0 12,0ZM12,16.286C9.634,16.286 7.714,14.366 7.714,12C7.714,9.634 9.634,7.714 12,7.714C14.366,7.714 16.286,9.634 16.286,12C16.286,14.366 14.366,16.286 12,16.286Z"/>
<path android:fillColor="#0CC18B" android:pathData="M27.111,33.579C26.879,33.809 26.551,34 26.261,34C25.972,34 25.644,33.799 25.403,33.569L20,28.212L21.717,26.51L26.271,31.025L38.312,19L40,20.732L27.111,33.579Z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="20dp" android:viewportHeight="35"
android:viewportWidth="33" android:width="18.857143dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#2D8BA4" android:pathData="M12,0C5.374,0 0,5.374 0,12C0,21 12,34.286 12,34.286C12,34.286 24,21 24,12C24,5.374 18.626,0 12,0ZM12,16.286C9.634,16.286 7.714,14.366 7.714,12C7.714,9.634 9.634,7.714 12,7.714C14.366,7.714 16.286,9.634 16.286,12C16.286,14.366 14.366,16.286 12,16.286Z"/>
<path android:fillColor="#FF1D1E" android:pathData="M27.764,18.49C29.26,18.49 30.455,18.901 31.35,19.722C32.259,20.544 32.714,21.666 32.714,23.088C32.714,24.57 32.244,25.684 31.306,26.432C30.367,27.18 29.121,27.554 27.566,27.554L27.478,29.292H25.3L25.19,25.838H25.916C27.338,25.838 28.424,25.648 29.172,25.266C29.934,24.885 30.316,24.159 30.316,23.088C30.316,22.311 30.088,21.702 29.634,21.262C29.194,20.822 28.578,20.602 27.786,20.602C26.994,20.602 26.371,20.815 25.916,21.24C25.461,21.666 25.234,22.26 25.234,23.022H22.88C22.88,22.142 23.078,21.358 23.474,20.668C23.87,19.979 24.434,19.444 25.168,19.062C25.916,18.681 26.781,18.49 27.764,18.49ZM26.356,34.154C25.901,34.154 25.52,34 25.212,33.692C24.904,33.384 24.75,33.003 24.75,32.548C24.75,32.094 24.904,31.712 25.212,31.404C25.52,31.096 25.901,30.942 26.356,30.942C26.796,30.942 27.17,31.096 27.478,31.404C27.786,31.712 27.94,32.094 27.94,32.548C27.94,33.003 27.786,33.384 27.478,33.692C27.17,34 26.796,34.154 26.356,34.154Z"/>
</vector>

View file

@ -65,14 +65,6 @@
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"

View file

@ -17,7 +17,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/dimen_10"
android:layout_marginStart="@dimen/dimen_10"
android:layout_marginTop="@dimen/dimen_10"
android:layout_marginEnd="@dimen/dimen_10"
android:layout_marginBottom="@dimen/dimen_10"
android:elevation="@dimen/cardview_default_elevation">
<LinearLayout
@ -26,81 +29,145 @@
android:layout_margin="@dimen/dimen_10"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_container_title"
<LinearLayout
android:id="@+id/ll_container_title"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="@dimen/half_standard_height"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="@dimen/half_standard_height"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:layout_marginRight="@dimen/tiny_gap"
android:gravity="center_vertical"
android:textSize="@dimen/normal_text"
android:textSize="18dp"
android:textStyle="bold"
tools:text="Step 1 of 15" />
<ImageView
android:id="@+id/tooltip"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/maplibre_info_icon_default"/>
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@drawable/maplibre_info_icon_default" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/ib_map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:layout_toLeftOf="@id/ib_expand_collapse"
android:visibility="visible"
app:srcCompat="@drawable/ic_map_white_24dp"
tools:visibility="visible" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/ib_expand_collapse"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="@dimen/half_standard_height"
android:layout_height="@dimen/half_standard_height"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="@dimen/small_gap"
android:layout_marginEnd="@dimen/small_gap"
android:layout_marginBottom="@dimen/small_gap"
android:clickable="false"
android:focusable="false"
android:padding="@dimen/medium_height"
android:rotation="180"
app:srcCompat="@drawable/arrow_up" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_container_media_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_gap"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_container_actions"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/standard_gap"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_edit_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/clicked_linearlayout_background"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_image_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="@dimen/half_standard_height"
android:layout_marginStart="@dimen/tiny_gap"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:gravity="center_vertical"
android:text="@string/edit_image"
android:textColor="#2D8BA4"
android:textSize="@dimen/normal_text"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"></LinearLayout>
<LinearLayout
android:id="@+id/ll_location_status"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/clicked_linearlayout_background"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/location_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_map_not_available_20dp" />
<TextView
android:id="@+id/location_text_view"
android:layout_width="wrap_content"
android:layout_height="@dimen/half_standard_height"
android:layout_marginStart="@dimen/tiny_gap"
android:layout_marginLeft="@dimen/tiny_gap"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:gravity="center_vertical"
android:text="@string/add_location"
android:textColor="#2D8BA4"
android:textSize="@dimen/normal_text"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/tiny_margin"
android:layout_weight="1"
android:src="@drawable/ic_arrow_16dp" />
</LinearLayout>
</LinearLayout>
<fr.free.nrw.commons.widget.HeightLimitedRecyclerView
android:id="@+id/rv_descriptions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin_horizontal"
android:layout_marginBottom="@dimen/activity_margin_horizontal"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:scrollbarThumbVertical="@color/primaryColor"
android:scrollbarSize="@dimen/dimen_6"
android:scrollbarThumbVertical="@color/primaryColor"
android:scrollbars="vertical"
tools:visibility="visible" />
@ -109,8 +176,8 @@
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/copy_image_caption_description"
android:padding="@dimen/miniscule_margin"
android:text="@string/copy_image_caption_description"
android:textAlignment="textEnd"
android:textColor="@color/button_blue"
android:visibility="gone"
@ -120,21 +187,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<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_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:enabled="false"
android:alpha=".5"
android:enabled="false"
android:text="@string/next"
android:textColor="@android:color/white" />
@ -147,16 +206,6 @@
android:layout_marginRight="@dimen/standard_gap"
android:layout_toLeftOf="@+id/btn_next"
android:text="@string/previous" />
<Button
android:id="@+id/edit_image"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginBottom="24dp"
android:layout_toStartOf="@id/btn_previous"
android:contentDescription="Edit Image"
android:text="Edit Image" />
</RelativeLayout>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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="wrap_content"
android:layout_marginHorizontal="8dp"
@ -8,6 +9,7 @@
app:elevation="6dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="20dp"
@ -23,6 +25,17 @@
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_remove" />
<ImageView
android:id="@+id/btn_add"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:contentDescription="@string/remove"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="@+id/btn_remove"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_add" />
<TextView
android:id="@+id/description_languages"
android:layout_width="wrap_content"

View file

@ -787,6 +787,8 @@ Upload your first media by tapping on the add button.</string>
<string name="learn_how_to_write_a_useful_description">Learn how to write a useful description</string>
<string name="learn_how_to_write_a_useful_caption">Learn how to write a useful caption</string>
<string name="see_your_achievements">See your achievements</string>
<string name="edit_image">Edit Image</string>
<string name="edit_location">Edit Location</string>
<string name="send_thanks_to_author">Thank the author</string>
<string name="error_sending_thanks">Error sending thanks to author.</string>
<plurals name="custom_picker_images_selected_title_appendix">

View file

@ -124,18 +124,6 @@ class DescriptionEditActivityUnitTest {
assertEquals(activity.isFinishing, true)
}
@Test
@Throws(Exception::class)
fun testOnButtonAddDescriptionClicked() {
Shadows.shadowOf(Looper.getMainLooper()).idle()
val method: Method = DescriptionEditActivity::class.java.getDeclaredMethod(
"onButtonAddDescriptionClicked", View::class.java
)
method.isAccessible = true
method.invoke(activity, null)
verify(uploadMediaDetailAdapter).addDescription(UploadMediaDetail())
}
@Test
@Throws(Exception::class)
fun testOnBackButtonClicked() {

View file

@ -72,7 +72,9 @@ class UploadMediaDetailFragmentUnitTest {
private lateinit var btnNext: AppCompatButton
private lateinit var btnCopyToSubsequentMedia: AppCompatButton
private lateinit var photoViewBackgroundImage: PhotoView
private lateinit var ibMap: AppCompatImageButton
private lateinit var locationStatusLl: LinearLayout
private lateinit var locationImageView : ImageView
private lateinit var locationTextView : TextView
private lateinit var llContainerMediaDetail: LinearLayout
private lateinit var ibExpandCollapse: AppCompatImageButton
@ -134,7 +136,9 @@ class UploadMediaDetailFragmentUnitTest {
btnNext = view.findViewById(R.id.btn_next)
btnCopyToSubsequentMedia = view.findViewById(R.id.btn_copy_subsequent_media)
photoViewBackgroundImage = view.findViewById(R.id.backgroundImage)
ibMap = view.findViewById(R.id.ib_map)
locationStatusLl = view.findViewById(R.id.ll_location_status)
locationImageView = view.findViewById(R.id.location_image_view)
locationTextView = view.findViewById(R.id.location_text_view)
llContainerMediaDetail = view.findViewById(R.id.ll_container_media_detail)
ibExpandCollapse = view.findViewById(R.id.ib_expand_collapse)
@ -147,7 +151,9 @@ class UploadMediaDetailFragmentUnitTest {
Whitebox.setInternalState(fragment, "btnCopyToSubsequentMedia", btnCopyToSubsequentMedia)
Whitebox.setInternalState(fragment, "photoViewBackgroundImage", photoViewBackgroundImage)
Whitebox.setInternalState(fragment, "uploadMediaDetailAdapter", uploadMediaDetailAdapter)
Whitebox.setInternalState(fragment, "ibMap", ibMap)
Whitebox.setInternalState(fragment, "llLocationStatus", locationStatusLl)
Whitebox.setInternalState(fragment, "locationImageView", locationImageView)
Whitebox.setInternalState(fragment, "locationTextView", locationTextView)
Whitebox.setInternalState(fragment, "llContainerMediaDetail", llContainerMediaDetail)
Whitebox.setInternalState(fragment, "ibExpandCollapse", ibExpandCollapse)
}
@ -245,13 +251,6 @@ class UploadMediaDetailFragmentUnitTest {
fragment.onPreviousButtonClicked()
}
@Test
@Throws(Exception::class)
fun testOnButtonAddDescriptionClicked() {
Shadows.shadowOf(Looper.getMainLooper()).idle()
fragment.onButtonAddDescriptionClicked()
}
@Test
@Throws(Exception::class)
fun testShowSimilarImageFragment() {
@ -429,9 +428,9 @@ class UploadMediaDetailFragmentUnitTest {
@Test
@Throws(Exception::class)
fun testOnRlContainerTitleClicked() {
fun testOnLlContainerTitleClicked() {
Shadows.shadowOf(Looper.getMainLooper()).idle()
fragment.onRlContainerTitleClicked()
fragment.onLlContainerTitleClicked()
}
@Test