Commit 01c820bc authored by yanglin's avatar yanglin

页面、显示逻辑等代码优化

parent e5ce5cb4
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
android:name=".MyApplication" android:name=".MyApplication"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/ic_app_icon" android:icon="@mipmap/app_icon"
android:label="@string/app_name" android:label="@string/app_name"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/app_icon"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.MyDemo3" android:theme="@style/Theme.MyDemo3"
tools:targetApi="31"> tools:targetApi="31">
......
...@@ -40,7 +40,7 @@ class CleanActivity : AppCompatActivity(), CleanAdapter2.IClean { ...@@ -40,7 +40,7 @@ class CleanActivity : AppCompatActivity(), CleanAdapter2.IClean {
private var mProgress: ProgressBar? = null private var mProgress: ProgressBar? = null
private lateinit var mListView: RecyclerView private lateinit var mListView: RecyclerView
private lateinit var mScaningView: View private lateinit var mScaningView: View
private var mCleanSizeSuccessTv: String = "" private var mCleanSizeSuccessTv: String = "Successfully cleaned up 0B of junk!"
// private var mCleanAdapter: CleanAdapter? = null // private var mCleanAdapter: CleanAdapter? = null
private var mCleanAdapter2: CleanAdapter2? = null private var mCleanAdapter2: CleanAdapter2? = null
......
...@@ -107,8 +107,17 @@ class HomeActivity : AppCompatActivity() { ...@@ -107,8 +107,17 @@ class HomeActivity : AppCompatActivity() {
fun getPermission(){ fun getPermission(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
isPermission = false isPermission = false
}else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R && !isPermission){ }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !isPermission){
PermissionX.init(this).permissions(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
).request(RequestCallback { allGranted, grantedList, deniedList ->
if (allGranted){
isPermission = true
}else{
isPermission = false isPermission = false
}
})
} else { } else {
PermissionX.init(this).permissions( PermissionX.init(this).permissions(
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE,
......
...@@ -136,8 +136,13 @@ class SimilarImagesActivity : AppCompatActivity(), OnClickListener{ ...@@ -136,8 +136,13 @@ class SimilarImagesActivity : AppCompatActivity(), OnClickListener{
mEditBtn.visibility = View.VISIBLE mEditBtn.visibility = View.VISIBLE
// if (mDataBeans.size == 0) { // if (mDataBeans.size == 0) {
if (mSimilarDatas.size == 0) { if (mSimilarDatas.size == 0) {
mRecycleView.visibility = View.GONE
findViewById<View>(R.id.not_file_found_layout).visibility = View.VISIBLE findViewById<View>(R.id.not_file_found_layout).visibility = View.VISIBLE
mEditBtn.visibility = View.GONE
}else{ }else{
findViewById<View>(R.id.not_file_found_layout).visibility = View.GONE
mRecycleView.visibility = View.VISIBLE
mEditBtn.visibility = View.VISIBLE
// mImageItemAdapter?.setData(mDataBeans) // mImageItemAdapter?.setData(mDataBeans)
Log.e("yanglin", "onSmilarScanFinish: mSimilarDatas.size = ${mSimilarDatas.size}", ) Log.e("yanglin", "onSmilarScanFinish: mSimilarDatas.size = ${mSimilarDatas.size}", )
mSimilarBeanAdapter?.setData(mSimilarDatas) mSimilarBeanAdapter?.setData(mSimilarDatas)
......
...@@ -126,7 +126,7 @@ class HomeFragment : Fragment(), OnClickListener{ ...@@ -126,7 +126,7 @@ class HomeFragment : Fragment(), OnClickListener{
}).show() }).show()
customDialog.isShowEditText(false) customDialog.isShowEditText(false)
customDialog.setsTitle("not permission") customDialog.setsTitle("not permission")
customDialog.setsHint("Please grant file management permissions") customDialog.setsHint("Please grant fileAll management permissions")
return false return false
} }
return true return true
......
...@@ -20,15 +20,18 @@ object PermissionUtil { ...@@ -20,15 +20,18 @@ object PermissionUtil {
var LOCATION_PERMISSION = false var LOCATION_PERMISSION = false
fun requestPermission(context: Context?){ fun requestPermission(context: Context?){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
}else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
val intent = Intent().apply { val intent = Intent().apply {
action = Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION action = Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
data = Uri.fromParts("package", context?.packageName, null) data = Uri.fromParts("package", context?.packageName, null)
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
} }
context?.startActivity(intent) context?.startActivity(intent)
}else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val intent = Intent().apply {
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
data = Uri.fromParts("package", context?.packageName, null)
}
context?.startActivity(intent)
}else{ }else{
val intent = Intent().apply { val intent = Intent().apply {
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
...@@ -43,8 +46,10 @@ object PermissionUtil { ...@@ -43,8 +46,10 @@ object PermissionUtil {
//TODO android 14以上 //TODO android 14以上
HomeActivity.isPermission = Environment.isExternalStorageManager() HomeActivity.isPermission = Environment.isExternalStorageManager()
return HomeActivity.isPermission return HomeActivity.isPermission
}else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) { }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
HomeActivity.isPermission = Environment.isExternalStorageManager() HomeActivity.isPermission = Environment.isExternalStorageManager()
&&ActivityCompat.checkSelfPermission(activity!!,
Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
return HomeActivity.isPermission return HomeActivity.isPermission
}else{ }else{
HomeActivity.isPermission = ActivityCompat.checkSelfPermission(activity!!, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED HomeActivity.isPermission = ActivityCompat.checkSelfPermission(activity!!, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
......
...@@ -28,14 +28,19 @@ ...@@ -28,14 +28,19 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="12dp"/> android:layout_marginTop="12dp"/>
<ImageView <ScrollView
android:layout_below="@id/battery_quit_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:scrollbars="none"
android:layout_above="@+id/battery_ad"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout <RelativeLayout
android:id="@+id/battery_info_layout" android:id="@+id/battery_info_layout"
android:layout_below="@+id/battery_quit_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp"> android:layout_height="200dp">
...@@ -80,9 +85,7 @@ ...@@ -80,9 +85,7 @@
android:layout_toRightOf="@+id/battery_image"/> android:layout_toRightOf="@+id/battery_image"/>
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:layout_below="@+id/battery_info_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
...@@ -437,10 +440,26 @@ ...@@ -437,10 +440,26 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
<LinearLayout <LinearLayout
android:id="@+id/battery_ad"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
......
...@@ -48,13 +48,7 @@ ...@@ -48,13 +48,7 @@
android:layout_height="100dp" android:layout_height="100dp"
android:layout_above="@+id/clean_hint_text" android:layout_above="@+id/clean_hint_text"
android:layout_below="@id/clean_quit_btn"> android:layout_below="@id/clean_quit_btn">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/battery_animation_btn"
android:layout_width="match_parent"
android:layout_height="100dp"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/qinglisaomiao" />
<!--1111--> <!--1111-->
</RelativeLayout> </RelativeLayout>
...@@ -96,6 +90,15 @@ ...@@ -96,6 +90,15 @@
</LinearLayout> </LinearLayout>
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/battery_animation_btn"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="20dp"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/qinglisaomiao" />
<LinearLayout <LinearLayout
android:id="@+id/ad_layout" android:id="@+id/ad_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -35,6 +35,13 @@ ...@@ -35,6 +35,13 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
<RelativeLayout
android:id="@+id/not_file_found_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/not_found_layout"/>
</RelativeLayout>
<include <include
......
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".fragment.FileManagerFragment"> tools:context=".fragment.FileManagerFragment">
<ScrollView
android:layout_above="@+id/file_manager_ad"
android:scrollbars="none"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:orientation="vertical"
...@@ -349,7 +355,11 @@ ...@@ -349,7 +355,11 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<RelativeLayout </ScrollView>
<FrameLayout
android:id="@+id/file_manager_ad"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
...@@ -357,9 +367,9 @@ ...@@ -357,9 +367,9 @@
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_gravity="center"
android:src="@mipmap/ad"/> android:src="@mipmap/ad"/>
</RelativeLayout> </FrameLayout>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@drawable/bg_ad_shape"
android:layout_height="58dp">
<ImageView
android:layout_centerVertical="true"
android:id="@+id/notification_icon"
android:src="@mipmap/notification_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginEnd="50dp"
android:layout_toRightOf="@+id/notification_icon">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Battery"
android:textColor="@color/black"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Low"
android:textColor="@color/style_background"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Power"
android:textColor="@color/black"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20%"
android:textColor="@color/style_background"/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/battery_btn"
android:layout_width="49dp"
android:layout_height="24dp"
android:text="View"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="12dp"
android:gravity="center"
android:textColor="@color/white"
android:background="@drawable/bg_btn_sure_shape"/>
</RelativeLayout>
\ No newline at end of file
...@@ -6,12 +6,14 @@ ...@@ -6,12 +6,14 @@
<ImageView <ImageView
android:id="@+id/scan_app_icon" android:id="@+id/scan_app_icon"
android:layout_width="60dp" android:layout_width="60dp"
android:padding="5dp"
android:layout_height="60dp" android:layout_height="60dp"
android:src="@mipmap/scan_app_icon"/> android:src="@mipmap/scan_app_icon"/>
<LinearLayout <LinearLayout
android:layout_toRightOf="@+id/scan_app_icon" android:layout_toRightOf="@+id/scan_app_icon"
android:orientation="vertical" android:orientation="vertical"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginStart="12dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
......
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