Skip to content

Commit

Permalink
support Android 4.0.3+/SDK 15, target SDK 36, pure/AMOLED black theme…
Browse files Browse the repository at this point in the history
…, add option to remove EXIF, work with no permissions on Android 6+/SDK 23+
  • Loading branch information
AbdurazaaqMohammed committed Dec 24, 2024
1 parent 3757f9e commit dd3f791
Show file tree
Hide file tree
Showing 36 changed files with 723 additions and 584 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
/cropper/build
/todo.txt
/advertise-llCrop.md
/app/release
24 changes: 7 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
apply plugin: 'com.android.application'

android {
//noinspection GradleCompatible
compileSdkVersion 28
compileSdk 34
defaultConfig {
applicationId "de.k3b.android.lossless_jpg_crop"

// SAF ACTION_CREATE_DOCUMENT requires api-19 and later
minSdkVersion 19 // Android 4.4 KitKat (API 19); Android 5.0 Lollipop (API 21); Android 6.0 Marshmallow (API 23); Android 7.0 Nougat (API 24)
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 29
minSdk 15
targetSdk 36

// 1.0.0.190425 (1) initial version
// 1.0.1.190507 (2) Bugfix: missing read permission; port to android-x
Expand All @@ -23,7 +20,6 @@ android {
// 1.3.0.230218 (10) new features: #15:modifyable dimensions; #35:Display crop box coordinates and size
versionCode 10
versionName "1.3.0.230218"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// all supported locales. Note: the lib has more translations which are supressed here
// resConfigs "ar","de","es","fr","hi","in","it","ja","nl","pl","ro","ru","tr","uk","zz","pt-rBR","zh-rCN","zh-rTW"
Expand All @@ -33,11 +29,11 @@ android {
debug {
shrinkResources true
minifyEnabled true
// minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

applicationIdSuffix ".debug"
versionNameSuffix "-DEBUG" }
versionNameSuffix "-DEBUG"
}
release {
shrinkResources true
minifyEnabled true
Expand All @@ -47,8 +43,7 @@ android {
lintOptions {
// http://stackoverflow.com/questions/31350350/generating-signed-apk-error7-missingtranslation-in-build-generated-res-gen
// MissingTranslation : not all crowdwin translations are complete so ignore them
disable 'MissingTranslation'

// Hell nah dont just ignore the translations
abortOnError false
}
compileOptions {
Expand All @@ -59,17 +54,12 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.annotation:annotation:1.2.0'

implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'


// implements lossless croppig
// implementation 'com.facebook.spectrum:spectrum-default:1.0.0'
implementation("io.github.tommy-geenexus:exif-interface-extended:1.0.3")
implementation 'com.facebook.spectrum:spectrum-core:1.3.0'
implementation 'com.facebook.spectrum:spectrum-jpeg:1.3.0'
// the cropping gui
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package de.k3b.android.lossless_jpg_crop;

import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

Expand Down
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
package="de.k3b.android.lossless_jpg_crop"
android:installLocation="auto">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="22"/>

<application
android:name=".MainApp"
android:allowBackup="false"
android:icon="@mipmap/ll_crop"
android:label="@string/app_name"
android:supportsRtl="true"

android:theme="@style/AppTheme">

<provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package de.k3b.android.lossless_jpg_crop;

import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;

/**
* Created by Oleksii Shliama (https://github.com/shliama).
* Created by Oleksii Shliama (<a href="https://github.com/shliama">...</a>).
*/
public class BaseActivity extends Activity {

Expand All @@ -25,6 +29,12 @@ protected void onStop() {
}
}

@Override
protected void onStart() {
ActionBar ab = getActionBar();
if(ab != null) ab.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
super.onStart();
}

/**
* Requests given permission.
Expand All @@ -34,13 +44,8 @@ protected void onStop() {
protected void requestPermission(final String permission, String rationale, final int requestCode) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission)) {
showAlertDialog(getString(R.string.permission_title_rationale), rationale,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(BaseActivity.this,
new String[]{permission}, requestCode);
}
}, getString(android.R.string.ok), null, getString(android.R.string.cancel));
(dialog, which) -> ActivityCompat.requestPermissions(BaseActivity.this,
new String[]{permission}, requestCode), getString(android.R.string.ok), null, getString(android.R.string.cancel));
} else {
ActivityCompat.requestPermissions(this, new String[]{permission}, requestCode);
}
Expand Down Expand Up @@ -69,5 +74,4 @@ protected void showAlertDialog(@Nullable String title, @Nullable String message,
builder.setNegativeButton(negativeText, onNegativeButtonClickListener);
mAlertDialog = builder.show();
}

}
}
Loading

0 comments on commit dd3f791

Please sign in to comment.