feat: use custom base activity
This commit is contained in:
parent
6f4b76353a
commit
e73dea21a9
5 changed files with 22 additions and 9 deletions
18
app/src/main/java/com/dazuoye/filemanager/BaseActivity.kt
Normal file
18
app/src/main/java/com/dazuoye/filemanager/BaseActivity.kt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package com.dazuoye.filemanager
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.dazuoye.filemanager.fileSystem.DeleteHelper.Companion.delete
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
open class BaseActivity: AppCompatActivity() {
|
||||||
|
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
val clipFile = File(this.cacheDir,"clipboard")
|
||||||
|
if (clipFile.exists()){
|
||||||
|
delete(clipFile.path)
|
||||||
|
}
|
||||||
|
System.gc()
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ import kotlinx.coroutines.launch
|
||||||
import org.apache.commons.io.IOUtils
|
import org.apache.commons.io.IOUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class document_page : AppCompatActivity() {
|
class document_page : BaseActivity() {
|
||||||
private var documentList = listOf<String>()
|
private var documentList = listOf<String>()
|
||||||
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Documents/pasted"
|
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Documents/pasted"
|
||||||
private var listOrderType = 0
|
private var listOrderType = 0
|
||||||
|
|
|
@ -35,7 +35,7 @@ import kotlinx.coroutines.launch
|
||||||
import org.apache.commons.io.IOUtils
|
import org.apache.commons.io.IOUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class music_page : AppCompatActivity() {
|
class music_page : BaseActivity() {
|
||||||
private var musicList = listOf<String>()
|
private var musicList = listOf<String>()
|
||||||
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Music/pasted"
|
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Music/pasted"
|
||||||
private var listOrderType = 0
|
private var listOrderType = 0
|
||||||
|
|
|
@ -34,7 +34,7 @@ import kotlinx.coroutines.launch
|
||||||
import org.apache.commons.io.IOUtils
|
import org.apache.commons.io.IOUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class picture_page : AppCompatActivity() {
|
class picture_page : BaseActivity() {
|
||||||
private var imageList = listOf<String>()
|
private var imageList = listOf<String>()
|
||||||
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Pictures/pasted"
|
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Pictures/pasted"
|
||||||
private var imageListOrderType = 0
|
private var imageListOrderType = 0
|
||||||
|
@ -292,9 +292,4 @@ class picture_page : AppCompatActivity() {
|
||||||
loadingText(loadingTextView, defaultText, next)
|
loadingText(loadingTextView, defaultText, next)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
System.gc()
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ import kotlinx.coroutines.launch
|
||||||
import org.apache.commons.io.IOUtils
|
import org.apache.commons.io.IOUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class video_page : AppCompatActivity() {
|
class video_page : BaseActivity() {
|
||||||
private var videoList = listOf<String>()
|
private var videoList = listOf<String>()
|
||||||
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Movies/pasted"
|
private val pasteDir = "${Environment.getExternalStorageDirectory().path}/Movies/pasted"
|
||||||
private var videoListOrderType = 0
|
private var videoListOrderType = 0
|
||||||
|
|
Loading…
Reference in a new issue