V1.0.1(2)导入图片限制最大5M
This commit is contained in:
parent
bbfeeac425
commit
890645da5a
@ -14,11 +14,11 @@ android {
|
|||||||
applicationId = "com.paintings.tool"
|
applicationId = "com.paintings.tool"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 2
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.1"
|
||||||
setProperty(
|
setProperty(
|
||||||
"archivesBaseName",
|
"archivesBaseName",
|
||||||
"AR Drawing-Paintings Tool_V" + versionName + "(${versionCode})_$timestamp"
|
"AR Drawing_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
)
|
)
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
149
app/proguard-rules.pro
vendored
149
app/proguard-rules.pro
vendored
@ -19,140 +19,19 @@
|
|||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
-keepclassmembers class * implements android.os.Parcelable {
|
# 保持 Room 的核心类不被混淆
|
||||||
public static final android.os.Parcelable$Creator *;
|
-keep class androidx.room.** { *; }
|
||||||
}
|
-keep class androidx.sqlite.db.** { *; }
|
||||||
|
|
||||||
-keepclassmembers class com.app.paintingstool.myuntils.Keys {
|
# 保持 Room 数据库类的基本结构
|
||||||
public static final java.lang.String tatab;
|
-keep class * extends androidx.room.RoomDatabase { *; }
|
||||||
public static final int ababa;
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclassmembers class * {
|
# 保持 Room DAO 接口
|
||||||
@androidx.room.Query <methods>;
|
-keep @androidx.room.Dao interface * { *; }
|
||||||
}
|
-keep @androidx.room.Dao class * { *; }
|
||||||
-keep class com.app.paintingstool.mydao.AppDatabase { *; }
|
|
||||||
#noinspection ShrinkerUnresolvedReference
|
# 保持 Room 实体类
|
||||||
#unity
|
-keep @androidx.room.Entity class * { *; }
|
||||||
-keep class com.google.android.gms.ads.** {public *;}
|
|
||||||
-keep class com.google.android.gms.appset.** { *; }
|
# 保持 Room 的注解类
|
||||||
-keep class com.google.android.gms.tasks.** { *; }
|
-keep @androidx.room.Database class * { *; }
|
||||||
#adapters
|
|
||||||
-keep class com.ironsource.adapters.** { *; }
|
|
||||||
#sdk
|
|
||||||
-dontwarn com.ironsource.**
|
|
||||||
-dontwarn com.ironsource.adapters.**
|
|
||||||
-keepclassmembers class com.ironsource.** { public *; }
|
|
||||||
-keep public class com.ironsource.**
|
|
||||||
-keep class com.ironsource.adapters.** { *;
|
|
||||||
}
|
|
||||||
#omid
|
|
||||||
-dontwarn com.iab.omid.**
|
|
||||||
-keep class com.iab.omid.** {*;}
|
|
||||||
#javascript
|
|
||||||
-keepattributes JavascriptInterface
|
|
||||||
-keepclassmembers class * { @android.webkit.JavascriptInterface <methods>; }
|
|
||||||
#For AmazonAps integration
|
|
||||||
-keep class com.amazon.device.ads.DtbThreadService {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keep public interface com.amazon.device.ads** {*; }
|
|
||||||
#For AppLovin integration
|
|
||||||
-keepclassmembers class com.applovin.sdk.AppLovinSdk {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keep public interface com.applovin.sdk** {*; }
|
|
||||||
-keep public interface com.applovin.adview** {*; }
|
|
||||||
-keep public interface com.applovin.mediation** {*; }
|
|
||||||
-keep public interface com.applovin.communicator** {*; }
|
|
||||||
#For Bytedance integration
|
|
||||||
-keep public interface com.bytedance.sdk.openadsdk** {*; }
|
|
||||||
#For Facebook integration
|
|
||||||
-keepclassmembers class com.facebook.ads.internal.AdSdkVersion {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keepclassmembers class com.facebook.ads.internal.settings.AdSdkVersion {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keepclassmembers class com.facebook.ads.BuildConfig {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keep public interface com.facebook.ads** {*; }
|
|
||||||
#For Fairbid
|
|
||||||
-keep public interface com.fyber.fairbid.ads.interstitial** {*; }
|
|
||||||
-keep public interface com.fyber.fairbid.ads.rewarded** {*; }
|
|
||||||
-keep class com.fyber.offerwall.*
|
|
||||||
#For Fivead
|
|
||||||
-keep public interface com.five_corp.ad** {*; }
|
|
||||||
#For Fyber(Inneractive) integration
|
|
||||||
-keep public interface com.fyber.inneractive.sdk.external** {*; }
|
|
||||||
-keep public interface com.fyber.inneractive.sdk.activities** {*; }
|
|
||||||
-keep public interface com.fyber.inneractive.sdk.ui** {*; }
|
|
||||||
#For HyprMX integration
|
|
||||||
-keepclassmembers class com.hyprmx.android.sdk.utility.HyprMXProperties {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keepclassmembers class com.hyprmx.android.BuildConfig {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keep public interface com.hyprmx.android.sdk.activity** {*; }
|
|
||||||
-keep public interface com.hyprmx.android.sdk.graphics** {*; }
|
|
||||||
# For Inmobi integration
|
|
||||||
-keep class com.inmobi.*
|
|
||||||
-keep public interface com.inmobi.ads.listeners** {*; }
|
|
||||||
-keep public interface com.inmobi.ads.InMobiInterstitial** {*; }
|
|
||||||
-keep public interface com.inmobi.ads.InMobiBanner** {*; }
|
|
||||||
# For ironSource integration
|
|
||||||
-keep public interface com.ironsource.mediationsdk.sdk** {*; }
|
|
||||||
-keep public interface com.ironsource.mediationsdk.impressionData.ImpressionDataListener {*; }
|
|
||||||
#For Maio integration
|
|
||||||
-keep public interface jp.maio.sdk.android.MaioAdsListenerInterface {*; }
|
|
||||||
# For Mintergral integration
|
|
||||||
-keep public interface com.mbridge.msdk.out** {*; }
|
|
||||||
-keep public interface com.mbridge.msdk.videocommon.listener** {*; }
|
|
||||||
-keep public interface com.mbridge.msdk.interstitialvideo.out** {*; }
|
|
||||||
-keep public interface com.mintegral.msdk.out** {*; }
|
|
||||||
-keep public interface com.mintegral.msdk.videocommon.listener** {*; }
|
|
||||||
-keep public interface com.mintegral.msdk.interstitialvideo.out** {*; }
|
|
||||||
#For MyTarget integration
|
|
||||||
-keep class com.my.target.** {*;}
|
|
||||||
#For Ogury integration
|
|
||||||
-keep public interface io.presage.interstitial** {*; }
|
|
||||||
-keep public interface io.presage.interstitial.PresageInterstitialCallback {*; }
|
|
||||||
#For Pubnative integration
|
|
||||||
-keep public interface net.pubnative.lite.sdk.interstitial.HyBidInterstitialAd** {*; }
|
|
||||||
-keep public interface net.pubnative.lite.sdk.rewarded.HyBidRewardedAd** {*; }
|
|
||||||
-keep public interface net.pubnative.lite.sdk.views.HyBidAdView** {*; }
|
|
||||||
#For Smaato integration
|
|
||||||
-keep public interface com.smaato.sdk.interstitial** {*; }
|
|
||||||
-keep public interface com.smaato.sdk.video.vast** {*; }
|
|
||||||
-keep public interface com.smaato.sdk.banner.widget** {*; }
|
|
||||||
-keep public interface com.smaato.sdk.core.util** {*; }
|
|
||||||
# For Tapjoy integration
|
|
||||||
-keep public interface com.tapjoy.** {*; }
|
|
||||||
# For Tencent integration
|
|
||||||
-keep public interface com.qq.e.ads.interstitial2** {*; }
|
|
||||||
-keep public interface com.qq.e.ads.interstitial3** {*; }
|
|
||||||
-keep public interface com.qq.e.ads.rewardvideo** {*; }
|
|
||||||
-keep public interface com.qq.e.ads.rewardvideo2** {*; }
|
|
||||||
-keep public interface com.qq.e.ads.banner2** {*; }
|
|
||||||
-keep public interface com.qq.e.comm.adevent** {*; }
|
|
||||||
#For Verizon integration
|
|
||||||
-keepclassmembers class com.verizon.ads.edition.BuildConfig {
|
|
||||||
static *;
|
|
||||||
}
|
|
||||||
-keep public interface com.verizon.ads.interstitialplacement** {*; }
|
|
||||||
-keep public interface com.verizon.ads.inlineplacement** {*; }
|
|
||||||
-keep public interface com.verizon.ads.vastcontroller** {*; }
|
|
||||||
-keep public interface com.verizon.ads.webcontroller** {*; }
|
|
||||||
#For Vungle integration
|
|
||||||
-keep public interface com.vungle.warren.PlayAdCallback {*; }
|
|
||||||
-keep public interface com.vungle.warren.ui.contract** {*; }
|
|
||||||
-keep public interface com.vungle.warren.ui.view** {*; }
|
|
||||||
#For AndroidX
|
|
||||||
-keep class androidx.localbroadcastmanager.content.LocalBroadcastManager { *;}
|
|
||||||
-keep class androidx.recyclerview.widget.RecyclerView { *;}
|
|
||||||
-keep class androidx.recyclerview.widget.RecyclerView$OnScrollListener { *;}
|
|
||||||
#For Android
|
|
||||||
-keep class * extends android.app.Activity
|
|
||||||
#-----------------------------------------------------ironSource SDK
|
|
||||||
@ -40,8 +40,10 @@ import androidx.core.view.WindowInsetsCompat;
|
|||||||
import com.app.paintingstool.R;
|
import com.app.paintingstool.R;
|
||||||
import com.app.paintingstool.databinding.ActivityCarmelBinding;
|
import com.app.paintingstool.databinding.ActivityCarmelBinding;
|
||||||
import com.app.paintingstool.myuntils.Keys;
|
import com.app.paintingstool.myuntils.Keys;
|
||||||
|
import com.app.paintingstool.myuntils.Utils;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
@ -79,8 +81,27 @@ public class CarmelActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
intentActivityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
intentActivityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
||||||
if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
||||||
Uri imageUri = result.getData().getData();
|
Uri imageUri = result.getData().getData();
|
||||||
|
if (imageUri == null) return;
|
||||||
|
new Thread(() -> {
|
||||||
|
InputStream putStream = null;
|
||||||
|
try {
|
||||||
|
putStream = getContentResolver().openInputStream(imageUri);
|
||||||
|
double v = Utils.convertBytesToMB(putStream.available());
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
if (v >= 5) {
|
||||||
|
Toast.makeText(CarmelActivity.this, getString(R.string.im_big), Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
binding.image.setImageURI(imageUri);
|
binding.image.setImageURI(imageUri);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
putStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
init();
|
init();
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import android.provider.MediaStore;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
@ -25,6 +26,7 @@ import com.app.paintingstool.databinding.ActivityImporImageBinding;
|
|||||||
import com.app.paintingstool.myadapter.ImageAdapter1;
|
import com.app.paintingstool.myadapter.ImageAdapter1;
|
||||||
import com.app.paintingstool.myuntils.ImageItem;
|
import com.app.paintingstool.myuntils.ImageItem;
|
||||||
import com.app.paintingstool.myuntils.MyItemDecoration;
|
import com.app.paintingstool.myuntils.MyItemDecoration;
|
||||||
|
import com.app.paintingstool.myuntils.Utils;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
@ -74,25 +76,48 @@ public class ImporImageActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void importImage() {
|
private void importImage() {
|
||||||
intentActivityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
intentActivityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
||||||
if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
||||||
Uri imageUri = result.getData().getData();
|
Intent data = result.getData();
|
||||||
|
Uri imageUri = data.getData();
|
||||||
|
if (imageUri == null) return;
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
assert imageUri != null;
|
|
||||||
String mimeType = getContentResolver().getType(imageUri);
|
String mimeType = getContentResolver().getType(imageUri);
|
||||||
fileExtension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
|
fileExtension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
|
||||||
fileName = "image_" + System.currentTimeMillis() + "." + fileExtension;
|
fileName = "image_" + System.currentTimeMillis() + "." + fileExtension;
|
||||||
File outputFile = new File(getFilesDir(), fileName);
|
File outputFile = new File(getFilesDir(), fileName);
|
||||||
try (InputStream inputStream = getContentResolver().openInputStream(imageUri);
|
InputStream inputStream = null;
|
||||||
OutputStream outputStream = new FileOutputStream(outputFile)) {
|
OutputStream outputStream = null;
|
||||||
|
try {
|
||||||
|
inputStream = getContentResolver().openInputStream(imageUri);
|
||||||
|
double v = Utils.convertBytesToMB(inputStream.available());
|
||||||
|
Log.d("----------","-----------"+v);
|
||||||
|
if (v >= 5) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Toast.makeText(ImporImageActivity.this, getString(R.string.im_big), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputStream = new FileOutputStream(outputFile);
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int length;
|
int length;
|
||||||
while ((length = inputStream.read(buffer)) > 0) {
|
while ((length = inputStream.read(buffer)) > 0) {
|
||||||
outputStream.write(buffer, 0, length);
|
outputStream.write(buffer, 0, length);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (inputStream != null) {
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
if (outputStream != null) {
|
||||||
|
outputStream.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
Glide.with(this).load(outputFile)
|
Glide.with(this).load(outputFile)
|
||||||
@ -104,6 +129,7 @@ public class ImporImageActivity extends AppCompatActivity {
|
|||||||
binding.reDef.setVisibility(View.GONE);
|
binding.reDef.setVisibility(View.GONE);
|
||||||
saveImageList();
|
saveImageList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
}
|
}
|
||||||
@ -168,7 +194,8 @@ public class ImporImageActivity extends AppCompatActivity {
|
|||||||
} catch (IOException | JSONException e) {
|
} catch (IOException | JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
public void run() {
|
public void run() {
|
||||||
// 使用 ValueAnimator 创建进度条动画
|
// 使用 ValueAnimator 创建进度条动画
|
||||||
ValueAnimator animation = ValueAnimator.ofInt(0, binding.progressBar.getMax());
|
ValueAnimator animation = ValueAnimator.ofInt(0, binding.progressBar.getMax());
|
||||||
animation.setDuration(4000); // 动画时长
|
animation.setDuration(2000); // 动画时长
|
||||||
animation.setInterpolator(new DecelerateInterpolator()); // 减速插值器
|
animation.setInterpolator(new DecelerateInterpolator()); // 减速插值器
|
||||||
animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -61,6 +61,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
public void onAnimationRepeat(android.animation.Animator animation) {}
|
public void onAnimationRepeat(android.animation.Animator animation) {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 1500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,2 +1,8 @@
|
|||||||
package com.app.paintingstool.myuntils;public class Utils {
|
package com.app.paintingstool.myuntils;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
public static double convertBytesToMB(long bytes) {
|
||||||
|
return bytes / (1024.0 * 1024.0); // 字节转换为兆
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,7 +118,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginHorizontal="12dp"
|
android:layout_marginHorizontal="12dp"
|
||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
android:text="@string/tate_us"
|
android:text="@string/rate_us"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
app:chipBackgroundColor="#00000000"
|
app:chipBackgroundColor="#00000000"
|
||||||
app:chipIcon="@mipmap/icon_rate"
|
app:chipIcon="@mipmap/icon_rate"
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
<string name="my_favorites">My favorites</string>
|
<string name="my_favorites">My favorites</string>
|
||||||
<string name="myfav">No favorites have been added yet, please go to the homepage to check it out</string>
|
<string name="myfav">No favorites have been added yet, please go to the homepage to check it out</string>
|
||||||
<string name="share">Share</string>
|
<string name="share">Share</string>
|
||||||
<string name="tate_us">Tate us</string>
|
<string name="rate_us">Rate us</string>
|
||||||
<string name="todo">TODO</string>
|
<string name="todo">TODO</string>
|
||||||
|
<string name="im_big">Please reselect an image no larger than 5M</string>
|
||||||
</resources>
|
</resources>
|
||||||
@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.5.0"
|
agp = "8.1.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.2.1"
|
junitVersion = "1.2.1"
|
||||||
espressoCore = "3.6.1"
|
espressoCore = "3.6.1"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user