V1.0.1(2) 集成max ,上传参数
This commit is contained in:
parent
3bac2e6ed9
commit
a1b53e38d4
@ -4,9 +4,13 @@ import java.text.SimpleDateFormat
|
|||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
// id("com.google.firebase.crashlytics")
|
id("com.google.firebase.crashlytics")
|
||||||
// id("com.google.gms.google-services")
|
id("com.google.gms.google-services")
|
||||||
id("io.objectbox")
|
id("io.objectbox")
|
||||||
|
id("applovin-quality-service")
|
||||||
|
}
|
||||||
|
applovin {
|
||||||
|
apiKey = "dEoKIpTvxCdhzapxKLHoPaCvNUnIJ5eMfILsy7J93J_SOBMp5ob1ML0P2VsqoHRAmclao4OAqpwh39eHPT4GFH"
|
||||||
}
|
}
|
||||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
android {
|
android {
|
||||||
@ -15,11 +19,11 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
//com.ar.sketch.paint.drawing
|
//com.ar.sketch.paint.drawing
|
||||||
applicationId = "com.ar.sketch.paint.drawing.test"
|
applicationId = "com.ar.sketch.paint.drawing"
|
||||||
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 Sketch_V" + versionName + "(${versionCode})_$timestamp"
|
"AR Sketch_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
@ -29,7 +33,6 @@ android {
|
|||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
isDebuggable = true
|
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
@ -76,7 +79,44 @@ dependencies {
|
|||||||
implementation ("com.squareup.okhttp3:okhttp:4.12.0")
|
implementation ("com.squareup.okhttp3:okhttp:4.12.0")
|
||||||
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
|
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//获取gaid
|
||||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||||
implementation("com.google.android.gms:play-services-appset:16.0.1")
|
implementation("com.google.android.gms:play-services-appset:16.0.1")
|
||||||
|
//开启协程
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
|
||||||
|
implementation ("com.squareup.okhttp3:okhttp:4.12.0")
|
||||||
|
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------MAX (BIGO Ads、Chartboost、DT Exchangc、Googlc Ad Managcr、Google Bidding and Google AdMob、InMobi、ironSource、Liftoff Monetizc、
|
||||||
|
//Meta Audience Network、Moloco、Panglc、Unity Ads)
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
|
||||||
|
implementation("com.google.firebase:firebase-crashlytics")
|
||||||
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
implementation("com.google.firebase:firebase-config")
|
||||||
|
|
||||||
|
|
||||||
|
implementation("com.applovin:applovin-sdk:+")
|
||||||
|
implementation("com.applovin.mediation:bigoads-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:chartboost-adapter:+")
|
||||||
|
implementation("com.google.android.gms:play-services-base:16.1.0")
|
||||||
|
implementation("com.applovin.mediation:fyber-adapter:+")
|
||||||
|
//Google Ad Manager
|
||||||
|
// implementation("com.applovin.mediation:google-ad-manager-adapter:+")
|
||||||
|
|
||||||
|
//Google Bidding and Google AdMob
|
||||||
|
// implementation("com.applovin.mediation:google-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:inmobi-adapter:+")
|
||||||
|
implementation("com.squareup.picasso:picasso:2.71828")
|
||||||
|
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||||
|
implementation("com.applovin.mediation:ironsource-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:vungle-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:facebook-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:moloco-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:bytedance-adapter:+")
|
||||||
|
implementation("com.applovin.mediation:unityads-adapter:+")
|
||||||
|
|
||||||
}
|
}
|
||||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "863983910100",
|
||||||
|
"project_id": "ar-sketch-93bb3",
|
||||||
|
"storage_bucket": "ar-sketch-93bb3.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:863983910100:android:a17d8e619d2d1c3dc40f41",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.ar.sketch.paint.drawing"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAwWqr1NV8744O6NDUj5-LzLwc8_oRsVJY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
@ -20,3 +20,5 @@
|
|||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,10 +23,10 @@
|
|||||||
<!-- <!– 近似位置(WiFi、蜂窝) 运行时请求权限 –>-->
|
<!-- <!– 近似位置(WiFi、蜂窝) 运行时请求权限 –>-->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
|
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="com.ar.sketch.paint.drawing.tool.MyArApp"
|
android:name=".tool.MyArApp"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
@ -37,15 +37,7 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.PaintingHelper"
|
android:theme="@style/Theme.PaintingHelper"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
|
||||||
android:name="com.ar.sketch.paint.drawing.act.UploadActivity"
|
|
||||||
android:exported="true" >
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.ar.sketch.paint.drawing.act.PageList"
|
android:name="com.ar.sketch.paint.drawing.act.PageList"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
@ -58,11 +50,11 @@
|
|||||||
android:name="com.ar.sketch.paint.drawing.act.PageWelcome"
|
android:name="com.ar.sketch.paint.drawing.act.PageWelcome"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait">
|
||||||
<!-- <intent-filter>-->
|
<intent-filter>
|
||||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<!-- </intent-filter>-->
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.ar.sketch.paint.drawing.act.PagePreview"
|
android:name="com.ar.sketch.paint.drawing.act.PagePreview"
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import android.view.View;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.ar.sketch.paint.drawing.ad.MaxManager;
|
||||||
|
import com.ar.sketch.paint.drawing.ad.onAdAfterAction;
|
||||||
import com.ar.sketch.paint.drawing.adapter.RecyclerList;
|
import com.ar.sketch.paint.drawing.adapter.RecyclerList;
|
||||||
import com.ar.sketch.paint.drawing.databinding.PageItemBinding;
|
import com.ar.sketch.paint.drawing.databinding.PageItemBinding;
|
||||||
import com.ar.sketch.paint.drawing.tool.ItemDec;
|
import com.ar.sketch.paint.drawing.tool.ItemDec;
|
||||||
@ -24,14 +26,19 @@ public class PageList extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
MaxManager.onLoadAd();
|
||||||
preViewBinding = PageItemBinding.inflate(getLayoutInflater());
|
preViewBinding = PageItemBinding.inflate(getLayoutInflater());
|
||||||
setContentView(preViewBinding.getRoot());
|
setContentView(preViewBinding.getRoot());
|
||||||
Utils.setStatusBarTextColor(this, true);
|
Utils.setStatusBarTextColor(this, true);
|
||||||
dirStr = getIntent().getStringExtra(MyArApp.Key_ViewDir);
|
dirStr = getIntent().getStringExtra(MyArApp.Key_ViewDir);
|
||||||
preViewBinding.categoryName.setText(dirStr.substring(dirStr.lastIndexOf("_") + 1));
|
preViewBinding.categoryName.setText(dirStr.substring(dirStr.lastIndexOf("_") + 1));
|
||||||
|
|
||||||
|
MaxManager.startShowMaxAd(PageList.this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
onInitList();
|
onInitList();
|
||||||
onInitClick();
|
onInitClick();
|
||||||
@ -51,7 +58,14 @@ public class PageList extends AppCompatActivity {
|
|||||||
preViewBinding.back.setOnClickListener(new View.OnClickListener() {
|
preViewBinding.back.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finish();
|
|
||||||
|
MaxManager.startShowMaxAd(PageList.this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,8 @@ import com.ar.sketch.paint.drawing.frag.PageFavorite;
|
|||||||
import com.ar.sketch.paint.drawing.frag.PageHome;
|
import com.ar.sketch.paint.drawing.frag.PageHome;
|
||||||
import com.ar.sketch.paint.drawing.frag.PageImport;
|
import com.ar.sketch.paint.drawing.frag.PageImport;
|
||||||
import com.ar.sketch.paint.drawing.tool.Utils;
|
import com.ar.sketch.paint.drawing.tool.Utils;
|
||||||
|
import com.ar.sketch.paint.drawing.upload.Http;
|
||||||
|
import com.ar.sketch.paint.drawing.upload.SaveUtils;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -43,6 +45,12 @@ public class PageMain extends AppCompatActivity {
|
|||||||
listFragment.add(PageImport.newInstance());
|
listFragment.add(PageImport.newInstance());
|
||||||
listFragment.add(PageFavorite.newInstance());
|
listFragment.add(PageFavorite.newInstance());
|
||||||
|
|
||||||
|
boolean post = SaveUtils.INSTANCE.isPost();
|
||||||
|
if(!post){
|
||||||
|
Http.INSTANCE.makeGetRequest(PageMain.this);
|
||||||
|
SaveUtils.INSTANCE.setPost(true);
|
||||||
|
}
|
||||||
|
|
||||||
onTabInit();
|
onTabInit();
|
||||||
binding.viewPager2.setUserInputEnabled(false);
|
binding.viewPager2.setUserInputEnabled(false);
|
||||||
binding.viewPager2.setAdapter(new FragmentStateAdapter(this) {
|
binding.viewPager2.setAdapter(new FragmentStateAdapter(this) {
|
||||||
|
|||||||
@ -31,6 +31,8 @@ import androidx.camera.view.PreviewView;
|
|||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.ar.sketch.paint.drawing.ad.MaxManager;
|
||||||
|
import com.ar.sketch.paint.drawing.ad.onAdAfterAction;
|
||||||
import com.ar.sketch.paint.drawing.dbmanager.MyDataBase;
|
import com.ar.sketch.paint.drawing.dbmanager.MyDataBase;
|
||||||
import com.ar.sketch.paint.drawing.tool.Utils;
|
import com.ar.sketch.paint.drawing.tool.Utils;
|
||||||
import com.ar.sketch.paint.drawing.tool.MyArApp;
|
import com.ar.sketch.paint.drawing.tool.MyArApp;
|
||||||
@ -78,7 +80,7 @@ public class PagePreview extends AppCompatActivity implements View.OnTouchListen
|
|||||||
Utils.setStatusBarTextColor(this, true);
|
Utils.setStatusBarTextColor(this, true);
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
isMain = intent.getBooleanExtra(MyArApp.Key_ISMAIN, false);
|
isMain = intent.getBooleanExtra(MyArApp.Key_ISMAIN, false);
|
||||||
|
MaxManager.onLoadAd();
|
||||||
|
|
||||||
previewView = findViewById(R.id.preview);
|
previewView = findViewById(R.id.preview);
|
||||||
imageView = findViewById(R.id.image);
|
imageView = findViewById(R.id.image);
|
||||||
@ -90,7 +92,12 @@ public class PagePreview extends AppCompatActivity implements View.OnTouchListen
|
|||||||
imZoom = findViewById(R.id.im_zoom);
|
imZoom = findViewById(R.id.im_zoom);
|
||||||
imFavorite = findViewById(R.id.im_favorite);
|
imFavorite = findViewById(R.id.im_favorite);
|
||||||
|
|
||||||
|
MaxManager.startShowMaxAd(PagePreview.this, new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
curBitmapPath = getIntent().getStringExtra(MyArApp.Key_Camera);
|
curBitmapPath = getIntent().getStringExtra(MyArApp.Key_Camera);
|
||||||
|
|
||||||
@ -199,13 +206,12 @@ public class PagePreview extends AppCompatActivity implements View.OnTouchListen
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v.equals(imBack)) {
|
if (v.equals(imBack)) {
|
||||||
|
MaxManager.startShowMaxAd(PagePreview.this, new onAdAfterAction() {
|
||||||
if (isMain) {
|
@Override
|
||||||
finish();
|
public void onAction() {
|
||||||
} else {
|
finish();
|
||||||
finish();
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
showNoPermission();
|
showNoPermission();
|
||||||
@ -216,8 +222,14 @@ public class PagePreview extends AppCompatActivity implements View.OnTouchListen
|
|||||||
flashIm.setSelected(!selected);
|
flashIm.setSelected(!selected);
|
||||||
camera.getCameraControl().enableTorch(!selected);
|
camera.getCameraControl().enableTorch(!selected);
|
||||||
} else if (v.equals(imPhoto)) {
|
} else if (v.equals(imPhoto)) {
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
MaxManager.startShowMaxAd(PagePreview.this, new onAdAfterAction() {
|
||||||
intentActivityResultLauncher.launch(intent);
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
intentActivityResultLauncher.launch(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else if (v.equals(imZoom)) {
|
} else if (v.equals(imZoom)) {
|
||||||
if (seekBar.getVisibility() == View.VISIBLE) {
|
if (seekBar.getVisibility() == View.VISIBLE) {
|
||||||
seekBar.setVisibility(View.GONE);
|
seekBar.setVisibility(View.GONE);
|
||||||
@ -225,15 +237,21 @@ public class PagePreview extends AppCompatActivity implements View.OnTouchListen
|
|||||||
seekBar.setVisibility(View.VISIBLE);
|
seekBar.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}else if(v.equals(imFavorite)){
|
}else if(v.equals(imFavorite)){
|
||||||
boolean selected = imFavorite.isSelected();
|
MaxManager.startShowMaxAd(PagePreview.this, new onAdAfterAction() {
|
||||||
imFavorite.setSelected(!selected);
|
@Override
|
||||||
boolean newSelect = imFavorite.isSelected();
|
public void onAction() {
|
||||||
if(newSelect){
|
boolean selected = imFavorite.isSelected();
|
||||||
MyDataBase.insertOrUpdateLike(curBitmapPath);
|
imFavorite.setSelected(!selected);
|
||||||
}else {
|
boolean newSelect = imFavorite.isSelected();
|
||||||
MyDataBase.deleteLike(curBitmapPath);
|
if(newSelect){
|
||||||
|
MyDataBase.insertOrUpdateLike(curBitmapPath);
|
||||||
|
}else {
|
||||||
|
MyDataBase.deleteLike(curBitmapPath);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,18 @@ import android.os.CountDownTimer;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.ar.sketch.paint.drawing.ad.WelComManager;
|
||||||
import com.ar.sketch.paint.drawing.databinding.PageWelcomeBinding;
|
import com.ar.sketch.paint.drawing.databinding.PageWelcomeBinding;
|
||||||
import com.ar.sketch.paint.drawing.tool.Utils;
|
import com.ar.sketch.paint.drawing.tool.Utils;
|
||||||
|
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function0;
|
||||||
|
import kotlin.jvm.functions.Function1;
|
||||||
|
|
||||||
public class PageWelcome extends AppCompatActivity {
|
public class PageWelcome extends AppCompatActivity {
|
||||||
|
|
||||||
private PageWelcomeBinding binding;
|
private PageWelcomeBinding binding;
|
||||||
private long time = 1000;
|
private long time = 12000;
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
|
|
||||||
@ -25,20 +30,22 @@ public class PageWelcome extends AppCompatActivity {
|
|||||||
Utils.setStatusBarTextColor(this, true);
|
Utils.setStatusBarTextColor(this, true);
|
||||||
|
|
||||||
|
|
||||||
countDownTimer= new CountDownTimer(time,100) {
|
countDownTimer = WelComManager.initTimer(PageWelcome.this, time, new Function1<Long, Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
public Unit invoke(Long aLong) {
|
||||||
int progressPercentage = (int) ((100 * millisUntilFinished) / time);
|
int progressPercentage = (int) ((100 * aLong) / time);
|
||||||
int Percentage = 100 - progressPercentage;
|
int Percentage = 100 - progressPercentage;
|
||||||
binding.loadingPb.setProgress(Percentage);
|
binding.loadingPb.setProgress(Percentage);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}, new Function0<Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {
|
public Unit invoke() {
|
||||||
enterMain();
|
enterMain();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
countDownTimer.start();
|
|
||||||
}
|
}
|
||||||
private void enterMain() {
|
private void enterMain() {
|
||||||
binding.loadingPb.setProgress(100);
|
binding.loadingPb.setProgress(100);
|
||||||
|
|||||||
@ -1,73 +0,0 @@
|
|||||||
package com.ar.sketch.paint.drawing.act
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
|
|
||||||
import com.ar.sketch.paint.drawing.databinding.ActivityUploadBinding
|
|
||||||
import com.ar.sketch.paint.drawing.tool.Http
|
|
||||||
import com.ar.sketch.paint.drawing.tool.Upload
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
|
|
||||||
class UploadActivity : AppCompatActivity() {
|
|
||||||
|
|
||||||
|
|
||||||
private lateinit var requestPermissionLauncher: ActivityResultLauncher<Array<String>>
|
|
||||||
private val permissions = arrayOf(
|
|
||||||
Manifest.permission.READ_PHONE_STATE,
|
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
|
||||||
)
|
|
||||||
private lateinit var binding: ActivityUploadBinding
|
|
||||||
|
|
||||||
@SuppressLint("SuspiciousIndentation")
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
binding = ActivityUploadBinding.inflate(layoutInflater)
|
|
||||||
setContentView(binding.root)
|
|
||||||
|
|
||||||
// requestPermissionLauncher =
|
|
||||||
// registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { result ->
|
|
||||||
// val phoneGranted: Boolean = result[Manifest.permission.READ_PHONE_STATE] == true
|
|
||||||
// val locationGranted: Boolean =
|
|
||||||
// result[Manifest.permission.ACCESS_FINE_LOCATION] == true
|
|
||||||
// val coarseLocation: Boolean =
|
|
||||||
// result[Manifest.permission.ACCESS_COARSE_LOCATION] == true
|
|
||||||
//
|
|
||||||
// Log.e("Permission", "1=${phoneGranted} 2= ${locationGranted} 3=$coarseLocation")
|
|
||||||
// if (phoneGranted && locationGranted && coarseLocation) {
|
|
||||||
// Upload.getData(this)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (ContextCompat.checkSelfPermission(
|
|
||||||
// this,
|
|
||||||
// Manifest.permission.READ_PHONE_STATE
|
|
||||||
// ) != PackageManager.PERMISSION_GRANTED
|
|
||||||
// || ContextCompat.checkSelfPermission(
|
|
||||||
// this,
|
|
||||||
// Manifest.permission.ACCESS_FINE_LOCATION
|
|
||||||
// ) != PackageManager.PERMISSION_GRANTED
|
|
||||||
// ) {
|
|
||||||
//
|
|
||||||
//// requestPermissionLauncher.launch(permissions)
|
|
||||||
// } else {
|
|
||||||
// Upload.getData(this)
|
|
||||||
// }
|
|
||||||
binding.btn.setOnClickListener {
|
|
||||||
Http.makeGetRequest(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.ar.sketch.paint.drawing.ad;
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
|
||||||
|
public interface MaxListener {
|
||||||
|
void onFail(MaxAd ad);
|
||||||
|
|
||||||
|
void onShowSuccess(MaxAd ad);
|
||||||
|
|
||||||
|
void onHidden();
|
||||||
|
}
|
||||||
174
app/src/main/java/com/ar/sketch/paint/drawing/ad/MaxManager.java
Normal file
174
app/src/main/java/com/ar/sketch/paint/drawing/ad/MaxManager.java
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
package com.ar.sketch.paint.drawing.ad;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
|
||||||
|
import com.applovin.mediation.MaxAd;
|
||||||
|
import com.applovin.mediation.MaxAdListener;
|
||||||
|
import com.applovin.mediation.MaxError;
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||||
|
import com.ar.sketch.paint.drawing.tool.MyArApp;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MaxManager {
|
||||||
|
|
||||||
|
private static final String one_AD = "7c4b34325d69456c";
|
||||||
|
private static final String two_Ad = "f1ada735b400f486";
|
||||||
|
private static final String three_ad = "12f02849b311236f";
|
||||||
|
|
||||||
|
|
||||||
|
public static final int type_no_cache = 0;
|
||||||
|
public static final int type_has_cache = 1;
|
||||||
|
public static final int type_show_success = 2;
|
||||||
|
public static final int type_show_close = 3;
|
||||||
|
public static final int type_show_fail = 4;
|
||||||
|
private static final String Ad_TAG = MyArApp.TAG;
|
||||||
|
private static List<MaxInterstitialAd> adList = new ArrayList<>();
|
||||||
|
|
||||||
|
public static MaxInterstitialAd getAd(List<MaxInterstitialAd> list) {
|
||||||
|
Collections.shuffle(list);
|
||||||
|
for (MaxInterstitialAd ad : list) {
|
||||||
|
if (ad.isReady()) {
|
||||||
|
return ad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<MaxInterstitialAd> onLoadAd() {
|
||||||
|
if (adList.isEmpty()) {
|
||||||
|
MaxInterstitialAd AdT = new MaxInterstitialAd(two_Ad, MyArApp.app);
|
||||||
|
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, MyArApp.app);
|
||||||
|
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, MyArApp.app);
|
||||||
|
adList.add(AdOne);
|
||||||
|
adList.add(AdT);
|
||||||
|
adList.add(AdThree);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MaxInterstitialAd ad : adList) {
|
||||||
|
if (!ad.isReady()) {
|
||||||
|
setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.loadAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return adList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMyListener(MaxInterstitialAd ad, MaxListener maxListener) {
|
||||||
|
ad.setListener(new MaxAdListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(Ad_TAG, "-------onAdLoaded-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(Ad_TAG, "-------onAdDisplayed-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
maxListener.onShowSuccess(maxAd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||||
|
Log.d(Ad_TAG, "-------onAdHidden-----maxAd=" + maxAd.getAdUnitId());
|
||||||
|
maxListener.onHidden();
|
||||||
|
setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.loadAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||||
|
Log.d(Ad_TAG, "-------onAdLoadFailed-----s=" + s+"----maxError="+maxError.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||||
|
maxListener.onFail(maxAd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void ShowAd(Activity activity, onAdStatusListener listener) {
|
||||||
|
MaxInterstitialAd ad = MaxManager.getAd(adList);
|
||||||
|
if (ad == null) {
|
||||||
|
listener.onAdStatus(type_no_cache);
|
||||||
|
} else {
|
||||||
|
listener.onAdStatus(type_has_cache);
|
||||||
|
MaxManager.setMyListener(ad, new MaxListener() {
|
||||||
|
@Override
|
||||||
|
public void onFail(MaxAd ad) {
|
||||||
|
listener.onAdStatus(type_show_fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowSuccess(MaxAd ad) {
|
||||||
|
listener.onAdStatus(type_show_success);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHidden() {
|
||||||
|
listener.onAdStatus(type_show_close);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ad.showAd(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void startShowMaxAd(Activity activity, onAdAfterAction listener) {
|
||||||
|
MaxManager.ShowAd(activity, new onAdStatusListener() {
|
||||||
|
@Override
|
||||||
|
public void onAdStatus(int type) {
|
||||||
|
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
|
||||||
|
if (listener != null)
|
||||||
|
listener.onAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.ar.sketch.paint.drawing.ad
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.IntentFilter
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
|
|
||||||
|
import com.applovin.mediation.ads.MaxInterstitialAd
|
||||||
|
import com.ar.sketch.paint.drawing.tool.MyArApp
|
||||||
|
|
||||||
|
|
||||||
|
object WelComManager {
|
||||||
|
|
||||||
|
private lateinit var timer: CountDownTimer
|
||||||
|
|
||||||
|
private var need_Show = true
|
||||||
|
|
||||||
|
private lateinit var lists: List<MaxInterstitialAd>
|
||||||
|
private val Ad_TAG: String = MyArApp.TAG
|
||||||
|
@JvmStatic
|
||||||
|
fun initTimer(activity: Activity, countTime: Long,countAction: (Long) -> Unit, goMainAction: () -> Unit): CountDownTimer {
|
||||||
|
need_Show = true
|
||||||
|
timer = object : CountDownTimer(countTime, 100) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
countAction.invoke(millisUntilFinished)
|
||||||
|
if (need_Show) {
|
||||||
|
MaxManager.ShowAd(activity) {
|
||||||
|
Log.d(Ad_TAG, "--onTick----------it=$it")
|
||||||
|
if (it == MaxManager.type_has_cache) {
|
||||||
|
need_Show = false
|
||||||
|
}
|
||||||
|
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail) {
|
||||||
|
Log.d(Ad_TAG, "--onTick---------enter")
|
||||||
|
goMainAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
if (need_Show) {
|
||||||
|
MaxManager.ShowAd(activity) {
|
||||||
|
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail || it == MaxManager.type_no_cache) {
|
||||||
|
Log.d(Ad_TAG, "--onFinish---------enter")
|
||||||
|
goMainAction.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startAd(activity)
|
||||||
|
return timer
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startAd(activity: Activity) {
|
||||||
|
if (!MyArApp.initSDkOK) {
|
||||||
|
LocalBroadcastManager.getInstance(activity)
|
||||||
|
.registerReceiver(object : BroadcastReceiver() {
|
||||||
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
lists = MaxManager.onLoadAd()
|
||||||
|
timer.start()
|
||||||
|
Log.d(Ad_TAG, "------------1sucess")
|
||||||
|
}
|
||||||
|
}, IntentFilter(MyArApp.initAction))
|
||||||
|
} else {
|
||||||
|
lists = MaxManager.onLoadAd()
|
||||||
|
timer.start()
|
||||||
|
Log.d(Ad_TAG, "------------2sucess")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.ar.sketch.paint.drawing.ad;
|
||||||
|
|
||||||
|
public interface onAdAfterAction {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.ar.sketch.paint.drawing.ad;
|
||||||
|
|
||||||
|
public interface onAdStatusListener {
|
||||||
|
|
||||||
|
void onAdStatus(int type);
|
||||||
|
}
|
||||||
@ -11,6 +11,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
|||||||
|
|
||||||
import com.ar.sketch.paint.drawing.act.PageList;
|
import com.ar.sketch.paint.drawing.act.PageList;
|
||||||
import com.ar.sketch.paint.drawing.act.PagePreview;
|
import com.ar.sketch.paint.drawing.act.PagePreview;
|
||||||
|
import com.ar.sketch.paint.drawing.ad.MaxManager;
|
||||||
import com.ar.sketch.paint.drawing.adapter.ListMain;
|
import com.ar.sketch.paint.drawing.adapter.ListMain;
|
||||||
import com.ar.sketch.paint.drawing.api.OnClick;
|
import com.ar.sketch.paint.drawing.api.OnClick;
|
||||||
import com.ar.sketch.paint.drawing.databinding.FragmentHomeBinding;
|
import com.ar.sketch.paint.drawing.databinding.FragmentHomeBinding;
|
||||||
@ -31,6 +32,11 @@ public class PageHome extends Fragment implements OnClick {
|
|||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
MaxManager.onLoadAd();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
|||||||
@ -20,6 +20,8 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
import com.ar.sketch.paint.drawing.R;
|
import com.ar.sketch.paint.drawing.R;
|
||||||
|
import com.ar.sketch.paint.drawing.ad.MaxManager;
|
||||||
|
import com.ar.sketch.paint.drawing.ad.onAdAfterAction;
|
||||||
import com.ar.sketch.paint.drawing.adapter.ListImport;
|
import com.ar.sketch.paint.drawing.adapter.ListImport;
|
||||||
import com.ar.sketch.paint.drawing.databinding.FragmentImportBinding;
|
import com.ar.sketch.paint.drawing.databinding.FragmentImportBinding;
|
||||||
import com.ar.sketch.paint.drawing.dbmanager.ImportData;
|
import com.ar.sketch.paint.drawing.dbmanager.ImportData;
|
||||||
@ -71,7 +73,13 @@ public class PageImport extends Fragment {
|
|||||||
binding.btnImport.setOnClickListener(new View.OnClickListener() {
|
binding.btnImport.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
checkPermission();
|
MaxManager.startShowMaxAd(requireActivity(), new onAdAfterAction() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
checkPermission();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,16 @@
|
|||||||
package com.ar.sketch.paint.drawing.tool;
|
package com.ar.sketch.paint.drawing.tool;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
|
import com.applovin.sdk.AppLovinMediationProvider;
|
||||||
|
import com.applovin.sdk.AppLovinSdk;
|
||||||
|
import com.applovin.sdk.AppLovinSdkConfiguration;
|
||||||
|
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
|
||||||
import com.ar.sketch.paint.drawing.dbmanager.MyDataBase;
|
import com.ar.sketch.paint.drawing.dbmanager.MyDataBase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -20,10 +27,9 @@ public class MyArApp extends Application {
|
|||||||
|
|
||||||
public static MyArApp app;
|
public static MyArApp app;
|
||||||
|
|
||||||
// private String APPId ="h67505d35951dc";
|
public static boolean initSDkOK = false;
|
||||||
//
|
public static String initAction = "ACTION_INIT";
|
||||||
// private String AppKey ="a81d17e5cc10cd96a65fe75c0ffd15334";
|
private String SDK_KEY = "vNzLVnoFhzyl4hLzTNPEaBVQE8_Oz_8JkiuKmiRamrxGHN3WtWEGH7Mx20POJPvaycKl1PumsEVkJXhRAse1wn";
|
||||||
|
|
||||||
public static Typeface defaultFont;
|
public static Typeface defaultFont;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -32,30 +38,24 @@ public class MyArApp extends Application {
|
|||||||
app = this;
|
app = this;
|
||||||
AssetManager assets = getAssets();
|
AssetManager assets = getAssets();
|
||||||
defaultFont = Typeface.createFromAsset(assets, "myfont.ttf");
|
defaultFont = Typeface.createFromAsset(assets, "myfont.ttf");
|
||||||
|
initMAxSDk();
|
||||||
MyDataBase.init(this);
|
MyDataBase.init(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void initSDk(){
|
private void initMAxSDk() {
|
||||||
// ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
|
||||||
//
|
AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(SDK_KEY, this)
|
||||||
// @Override
|
.setMediationProvider(AppLovinMediationProvider.MAX)
|
||||||
// public void onResultCallback(boolean isEU) {
|
.build();
|
||||||
// if (isEU && ATSDK.getGDPRDataLevel(MyApplication.this) == ATSDK.UNKNOWN) {
|
AppLovinSdk.getInstance(this).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
|
||||||
// ATSDK.showGdprAuth(MyApplication.this);
|
@Override
|
||||||
// }
|
public void onSdkInitialized(AppLovinSdkConfiguration appLovinSdkConfiguration) {
|
||||||
//
|
initSDkOK = true;
|
||||||
// }
|
LocalBroadcastManager.getInstance(MyArApp.this).sendBroadcast(new Intent(initAction));
|
||||||
//
|
}
|
||||||
// @Override
|
});
|
||||||
// public void onErrorCallback(String errorMsg) {
|
}
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// ATSDK.init( this, APPId, AppKey);
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static String Class_Animals = "res_Animals";
|
public static String Class_Animals = "res_Animals";
|
||||||
public static String Class_birds = "res_Birds";
|
public static String Class_birds = "res_Birds";
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
package com.ar.sketch.paint.drawing.upload
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.provider.Contacts.SettingsColumns.KEY
|
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import com.ar.sketch.paint.drawing.tool.Upload
|
|
||||||
import java.security.SecureRandom
|
import java.security.SecureRandom
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
import javax.crypto.KeyGenerator
|
import javax.crypto.KeyGenerator
|
||||||
@ -1,6 +1,5 @@
|
|||||||
package com.ar.sketch.paint.drawing.tool
|
package com.ar.sketch.paint.drawing.upload
|
||||||
|
|
||||||
import AESUtils
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -29,8 +28,6 @@ object Http {
|
|||||||
val logging = HttpLoggingInterceptor()
|
val logging = HttpLoggingInterceptor()
|
||||||
logging.setLevel(HttpLoggingInterceptor.Level.BODY)
|
logging.setLevel(HttpLoggingInterceptor.Level.BODY)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
val data = Upload.getData(context)
|
val data = Upload.getData(context)
|
||||||
|
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.ar.sketch.paint.drawing.upload
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import com.ar.sketch.paint.drawing.tool.MyArApp
|
||||||
|
|
||||||
|
|
||||||
|
object SaveUtils {
|
||||||
|
|
||||||
|
|
||||||
|
val IS_POST = "is_post"
|
||||||
|
private var shared: SharedPreferences? = null
|
||||||
|
|
||||||
|
var isPost: Boolean
|
||||||
|
get() = queryBoolean(
|
||||||
|
IS_POST,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
set(value) {
|
||||||
|
saveBoolean(IS_POST, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private fun getShared(): SharedPreferences {
|
||||||
|
if (shared == null) {
|
||||||
|
shared = MyArApp.app.getSharedPreferences("", Context.MODE_PRIVATE)
|
||||||
|
}
|
||||||
|
return shared!!
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun saveBoolean(key: String, value: Boolean) {
|
||||||
|
getShared().edit()
|
||||||
|
.putBoolean(key, value).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryBoolean(key: String, defaultValue: Boolean): Boolean {
|
||||||
|
return getShared()
|
||||||
|
.getBoolean(key, defaultValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.ar.sketch.paint.drawing.tool
|
package com.ar.sketch.paint.drawing.upload
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
@ -17,19 +17,12 @@ import android.text.format.Formatter
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient
|
import com.google.android.gms.ads.identifier.AdvertisingIdClient
|
||||||
import com.google.android.gms.appset.AppSet
|
|
||||||
import com.google.android.gms.appset.AppSetIdInfo
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
object Upload {
|
object Upload {
|
||||||
|
|
||||||
@ -2,12 +2,13 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("com.android.application") version "8.1.0" apply false
|
id("com.android.application") version "8.1.0" apply false
|
||||||
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
|
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
|
||||||
// id("com.google.gms.google-services") version "4.3.15" apply false
|
id("com.google.gms.google-services") version "4.3.15" apply false
|
||||||
// id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||||
}
|
}
|
||||||
buildscript{
|
buildscript{
|
||||||
dependencies{
|
dependencies{
|
||||||
|
|
||||||
classpath("io.objectbox:objectbox-gradle-plugin:4.0.3")
|
classpath("io.objectbox:objectbox-gradle-plugin:4.0.3")
|
||||||
|
classpath ("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,7 +3,7 @@ pluginManagement {
|
|||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
maven { url = uri("https://artifacts.applovin.com/android") }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13,8 +13,9 @@ dependencyResolutionManagement {
|
|||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
|
maven { url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/") }
|
||||||
|
maven { url = uri("https://android-sdk.is.com") }
|
||||||
|
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user