mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
parent
900bd4ff2f
commit
6cbce9d283
8 changed files with 15 additions and 45 deletions
|
|
@ -102,7 +102,7 @@ android {
|
|||
versionName '2.10.1'
|
||||
setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName())
|
||||
|
||||
minSdkVersion 15
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 28
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import android.Manifest;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -67,15 +66,11 @@ public class ContributionController {
|
|||
* Check for permissions and initiate gallery picker
|
||||
*/
|
||||
public void initiateGalleryPick(Activity activity, boolean allowMultipleUploads) {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
initiateGalleryUpload(activity, allowMultipleUploads);
|
||||
} else {
|
||||
PermissionUtils.checkPermissionsAndPerformAction(activity,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
() -> initiateGalleryUpload(activity, allowMultipleUploads),
|
||||
R.string.storage_permission_title,
|
||||
R.string.read_storage_permission_rationale);
|
||||
}
|
||||
PermissionUtils.checkPermissionsAndPerformAction(activity,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
() -> initiateGalleryUpload(activity, allowMultipleUploads),
|
||||
R.string.storage_permission_title,
|
||||
R.string.read_storage_permission_rationale);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -353,11 +353,7 @@ public class FilePicker implements Constants {
|
|||
}
|
||||
|
||||
private static boolean isPhoto(Intent data) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
return data == null || (data.getData() == null && data.getClipData() == null);
|
||||
} else {
|
||||
return data == null || (data.getData() == null);
|
||||
}
|
||||
return data == null || (data.getData() == null && data.getClipData() == null);
|
||||
}
|
||||
|
||||
public static boolean willHandleActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
|
@ -430,10 +426,7 @@ public class FilePicker implements Constants {
|
|||
|
||||
private static List<UploadableFile> getFilesFromGalleryPictures(Intent data, Activity activity) throws IOException {
|
||||
List<UploadableFile> files = new ArrayList<>();
|
||||
ClipData clipData = null;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
clipData = data.getClipData();
|
||||
}
|
||||
ClipData clipData = data.getClipData();
|
||||
if (clipData == null) {
|
||||
Uri uri = data.getData();
|
||||
UploadableFile file = PickedFiles.pickedExistingPicture(activity, uri);
|
||||
|
|
|
|||
|
|
@ -127,9 +127,7 @@ public class SpinnerLanguagesAdapter extends ArrayAdapter {
|
|||
if (languageCodesList.get(position).isEmpty()) {
|
||||
tvLanguage.setText(languageNamesList.get(position));
|
||||
tvLanguage.setTextColor(Color.GRAY);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
tvLanguage.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||
}
|
||||
tvLanguage.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||
} else {
|
||||
tvLanguage.setText(
|
||||
String.format("%s [%s]", languageNamesList.get(position), languageCodesList.get(position)));
|
||||
|
|
|
|||
|
|
@ -567,9 +567,7 @@ public class UploadActivity extends BaseActivity implements UploadView, SimilarI
|
|||
}
|
||||
|
||||
private void configureCategories() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
categoryFrameLayout.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
|
||||
}
|
||||
categoryFrameLayout.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
|
||||
categoriesAdapter = new UploadCategoriesAdapterFactory(categoriesModel).create(new ArrayList<>());
|
||||
categoriesList.setLayoutManager(new LinearLayoutManager(this));
|
||||
categoriesList.setAdapter(categoriesAdapter);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class UploadCategoriesRenderer extends Renderer<CategoryItem> {
|
|||
protected void setUpView(View view) {
|
||||
ButterKnife.bind(this, view);
|
||||
Configuration config = getContext().getResources().getConfiguration();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
checkedView.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,13 +55,6 @@ public class DateUtils {
|
|||
}
|
||||
|
||||
public static String dateInLocaleFormat(Date date){
|
||||
String formatter;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
formatter = new SimpleDateFormat(DateFormat.getBestDateTimePattern(Locale.getDefault(), "dd MMM yyyy"), Locale.getDefault()).format(date);
|
||||
}
|
||||
else {
|
||||
formatter = String.valueOf(new SimpleDateFormat("dd MMM yyyy", Locale.getDefault()));
|
||||
}
|
||||
return formatter;
|
||||
return new SimpleDateFormat(DateFormat.getBestDateTimePattern(Locale.getDefault(), "dd MMM yyyy"), Locale.getDefault()).format(date);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@ public class DialogUtil {
|
|||
return;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
isActivityDestroyed = activity.isDestroyed();
|
||||
}
|
||||
isActivityDestroyed = activity.isDestroyed();
|
||||
if (activity.isFinishing() || isActivityDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -55,10 +53,7 @@ public class DialogUtil {
|
|||
return;
|
||||
}
|
||||
|
||||
boolean isActivityDestroyed = false;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
isActivityDestroyed = activity.isDestroyed();
|
||||
}
|
||||
boolean isActivityDestroyed = activity.isDestroyed();
|
||||
if (activity.isFinishing() || isActivityDestroyed) {
|
||||
Timber.e("Activity is not running. Could not show dialog. ");
|
||||
return;
|
||||
|
|
@ -83,9 +78,7 @@ public class DialogUtil {
|
|||
return;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
isActivityDestroyed = activity.isDestroyed();
|
||||
}
|
||||
isActivityDestroyed = activity.isDestroyed();
|
||||
if (activity.isFinishing() || isActivityDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue