Remove android:onClick properties

This commit is contained in:
Matéo Duparc 2021-06-07 16:34:50 +02:00
parent 9cf3e71fd2
commit b0145e0192
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
22 changed files with 317 additions and 366 deletions

View File

@ -9,7 +9,6 @@ import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.text.InputType import android.text.InputType
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.util.Log
import android.util.Size import android.util.Size
import android.view.MotionEvent import android.view.MotionEvent
import android.view.ScaleGestureDetector import android.view.ScaleGestureDetector
@ -44,7 +43,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
private const val CAMERA_PERMISSION_REQUEST_CODE = 1 private const val CAMERA_PERMISSION_REQUEST_CODE = 1
private const val fileNameRandomMin = 100000 private const val fileNameRandomMin = 100000
private const val fileNameRandomMax = 999999 private const val fileNameRandomMax = 999999
private val dateFormat = SimpleDateFormat("yyyyMMdd_HHmmss") private val dateFormat = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US)
private val random = Random() private val random = Random()
} }
private var timerDuration = 0 private var timerDuration = 0
@ -88,6 +87,74 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
cameraExecutor = Executors.newSingleThreadExecutor() cameraExecutor = Executors.newSingleThreadExecutor()
image_ratio.setOnClickListener {
resolutions?.let {
ColoredAlertDialogBuilder(this)
.setTitle(R.string.choose_resolution)
.setSingleChoiceItems(DialogSingleChoiceAdapter(this, it.map { size -> size.toString() }.toTypedArray()), currentResolutionIndex) { dialog, which ->
setupCamera(resolutions!![which])
dialog.dismiss()
currentResolutionIndex = which
}
.setNegativeButton(R.string.cancel, null)
.show()
}
}
image_timer.setOnClickListener {
val dialogEditTextView = layoutInflater.inflate(R.layout.dialog_edit_text, null)
val dialogEditText = dialogEditTextView.findViewById<EditText>(R.id.dialog_edit_text)
dialogEditText.inputType = InputType.TYPE_CLASS_NUMBER
val dialog = ColoredAlertDialogBuilder(this)
.setView(dialogEditTextView)
.setTitle(getString(R.string.enter_timer_duration))
.setPositiveButton(R.string.ok) { _, _ ->
val enteredValue = dialogEditText.text.toString()
if (enteredValue.isEmpty()){
Toast.makeText(this, getString(R.string.timer_empty_error_msg), Toast.LENGTH_SHORT).show()
} else {
timerDuration = enteredValue.toInt()
}
}
.setNegativeButton(R.string.cancel, null)
.create()
dialogEditText.setOnEditorActionListener { _, _, _ ->
timerDuration = dialogEditText.text.toString().toInt()
dialog.dismiss()
true
}
dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
dialog.show()
}
image_close.setOnClickListener {
isFinishingIntentionally = true
finish()
}
image_flash.setOnClickListener {
image_flash.setImageResource(when (imageCapture?.flashMode) {
ImageCapture.FLASH_MODE_AUTO -> {
imageCapture?.flashMode = ImageCapture.FLASH_MODE_ON
R.drawable.icon_flash_on
}
ImageCapture.FLASH_MODE_ON -> {
imageCapture?.flashMode = ImageCapture.FLASH_MODE_OFF
R.drawable.icon_flash_off
}
else -> {
imageCapture?.flashMode = ImageCapture.FLASH_MODE_AUTO
R.drawable.icon_flash_auto
}
})
}
image_camera_switch.setOnClickListener {
isBackCamera = if (isBackCamera) {
image_camera_switch.setImageResource(R.drawable.icon_camera_front)
false
} else {
image_camera_switch.setImageResource(R.drawable.icon_camera_back)
true
}
setupCamera()
}
take_photo_button.onClick = ::onClickTakePhoto take_photo_button.onClick = ::onClickTakePhoto
orientedIcons = listOf(image_ratio, image_timer, image_close, image_flash, image_camera_switch) orientedIcons = listOf(image_ratio, image_timer, image_close, image_flash, image_camera_switch)
sensorOrientationListener = SensorOrientationListener(this) sensorOrientationListener = SensorOrientationListener(this)
@ -99,23 +166,25 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
return true return true
} }
}) })
camera_preview.setOnTouchListener { _, motionEvent: MotionEvent -> camera_preview.setOnTouchListener { view, event ->
when (motionEvent.action) { view.performClick()
when (event.action) {
MotionEvent.ACTION_DOWN -> true MotionEvent.ACTION_DOWN -> true
MotionEvent.ACTION_UP -> { MotionEvent.ACTION_UP -> {
val factory = camera_preview.meteringPointFactory val factory = camera_preview.meteringPointFactory
val point = factory.createPoint(motionEvent.x, motionEvent.y) val point = factory.createPoint(event.x, event.y)
val action = FocusMeteringAction.Builder(point).build() val action = FocusMeteringAction.Builder(point).build()
imageCapture?.camera?.cameraControl?.startFocusAndMetering(action) imageCapture?.camera?.cameraControl?.startFocusAndMetering(action)
true true
} }
MotionEvent.ACTION_MOVE -> scaleGestureDetector.onTouchEvent(motionEvent) MotionEvent.ACTION_MOVE -> scaleGestureDetector.onTouchEvent(event)
else -> false else -> false
} }
} }
} }
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) { override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
when (requestCode) { when (requestCode) {
CAMERA_PERMISSION_REQUEST_CODE -> if (grantResults.size == 1) { CAMERA_PERMISSION_REQUEST_CODE -> if (grantResults.size == 1) {
if (grantResults[0] != PackageManager.PERMISSION_GRANTED) { if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
@ -134,7 +203,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
} }
} }
private fun adaptPreviewSize(resolution: Size){ private fun adaptPreviewSize(resolution: Size) {
val metrics = DisplayMetrics() val metrics = DisplayMetrics()
windowManager.defaultDisplay.getMetrics(metrics) windowManager.defaultDisplay.getMetrics(metrics)
//resolution.width and resolution.height seem to be inverted //resolution.width and resolution.height seem to be inverted
@ -238,79 +307,6 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
} }
} }
fun onClickFlash(view: View) {
image_flash.setImageResource(when (imageCapture?.flashMode) {
ImageCapture.FLASH_MODE_AUTO -> {
imageCapture?.flashMode = ImageCapture.FLASH_MODE_ON
R.drawable.icon_flash_on
}
ImageCapture.FLASH_MODE_ON -> {
imageCapture?.flashMode = ImageCapture.FLASH_MODE_OFF
R.drawable.icon_flash_off
}
else -> {
imageCapture?.flashMode = ImageCapture.FLASH_MODE_AUTO
R.drawable.icon_flash_auto
}
})
}
fun onClickCameraSwitch(view: View) {
isBackCamera = if (isBackCamera) {
image_camera_switch.setImageResource(R.drawable.icon_camera_front)
false
} else {
image_camera_switch.setImageResource(R.drawable.icon_camera_back)
true
}
setupCamera()
}
fun onClickTimer(view: View) {
val dialogEditTextView = layoutInflater.inflate(R.layout.dialog_edit_text, null)
val dialogEditText = dialogEditTextView.findViewById<EditText>(R.id.dialog_edit_text)
dialogEditText.inputType = InputType.TYPE_CLASS_NUMBER
val dialog = ColoredAlertDialogBuilder(this)
.setView(dialogEditTextView)
.setTitle(getString(R.string.enter_timer_duration))
.setPositiveButton(R.string.ok) { _, _ ->
val enteredValue = dialogEditText.text.toString()
if (enteredValue.isEmpty()){
Toast.makeText(this, getString(R.string.timer_empty_error_msg), Toast.LENGTH_SHORT).show()
} else {
timerDuration = enteredValue.toInt()
}
}
.setNegativeButton(R.string.cancel, null)
.create()
dialogEditText.setOnEditorActionListener { _, _, _ ->
timerDuration = dialogEditText.text.toString().toInt()
dialog.dismiss()
true
}
dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
dialog.show()
}
fun onClickRatio(view: View) {
resolutions?.let {
ColoredAlertDialogBuilder(this)
.setTitle(R.string.choose_resolution)
.setSingleChoiceItems(DialogSingleChoiceAdapter(this, it.map { size -> size.toString() }.toTypedArray()), currentResolutionIndex) { dialog, which ->
setupCamera(resolutions!![which])
dialog.dismiss()
currentResolutionIndex = which
}
.setNegativeButton(R.string.cancel, null)
.show()
}
}
fun onClickClose(view: View) {
isFinishingIntentionally = true
finish()
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
cameraExecutor.shutdown() cameraExecutor.shutdown()

View File

@ -5,7 +5,6 @@ import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.View
import android.widget.AdapterView.OnItemClickListener import android.widget.AdapterView.OnItemClickListener
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
@ -25,7 +24,7 @@ class ChangePasswordActivity : VolumeActionActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_change_password) setContentView(R.layout.activity_change_password)
setupActionBar() setupLayout()
setupFingerprintStuff() setupFingerprintStuff()
savedVolumesAdapter = SavedVolumesAdapter(this, volumeDatabase) savedVolumesAdapter = SavedVolumesAdapter(this, volumeDatabase)
if (savedVolumesAdapter.count > 0){ if (savedVolumesAdapter.count > 0){
@ -40,7 +39,7 @@ class ChangePasswordActivity : VolumeActionActivity() {
switch_hidden_volume.isChecked = false switch_hidden_volume.isChecked = false
edit_volume_path.setText(currentVolumeName) edit_volume_path.setText(currentVolumeName)
} }
onClickSwitchHiddenVolume(switch_hidden_volume) onClickSwitchHiddenVolume()
} }
} else { } else {
WidgetUtil.hideWithPadding(saved_path_listview) WidgetUtil.hideWithPadding(saved_path_listview)
@ -71,14 +70,13 @@ class ChangePasswordActivity : VolumeActionActivity() {
} }
edit_volume_path.addTextChangedListener(textWatcher) edit_volume_path.addTextChangedListener(textWatcher)
edit_volume_name.addTextChangedListener(textWatcher) edit_volume_name.addTextChangedListener(textWatcher)
edit_new_password_confirm.setOnEditorActionListener { v, _, _ -> edit_new_password_confirm.setOnEditorActionListener { _, _, _ ->
onClickChangePassword(v) checkVolumePathThenChangePassword()
true true
} }
} button_change_password.setOnClickListener {
checkVolumePathThenChangePassword()
fun pickDirectory(view: View?) { }
askPermissionThenPickDirectory()
} }
override fun onDirectoryPicked(uri: Uri) { override fun onDirectoryPicked(uri: Uri) {
@ -102,7 +100,7 @@ class ChangePasswordActivity : VolumeActionActivity() {
} }
} }
fun onClickChangePassword(view: View?) { fun checkVolumePathThenChangePassword() {
loadVolumePath { loadVolumePath {
val volumeFile = File(currentVolumePath) val volumeFile = File(currentVolumePath)
if (!GocryptfsVolume.isGocryptfsVolume(volumeFile)){ if (!GocryptfsVolume.isGocryptfsVolume(volumeFile)){
@ -209,12 +207,6 @@ class ChangePasswordActivity : VolumeActionActivity() {
.show() .show()
} }
fun onClickRememberPath(view: View) {
if (!checkbox_remember_path.isChecked){
checkbox_save_password.isChecked = false
}
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
Wiper.wipeEditText(edit_old_password) Wiper.wipeEditText(edit_old_password)

View File

@ -18,11 +18,11 @@ class ConstValues {
Pair("image", listOf("png", "jpg", "jpeg", "gif", "bmp")), Pair("image", listOf("png", "jpg", "jpeg", "gif", "bmp")),
Pair("video", listOf("mp4", "webm", "mkv", "mov")), Pair("video", listOf("mp4", "webm", "mkv", "mov")),
Pair("audio", listOf("mp3", "ogg", "m4a", "wav", "flac")), Pair("audio", listOf("mp3", "ogg", "m4a", "wav", "flac")),
Pair("text", listOf("txt", "json", "conf", "log", "xml", "java", "kt", "py", "pl", "rb", "go", "c", "h", "cpp", "hpp", "sh", "bat", "js", "html", "css", "php", "yml", "yaml", "ini", "md")) Pair("text", listOf("txt", "json", "conf", "log", "xml", "java", "kt", "py", "pl", "rb", "go", "c", "h", "cpp", "hpp", "rs", "sh", "bat", "js", "html", "css", "php", "yml", "yaml", "toml", "ini", "md"))
) )
fun isExtensionType(extensionType: String, path: String): Boolean { fun isExtensionType(extensionType: String, path: String): Boolean {
return fileExtensions[extensionType]?.contains(File(path).extension.toLowerCase(Locale.ROOT)) ?: false return fileExtensions[extensionType]?.contains(File(path).extension.lowercase()) ?: false
} }
fun isImage(path: String): Boolean { fun isImage(path: String): Boolean {

View File

@ -4,7 +4,6 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_create.* import kotlinx.android.synthetic.main.activity_create.*
@ -23,26 +22,26 @@ class CreateActivity : VolumeActionActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_create) setContentView(R.layout.activity_create)
setupActionBar() setupLayout()
setupFingerprintStuff() setupFingerprintStuff()
edit_password_confirm.setOnEditorActionListener { v, _, _ -> edit_password_confirm.setOnEditorActionListener { _, _, _ ->
onClickCreate(v) createVolume()
true true
} }
switch_hidden_volume.setOnClickListener { button_create.setOnClickListener {
onClickSwitchHiddenVolume(it) createVolume()
if (switch_hidden_volume.isChecked){
ColoredAlertDialogBuilder(this)
.setTitle(R.string.warning)
.setMessage(R.string.hidden_volume_warning)
.setPositiveButton(R.string.ok, null)
.show()
}
} }
} }
fun pickDirectory(view: View?) { override fun onClickSwitchHiddenVolume() {
askPermissionThenPickDirectory() super.onClickSwitchHiddenVolume()
if (switch_hidden_volume.isChecked){
ColoredAlertDialogBuilder(this)
.setTitle(R.string.warning)
.setMessage(R.string.hidden_volume_warning)
.setPositiveButton(R.string.ok, null)
.show()
}
} }
override fun onDirectoryPicked(uri: Uri) { override fun onDirectoryPicked(uri: Uri) {
@ -66,7 +65,7 @@ class CreateActivity : VolumeActionActivity() {
} }
} }
fun onClickCreate(view: View?) { fun createVolume() {
loadVolumePath { loadVolumePath {
val password = edit_password.text.toString().toCharArray() val password = edit_password.text.toString().toCharArray()
val passwordConfirm = edit_password_confirm.text.toString().toCharArray() val passwordConfirm = edit_password_confirm.text.toString().toCharArray()
@ -173,12 +172,6 @@ class CreateActivity : VolumeActionActivity() {
.show() .show()
} }
fun onClickRememberPath(view: View) {
if (!checkbox_remember_path.isChecked) {
checkbox_save_password.isChecked = false
}
}
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
//Closing volume if leaving activity while showing dialog //Closing volume if leaving activity while showing dialog

View File

@ -4,7 +4,7 @@ import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.toolbar.* import kotlinx.android.synthetic.main.toolbar.*
import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder
@ -29,6 +29,15 @@ class MainActivity : BaseActivity() {
.show() .show()
} }
} }
button_open.setOnClickListener {
startActivity(OpenActivity::class.java)
}
button_create.setOnClickListener {
startActivity(CreateActivity::class.java)
}
button_change_password.setOnClickListener {
startActivity(ChangePasswordActivity::class.java)
}
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
@ -47,18 +56,8 @@ class MainActivity : BaseActivity() {
return true return true
} }
fun onClickCreate(v: View?) { fun <T> startActivity(clazz: Class<T>) {
val intent = Intent(this, CreateActivity::class.java) val intent = Intent(this, clazz)
startActivity(intent)
}
fun onClickOpen(v: View?) {
val intent = Intent(this, OpenActivity::class.java)
startActivity(intent)
}
fun onClickChangePassword(v: View?) {
val intent = Intent(this, ChangePasswordActivity::class.java)
startActivity(intent) startActivity(intent)
} }
} }

View File

@ -7,7 +7,6 @@ import android.os.Bundle
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.MenuItem import android.view.MenuItem
import android.view.View
import android.widget.AdapterView.OnItemClickListener import android.widget.AdapterView.OnItemClickListener
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_open.* import kotlinx.android.synthetic.main.activity_open.*
@ -34,7 +33,7 @@ class OpenActivity : VolumeActionActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_open) setContentView(R.layout.activity_open)
setupActionBar() setupLayout()
setupFingerprintStuff() setupFingerprintStuff()
savedVolumesAdapter = SavedVolumesAdapter(this, volumeDatabase) savedVolumesAdapter = SavedVolumesAdapter(this, volumeDatabase)
if (savedVolumesAdapter.count > 0){ if (savedVolumesAdapter.count > 0){
@ -49,7 +48,7 @@ class OpenActivity : VolumeActionActivity() {
switch_hidden_volume.isChecked = false switch_hidden_volume.isChecked = false
edit_volume_path.setText(currentVolumeName) edit_volume_path.setText(currentVolumeName)
} }
onClickSwitchHiddenVolume(switch_hidden_volume) onClickSwitchHiddenVolume()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
volume.hash?.let { hash -> volume.hash?.let { hash ->
volume.iv?.let { iv -> volume.iv?.let { iv ->
@ -89,10 +88,13 @@ class OpenActivity : VolumeActionActivity() {
} }
edit_volume_path.addTextChangedListener(textWatcher) edit_volume_path.addTextChangedListener(textWatcher)
edit_volume_name.addTextChangedListener(textWatcher) edit_volume_name.addTextChangedListener(textWatcher)
edit_password.setOnEditorActionListener { v, _, _ -> edit_password.setOnEditorActionListener { _, _, _ ->
onClickOpen(v) checkVolumePathThenOpen()
true true
} }
button_open.setOnClickListener {
checkVolumePathThenOpen()
}
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
@ -106,10 +108,6 @@ class OpenActivity : VolumeActionActivity() {
} }
} }
fun pickDirectory(view: View?) {
askPermissionThenPickDirectory()
}
override fun onPickingDirectory() { override fun onPickingDirectory() {
isStartingActivity = true isStartingActivity = true
} }
@ -127,7 +125,7 @@ class OpenActivity : VolumeActionActivity() {
} }
} }
fun onClickOpen(view: View?) { fun checkVolumePathThenOpen() {
loadVolumePath { loadVolumePath {
val volumeFile = File(currentVolumePath) val volumeFile = File(currentVolumePath)
if (!GocryptfsVolume.isGocryptfsVolume(volumeFile)){ if (!GocryptfsVolume.isGocryptfsVolume(volumeFile)){
@ -245,12 +243,6 @@ class OpenActivity : VolumeActionActivity() {
finish() finish()
} }
fun onClickRememberPath(view: View) {
if (!checkbox_remember_path.isChecked){
checkbox_save_password.isChecked = false
}
}
override fun onBackPressed() { override fun onBackPressed() {
super.onBackPressed() super.onBackPressed()
isFinishingIntentionally = true isFinishingIntentionally = true

View File

@ -10,7 +10,7 @@ import kotlinx.android.synthetic.main.toolbar.*
import sushi.hardcore.droidfs.widgets.SimpleActionPreference import sushi.hardcore.droidfs.widgets.SimpleActionPreference
import sushi.hardcore.droidfs.widgets.ThemeColor import sushi.hardcore.droidfs.widgets.ThemeColor
class SettingsActivity : BaseActivity(), PreferenceFragmentCompat.OnPreferenceStartFragmentCallback { class SettingsActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -72,12 +72,4 @@ class SettingsActivity : BaseActivity(), PreferenceFragmentCompat.OnPreferenceSt
ThemeColor.tintPreferenceIcons(preferenceScreen, ThemeColor.getThemeColor(requireContext())) ThemeColor.tintPreferenceIcons(preferenceScreen, ThemeColor.getThemeColor(requireContext()))
} }
} }
override fun onPreferenceStartFragment(caller: PreferenceFragmentCompat, pref: Preference): Boolean {
val fragment = supportFragmentManager.fragmentFactory.instantiate(classLoader, pref.fragment)
fragment.arguments = pref.extras
fragment.setTargetFragment(caller, 0)
supportFragmentManager.beginTransaction().replace(R.id.settings, fragment).addToBackStack(null).commit()
return true
}
} }

View File

@ -10,7 +10,6 @@ import android.os.Build
import android.security.keystore.KeyGenParameterSpec import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyPermanentlyInvalidatedException import android.security.keystore.KeyPermanentlyInvalidatedException
import android.security.keystore.KeyProperties import android.security.keystore.KeyProperties
import android.view.View
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.Toast import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
@ -59,22 +58,54 @@ abstract class VolumeActionActivity : BaseActivity() {
private const val GCM_TAG_LEN = 128 private const val GCM_TAG_LEN = 128
} }
protected open fun onPickingDirectory() {} protected fun setupLayout() {
protected abstract fun onDirectoryPicked(uri: Uri) setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
protected fun askPermissionThenPickDirectory() { button_pick_directory.setOnClickListener {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) + if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) +
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSIONS_REQUEST) requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSIONS_REQUEST)
} else {
safePickDirectory()
}
} else { } else {
safePickDirectory() safePickDirectory()
} }
} else { }
safePickDirectory() switch_hidden_volume.setOnClickListener {
onClickSwitchHiddenVolume()
}
checkbox_remember_path.setOnClickListener {
if (!checkbox_remember_path.isChecked) {
checkbox_save_password.isChecked = false
}
}
checkbox_save_password.setOnClickListener {
if (checkbox_save_password.isChecked) {
if (biometricCanAuthenticateCode == 0) {
checkbox_remember_path.isChecked = checkbox_remember_path.isEnabled
} else {
checkbox_save_password.isChecked = false
printAuthenticateImpossibleError()
}
}
} }
} }
protected open fun onClickSwitchHiddenVolume() {
if (switch_hidden_volume.isChecked){
WidgetUtil.show(hidden_volume_section, originalHiddenVolumeSectionLayoutParams)
WidgetUtil.hide(normal_volume_section)
} else {
WidgetUtil.show(normal_volume_section, originalNormalVolumeSectionLayoutParams)
WidgetUtil.hide(hidden_volume_section)
}
}
protected open fun onPickingDirectory() {}
protected abstract fun onDirectoryPicked(uri: Uri)
private fun safePickDirectory() { private fun safePickDirectory() {
try { try {
onPickingDirectory() onPickingDirectory()
@ -185,11 +216,6 @@ abstract class VolumeActionActivity : BaseActivity() {
} }
} }
protected fun setupActionBar(){
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
private fun canAuthenticate(): Int { private fun canAuthenticate(): Int {
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
return if (!keyguardManager.isKeyguardSecure) { return if (!keyguardManager.isKeyguardSecure) {
@ -215,17 +241,6 @@ abstract class VolumeActionActivity : BaseActivity() {
}, Toast.LENGTH_SHORT).show() }, Toast.LENGTH_SHORT).show()
} }
fun onClickSavePasswordHash(view: View) {
if (checkbox_save_password.isChecked){
if (biometricCanAuthenticateCode == 0){
checkbox_remember_path.isChecked = checkbox_remember_path.isEnabled
} else {
checkbox_save_password.isChecked = false
printAuthenticateImpossibleError()
}
}
}
@RequiresApi(Build.VERSION_CODES.M) @RequiresApi(Build.VERSION_CODES.M)
private fun prepareCipher() { private fun prepareCipher() {
keyStore = KeyStore.getInstance(ANDROID_KEY_STORE) keyStore = KeyStore.getInstance(ANDROID_KEY_STORE)
@ -337,14 +352,4 @@ abstract class VolumeActionActivity : BaseActivity() {
callback() callback()
} }
} }
fun onClickSwitchHiddenVolume(view: View){
if (switch_hidden_volume.isChecked){
WidgetUtil.show(hidden_volume_section, originalHiddenVolumeSectionLayoutParams)
WidgetUtil.hide(normal_volume_section)
} else {
WidgetUtil.show(normal_volume_section, originalNormalVolumeSectionLayoutParams)
WidgetUtil.hide(hidden_volume_section)
}
}
} }

View File

@ -4,11 +4,11 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.widget.EditText import android.widget.EditText
import android.widget.Toast import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import kotlinx.android.synthetic.main.activity_explorer.*
import sushi.hardcore.droidfs.CameraActivity import sushi.hardcore.droidfs.CameraActivity
import sushi.hardcore.droidfs.GocryptfsVolume import sushi.hardcore.droidfs.GocryptfsVolume
import sushi.hardcore.droidfs.OpenActivity import sushi.hardcore.droidfs.OpenActivity
@ -146,6 +146,71 @@ class ExplorerActivity : BaseExplorerActivity() {
override fun init() { override fun init() {
setContentView(R.layout.activity_explorer) setContentView(R.layout.activity_explorer)
fab.setOnClickListener {
if (currentItemAction != ItemsActions.NONE){
openDialogCreateFolder()
} else {
val adapter = IconTextDialogAdapter(this)
adapter.items = listOf(
listOf("importFromOtherVolumes", R.string.import_from_other_volume, R.drawable.icon_transfert),
listOf("importFiles", R.string.import_files, R.drawable.icon_encrypt),
listOf("createFile", R.string.new_file, R.drawable.icon_file_unknown),
listOf("createFolder", R.string.mkdir, R.drawable.icon_folder),
listOf("takePhoto", R.string.take_photo, R.drawable.icon_camera)
)
ColoredAlertDialogBuilder(this)
.setSingleChoiceItems(adapter, -1){ thisDialog, which ->
when (adapter.getItem(which)){
"importFromOtherVolumes" -> {
val intent = Intent(this, OpenActivity::class.java)
intent.action = "pick"
intent.putExtra("sessionID", gocryptfsVolume.sessionID)
isStartingActivity = true
pickFromOtherVolumes.launch(intent)
}
"importFiles" -> {
isStartingActivity = true
pickFiles.launch(arrayOf("*/*"))
}
"createFile" -> {
val dialogEditTextView = layoutInflater.inflate(R.layout.dialog_edit_text, null)
val dialogEditText = dialogEditTextView.findViewById<EditText>(R.id.dialog_edit_text)
val dialog = ColoredAlertDialogBuilder(this)
.setView(dialogEditTextView)
.setTitle(getString(R.string.enter_file_name))
.setPositiveButton(R.string.ok) { _, _ ->
val fileName = dialogEditText.text.toString()
createNewFile(fileName)
}
.setNegativeButton(R.string.cancel, null)
.create()
dialogEditText.setOnEditorActionListener { _, _, _ ->
val fileName = dialogEditText.text.toString()
dialog.dismiss()
createNewFile(fileName)
true
}
dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
dialog.show()
}
"createFolder" -> {
openDialogCreateFolder()
}
"takePhoto" -> {
val intent = Intent(this, CameraActivity::class.java)
intent.putExtra("path", currentDirectoryPath)
intent.putExtra("sessionID", gocryptfsVolume.sessionID)
isStartingActivity = true
startActivity(intent)
}
}
thisDialog.dismiss()
}
.setTitle(getString(R.string.fab_dialog_title))
.setNegativeButton(R.string.cancel, null)
.show()
}
}
usf_decrypt = sharedPrefs.getBoolean("usf_decrypt", false) usf_decrypt = sharedPrefs.getBoolean("usf_decrypt", false)
usf_share = sharedPrefs.getBoolean("usf_share", false) usf_share = sharedPrefs.getBoolean("usf_share", false)
} }
@ -175,72 +240,6 @@ class ExplorerActivity : BaseExplorerActivity() {
} }
} }
fun onClickFAB(view: View) {
if (currentItemAction != ItemsActions.NONE){
openDialogCreateFolder()
} else {
val adapter = IconTextDialogAdapter(this)
adapter.items = listOf(
listOf("importFromOtherVolumes", R.string.import_from_other_volume, R.drawable.icon_transfert),
listOf("importFiles", R.string.import_files, R.drawable.icon_encrypt),
listOf("createFile", R.string.new_file, R.drawable.icon_file_unknown),
listOf("createFolder", R.string.mkdir, R.drawable.icon_folder),
listOf("takePhoto", R.string.take_photo, R.drawable.icon_camera)
)
ColoredAlertDialogBuilder(this)
.setSingleChoiceItems(adapter, -1){ thisDialog, which ->
when (adapter.getItem(which)){
"importFromOtherVolumes" -> {
val intent = Intent(this, OpenActivity::class.java)
intent.action = "pick"
intent.putExtra("sessionID", gocryptfsVolume.sessionID)
isStartingActivity = true
pickFromOtherVolumes.launch(intent)
}
"importFiles" -> {
isStartingActivity = true
pickFiles.launch(arrayOf("*/*"))
}
"createFile" -> {
val dialogEditTextView = layoutInflater.inflate(R.layout.dialog_edit_text, null)
val dialogEditText = dialogEditTextView.findViewById<EditText>(R.id.dialog_edit_text)
val dialog = ColoredAlertDialogBuilder(this)
.setView(dialogEditTextView)
.setTitle(getString(R.string.enter_file_name))
.setPositiveButton(R.string.ok) { _, _ ->
val fileName = dialogEditText.text.toString()
createNewFile(fileName)
}
.setNegativeButton(R.string.cancel, null)
.create()
dialogEditText.setOnEditorActionListener { _, _, _ ->
val fileName = dialogEditText.text.toString()
dialog.dismiss()
createNewFile(fileName)
true
}
dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
dialog.show()
}
"createFolder" -> {
openDialogCreateFolder()
}
"takePhoto" -> {
val intent = Intent(this, CameraActivity::class.java)
intent.putExtra("path", currentDirectoryPath)
intent.putExtra("sessionID", gocryptfsVolume.sessionID)
isStartingActivity = true
startActivity(intent)
}
}
thisDialog.dismiss()
}
.setTitle(getString(R.string.fab_dialog_title))
.setNegativeButton(R.string.cancel, null)
.show()
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.explorer, menu) menuInflater.inflate(R.menu.explorer, menu)
if (currentItemAction != ItemsActions.NONE) { if (currentItemAction != ItemsActions.NONE) {

View File

@ -4,17 +4,16 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import kotlinx.android.synthetic.main.activity_explorer_drop.*
import sushi.hardcore.droidfs.R import sushi.hardcore.droidfs.R
import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder
class ExplorerActivityDrop : BaseExplorerActivity() { class ExplorerActivityDrop : BaseExplorerActivity() {
override fun init() { override fun init() {
setContentView(R.layout.activity_explorer_drop) setContentView(R.layout.activity_explorer_drop)
} fab.setOnClickListener {
openDialogCreateFolder()
fun onClickFAB(view: View) { }
openDialogCreateFolder()
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {

View File

@ -83,6 +83,64 @@ class ImageViewer: FileViewerActivity() {
} }
} }
}) })
image_delete.setOnClickListener {
ColoredAlertDialogBuilder(this)
.keepFullScreen()
.setTitle(R.string.warning)
.setPositiveButton(R.string.ok) { _, _ ->
createPlaylist() //be sure the playlist is created before deleting if there is only one image
if (gocryptfsVolume.removeFile(filePath)) {
playlistNext(true)
refreshPlaylist()
if (mappedPlaylist.size == 0) { //deleted all images of the playlist
goBackToExplorer()
} else {
loadImage()
}
} else {
ColoredAlertDialogBuilder(this)
.keepFullScreen()
.setTitle(R.string.error)
.setMessage(getString(R.string.remove_failed, fileName))
.setPositiveButton(R.string.ok, null)
.show()
}
}
.setNegativeButton(R.string.cancel, null)
.setMessage(getString(R.string.single_delete_confirm, fileName))
.show()
}
image_button_slideshow.setOnClickListener {
if (!slideshowActive){
slideshowActive = true
handler.postDelayed(slideshowNext, ConstValues.slideshow_delay)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
hideUI.run()
Toast.makeText(this, R.string.slideshow_started, Toast.LENGTH_SHORT).show()
} else {
stopSlideshow()
}
}
image_previous.setOnClickListener {
askSaveRotation {
image_viewer.resetZoomFactor()
swipeImage(1F)
}
}
image_next.setOnClickListener {
askSaveRotation {
image_viewer.resetZoomFactor()
swipeImage(-1F)
}
}
image_rotate_right.setOnClickListener {
rotationAngle += 90
rotateImage()
}
image_rotate_left.setOnClickListener {
rotationAngle -= 90
rotateImage()
}
loadImage() loadImage()
handler.postDelayed(hideUI, hideDelay) handler.postDelayed(hideUI, hideDelay)
} }
@ -114,46 +172,6 @@ class ImageViewer: FileViewerActivity() {
} }
} }
fun onClickDelete(view: View) {
ColoredAlertDialogBuilder(this)
.keepFullScreen()
.setTitle(R.string.warning)
.setPositiveButton(R.string.ok) { _, _ ->
createPlaylist() //be sure the playlist is created before deleting if there is only one image
if (gocryptfsVolume.removeFile(filePath)) {
playlistNext(true)
refreshPlaylist()
if (mappedPlaylist.size == 0) { //deleted all images of the playlist
goBackToExplorer()
} else {
loadImage()
}
} else {
ColoredAlertDialogBuilder(this)
.keepFullScreen()
.setTitle(R.string.error)
.setMessage(getString(R.string.remove_failed, fileName))
.setPositiveButton(R.string.ok, null)
.show()
}
}
.setNegativeButton(R.string.cancel, null)
.setMessage(getString(R.string.single_delete_confirm, fileName))
.show()
}
fun onClickSlideshow(view: View) {
if (!slideshowActive){
slideshowActive = true
handler.postDelayed(slideshowNext, ConstValues.slideshow_delay)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
hideUI.run()
Toast.makeText(this, R.string.slideshow_started, Toast.LENGTH_SHORT).show()
} else {
stopSlideshow()
}
}
private fun stopSlideshow(){ private fun stopSlideshow(){
slideshowActive = false slideshowActive = false
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
@ -186,27 +204,6 @@ class ImageViewer: FileViewerActivity() {
image_viewer.restoreZoomNormal() image_viewer.restoreZoomNormal()
glideImage.transform(RotateTransformation(this)).into(image_viewer) glideImage.transform(RotateTransformation(this)).into(image_viewer)
} }
fun onCLickRotateRight(view: View){
rotationAngle += 90
rotateImage()
}
fun onClickRotateLeft(view: View){
rotationAngle -= 90
rotateImage()
}
fun onClickPrevious(view: View){
askSaveRotation {
image_viewer.resetZoomFactor()
swipeImage(1F)
}
}
fun onClickNext(view: View){
askSaveRotation {
image_viewer.resetZoomFactor()
swipeImage(-1F)
}
}
private fun askSaveRotation(callback: () -> Unit){ private fun askSaveRotation(callback: () -> Unit){
if (rotationAngle%360 != 0f && !slideshowActive){ if (rotationAngle%360 != 0f && !slideshowActive){

View File

@ -9,10 +9,11 @@ class TakePhotoButton: AppCompatImageView {
constructor(context: Context) : super(context) { init() } constructor(context: Context) : super(context) { init() }
constructor(context: Context, attrs: AttributeSet): super(context, attrs) { init() } constructor(context: Context, attrs: AttributeSet): super(context, attrs) { init() }
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { init() } constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr) { init() }
lateinit var onClick: ()->Unit lateinit var onClick: () -> Unit
private fun init(){ private fun init() {
setOnTouchListener{ _, event -> setOnTouchListener{ view, event ->
view.performClick()
when (event.action) { when (event.action) {
MotionEvent.ACTION_DOWN -> onClick() MotionEvent.ACTION_DOWN -> onClick()
MotionEvent.ACTION_UP -> isPressed = true MotionEvent.ACTION_UP -> isPressed = true

View File

@ -21,7 +21,6 @@
android:id="@+id/image_ratio" android:id="@+id/image_ratio"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:onClick="onClickRatio"
android:src="@drawable/icon_aspect_ratio" android:src="@drawable/icon_aspect_ratio"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/image_timer" app:layout_constraintEnd_toStartOf="@id/image_timer"
@ -32,7 +31,6 @@
android:id="@+id/image_timer" android:id="@+id/image_timer"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:onClick="onClickTimer"
android:src="@drawable/icon_timer_off" android:src="@drawable/icon_timer_off"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/image_close" app:layout_constraintEnd_toStartOf="@id/image_close"
@ -43,7 +41,6 @@
android:id="@+id/image_close" android:id="@+id/image_close"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:onClick="onClickClose"
android:src="@drawable/icon_close" android:src="@drawable/icon_close"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -73,8 +70,7 @@
android:src="@drawable/icon_flash_auto" android:src="@drawable/icon_flash_auto"
android:layout_alignEnd="@id/take_photo_button" android:layout_alignEnd="@id/take_photo_button"
android:layout_marginEnd="120dp" android:layout_marginEnd="120dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"/>
android:onClick="onClickFlash"/>
<sushi.hardcore.droidfs.widgets.TakePhotoButton <sushi.hardcore.droidfs.widgets.TakePhotoButton
android:id="@+id/take_photo_button" android:id="@+id/take_photo_button"
@ -90,8 +86,7 @@
android:src="@drawable/icon_camera_front" android:src="@drawable/icon_camera_front"
android:layout_alignStart="@id/take_photo_button" android:layout_alignStart="@id/take_photo_button"
android:layout_marginStart="120dp" android:layout_marginStart="120dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"/>
android:onClick="onClickCameraSwitch"/>
</RelativeLayout> </RelativeLayout>

View File

@ -97,11 +97,11 @@
android:text="@string/create_password_warning"/> android:text="@string/create_password_warning"/>
<androidx.appcompat.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_change_password"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/action_activity_button_height" android:layout_height="@dimen/action_activity_button_height"
android:layout_marginHorizontal="@dimen/action_activity_button_horizontal_margin" android:layout_marginHorizontal="@dimen/action_activity_button_horizontal_margin"
android:layout_marginBottom="@dimen/action_activity_button_margin_bottom" android:layout_marginBottom="@dimen/action_activity_button_margin_bottom"
android:onClick="onClickChangePassword"
android:text="@string/change_password" android:text="@string/change_password"
style="@style/button"/> style="@style/button"/>

View File

@ -69,10 +69,10 @@
android:text="@string/create_password_warning"/> android:text="@string/create_password_warning"/>
<androidx.appcompat.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_create"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/action_activity_button_height" android:layout_height="@dimen/action_activity_button_height"
android:layout_marginHorizontal="@dimen/action_activity_button_horizontal_margin" android:layout_marginHorizontal="@dimen/action_activity_button_horizontal_margin"
android:onClick="onClickCreate"
android:text="@string/create" android:text="@string/create"
style="@style/button"/> style="@style/button"/>

View File

@ -37,13 +37,13 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<sushi.hardcore.droidfs.widgets.ColoredFAB <sushi.hardcore.droidfs.widgets.ColoredFAB
android:id="@+id/fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_margin="15dp" android:layout_margin="15dp"
android:src="@drawable/icon_add" android:src="@drawable/icon_add"/>
android:onClick="onClickFAB"/>
</RelativeLayout> </RelativeLayout>

View File

@ -35,13 +35,13 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<sushi.hardcore.droidfs.widgets.ColoredFAB <sushi.hardcore.droidfs.widgets.ColoredFAB
android:id="@+id/fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_margin="15dp" android:layout_margin="15dp"
android:src="@drawable/icon_add" android:src="@drawable/icon_add"/>
android:onClick="onClickFAB"/>
</RelativeLayout> </RelativeLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root_layout" android:id="@+id/root_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -38,7 +37,6 @@
android:background="#00000000" android:background="#00000000"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/icon_delete" android:src="@drawable/icon_delete"
android:onClick="onClickDelete"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:layout_toStartOf="@id/image_button_slideshow" android:layout_toStartOf="@id/image_button_slideshow"
@ -51,7 +49,6 @@
android:background="#00000000" android:background="#00000000"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/icon_slideshow" android:src="@drawable/icon_slideshow"
android:onClick="onClickSlideshow"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/> android:layout_centerVertical="true"/>
@ -65,40 +62,40 @@
android:gravity="center"> android:gravity="center">
<ImageButton <ImageButton
android:id="@+id/image_previous"
android:layout_width="@dimen/image_button_size" android:layout_width="@dimen/image_button_size"
android:layout_height="@dimen/image_button_size" android:layout_height="@dimen/image_button_size"
android:layout_margin="10dp" android:layout_margin="10dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:background="#00000000" android:background="#00000000"
android:src="@drawable/exo_icon_previous" android:src="@drawable/exo_icon_previous"/>
android:onClick="onClickPrevious"/>
<ImageButton <ImageButton
android:id="@+id/image_next"
android:layout_width="@dimen/image_button_size" android:layout_width="@dimen/image_button_size"
android:layout_height="@dimen/image_button_size" android:layout_height="@dimen/image_button_size"
android:layout_margin="10dp" android:layout_margin="10dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:background="#00000000" android:background="#00000000"
android:src="@drawable/icon_rotate_left" android:src="@drawable/icon_rotate_left"/>
android:onClick="onClickRotateLeft"/>
<ImageButton <ImageButton
android:id="@+id/image_rotate_right"
android:layout_width="@dimen/image_button_size" android:layout_width="@dimen/image_button_size"
android:layout_height="@dimen/image_button_size" android:layout_height="@dimen/image_button_size"
android:layout_margin="10dp" android:layout_margin="10dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:background="#00000000" android:background="#00000000"
android:src="@drawable/icon_rotate_right" android:src="@drawable/icon_rotate_right"/>
android:onClick="onCLickRotateRight"/>
<ImageButton <ImageButton
android:id="@+id/image_rotate_left"
android:layout_width="@dimen/image_button_size" android:layout_width="@dimen/image_button_size"
android:layout_height="@dimen/image_button_size" android:layout_height="@dimen/image_button_size"
android:layout_margin="10dp" android:layout_margin="10dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:background="#00000000" android:background="#00000000"
android:src="@drawable/exo_icon_next" android:src="@drawable/exo_icon_next"/>
android:onClick="onClickNext"/>
</LinearLayout> </LinearLayout>

View File

@ -29,7 +29,6 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/button_create" app:layout_constraintBottom_toTopOf="@id/button_create"
android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin" android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin"
android:onClick="onClickOpen"
android:text="@string/open_volume" android:text="@string/open_volume"
style="@style/button"/> style="@style/button"/>
@ -40,7 +39,6 @@
app:layout_constraintTop_toBottomOf="@id/button_open" app:layout_constraintTop_toBottomOf="@id/button_open"
app:layout_constraintBottom_toTopOf="@id/button_change_password" app:layout_constraintBottom_toTopOf="@id/button_change_password"
android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin" android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin"
android:onClick="onClickCreate"
android:text="@string/create_volume" android:text="@string/create_volume"
style="@style/button"/> style="@style/button"/>
@ -51,7 +49,6 @@
app:layout_constraintTop_toBottomOf="@id/button_create" app:layout_constraintTop_toBottomOf="@id/button_create"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin" android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin"
android:onClick="onClickChangePassword"
android:text="@string/change_volume_password" android:text="@string/change_volume_password"
style="@style/button"/> style="@style/button"/>

View File

@ -56,11 +56,11 @@
android:text="@string/open_activity_warning"/> android:text="@string/open_activity_warning"/>
<androidx.appcompat.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_open"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/action_activity_button_height" android:layout_height="@dimen/action_activity_button_height"
android:layout_marginHorizontal="@dimen/action_activity_button_horizontal_margin" android:layout_marginHorizontal="@dimen/action_activity_button_horizontal_margin"
android:layout_marginBottom="@dimen/action_activity_button_margin_bottom" android:layout_marginBottom="@dimen/action_activity_button_margin_bottom"
android:onClick="onClickOpen"
android:text="@string/open" android:text="@string/open"
style="@style/button"/> style="@style/button"/>

View File

@ -8,15 +8,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/remember_volume_path" android:text="@string/remember_volume_path"/>
android:onClick="onClickRememberPath"/>
<sushi.hardcore.droidfs.widgets.ColoredCheckBox <sushi.hardcore.droidfs.widgets.ColoredCheckBox
android:id="@+id/checkbox_save_password" android:id="@+id/checkbox_save_password"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/fingerprint_save_checkbox_text" android:text="@string/fingerprint_save_checkbox_text"/>
android:onClick="onClickSavePasswordHash"/>
</LinearLayout> </LinearLayout>

View File

@ -11,8 +11,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/hidden_volume" android:text="@string/hidden_volume"
app:switchPadding="10dp" app:switchPadding="10dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"/>
android:onClick="onClickSwitchHiddenVolume"/>
<LinearLayout <LinearLayout
android:id="@+id/normal_volume_section" android:id="@+id/normal_volume_section"
@ -35,9 +34,9 @@
android:maxLines="1"/> android:maxLines="1"/>
<sushi.hardcore.droidfs.widgets.ColoredImageButton <sushi.hardcore.droidfs.widgets.ColoredImageButton
android:id="@+id/button_pick_directory"
android:layout_width="@dimen/image_button_size" android:layout_width="@dimen/image_button_size"
android:layout_height="@dimen/image_button_size" android:layout_height="@dimen/image_button_size"
android:onClick="pickDirectory"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:background="#00000000" android:background="#00000000"
android:src="@drawable/icon_folder" /> android:src="@drawable/icon_folder" />