Преглед на файлове

增加学生端清除缓存的逻辑

Pq преди 9 месеца
родител
ревизия
369a84e599

+ 11 - 0
BaseLibrary/src/main/java/com/cooleshow/base/utils/FileUtils.java

@@ -2061,4 +2061,15 @@ public final class FileUtils {
         }
         return "";
     }
+
+    public static boolean clearMusicMergeCache() {
+        try {
+            String material = FileUtils.getCacheDir(Utils.getApp(), "musicmerge");
+            FileUtils.deleteAllInDir(material);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
 }

+ 1 - 0
institution/src/main/java/com/cooleshow/institution/stu/ui/setting/PersonalSettingActivity.java

@@ -150,6 +150,7 @@ public class PersonalSettingActivity extends BaseMVPActivity<JgActivityPersonalS
         if (id == R.id.cl_clear_cache) {
             //清理缓存
             boolean b = WebLoadFileHelper.getInstance().clearCache();
+            boolean b1 = FileUtils.clearMusicMergeCache();
             ToastUtil.getInstance().showShort("清理完成");
             return;
         }

+ 9 - 0
student/src/main/java/com/cooleshow/student/ui/mine/SettingActivity.java

@@ -13,8 +13,11 @@ import com.cooleshow.base.common.WebConstants;
 import com.cooleshow.base.constanst.EventConstants;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.SPUtils;
+import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.base.utils.helper.WebLoadFileHelper;
 import com.cooleshow.base.utils.helper.WebStartHelper;
 import com.cooleshow.student.R;
 import com.cooleshow.student.contract.SettingContract;
@@ -80,6 +83,11 @@ public class SettingActivity extends BaseMVPActivity<ActivitySettingBinding, Set
                 ARouter.getInstance().build(RouterPath.UserCenter.SIGN_OUT_ACCOUNT)
                         .navigation();
                 break;
+            case R.id.cl_clear_cache:
+                boolean b = WebLoadFileHelper.getInstance().clearCache();
+                boolean b1 = FileUtils.clearMusicMergeCache();
+                ToastUtil.getInstance().showShort("清理完成");
+                break;
         }
     }
 
@@ -102,6 +110,7 @@ public class SettingActivity extends BaseMVPActivity<ActivitySettingBinding, Set
         viewBinding.clFeedback.setOnClickListener(this);
         viewBinding.clUserPrivate.setOnClickListener(this);
         viewBinding.tvSignOutAccount.setOnClickListener(this);
+        viewBinding.clClearCache.setOnClickListener(this);
 
         is_detection = SPUtils.getInstance().getBoolean("IS_DETECTION");
         if (is_detection) {

+ 43 - 8
student/src/main/res/layout/activity_setting.xml

@@ -245,30 +245,65 @@
                     app:layout_constraintRight_toRightOf="parent"
                     app:layout_constraintTop_toTopOf="parent" />
 
-
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="1dp"
+                    android:layout_marginLeft="11dp"
+                    android:layout_marginRight="9dp"
+                    android:background="@color/color_f2f2f2"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintLeft_toLeftOf="parent" />
             </androidx.constraintlayout.widget.ConstraintLayout>
 
-            <View
+
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:id="@+id/cl_clear_cache"
                 android:layout_width="match_parent"
-                android:layout_height="1px"
+                android:layout_height="@dimen/dp_50"
                 app:layout_constraintLeft_toLeftOf="parent"
-                app:layout_constraintTop_toBottomOf="@+id/cl_about" />
+                app:layout_constraintTop_toBottomOf="@+id/cl_about">
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="12dp"
+                    android:text="清除缓存"
+                    android:textColor="@color/color_1a1a1a"
+                    android:textSize="@dimen/sp_16"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintLeft_toLeftOf="parent"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+
+                <ImageView
+                    android:layout_width="@dimen/dp_6"
+                    android:layout_height="@dimen/dp_11"
+                    android:layout_marginRight="15dp"
+                    android:background="@drawable/icon_next_right"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintRight_toRightOf="parent"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
         </androidx.constraintlayout.widget.ConstraintLayout>
 
 
         <androidx.constraintlayout.widget.ConstraintLayout
-            android:background="@drawable/bg_white_10dp"
             android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="14dp"
             android:layout_marginTop="12dp"
             android:layout_marginEnd="14dp"
-            android:layout_marginStart="14dp"
-            android:layout_height="wrap_content">
+            android:background="@drawable/bg_white_10dp">
+
             <TextView
                 android:id="@+id/tv_sign_out_account"
-                android:gravity="center_vertical"
                 android:layout_width="match_parent"
                 android:layout_height="50dp"
                 android:layout_marginLeft="12dp"
+                android:gravity="center_vertical"
                 android:text="注销账号"
                 android:textColor="@color/color_1a1a1a"
                 android:textSize="@dimen/sp_16"

+ 2 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/mine/SettingActivity.java

@@ -14,6 +14,7 @@ import com.cooleshow.base.common.WebConstants;
 import com.cooleshow.base.constanst.EventConstants;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.SPUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
@@ -78,6 +79,7 @@ public class SettingActivity extends BaseMVPActivity<ActivitySettingBinding, Set
         }else if(id == R.id.cl_clear_cache){
             //清理缓存
             boolean b = WebLoadFileHelper.getInstance().clearCache();
+            boolean b1 = FileUtils.clearMusicMergeCache();
             ToastUtil.getInstance().showShort("清理完成");
         }
     }