Commit f5f7a187 authored by wanglei's avatar wanglei

混淆前定位

parent 91d38355
......@@ -152,8 +152,8 @@ class AppManagerActivity : BaseActivity<ActivityAppManagerBinding>() {
private fun playLottie() {
binding.llLottie.isVisible = true
binding.lottie.imageAssetsFolder = "appmanager_scan/images/"
binding.lottie.setAnimation("appmanager_scan/data.json")
binding.lottie.imageAssetsFolder = "easy_appmanager_scan/images/"
binding.lottie.setAnimation("easy_appmanager_scan/data.json")
binding.lottie.playAnimation()
binding.root.postDelayed({
AdmobUtils.showInterstitialAd(this) {
......
......@@ -52,8 +52,8 @@ class BatteryInfoActivity : BaseActivity<ActivityBatteryInfoBinding>() {
e.printStackTrace()
}
setFilter()
binding.idBatteryLottie.imageAssetsFolder = "battery_scan/images/"
binding.idBatteryLottie.setAnimation("battery_scan/data.json")
binding.idBatteryLottie.imageAssetsFolder = "easy_battery_scan/images/"
binding.idBatteryLottie.setAnimation("easy_battery_scan/data.json")
binding.idBatteryLottie.playAnimation()
binding.root.postDelayed({
playFinish()
......
......@@ -3,8 +3,6 @@ package com.test.easy.easycleanerjunk.activity
import android.annotation.SuppressLint
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Environment
import android.text.format.Formatter
import android.view.View
import android.view.ViewGroup
......@@ -42,10 +40,11 @@ import com.test.easy.easycleanerjunk.databinding.PopupwindowFileFilterBinding
import com.test.easy.easycleanerjunk.helps.BaseActivity
import com.test.easy.easycleanerjunk.helps.LogEx
import com.test.easy.easycleanerjunk.helps.MediaStoreUtils
import com.test.easy.easycleanerjunk.helps.PermissionHelp.checkStorePermission
import com.test.easy.easycleanerjunk.helps.PermissionHelp.requestStorePermission
import com.test.easy.easycleanerjunk.helps.TimeUtils
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.utils.PermissionUtils
import com.test.easy.easycleanerjunk.utils.PermissionUtils.STORAGE
import com.test.easy.easycleanerjunk.view.DialogViews.showGerPermission
import com.test.easy.easycleanerjunk.view.FileDeleteDialog.showFileDeleteDialog
import com.test.easy.easycleanerjunk.view.FileDetailDialog.showFileDetailDialog
import com.test.easy.easycleanerjunk.view.XmlEx.inflate
......@@ -125,6 +124,30 @@ class LargeFileCleanActivity : BaseActivity<ActivityLayoutLargeFileBinding>() {
)
binding.rv.adapter = adapter
binding.tvType.text = fileType
binding.tvSize.text = filterSize
binding.tvTime.text = filterTime
if (checkStorePermission()) {
playLottie()
initList()
} else {
dialog = showGerPermission(deny = { finishToMain() }) {
requestStorePermission(launcher, result = { flag ->
if (flag) {
playLottie()
initList()
} else {
finishToMain()
}
})
}
}
}
@SuppressLint("SetTextI18n")
override fun initListener() {
binding.tvDelete.setOnClickListener {
this.showFileDeleteDialog {
val deleteList = arrayListOf<FileBean>()
......@@ -166,36 +189,8 @@ class LargeFileCleanActivity : BaseActivity<ActivityLayoutLargeFileBinding>() {
finishToMain()
}
}
binding.tvType.text = fileType
binding.tvSize.text = filterSize
binding.tvTime.text = filterTime
val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Environment.isExternalStorageManager()
} else {
PermissionUtils.isGranted(STORAGE)
}
if (flag) {
isplay += 1
playLottie()
}
checkPermission()
}
var isplay = 0
override fun onPermissionsResult(isGranted: Boolean) {
super.onPermissionsResult(isGranted)
if (isGranted) {
isplay += 1
if (isplay == 1) {
playLottie()
}
initList()
} else {
finishToMain()
}
}
private fun initList() {
lifecycleScope.launch(Dispatchers.Main) {
......
......@@ -74,8 +74,8 @@ class NetWorkActivity : BaseActivity<ActivityLayoutNetworkBinding>() {
private fun playLottie() {
binding.idLlNetDh.isVisible = true
binding.idLottieNetwork.imageAssetsFolder = "network_scan/images/"
binding.idLottieNetwork.setAnimation("network_scan/data.json")
binding.idLottieNetwork.imageAssetsFolder = "easy_network_scan/images/"
binding.idLottieNetwork.setAnimation("easy_network_scan/data.json")
binding.idLottieNetwork.playAnimation()
binding.root.postDelayed({
AdmobUtils.showInterstitialAd(this) {
......
......@@ -86,8 +86,8 @@ class PrepareScanActivity : BaseActivity<ActivityLayoutParepreScanBinding>() {
}
start()
}
binding.idJunkScan.imageAssetsFolder = "junk_scan/images/"
binding.idJunkScan.setAnimation("junk_scan/data.json")
binding.idJunkScan.imageAssetsFolder = "easy_junk_scan/images/"
binding.idJunkScan.setAnimation("easy_junk_scan/data.json")
binding.idJunkScan.playAnimation()
binding.root.postDelayed({
AdmobUtils.showInterstitialAd(this) {
......
......@@ -105,8 +105,8 @@ class RecentAppActivity : BaseActivity<ActivityRecentAppBinding>() {
private fun playLottie(showFinish: (() -> Unit)? = null) {
binding.llLottie.isVisible = true
binding.lottie.imageAssetsFolder = "recentapp_scan/images/"
binding.lottie.setAnimation("recentapp_scan/data.json")
binding.lottie.imageAssetsFolder = "easy_recentapp_scan/images/"
binding.lottie.setAnimation("easy_recentapp_scan/data.json")
binding.lottie.playAnimation()
binding.root.postDelayed({
AdmobUtils.showInterstitialAd(this) {
......
package com.test.easy.easycleanerjunk.activity
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import androidx.activity.OnBackPressedCallback
......@@ -31,6 +32,7 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
}
private lateinit var adapter: AppFunctionAdapter
@SuppressLint("SetTextI18n", "NotifyDataSetChanged")
override fun initView() {
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
binding.clTop.updatePadding(top = BarUtils.getStatusBarHeight())
......@@ -40,10 +42,6 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
startActivity(Intent(this, ScanJunkActivity::class.java))
}
// VIRUS_SCAN -> {
// startActivity(Intent(this, VirusActivity::class.java))
// }
RECENT_APP_USAGE -> {
startActivity(Intent(this, RecentAppActivity::class.java))
}
......@@ -88,10 +86,9 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
when (from) {
JUNK_CLEANER -> {
if (intent.getLongExtra("clean_size", 0L) > 0) {
binding.tvInfo.text =
"Cleaned up ${
intent.getLongExtra("clean_size", 0L).toFormatSize(1)
}"
val size = intent.getLongExtra("clean_size", 0L).toFormatSize(1)
binding.tvInfo.text = "Cleaned up $size"
} else {
binding.tvInfo.text = "No junk files found."
}
......@@ -129,13 +126,8 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
}
PHOTO_COMPRESS -> {
binding.tvInfo.text =
"Compress ${intent.getIntExtra("num", 0)} photo, ${
intent.getLongExtra(
"size",
0L
).toFormatSize(1)
} space freed"
val size = intent.getLongExtra("size", 0L).toFormatSize(1)
binding.tvInfo.text = "Compress ${intent.getIntExtra("num", 0)} photo, $size space freed"
}
BATTERY_OPTIMIZER -> {
......
......@@ -71,8 +71,8 @@ class ScanJunkActivity : BaseActivity<ActivityLayoutScanJunkBinding>() {
private fun playLottie() {
startAnimation()
binding.idJunkScan.imageAssetsFolder = "junk_scan/images/"
binding.idJunkScan.setAnimation("junk_scan/data.json")
binding.idJunkScan.imageAssetsFolder = "easy_junk_scan/images/"
binding.idJunkScan.setAnimation("easy_junk_scan/data.json")
binding.idJunkScan.playAnimation()
binding.root.postDelayed({
AdmobUtils.showInterstitialAd(this) {
......
package com.test.easy.easycleanerjunk.activity.photocompress.photo
import android.annotation.SuppressLint
import android.app.Activity
import android.graphics.Bitmap
import android.util.Log
import android.view.View
import android.widget.ImageView
import android.widget.ProgressBar
......@@ -15,13 +15,15 @@ import com.bumptech.glide.Glide
import com.test.easy.easycleanerjunk.R
class PreviewCompressionManager : GalleryLayoutManager.OnItemSelectedListener, CompressionImageUtils.BitmapCallback,
@Suppress("DEPRECATION")
class PreviewCompressionManager(private val mContext: Activity) : GalleryLayoutManager.OnItemSelectedListener,
CompressionImageUtils.BitmapCallback,
OnSeekBarChangeListener {
private val mContext: Activity
private var galleryRecyclerView: RecyclerView? = null
private var galleryAdapter: GalleryAdapter? = null
private val mList: List<PhotoBean>
private val mList: List<PhotoBean> = PhotoCache.getInstance().photoList
private var mTitleView: TextView? = null
private var mPreviewView: RelativeLayout? = null
......@@ -37,21 +39,6 @@ class PreviewCompressionManager : GalleryLayoutManager.OnItemSelectedListener, C
private var mIndex = 0
constructor(mContext: Activity) {
this.mContext = mContext
mList = PhotoCache.getInstance().photoList
galleryRecyclerView = mContext.findViewById(R.id.galleryRecyclerView)
mPreviewView = mContext.findViewById(R.id.preview_view)
mLoadingView = mContext.findViewById(R.id.img_loading)
mBeforeImage = mContext.findViewById(R.id.before_image)
mAfterImage = mContext.findViewById(R.id.after_image)
mBeforeSize = mContext.findViewById(R.id.before_size)
mAfterSize = mContext.findViewById(R.id.after_size)
mTitleView = mContext.findViewById(R.id.title)
mSeekBar = mContext.findViewById(R.id.seekBar)
initView()
}
private fun initView() {
galleryAdapter = GalleryAdapter(mContext, mList)
val manager = GalleryLayoutManager(GalleryLayoutManager.HORIZONTAL)
......@@ -76,8 +63,7 @@ class PreviewCompressionManager : GalleryLayoutManager.OnItemSelectedListener, C
lastRefreshTime = currentTime
mIndex = position
Log.d("glc","")
refreshPreviewImage(true)
refreshPreviewImage(true, 50)
}
override fun onBitmapReady(bitmap: Bitmap?, size: Long, position: Int) {
......@@ -89,17 +75,14 @@ class PreviewCompressionManager : GalleryLayoutManager.OnItemSelectedListener, C
val entity = mList[position]
mPreviewView?.visibility = View.VISIBLE
mLoadingView?.visibility = View.GONE
if (mBeforeImage != null) {
Glide.with(mContext).load(entity.src).into(mBeforeImage)
}
Glide.with(mContext).load(entity.src).into(mBeforeImage)
mBeforeSize?.text = entity.sizeText
mAfterSize?.text = ImagesMediaUtils.formatFileSize(size)
if (mAfterImage != null) {
Glide.with(mContext).load(bitmap).into(mAfterImage)
}
Glide.with(mContext).load(bitmap).into(mAfterImage)
}
}
@SuppressLint("SetTextI18n")
private fun loading(boolean: Boolean) {
mPreviewView?.visibility = View.GONE
mLoadingView?.visibility = View.VISIBLE
......@@ -110,11 +93,6 @@ class PreviewCompressionManager : GalleryLayoutManager.OnItemSelectedListener, C
}
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
when {
progress <= 25 -> seekBar?.progress = 0
progress in 26..75 -> seekBar?.progress = 50
progress > 75 -> seekBar?.progress = 100
}
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
......@@ -124,26 +102,38 @@ class PreviewCompressionManager : GalleryLayoutManager.OnItemSelectedListener, C
override fun onStopTrackingTouch(seekBar: SeekBar?) {
val progress = seekBar?.progress ?: 0
var mode: Int = 0
when {
seekBar?.progress ?: 0 <= 1 -> seekBar?.progress = 0
(seekBar?.progress ?: 0) > 1 && (seekBar?.progress ?: 0) <= 50 -> seekBar?.progress =
50
seekBar?.progress ?: 0 > 50 -> seekBar?.progress = 100
(seekBar?.progress ?: 0) <= 1 -> mode = 0
(seekBar?.progress ?: 0) > 1 && (seekBar?.progress ?: 0) <= 50 -> mode = 50
(seekBar?.progress ?: 0) > 50 -> mode = 100
}
if (progress != lastProgress) {
refreshPreviewImage(false)
refreshPreviewImage(false, mode)
lastProgress = progress
}
}
private fun refreshPreviewImage(boolean: Boolean) {
@SuppressLint("SetTextI18n")
private fun refreshPreviewImage(boolean: Boolean, mode: Int) {
loading(boolean)
val entity = mList[mIndex]
mTitleView?.text = "Preview (" + (mIndex + 1) + "/${mList.size})"
CompressionImageUtils.compressImage(entity.src, mSeekBar.progress, mIndex, this)
CompressionImageUtils.compressImage(entity.src, mode, mIndex, this)
}
fun getMode() = mSeekBar.progress
init {
galleryRecyclerView = mContext.findViewById(R.id.galleryRecyclerView)
mPreviewView = mContext.findViewById(R.id.preview_view)
mLoadingView = mContext.findViewById(R.id.img_loading)
mBeforeImage = mContext.findViewById(R.id.before_image)
mAfterImage = mContext.findViewById(R.id.after_image)
mBeforeSize = mContext.findViewById(R.id.before_size)
mAfterSize = mContext.findViewById(R.id.after_size)
mTitleView = mContext.findViewById(R.id.title)
mSeekBar = mContext.findViewById(R.id.seekBar)
initView()
}
}
\ No newline at end of file
......@@ -50,8 +50,8 @@ class StartCompressionPhotoActivity : BaseActivity<ActivityStartCompressionPhoto
}
private fun playLottie() {
binding.idLottie1.imageAssetsFolder = "imgcompress/images/"
binding.idLottie1.setAnimation("imgcompress/data.json")
binding.idLottie1.imageAssetsFolder = "easy_imgcompress/images/"
binding.idLottie1.setAnimation("easy_imgcompress/data.json")
binding.idLottie1.playAnimation()
Handler().postDelayed({
AdmobUtils.showInterstitialAd(this) {
......
......@@ -25,32 +25,31 @@ class AppFunctionAdapter(val click: (name: String) -> Unit) :
RecyclerView.Adapter<AppFunctionAdapter.JJJ>() {
val list = arrayListOf(
Fun(JUNK_CLEANER, R.drawable.cleanjunk, "Clean junk regularly to free up space", "Clean Up"),
Fun(PHOTO_COMPRESS, R.drawable.photo, "Compress photos to save space", "Compress"),
Fun(LARGE_FILE_CLEANER, R.drawable.large, "Clean large files to free up storage space", "Clean Up"),
Fun(BATTERY_INFO, R.drawable.battery, "View battery usage and details", "Check Now"),
Fun(JUNK_CLEANER, R.mipmap.t_cleanjunk, "Clean junk regularly to free up space", "Clean Up"),
Fun(PHOTO_COMPRESS, R.mipmap.t_photo, "Compress photos to save space", "Compress"),
Fun(LARGE_FILE_CLEANER, R.mipmap.t_large, "Clean large files to free up storage space", "Clean Up"),
Fun(
APP_MANAGER,
R.drawable.appmanager,
R.mipmap.t_appmanager,
"Check apps size and uninstall some apps to release storage space",
"Check Now"
),
Fun(
SIMILAR_PHOTOS,
R.drawable.similar,
R.mipmap.t_similar,
"Check similar photos to release more space",
"Clean Up"
),
Fun(
NOTIFICATION_CLEANER,
R.drawable.notification,
R.mipmap.t_notification,
"Too many annoying notifications? Block and clean",
"Check Now"
),
Fun(RECENT_APP_USAGE, R.drawable.h_recentapp, "Check and manage recently active apps", "View Now"),
Fun(RECENT_APP_USAGE, R.mipmap.t_recent, "Check and manage recently active apps", "View Now"),
Fun(
NETWORK_TRAFFIC,
R.drawable.network,
R.mipmap.t_network,
"View network traffic usage and stop traffic-consuming apps",
"View Now"
)
......
......@@ -40,7 +40,6 @@ data class ConfigBean(
const val ID_JUNK_CLEAN_PUSH = 11001 //清理垃圾
const val ID_BOOST_PUSH = 11002 //性能优化
// const val ID_VIRUS_PUSH = 11003//扫描病毒,trustlook目前不加
const val ID_BATTERY_PUSH = 11004// 电量信息
const val ID_COOL_PUSH = 11005//手机降温
const val ID_LARGE_FILE_PUSH = 11006// 大文件清理
......@@ -53,23 +52,12 @@ data class ConfigBean(
const val ID_CLEAN_NOTIFICATION = 11013//清理通知栏
const val ID_RECENT_USE_APP = 11014//最近使用APP
const val ID_SIMILAR_IMAGE = 11015//清理相似图片
const val ID_CLEAN_SPEAKER = 11016//清理扬声器
// const val ID_BATTERY_OPTIMIZATION = 11017//电池优化,目前是虚假功能
//场景触发push actionId 被动发送
const val ID_WIFI_PUSH = 22001//连接wifi时
const val ID_INSTALL_PACKAGE_PUSH = 22002//安装应用
const val ID_UNINSTALL_PACKAGE_PUSH = 22003//卸载应用
const val ID_CHARGE = 22004//充电
const val ID_LOW_BATTERY_PUSH = 22005//电量低于阈值时
const val ID_LOW_RAM_PUSH = 22007//内存低于阈值
// const val ID_PHONE_ACCELERATE = 22011//手机加速,目前是虚假功能
fun ConfigBean.getActionPushInterval(actionId: Int): Int {
val interval = when (actionId) {
ID_JUNK_CLEAN_PUSH -> push_interval_11001
ID_BOOST_PUSH -> push_interval_11002
// ID_VIRUS_PUSH -> push_interval_11003
ID_BATTERY_PUSH -> push_interval_11004
ID_COOL_PUSH -> push_interval_11005
ID_LARGE_FILE_PUSH -> push_interval_11006
......@@ -82,15 +70,6 @@ data class ConfigBean(
ID_CLEAN_NOTIFICATION -> push_interval_11013
ID_RECENT_USE_APP -> push_interval_11014
ID_SIMILAR_IMAGE -> push_interval_11015
ID_CLEAN_SPEAKER -> push_interval_11016
// ID_BATTERY_OPTIMIZATION -> push_interval_11017
ID_WIFI_PUSH -> push_interval_22001
ID_INSTALL_PACKAGE_PUSH -> push_interval_22002
ID_UNINSTALL_PACKAGE_PUSH -> push_interval_22003
ID_CHARGE -> push_interval_22004
ID_LOW_BATTERY_PUSH -> push_interval_22005
ID_LOW_RAM_PUSH -> push_interval_22007
// ID_PHONE_ACCELERATE -> push_interval_22011
else -> 0
}
return interval
......
package com.test.easy.easycleanerjunk.display
//import com.test.fast.cleanerjunk.bean.ConfigBean.Companion.ID_BATTERY_OPTIMIZATION
//import com.test.fast.cleanerjunk.bean.ConfigBean.Companion.ID_PHONE_ACCELERATE
//import com.test.fast.cleanerjunk.bean.ConfigBean.Companion.ID_VIRUS_PUSH
import android.annotation.SuppressLint
import android.app.PendingIntent
......@@ -22,7 +19,6 @@ import com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_APP_MANAGER
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_BATTERY_PUSH
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_CLEAN_NOTIFICATION
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_CLEAN_SPEAKER
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_JUNK_CLEAN_PUSH
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_LARGE_FILE_PUSH
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_NETWORK_TRAFFIC
......@@ -60,7 +56,6 @@ object NotificationHelper {
ID_CLEAN_NOTIFICATION,
ID_RECENT_USE_APP,
ID_SIMILAR_IMAGE,
ID_CLEAN_SPEAKER,
)
/**
......@@ -125,58 +120,53 @@ object NotificationHelper {
val remoteViews = RemoteViews(packageName, R.layout.notification_common_notify)
when (actionId) {
ID_JUNK_CLEAN_PUSH -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.cleanjunk)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_cleanjunk)
remoteViews.setTextViewText(R.id.tv_desc, "Clean up remaining junk files")
remoteViews.setTextViewText(R.id.tv_btn, "Clean up")
}
ID_LARGE_FILE_PUSH -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.large)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_large)
remoteViews.setTextViewText(R.id.tv_desc, "Clean big files to free up storage space")
remoteViews.setTextViewText(R.id.tv_btn, "Clean up")
}
ID_PHOTO_COMPRESS -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.photo)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_photo)
remoteViews.setTextViewText(R.id.tv_desc, "Compress images to release more space")
remoteViews.setTextViewText(R.id.tv_btn, "Compress")
}
ID_APP_MANAGER -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.appmanager)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_appmanager)
remoteViews.setTextViewText(R.id.tv_desc, "Check apps size and uninstall junk apps to release storage space")
remoteViews.setTextViewText(R.id.tv_btn, "Manage")
}
ID_NETWORK_TRAFFIC -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.network)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_network)
remoteViews.setTextViewText(R.id.tv_desc, "View network traffic usage and stop traffic-consuming apps.")
remoteViews.setTextViewText(R.id.tv_btn, "View")
}
ID_CLEAN_NOTIFICATION -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.notification)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_notification)
remoteViews.setTextViewText(R.id.tv_desc, "Too many annoying notifications? Block and clean")
remoteViews.setTextViewText(R.id.tv_btn, "View")
}
ID_RECENT_USE_APP -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.h_recentapp)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_recent)
remoteViews.setTextViewText(R.id.tv_desc, "Check and manage recently active apps")
remoteViews.setTextViewText(R.id.tv_btn, "Manage")
}
ID_SIMILAR_IMAGE -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.similar)
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.t_similar)
remoteViews.setTextViewText(R.id.tv_desc, "Check similar photos to release more space")
remoteViews.setTextViewText(R.id.tv_btn, "Clean up")
}
ID_CLEAN_SPEAKER -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.drawable.speaker)
remoteViews.setTextViewText(R.id.tv_desc, "Clean the speaker dust and fix the low volume problem")
remoteViews.setTextViewText(R.id.tv_btn, "Clean up")
}
//==================================下面是被动推送的情况===============================================
else -> {
return
......
......@@ -41,7 +41,7 @@ class HomeFragment : BaseFragment<FragmentLayoutHomeBinding>() {
private var rotationValue = 0f
private fun startAnimation() {
animator = ValueAnimator.ofFloat(rotationValue, 360f - rotationValue).apply {
animator = ValueAnimator.ofFloat(rotationValue, rotationValue + 360f).apply {
duration = 1000
repeatMode = ValueAnimator.RESTART
repeatCount = ValueAnimator.INFINITE
......
......@@ -19,6 +19,7 @@ import com.test.easy.easycleanerjunk.utils.BarUtils
import com.test.easy.easycleanerjunk.utils.PermissionUtils
import com.test.easy.easycleanerjunk.utils.PermissionUtils.STORAGE
import com.test.easy.easycleanerjunk.view.DialogViews
import com.test.easy.easycleanerjunk.view.DialogViews.showGerPermission
import org.json.JSONObject
abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
......@@ -90,18 +91,17 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
if (isFinishing || isDestroyed) {
return
}
dialog = DialogViews.showGerPermission(this, {
dialog = showGerPermission(deny = {
finishToMain()
}, allow = {
val intent =
Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
intent.addCategory("android.intent.category.DEFAULT")
intent.data = Uri.parse("package:${packageName}")
permissionLauncher.launch(intent)
PermissionTripActivity.launch(this)
}, {
finishToMain()
})
}
} else {
val permissionUtils = PermissionUtils(this)
if (permissionUtils.checkStoragePermission()) {
......
package com.test.easy.easycleanerjunk.helps
import android.Manifest
import android.annotation.SuppressLint
import android.app.AppOpsManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.provider.Settings
import androidx.core.app.ActivityCompat
object PermissionHelp {
fun Context.checkStorePermission(): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Environment.isExternalStorageManager()
} else {
val readPermission = ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
val writePermission = ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
return readPermission == PackageManager.PERMISSION_GRANTED && writePermission == PackageManager.PERMISSION_GRANTED;
}
}
@SuppressLint("InlinedApi")
fun Context.manageStoreIntent(): Intent {
val intent =
Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
intent.addCategory("android.intent.category.DEFAULT")
intent.data = Uri.parse("package:${packageName}")
return intent
}
@SuppressLint("QueryPermissionsNeeded")
fun Context.requestStorePermission(
launcher: ActivityLauncher,
result: (flag: Boolean) -> Unit,
resolveNoAction: (() -> Unit)? = null,
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val intent = manageStoreIntent()
if (intent.resolveActivity(packageManager) != null) {
launcher.launch(intent) {
result.invoke(checkStorePermission())
}
} else {
resolveNoAction?.invoke()
}
} else {
launcher.launch(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { map ->
result(map.values.all { it })
}
}
}
fun Context.checkUsageAccessSettings(): Boolean {
val appOpsManager = getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
appOpsManager.unsafeCheckOpNoThrow(
AppOpsManager.OPSTR_GET_USAGE_STATS,
android.os.Process.myUid(),
this.packageName
) == AppOpsManager.MODE_ALLOWED
} else {
appOpsManager.checkOpNoThrow(
AppOpsManager.OPSTR_GET_USAGE_STATS,
android.os.Process.myUid(),
this.packageName
) == AppOpsManager.MODE_ALLOWED
}
}
fun Context.usageAccessSettings(): Intent {
val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
intent.addCategory("android.intent.category.DEFAULT")
intent.data = Uri.parse("package:${this.packageName}")
return intent
}
@SuppressLint("QueryPermissionsNeeded")
fun Context.requestUsageAccessSettings(
launcher: ActivityLauncher,
result: (flag: Boolean) -> Unit,
resolveNoAction: (() -> Unit)? = null,
) {
val intent = usageAccessSettings()
if (intent.resolveActivity(packageManager) != null) {
launcher.launch(intent) {
result.invoke(checkUsageAccessSettings())
}
} else {
resolveNoAction?.invoke()
}
}
}
\ No newline at end of file
......@@ -23,8 +23,8 @@ class NotificationGuestActivity : BaseActivity<ActivityLayoutTionGuestBinding>()
BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
binding.idTzGuest.imageAssetsFolder = "tz_scan/images/"
binding.idTzGuest.setAnimation("tz_scan/data.json")
binding.idTzGuest.imageAssetsFolder = "easy_tz_scan/images/"
binding.idTzGuest.setAnimation("easy_tz_scan/data.json")
binding.idTzGuest.playAnimation()
SPUtils.getInstance().put("notification_guest", true)
binding.root.postDelayed({
......
......@@ -13,16 +13,20 @@ import com.test.easy.easycleanerjunk.databinding.DialogPermissonOpenBinding
object DialogViews {
@SuppressLint("SetTextI18n")
fun showGerPermission(context: Context, onClose: (view: Dialog) -> Unit, onClose2: (view: Dialog) -> Unit?): Dialog {
val dialog = Dialog(context)
val binding = DialogPermissonOpenBinding.inflate(LayoutInflater.from(context))
fun Context.showGerPermission(
tittle: String? = null,
deny: ((view: Dialog) -> Unit)? = null,
allow: ((view: Dialog) -> Unit)? = null
): Dialog {
val dialog = Dialog(this)
val binding = DialogPermissonOpenBinding.inflate(LayoutInflater.from(this))
dialog.requestWindowFeature(1)
dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
dialog.window!!.setLayout(-1, -1)
dialog.setCanceledOnTouchOutside(false)
dialog.setCancelable(false)
dialog.setContentView(binding.root)
val str = context.resources.getString(R.string.app_name)
val str = resources.getString(R.string.app_name)
// SpanUtils.with(binding.idTvTt)
// .append("Allow ${str} to access ")
// .setFontSize(13, true)
......@@ -37,16 +41,18 @@ object DialogViews {
// .create()
binding.idTvTt.text =
"Our application needs to access your files to implement junk scanning, image compression, duplicate photos, and large file cleanup. Before you authorize, we need to confirm with you:"
binding.idFullLottie.imageAssetsFolder = "permisson_finger/images/"
binding.idFullLottie.setAnimation("permisson_finger/data.json")
tittle?.let { binding.idTvTt.text = it }
binding.idFullLottie.imageAssetsFolder = "easy_permission_finger/images/"
binding.idFullLottie.setAnimation("easy_permission_finger/data.json")
binding.idFullLottie.playAnimation()
binding.idDeny.setOnClickListener {
dialog.dismiss()
onClose2.invoke(dialog)
deny?.invoke(dialog)
}
binding.idTvAllow.setOnClickListener {
dialog.dismiss()
onClose.invoke(dialog)
allow?.invoke(dialog)
}
dialog.show()
return dialog
......
......@@ -31,8 +31,8 @@ class PermisonPopWindow(private val activity: AppCompatActivity, val onClick: ()
BarUtils.setStatusBarLightMode(activity, false)
showAtLocation(activity.window.decorView, Gravity.BOTTOM, 0, 100)
}
binding.idLottieFullFile.imageAssetsFolder = "permisson_bottom/images/"
binding.idLottieFullFile.setAnimation("permisson_bottom/data.json")
binding.idLottieFullFile.imageAssetsFolder = "easy_permission_bottom/images/"
binding.idLottieFullFile.setAnimation("easy_permission_bottom/data.json")
binding.idLottieFullFile.playAnimation()
binding.idFrameLayout.setOnClickListener {
dismiss()
......
......@@ -154,7 +154,7 @@
android:id="@+id/image_power"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/batteryl"
android:src="@mipmap/batteryl"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.4"
......@@ -301,7 +301,7 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="14.5dp"
android:src="@drawable/time"
android:src="@mipmap/time"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.045"
app:layout_constraintStart_toStartOf="parent"
......@@ -367,7 +367,7 @@
android:id="@+id/appCompatImageView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/hos"
android:src="@mipmap/hos"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.045"
......@@ -421,7 +421,7 @@
android:id="@+id/iv_blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/lanya"
android:src="@mipmap/laya"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.045"
......@@ -473,7 +473,7 @@
android:id="@+id/iv_light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/turn"
android:src="@mipmap/turn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.045"
......@@ -526,7 +526,7 @@
android:id="@+id/iv_gps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/gps"
android:src="@mipmap/daohang"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.045"
......
......@@ -21,7 +21,7 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:drawableEnd="@drawable/xuanze"
android:drawableEnd="@mipmap/xiala_compress"
android:drawablePadding="4dp"
android:textColor="#ff000000"
android:textSize="19sp"
......
......@@ -52,6 +52,7 @@
android:textSize="18sp"
android:textStyle="bold"
app:bl_corners_radius="24dp"
app:bl_solid_color="#5B4DFF"
app:bl_solid_color="@color/theme_color"
tools:ignore="HardcodedText" />
</LinearLayout>
\ No newline at end of file
......@@ -51,7 +51,7 @@
android:id="@+id/id_no_notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/queshentu"
android:drawableTop="@mipmap/notifications"
android:gravity="center"
android:text="No notifications"
android:visibility="gone"
......
......@@ -68,7 +68,7 @@
android:layout_height="74dp"
android:layout_marginVertical="10dp"
android:layout_marginEnd="20dp"
android:src="@drawable/permissiontu"
android:src="@mipmap/permissiontu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/fl_top"
......
......@@ -169,70 +169,73 @@
</RelativeLayout>
<RelativeLayout
<LinearLayout
android:id="@+id/bottom_layout"
android:layout_width="match_parent"
android:layout_height="170dp"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:orientation="vertical"
android:paddingTop="21dp">
<RelativeLayout
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/view_line">
android:max="100"
android:progress="50"
android:progressDrawable="@drawable/seekbar_bg"
android:thumb="@drawable/preview" />
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="50"
android:progressDrawable="@drawable/seekbar_bg"
android:thumb="@drawable/preview" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/seekBar"
android:layout_marginLeft="16dp"
android:layout_gravity="start"
android:layout_marginStart="16dp"
android:text="Best photo quality"
android:textColor="#ff000000"
android:textSize="14sp" />
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/seekBar"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:layout_gravity="end"
android:layout_marginEnd="16dp"
android:text="Most space saved"
android:textColor="#ff000000"
android:textSize="14sp" />
</RelativeLayout>
android:textSize="14sp"
tools:ignore="HardcodedText" />
</FrameLayout>
<View
android:id="@+id/view_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="@+id/btn_compress"
android:layout_marginTop="33dp"
android:background="#EEEEEE" />
android:layout_marginTop="5dp"
android:background="#EEEEEE"
tools:ignore="ObsoleteLayoutParam" />
<TextView
<com.noober.background.view.BLTextView
android:id="@+id/btn_compress"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="43dp"
android:layout_marginTop="8dp"
android:layout_marginRight="43dp"
android:layout_marginBottom="8dp"
android:layout_marginHorizontal="40dp"
android:layout_marginTop="15dp"
android:background="@drawable/btn_blue_bg"
android:gravity="center"
android:text="COMPRESS ALL"
android:textColor="#ffffffff"
android:textSize="19sp"
android:textStyle="bold" />
</RelativeLayout>
android:textStyle="bold"
app:bl_corners_radius="5dp"
app:bl_solid_color="@color/theme_color"
tools:ignore="HardcodedText" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -28,18 +28,18 @@
</FrameLayout>
<LinearLayout
android:visibility="gone"
android:id="@+id/fl_permission"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="290dp"
android:layout_height="130dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/authorizationtu"
android:src="@mipmap/managertu"
tools:ignore="ContentDescription" />
<TextView
......@@ -57,7 +57,6 @@
<TextView
android:id="@+id/tv_authorization"
android:layout_width="289dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
......
app/src/main/res/mipmap-xxhdpi/del.png

3.59 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/del.png

4.19 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/del.png
app/src/main/res/mipmap-xxhdpi/del.png
app/src/main/res/mipmap-xxhdpi/del.png
app/src/main/res/mipmap-xxhdpi/del.png
  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/qlbg.png

3.68 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/qlbg.png

3.54 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/qlbg.png
app/src/main/res/mipmap-xxhdpi/qlbg.png
app/src/main/res/mipmap-xxhdpi/qlbg.png
app/src/main/res/mipmap-xxhdpi/qlbg.png
  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/quanxuan_n.png

996 Bytes | W: | H:

app/src/main/res/mipmap-xxhdpi/quanxuan_n.png

653 Bytes | W: | H:

app/src/main/res/mipmap-xxhdpi/quanxuan_n.png
app/src/main/res/mipmap-xxhdpi/quanxuan_n.png
app/src/main/res/mipmap-xxhdpi/quanxuan_n.png
app/src/main/res/mipmap-xxhdpi/quanxuan_n.png
  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/time.png

3.58 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/time.png

2.84 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/time.png
app/src/main/res/mipmap-xxhdpi/time.png
app/src/main/res/mipmap-xxhdpi/time.png
app/src/main/res/mipmap-xxhdpi/time.png
  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/wifi.png

9.75 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/wifi.png

9.48 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/wifi.png
app/src/main/res/mipmap-xxhdpi/wifi.png
app/src/main/res/mipmap-xxhdpi/wifi.png
app/src/main/res/mipmap-xxhdpi/wifi.png
  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/xing.png

3.29 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/xing.png

2.74 KB | W: | H:

app/src/main/res/mipmap-xxhdpi/xing.png
app/src/main/res/mipmap-xxhdpi/xing.png
app/src/main/res/mipmap-xxhdpi/xing.png
app/src/main/res/mipmap-xxhdpi/xing.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment