Camera timer & grid icons fix

This commit is contained in:
Hardcore Sushi 2020-08-12 15:14:38 +02:00
parent 6c43750290
commit be17e5687d
12 changed files with 66 additions and 20 deletions

View File

@ -1,5 +1,6 @@
package sushi.hardcore.droidfs package sushi.hardcore.droidfs
import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.text.InputType import android.text.InputType
@ -41,9 +42,9 @@ class CameraActivity : BaseActivity() {
set(value) { set(value) {
field = value field = value
if (value > 0){ if (value > 0){
image_timer.setColorFilter(Color.GREEN) image_timer.setImageResource(R.drawable.icon_timer_on)
} else { } else {
image_timer.clearColorFilter() image_timer.setImageResource(R.drawable.icon_timer_off)
} }
} }
private lateinit var gocryptfsVolume: GocryptfsVolume private lateinit var gocryptfsVolume: GocryptfsVolume
@ -149,7 +150,12 @@ class CameraActivity : BaseActivity() {
.setView(dialogEditTextView) .setView(dialogEditTextView)
.setTitle(getString(R.string.enter_timer_duration)) .setTitle(getString(R.string.enter_timer_duration))
.setPositiveButton(R.string.ok) { _, _ -> .setPositiveButton(R.string.ok) { _, _ ->
timerDuration = dialogEditText.text.toString().toInt() 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) .setNegativeButton(R.string.cancel, null)
.create() .create()
@ -167,13 +173,14 @@ class CameraActivity : BaseActivity() {
.setTitle(getString(R.string.choose_grid)) .setTitle(getString(R.string.choose_grid))
.setSingleChoiceItems(gridTitles.map { getString(it) as CharSequence }.toTypedArray(), gridValues.indexOf(camera.grid)){ dialog, which -> .setSingleChoiceItems(gridTitles.map { getString(it) as CharSequence }.toTypedArray(), gridValues.indexOf(camera.grid)){ dialog, which ->
camera.grid = gridValues[which] camera.grid = gridValues[which]
image_grid.setImageResource(if (camera.grid == Grid.OFF){ R.drawable.icon_grid_off } else { R.drawable.icon_grid_on })
dialog.dismiss() dialog.dismiss()
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()
} }
fun onClickFilter(view: View) { private fun openFilterDialog(){
ColoredAlertDialogBuilder(this) ColoredAlertDialogBuilder(this)
.setTitle(getString(R.string.choose_filter)) .setTitle(getString(R.string.choose_filter))
.setSingleChoiceItems(filterNames, currentFilterIndex){ dialog, which -> .setSingleChoiceItems(filterNames, currentFilterIndex){ dialog, which ->
@ -185,6 +192,22 @@ class CameraActivity : BaseActivity() {
.show() .show()
} }
fun onClickFilter(view: View) {
if (sharedPrefs.getBoolean("filtersFirstOpening", true)){
ColoredAlertDialogBuilder(this)
.setTitle(R.string.warning)
.setMessage(R.string.filters_warning)
.setPositiveButton(R.string.ok){ _, _ ->
sharedPrefs.edit().putBoolean("filtersFirstOpening", false).apply()
openFilterDialog()
}
.setNegativeButton(R.string.cancel, null)
.show()
} else {
openFilterDialog()
}
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
if (!isFinishingIntentionally) { if (!isFinishingIntentionally) {

View File

@ -43,7 +43,7 @@ class MainActivity : BaseActivity() {
.setTitle(R.string.warning) .setTitle(R.string.warning)
.setMessage(R.string.usf_home_warning_msg) .setMessage(R.string.usf_home_warning_msg)
.setCancelable(false) .setCancelable(false)
.setPositiveButton(getString(R.string.see_unsafe_features)){ _, _ -> .setPositiveButton(R.string.see_unsafe_features){ _, _ ->
val intent = Intent(this, SettingsActivity::class.java) val intent = Intent(this, SettingsActivity::class.java)
intent.putExtra("screen", "UnsafeFeaturesSettingsFragment") intent.putExtra("screen", "UnsafeFeaturesSettingsFragment")
startActivity(intent) startActivity(intent)

View File

@ -194,6 +194,7 @@ open class BaseExplorerActivity : BaseActivity() {
} }
} }
total_size_text.text = getString(R.string.total_size, PathUtils.formatSize(totalSize)) total_size_text.text = getString(R.string.total_size, PathUtils.formatSize(totalSize))
explorerAdapter.notifyDataSetChanged()
}.start() }.start()
} }

View File

@ -211,7 +211,7 @@ class ExplorerActivity : BaseExplorerActivity() {
} }
} }
} }
.setNegativeButton(getString(R.string.no), null) .setNegativeButton(R.string.no, null)
.show() .show()
} }
} }

View File

@ -69,7 +69,7 @@ abstract class FileViewerActivity: BaseActivity() {
.setTitle(R.string.error) .setTitle(R.string.error)
.setMessage(R.string.outofmemoryerror_msg) .setMessage(R.string.outofmemoryerror_msg)
.setCancelable(false) .setCancelable(false)
.setPositiveButton(getString(R.string.ok)) { _, _ -> goBackToExplorer() } .setPositiveButton(R.string.ok) { _, _ -> goBackToExplorer() }
.show() .show()
} }
@ -106,4 +106,4 @@ abstract class FileViewerActivity: BaseActivity() {
super.onBackPressed() super.onBackPressed()
isFinishingIntentionally = true isFinishingIntentionally = true
} }
} }

View File

@ -34,7 +34,7 @@ class TextEditor: FileViewerActivity() {
.setTitle(R.string.error) .setTitle(R.string.error)
.setMessage(R.string.outofmemoryerror_msg) .setMessage(R.string.outofmemoryerror_msg)
.setCancelable(false) .setCancelable(false)
.setPositiveButton(getString(R.string.ok)) { _, _ -> goBackToExplorer()} .setPositiveButton(R.string.ok) { _, _ -> goBackToExplorer()}
.show() .show()
} }
} }
@ -101,12 +101,12 @@ class TextEditor: FileViewerActivity() {
ColoredAlertDialogBuilder(this) ColoredAlertDialogBuilder(this)
.setTitle(R.string.warning) .setTitle(R.string.warning)
.setMessage(R.string.ask_save) .setMessage(R.string.ask_save)
.setPositiveButton(getString(R.string.save)) { _, _ -> .setPositiveButton(R.string.save) { _, _ ->
if (save()){ if (save()){
goBackToExplorer() goBackToExplorer()
} }
} }
.setNegativeButton(getString(R.string.discard)){ _, _ -> goBackToExplorer()} .setNegativeButton(R.string.discard){ _, _ -> goBackToExplorer()}
.show() .show()
} else { } else {
goBackToExplorer() goBackToExplorer()
@ -144,4 +144,4 @@ class TextEditor: FileViewerActivity() {
override fun onBackPressed() { override fun onBackPressed() {
checkSaveAndExit() checkSaveAndExit()
} }
} }

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M8,4v1.45l2,2L10,4h4v4h-3.45l2,2L14,10v1.45l2,2L16,10h4v4h-3.45l2,2L20,16v1.45l2,2L22,4c0,-1.1 -0.9,-2 -2,-2L4.55,2l2,2L8,4zM16,4h4v4h-4L16,4zM1.27,1.27L0,2.55l2,2L2,20c0,1.1 0.9,2 2,2h15.46l2,2 1.27,-1.27L1.27,1.27zM10,12.55L11.45,14L10,14v-1.45zM4,6.55L5.45,8L4,8L4,6.55zM8,20L4,20v-4h4v4zM8,14L4,14v-4h3.45l0.55,0.55L8,14zM14,20h-4v-4h3.45l0.55,0.54L14,20zM16,20v-1.46L17.46,20L16,20z"/>
</vector>

View File

@ -1,6 +0,0 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
<path android:fillColor="@android:color/white" android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:fillColor="#FFFFFF"
android:pathData="M38.07,9.1l-2.85,2.85c-3.07,-2.47 -6.98,-3.95 -11.23,-3.95 -3.66,0 -7.05,1.1 -9.89,2.97l2.91,2.91c2.06,-1.19 4.44,-1.88 6.99,-1.88 7.73,0 14,6.27 14,14 0,2.55 -0.69,4.93 -1.88,6.99l2.91,2.91c1.87,-2.84 2.97,-6.24 2.97,-9.9 0,-4.25 -1.48,-8.15 -3.95,-11.23l2.85,-2.85 -2.83,-2.82zM30,2h-12v4h12v-4zM22,18.87l4,4v-6.87h-4v2.87zM6.04,8l-2.55,2.54 5.51,5.51c-1.89,2.85 -3,6.27 -3,9.95 0,9.94 8.04,18 17.99,18 3.68,0 7.1,-1.11 9.95,-3l5,5 2.54,-2.55 -15.4,-15.41 -20.04,-20.04zM24,40c-7.73,0 -14,-6.27 -14,-14 0,-2.57 0.7,-4.97 1.91,-7.04l19.13,19.13c-2.07,1.21 -4.47,1.91 -7.04,1.91z"/>
</vector>

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="23dp"
android:viewportWidth="18"
android:viewportHeight="23">
<path
android:pathData="M12,0.5L6,0.5L6,2.5L12,2.5L12,0.5L12,0.5ZM8,13.5L10,13.5L10,7.5L8,7.5L8,13.5L8,13.5ZM16,6.9L17.5,5.5C17,5 16.5,4.5 16,4.1L14.6,5.5C13.1,4.3 11.1,3.5 9,3.5C4,3.5 0,7.5 0,12.5C0,17.5 4,21.5 9,21.5C14,21.5 18,17.5 18,12.5C18,10.4 17.3,8.4 16,6.9L16,6.9ZM9,19.5C5.1,19.5 2,16.4 2,12.5C2,8.6 5.1,5.5 9,5.5C12.9,5.5 16,8.6 16,12.5C16,16.4 12.9,19.5 9,19.5L9,19.5Z"
android:strokeWidth="1"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

View File

@ -38,7 +38,7 @@
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:onClick="onClickTimer" android:onClick="onClickTimer"
android:src="@drawable/icon_timer" android:src="@drawable/icon_timer_off"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/image_grid" app:layout_constraintEnd_toStartOf="@id/image_grid"
app:layout_constraintStart_toEndOf="@id/image_hdr" app:layout_constraintStart_toEndOf="@id/image_hdr"
@ -49,7 +49,7 @@
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:onClick="onClickGrid" android:onClick="onClickGrid"
android:src="@drawable/icon_grid_on" android:src="@drawable/icon_grid_off"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/image_filter" app:layout_constraintEnd_toStartOf="@+id/image_filter"
app:layout_constraintStart_toEndOf="@+id/image_timer" app:layout_constraintStart_toEndOf="@+id/image_timer"

View File

@ -161,4 +161,6 @@
<string name="grid_4x4">4x4</string> <string name="grid_4x4">4x4</string>
<string name="choose_grid">Choose grid</string> <string name="choose_grid">Choose grid</string>
<string name="choose_filter">Choose filter</string> <string name="choose_filter">Choose filter</string>
<string name="filters_warning">Filters can only be applied to reduced quality images. If you want to take high definition photos, do not apply any filters.</string>
<string name="timer_empty_error_msg">Please enter a numeric value</string>
</resources> </resources>