Regarding issue 4042: bordering (#4071)

This commit is contained in:
Saral Verma 2020-12-13 00:27:06 +05:30 committed by GitHub
parent 7d8e09f708
commit 0415a57d34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,7 @@
package fr.free.nrw.commons.upload;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
@ -27,7 +29,7 @@ import fr.free.nrw.commons.filepicker.UploadableFile;
* The adapter class for image thumbnails to be shown while uploading.
*/
class ThumbnailsAdapter extends RecyclerView.Adapter<ThumbnailsAdapter.ViewHolder> {
public static Context context;
List<UploadableFile> uploadableFiles;
private Callback callback;
@ -85,18 +87,22 @@ class ThumbnailsAdapter extends RecyclerView.Adapter<ThumbnailsAdapter.ViewHolde
UploadableFile uploadableFile = uploadableFiles.get(position);
Uri uri = uploadableFile.getMediaUri();
background.setImageURI(Uri.fromFile(new File(String.valueOf(uri))));
if (position == callback.getCurrentSelectedFilePosition()) {
GradientDrawable border = new GradientDrawable();
border.setShape(GradientDrawable.RECTANGLE);
border.setStroke(8, context.getResources().getColor(R.color.primaryColor));
rlContainer.setEnabled(true);
rlContainer.setClickable(true);
rlContainer.setAlpha(1.0f);
rlContainer.setBackground(border);
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
rlContainer.setElevation(10);
}
} else {
rlContainer.setEnabled(false);
rlContainer.setClickable(false);
rlContainer.setAlpha(0.5f);
rlContainer.setAlpha(0.7f);
rlContainer.setBackground(null);
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
rlContainer.setElevation(0);
}

View file

@ -290,6 +290,7 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
}
private void receiveSharedItems() {
thumbnailsAdapter.context=this;
Intent intent = getIntent();
String action = intent.getAction();
if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {

View file

@ -72,6 +72,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_gap"
android:padding="8px"
/>
</LinearLayout>

View file

@ -13,6 +13,7 @@
android:id="@+id/iv_thumbnail"
android:layout_width="@dimen/big_height"
android:layout_height="@dimen/big_height"
android:padding="8px"
fresco:actualImageScaleType="fitCenter"/>
<ImageView