move some activity intent actions to SimpleActivity
This commit is contained in:
parent
6f11b05e25
commit
3e779c0a98
|
@ -78,7 +78,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
true
|
||||
}
|
||||
R.id.camera -> {
|
||||
startActivity(Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA))
|
||||
launchCamera()
|
||||
true
|
||||
}
|
||||
R.id.show_all -> {
|
||||
|
@ -86,11 +86,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
true
|
||||
}
|
||||
R.id.settings -> {
|
||||
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||
launchSettings()
|
||||
true
|
||||
}
|
||||
R.id.about -> {
|
||||
startActivity(Intent(applicationContext, AboutActivity::class.java))
|
||||
launchAbout()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
|
|
|
@ -5,13 +5,14 @@ import android.app.Activity
|
|||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import com.simplemobiletools.filepicker.extensions.isShowingWritePermissions
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.helpers.Config
|
||||
import com.simplemobiletools.gallery.helpers.OPEN_DOCUMENT_TREE
|
||||
import com.simplemobiletools.gallery.R
|
||||
import java.io.File
|
||||
|
||||
open class SimpleActivity : AppCompatActivity() {
|
||||
|
@ -53,6 +54,18 @@ open class SimpleActivity : AppCompatActivity() {
|
|||
contentResolver.takePersistableUriPermission(treeUri, takeFlags)
|
||||
}
|
||||
|
||||
fun launchCamera() {
|
||||
startActivity(Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA))
|
||||
}
|
||||
|
||||
fun launchSettings() {
|
||||
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||
}
|
||||
|
||||
fun launchAbout() {
|
||||
startActivity(Intent(applicationContext, AboutActivity::class.java))
|
||||
}
|
||||
|
||||
fun isShowingPermDialog(file: File) = isShowingWritePermissions(file, mConfig.treeUri, OPEN_DOCUMENT_TREE)
|
||||
|
||||
fun showSystemUI() {
|
||||
|
|
Loading…
Reference in New Issue