Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix register receiver for api 34 #68

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.novoda:bintray-release:0.4.0'
}
}

allprojects {
repositories {
jcenter()
google()
}
}

Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip

29 changes: 14 additions & 15 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 34
buildToolsVersion "30.0.2"

defaultConfig {
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 34
versionCode 1
versionName "1.0"
}
Expand All @@ -20,16 +19,16 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
}

publish {
artifactId = 'cropiwa'
userOrg = rootProject.userOrg
groupId = rootProject.groupId
uploadName = rootProject.uploadName
publishVersion = rootProject.publishVersion
description = rootProject.description
licences = rootProject.licences
}
//publish {
// artifactId = 'cropiwa'
// userOrg = rootProject.userOrg
// groupId = rootProject.groupId
// uploadName = rootProject.uploadName
// publishVersion = rootProject.publishVersion
// description = rootProject.description
// licences = rootProject.licences
//}
3 changes: 2 additions & 1 deletion library/src/main/java/com/steelkiwi/cropiwa/AspectRatio.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.steelkiwi.cropiwa;

import android.support.annotation.IntRange;

import androidx.annotation.IntRange;

/**
* Created by yarolegovich https://github.com/yarolegovich
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.support.annotation.FloatRange;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.widget.ImageView;

import androidx.annotation.FloatRange;
import androidx.appcompat.widget.AppCompatImageView;

import com.steelkiwi.cropiwa.config.ConfigChangeListener;
import com.steelkiwi.cropiwa.config.CropIwaImageViewConfig;
import com.steelkiwi.cropiwa.util.CropIwaUtils;
import com.steelkiwi.cropiwa.util.MatrixUtils;
import com.steelkiwi.cropiwa.util.MatrixAnimator;
import com.steelkiwi.cropiwa.util.MatrixUtils;
import com.steelkiwi.cropiwa.util.TensionInterpolator;

/**
* @author Yaroslav Polyakov https://github.com/polyak01
* 03.02.2017.
*/
@SuppressLint("ViewConstructor")
class CropIwaImageView extends ImageView implements OnNewBoundsListener, ConfigChangeListener {
class CropIwaImageView extends AppCompatImageView implements OnNewBoundsListener, ConfigChangeListener {

private Matrix imageMatrix;
private MatrixUtils matrixUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.view.MotionEvent;
import android.view.View;

import androidx.annotation.Nullable;

import com.steelkiwi.cropiwa.config.ConfigChangeListener;
import com.steelkiwi.cropiwa.config.CropIwaOverlayConfig;
import com.steelkiwi.cropiwa.shape.CropIwaShape;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.FloatRange;
import android.util.AttributeSet;

import androidx.annotation.FloatRange;

import com.steelkiwi.cropiwa.R;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.FloatRange;
import android.support.annotation.NonNull;
import android.util.AttributeSet;

import androidx.annotation.FloatRange;
import androidx.annotation.NonNull;

import com.steelkiwi.cropiwa.AspectRatio;
import com.steelkiwi.cropiwa.R;
import com.steelkiwi.cropiwa.shape.CropIwaOvalShape;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import android.graphics.Bitmap;
import android.net.Uri;
import android.support.annotation.IntRange;

import androidx.annotation.IntRange;

import com.steelkiwi.cropiwa.image.CropIwaBitmapManager;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.steelkiwi.cropiwa.config.CropIwaSaveConfig;
import com.steelkiwi.cropiwa.shape.CropIwaShapeMask;
Expand All @@ -28,6 +26,9 @@

import static com.steelkiwi.cropiwa.util.CropIwaUtils.*;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
* @author Yaroslav Polyakov https://github.com/polyak01
* on 25.02.2017.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.steelkiwi.cropiwa.image;

import static android.content.Context.RECEIVER_NOT_EXPORTED;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;

/**
Expand All @@ -19,12 +22,14 @@ public class CropIwaResultReceiver extends BroadcastReceiver {

public static void onCropCompleted(Context context, Uri croppedImageUri) {
Intent intent = new Intent(ACTION_CROP_COMPLETED);
intent.setPackage(context.getPackageName());
intent.putExtra(EXTRA_URI, croppedImageUri);
context.sendBroadcast(intent);
}

public static void onCropFailed(Context context, Throwable e) {
Intent intent = new Intent(ACTION_CROP_COMPLETED);
intent.setPackage(context.getPackageName());
intent.putExtra(EXTRA_ERROR, e);
context.sendBroadcast(intent);
}
Expand All @@ -45,7 +50,11 @@ public void onReceive(Context context, Intent intent) {

public void register(Context context) {
IntentFilter filter = new IntentFilter(ACTION_CROP_COMPLETED);
context.registerReceiver(this, filter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
context.registerReceiver(this, filter, RECEIVER_NOT_EXPORTED);
} else {
context.registerReceiver(this, filter);
}
}

public void unregister(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected void drawGrid(Canvas canvas, RectF cropBounds, Paint paint) {
clipPath.rewind();
clipPath.addOval(cropBounds, Path.Direction.CW);

canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.save();
canvas.clipPath(clipPath);
super.drawGrid(canvas, cropBounds, paint);
canvas.restore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import android.content.res.Resources;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.DisplayMetrics;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.io.Closeable;
import java.io.File;

Expand Down
10 changes: 6 additions & 4 deletions library/src/main/java/com/steelkiwi/cropiwa/util/ResUtil.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.steelkiwi.cropiwa.util;

import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DimenRes;
import android.support.v4.content.ContextCompat;

import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DimenRes;
import androidx.core.content.ContextCompat;


/**
* @author yarolegovich https://github.com/yarolegovich
Expand Down
20 changes: 10 additions & 10 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 31
buildToolsVersion "30.0.2"

defaultConfig {
applicationId "com.steelkiwi.cropiwa.sample"
minSdkVersion 21
targetSdkVersion 25
targetSdkVersion 34
versionCode 1
versionName "1.0"
}
Expand All @@ -20,12 +20,12 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.yarolegovich:mp:1.0.5'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':library')
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.yarolegovich:mp:1.0.5'

compile 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
}
10 changes: 6 additions & 4 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".CropGalleryActivity"
<activity
android:name=".CropGalleryActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -26,14 +28,14 @@

<activity
android:name=".ViewImageActivity"
android:screenOrientation="portrait"
android:parentActivityName=".CropGalleryActivity"
android:screenOrientation="portrait"
android:theme="@style/ViewImageActivityTheme" />

<activity
android:name=".CropActivity"
android:screenOrientation="portrait"
android:parentActivityName=".CropGalleryActivity" />
android:parentActivityName=".CropGalleryActivity"
android:screenOrientation="portrait" />

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.steelkiwi.cropiwa.AspectRatio;


import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import com.steelkiwi.cropiwa.CropIwaView;
import com.steelkiwi.cropiwa.sample.config.CropViewConfigurator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.google.android.material.snackbar.Snackbar;
import com.steelkiwi.cropiwa.image.CropIwaResultReceiver;
import com.steelkiwi.cropiwa.sample.adapter.CropGalleryAdapter;
import com.steelkiwi.cropiwa.sample.data.CropGallery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

/**
* @author yarolegovich
* 25.02.2017.
Expand Down
Loading