✨
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 11 KiB |
@@ -32,7 +32,7 @@ class AudioGalleryActivity : BaseGalleryActivity(), FileProcessCallback {
|
|||||||
uriList.add(uri)
|
uriList.add(uri)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.data?.data?.let { uriList.add(it) } // Single file selected
|
result.data?.data?.let { uriList.add(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uriList.isNotEmpty()) {
|
if (uriList.isNotEmpty()) {
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ abstract class BaseGalleryActivity : AppCompatActivity() {
|
|||||||
if (granted || Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && Environment.isExternalStorageManager()) {
|
if (granted || Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && Environment.isExternalStorageManager()) {
|
||||||
loadFiles()
|
loadFiles()
|
||||||
} else {
|
} else {
|
||||||
// Handle permission denial case
|
|
||||||
showPermissionDeniedDialog()
|
showPermissionDeniedDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,6 +46,29 @@ abstract class BaseGalleryActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
fileManager = FileManager(this, this)
|
fileManager = FileManager(this, this)
|
||||||
|
|
||||||
|
binding.fabAdd.text = when(fileType){
|
||||||
|
FileManager.FileType.IMAGE -> {
|
||||||
|
"Add Image"
|
||||||
|
}
|
||||||
|
FileManager.FileType.AUDIO -> {
|
||||||
|
"Add Audio"
|
||||||
|
}
|
||||||
|
FileManager.FileType.VIDEO -> {
|
||||||
|
"Add Video"
|
||||||
|
}
|
||||||
|
FileManager.FileType.DOCUMENT -> {
|
||||||
|
"Add Files"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.recyclerView.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
||||||
|
if (scrollY > oldScrollY && binding.fabAdd.isExtended) {
|
||||||
|
|
||||||
|
binding.fabAdd.shrink()
|
||||||
|
} else if (scrollY < oldScrollY && !binding.fabAdd.isExtended) {
|
||||||
|
|
||||||
|
binding.fabAdd.extend()
|
||||||
|
}
|
||||||
|
}
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
checkPermissionsAndLoadFiles()
|
checkPermissionsAndLoadFiles()
|
||||||
}
|
}
|
||||||
@@ -56,7 +78,7 @@ abstract class BaseGalleryActivity : AppCompatActivity() {
|
|||||||
ActivityResultContracts.StartIntentSenderForResult()
|
ActivityResultContracts.StartIntentSenderForResult()
|
||||||
) { result ->
|
) { result ->
|
||||||
if (result.resultCode == RESULT_OK) {
|
if (result.resultCode == RESULT_OK) {
|
||||||
loadFiles() // Refresh the list after deletion
|
loadFiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +125,7 @@ abstract class BaseGalleryActivity : AppCompatActivity() {
|
|||||||
abstract fun openPreview()
|
abstract fun openPreview()
|
||||||
|
|
||||||
private fun showPermissionDeniedDialog() {
|
private fun showPermissionDeniedDialog() {
|
||||||
// Show a dialog or a message informing the user about the importance of permissions
|
// permission denied
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
|||||||
@@ -33,11 +33,7 @@ class ImageGalleryActivity : BaseGalleryActivity(), FileProcessCallback {
|
|||||||
setupFabButton()
|
setupFabButton()
|
||||||
|
|
||||||
intentSenderLauncher = registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()){
|
intentSenderLauncher = registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()){
|
||||||
if (it.resultCode == RESULT_OK){
|
if (it.resultCode != RESULT_OK) Toast.makeText(this, "Failed to hide/unhide photo", Toast.LENGTH_SHORT).show()
|
||||||
// Toast.makeText(this, "Photo Deleted Successfully", Toast.LENGTH_SHORT).show()
|
|
||||||
}else{
|
|
||||||
Toast.makeText(this, "Failed to hide/unhide photo", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pickImageLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
pickImageLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||||
@@ -51,7 +47,7 @@ class ImageGalleryActivity : BaseGalleryActivity(), FileProcessCallback {
|
|||||||
uriList.add(uri)
|
uriList.add(uri)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.data?.data?.let { uriList.add(it) } // Single file selected
|
result.data?.data?.let { uriList.add(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uriList.isNotEmpty()) {
|
if (uriList.isNotEmpty()) {
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ class MainActivity : AppCompatActivity(), DialogActionsCallback {
|
|||||||
|
|
||||||
private fun clearDisplay() {
|
private fun clearDisplay() {
|
||||||
currentExpression = "0"
|
currentExpression = "0"
|
||||||
|
binding.total.text = ""
|
||||||
lastWasOperator = false
|
lastWasOperator = false
|
||||||
hasDecimal = false
|
hasDecimal = false
|
||||||
updateDisplay()
|
updateDisplay()
|
||||||
@@ -187,7 +188,30 @@ class MainActivity : AppCompatActivity(), DialogActionsCallback {
|
|||||||
|
|
||||||
private fun updateDisplay() {
|
private fun updateDisplay() {
|
||||||
binding.display.text = currentExpression
|
binding.display.text = currentExpression
|
||||||
|
|
||||||
|
if (currentExpression == "0"){
|
||||||
|
binding.total.text = ""
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
// Evaluate the expression and update total
|
||||||
|
try {
|
||||||
|
val expression = ExpressionBuilder(currentExpression).build()
|
||||||
|
val result = expression.evaluate()
|
||||||
|
|
||||||
|
// Format the result and update total.text
|
||||||
|
val formattedResult = if (result.toLong().toDouble() == result) {
|
||||||
|
result.toLong().toString()
|
||||||
|
} else {
|
||||||
|
String.format("%.2f", result)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.total.text = formattedResult
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// Show a blank or placeholder for invalid expressions
|
||||||
|
binding.total.text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun cutNumbers() {
|
private fun cutNumbers() {
|
||||||
if (currentExpression.isNotEmpty()){
|
if (currentExpression.isNotEmpty()){
|
||||||
if (currentExpression.length == 1){
|
if (currentExpression.length == 1){
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import devs.org.calculator.adapters.ImagePreviewAdapter
|
import devs.org.calculator.adapters.ImagePreviewAdapter
|
||||||
|
import devs.org.calculator.callbacks.DialogActionsCallback
|
||||||
import devs.org.calculator.databinding.ActivityPreviewBinding
|
import devs.org.calculator.databinding.ActivityPreviewBinding
|
||||||
import devs.org.calculator.utils.DialogUtil
|
import devs.org.calculator.utils.DialogUtil
|
||||||
import devs.org.calculator.utils.FileManager
|
import devs.org.calculator.utils.FileManager
|
||||||
@@ -21,6 +22,7 @@ class PreviewActivity : AppCompatActivity() {
|
|||||||
private lateinit var filetype: FileManager.FileType
|
private lateinit var filetype: FileManager.FileType
|
||||||
private lateinit var adapter: ImagePreviewAdapter
|
private lateinit var adapter: ImagePreviewAdapter
|
||||||
private lateinit var fileManager: FileManager
|
private lateinit var fileManager: FileManager
|
||||||
|
private val dialogUtil = DialogUtil(this)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -62,7 +64,7 @@ class PreviewActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun setupImagePreview() {
|
private fun setupImagePreview() {
|
||||||
adapter = ImagePreviewAdapter(this, filetype)
|
adapter = ImagePreviewAdapter(this, filetype)
|
||||||
adapter.images = files // Set initial data
|
adapter.images = files
|
||||||
binding.viewPager.adapter = adapter
|
binding.viewPager.adapter = adapter
|
||||||
|
|
||||||
binding.viewPager.setCurrentItem(currentPosition, false)
|
binding.viewPager.setCurrentItem(currentPosition, false)
|
||||||
@@ -75,40 +77,58 @@ class PreviewActivity : AppCompatActivity() {
|
|||||||
binding.delete.setOnClickListener {
|
binding.delete.setOnClickListener {
|
||||||
val fileUri = FileManager.FileManager().getContentUriImage(this, files[binding.viewPager.currentItem], filetype)
|
val fileUri = FileManager.FileManager().getContentUriImage(this, files[binding.viewPager.currentItem], filetype)
|
||||||
if (fileUri != null) {
|
if (fileUri != null) {
|
||||||
MaterialAlertDialogBuilder(this)
|
dialogUtil.showMaterialDialog(
|
||||||
.setTitle("Delete File")
|
"Delete File",
|
||||||
.setMessage("Are you sure you want to Delete this file?")
|
"Are you sure to Delete this file permanently?",
|
||||||
.setPositiveButton("Delete") { dialog, _ ->
|
"Delete Permanently",
|
||||||
|
"Cancel",
|
||||||
|
object : DialogActionsCallback{
|
||||||
|
override fun onPositiveButtonClicked() {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
FileManager(this@PreviewActivity, this@PreviewActivity).deletePhotoFromExternalStorage(fileUri)
|
FileManager(this@PreviewActivity, this@PreviewActivity).deletePhotoFromExternalStorage(fileUri)
|
||||||
removeFileFromList(binding.viewPager.currentItem)
|
removeFileFromList(binding.viewPager.currentItem)
|
||||||
}
|
}
|
||||||
dialog.dismiss()
|
|
||||||
}
|
}
|
||||||
.setNegativeButton("Cancel") { dialog, _ ->
|
|
||||||
dialog.dismiss()
|
override fun onNegativeButtonClicked() {
|
||||||
|
|
||||||
}
|
}
|
||||||
.show()
|
|
||||||
|
override fun onNaturalButtonClicked() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.unHide.setOnClickListener {
|
binding.unHide.setOnClickListener {
|
||||||
val fileUri = FileManager.FileManager().getContentUriImage(this, files[binding.viewPager.currentItem], filetype)
|
val fileUri = FileManager.FileManager().getContentUriImage(this, files[binding.viewPager.currentItem], filetype)
|
||||||
if (fileUri != null) {
|
if (fileUri != null) {
|
||||||
MaterialAlertDialogBuilder(this)
|
dialogUtil.showMaterialDialog(
|
||||||
.setTitle("Unhide File")
|
"Unhide File",
|
||||||
.setMessage("Are you sure you want to Unhide this file?")
|
"Are you sure you want to Unhide this file?",
|
||||||
.setPositiveButton("Unhide") { dialog, _ ->
|
"Unhide",
|
||||||
|
"Cancel",
|
||||||
|
object : DialogActionsCallback{
|
||||||
|
override fun onPositiveButtonClicked() {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
FileManager(this@PreviewActivity, this@PreviewActivity).copyFileToNormalDir(fileUri)
|
FileManager(this@PreviewActivity, this@PreviewActivity).copyFileToNormalDir(fileUri)
|
||||||
removeFileFromList(binding.viewPager.currentItem)
|
removeFileFromList(binding.viewPager.currentItem)
|
||||||
}
|
}
|
||||||
dialog.dismiss()
|
|
||||||
}
|
}
|
||||||
.setNegativeButton("Cancel") { dialog, _ ->
|
|
||||||
dialog.dismiss()
|
override fun onNegativeButtonClicked() {
|
||||||
|
|
||||||
}
|
}
|
||||||
.show()
|
|
||||||
|
override fun onNaturalButtonClicked() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,17 +11,33 @@ import com.google.android.material.textfield.TextInputEditText
|
|||||||
import devs.org.calculator.databinding.ActivitySetupPasswordBinding
|
import devs.org.calculator.databinding.ActivitySetupPasswordBinding
|
||||||
import devs.org.calculator.utils.PrefsUtil
|
import devs.org.calculator.utils.PrefsUtil
|
||||||
import devs.org.calculator.R
|
import devs.org.calculator.R
|
||||||
|
import devs.org.calculator.databinding.ActivityChangePasswordBinding
|
||||||
|
|
||||||
class SetupPasswordActivity : AppCompatActivity() {
|
class SetupPasswordActivity : AppCompatActivity() {
|
||||||
private lateinit var binding: ActivitySetupPasswordBinding
|
private lateinit var binding: ActivitySetupPasswordBinding
|
||||||
|
private lateinit var binding2: ActivityChangePasswordBinding
|
||||||
private lateinit var prefsUtil: PrefsUtil
|
private lateinit var prefsUtil: PrefsUtil
|
||||||
|
private var hasPassword = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivitySetupPasswordBinding.inflate(layoutInflater)
|
binding = ActivitySetupPasswordBinding.inflate(layoutInflater)
|
||||||
|
binding2 = ActivityChangePasswordBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
prefsUtil = PrefsUtil(this)
|
|
||||||
|
|
||||||
|
prefsUtil = PrefsUtil(this)
|
||||||
|
hasPassword = prefsUtil.hasPassword()
|
||||||
|
|
||||||
|
if (hasPassword){
|
||||||
|
setContentView(binding2.root)
|
||||||
|
}else{
|
||||||
|
setContentView(binding.root)
|
||||||
|
}
|
||||||
|
clickListeners()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun clickListeners(){
|
||||||
binding.btnSavePassword.setOnClickListener {
|
binding.btnSavePassword.setOnClickListener {
|
||||||
val password = binding.etPassword.text.toString()
|
val password = binding.etPassword.text.toString()
|
||||||
val confirmPassword = binding.etConfirmPassword.text.toString()
|
val confirmPassword = binding.etConfirmPassword.text.toString()
|
||||||
@@ -62,7 +78,38 @@ class SetupPasswordActivity : AppCompatActivity() {
|
|||||||
else Toast.makeText(this, "Security question not set yet.", Toast.LENGTH_SHORT).show()
|
else Toast.makeText(this, "Security question not set yet.", Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
binding2.btnChangePassword.setOnClickListener{
|
||||||
|
val oldPassword = binding2.etOldPassword.text.toString()
|
||||||
|
val newPassword = binding2.etNewPassword.text.toString()
|
||||||
|
if (oldPassword.isEmpty()) {
|
||||||
|
binding2.etOldPassword.error = "This field can't be empty"
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
if (newPassword.isEmpty()) {
|
||||||
|
binding2.etNewPassword.error = "This field can't be empty"
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prefsUtil.validatePassword(oldPassword)){
|
||||||
|
if (oldPassword != newPassword){
|
||||||
|
prefsUtil.savePassword(newPassword)
|
||||||
|
Toast.makeText(this, "Password reset successfully", Toast.LENGTH_SHORT).show()
|
||||||
|
startActivity(Intent(this, MainActivity::class.java))
|
||||||
|
finish()
|
||||||
|
|
||||||
|
}else {
|
||||||
|
Toast.makeText(this, "Old Password And New Password Not Be Same", Toast.LENGTH_SHORT).show()
|
||||||
|
binding2.etNewPassword.error = "Old Password And New Password Not Be Same"
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
Toast.makeText(this, "Wrong password entered", Toast.LENGTH_SHORT).show()
|
||||||
|
binding2.etOldPassword.error = "Old Password Not Matching"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding2.btnResetPassword.setOnClickListener{
|
||||||
|
if (prefsUtil.getSecurityQuestion() != null) showSecurityQuestionDialog(prefsUtil.getSecurityQuestion().toString())
|
||||||
|
else Toast.makeText(this, "Security question not set yet.", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showSecurityQuestionDialog(securityQuestion: String) {
|
private fun showSecurityQuestionDialog(securityQuestion: String) {
|
||||||
@@ -71,6 +118,7 @@ class SetupPasswordActivity : AppCompatActivity() {
|
|||||||
val questionTextView: TextView = dialogView.findViewById(R.id.security_question)
|
val questionTextView: TextView = dialogView.findViewById(R.id.security_question)
|
||||||
questionTextView.text = securityQuestion
|
questionTextView.text = securityQuestion
|
||||||
|
|
||||||
|
|
||||||
MaterialAlertDialogBuilder(this)
|
MaterialAlertDialogBuilder(this)
|
||||||
.setTitle("Answer the Security Question!")
|
.setTitle("Answer the Security Question!")
|
||||||
.setView(dialogView)
|
.setView(dialogView)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import com.bumptech.glide.Glide
|
|||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import devs.org.calculator.R
|
import devs.org.calculator.R
|
||||||
import devs.org.calculator.activities.PreviewActivity
|
import devs.org.calculator.activities.PreviewActivity
|
||||||
|
import devs.org.calculator.callbacks.DialogActionsCallback
|
||||||
|
import devs.org.calculator.utils.DialogUtil
|
||||||
import devs.org.calculator.utils.FileManager
|
import devs.org.calculator.utils.FileManager
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -30,6 +32,23 @@ class FileAdapter(
|
|||||||
private val selectedItems = mutableSetOf<Int>()
|
private val selectedItems = mutableSetOf<Int>()
|
||||||
private var isSelectionMode = false
|
private var isSelectionMode = false
|
||||||
private var fileName = "Unknown File"
|
private var fileName = "Unknown File"
|
||||||
|
private var fileTypes = when (fileType) {
|
||||||
|
|
||||||
|
FileManager.FileType.IMAGE -> {
|
||||||
|
"IMAGE"
|
||||||
|
}
|
||||||
|
|
||||||
|
FileManager.FileType.VIDEO -> {
|
||||||
|
"VIDEO"
|
||||||
|
}
|
||||||
|
|
||||||
|
FileManager.FileType.AUDIO -> {
|
||||||
|
"AUDIO"
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> "DOCUMENT"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
inner class FileViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
inner class FileViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||||
private val imageView: ImageView = view.findViewById(R.id.imageView)
|
private val imageView: ImageView = view.findViewById(R.id.imageView)
|
||||||
@@ -63,24 +82,6 @@ class FileAdapter(
|
|||||||
}
|
}
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
|
|
||||||
|
|
||||||
var fileTypes = when (fileType) {
|
|
||||||
|
|
||||||
FileManager.FileType.IMAGE -> {
|
|
||||||
"IMAGE"
|
|
||||||
}
|
|
||||||
|
|
||||||
FileManager.FileType.VIDEO -> {
|
|
||||||
"VIDEO"
|
|
||||||
}
|
|
||||||
|
|
||||||
FileManager.FileType.AUDIO -> {
|
|
||||||
"AUDIO"
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> "DOCUMENT"
|
|
||||||
|
|
||||||
}
|
|
||||||
val intent = Intent(context, PreviewActivity::class.java).apply {
|
val intent = Intent(context, PreviewActivity::class.java).apply {
|
||||||
putExtra("type", fileTypes)
|
putExtra("type", fileTypes)
|
||||||
putExtra("position", position)
|
putExtra("position", position)
|
||||||
@@ -101,11 +102,14 @@ class FileAdapter(
|
|||||||
fileName = FileManager.FileName(context).getFileNameFromUri(fileUri)?.toString()
|
fileName = FileManager.FileName(context).getFileNameFromUri(fileUri)?.toString()
|
||||||
?: "Unknown File"
|
?: "Unknown File"
|
||||||
|
|
||||||
|
DialogUtil(context).showMaterialDialogWithNaturalButton(
|
||||||
MaterialAlertDialogBuilder(context)
|
"$fileTypes DETAILS",
|
||||||
.setTitle("Details")
|
"File Name: $fileName\n\nFile Path: $file\n\nYou can permanently delete or unhide this file.",
|
||||||
.setMessage("File Name: $fileName\n\nFile Path: $file\n\nYou can delete or unhide this file.")
|
"Delete Permanently",
|
||||||
.setPositiveButton("Delete") { dialog, _ ->
|
"Unhide",
|
||||||
|
"Cancel",
|
||||||
|
object : DialogActionsCallback {
|
||||||
|
override fun onPositiveButtonClicked() {
|
||||||
lifecycleOwner.lifecycleScope.launch {
|
lifecycleOwner.lifecycleScope.launch {
|
||||||
FileManager(context, lifecycleOwner).deletePhotoFromExternalStorage(
|
FileManager(context, lifecycleOwner).deletePhotoFromExternalStorage(
|
||||||
fileUri
|
fileUri
|
||||||
@@ -114,16 +118,20 @@ class FileAdapter(
|
|||||||
val currentList = currentList.toMutableList()
|
val currentList = currentList.toMutableList()
|
||||||
currentList.remove(file)
|
currentList.remove(file)
|
||||||
submitList(currentList)
|
submitList(currentList)
|
||||||
dialog.dismiss()
|
|
||||||
}
|
}
|
||||||
.setNegativeButton("Unhide") { dialog, _ ->
|
|
||||||
|
override fun onNegativeButtonClicked() {
|
||||||
FileManager(context, lifecycleOwner).copyFileToNormalDir(fileUri)
|
FileManager(context, lifecycleOwner).copyFileToNormalDir(fileUri)
|
||||||
val currentList = currentList.toMutableList()
|
val currentList = currentList.toMutableList()
|
||||||
currentList.remove(file)
|
currentList.remove(file)
|
||||||
submitList(currentList)
|
submitList(currentList)
|
||||||
dialog.dismiss()
|
|
||||||
}
|
}
|
||||||
.show()
|
|
||||||
|
override fun onNaturalButtonClicked() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
@@ -145,12 +153,10 @@ class FileAdapter(
|
|||||||
|
|
||||||
class FileDiffCallback : DiffUtil.ItemCallback<File>() {
|
class FileDiffCallback : DiffUtil.ItemCallback<File>() {
|
||||||
override fun areItemsTheSame(oldItem: File, newItem: File): Boolean {
|
override fun areItemsTheSame(oldItem: File, newItem: File): Boolean {
|
||||||
// Compare based on file path or another unique identifier
|
|
||||||
return oldItem.path == newItem.path
|
return oldItem.path == newItem.path
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun areContentsTheSame(oldItem: File, newItem: File): Boolean {
|
override fun areContentsTheSame(oldItem: File, newItem: File): Boolean {
|
||||||
// Compare the content of files if needed
|
|
||||||
return oldItem == newItem
|
return oldItem == newItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ import android.content.Context
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
import androidx.activity.result.IntentSenderRequest
|
import androidx.activity.result.IntentSenderRequest
|
||||||
import androidx.documentfile.provider.DocumentFile
|
import androidx.documentfile.provider.DocumentFile
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
|
import devs.org.calculator.R
|
||||||
import devs.org.calculator.callbacks.DialogActionsCallback
|
import devs.org.calculator.callbacks.DialogActionsCallback
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|||||||
5
app/src/main/res/drawable/plus.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="20" android:viewportWidth="20" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="@color/textColor" android:fillType="evenOdd" android:pathData="M9,17a1,1 0,1 0,2 0v-6h6a1,1 0,1 0,0 -2h-6V3a1,1 0,1 0,-2 0v6H3a1,1 0,0 0,0 2h6v6z"/>
|
||||||
|
|
||||||
|
</vector>
|
||||||
78
app/src/main/res/layout/activity_change_password.xml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="16dp"
|
||||||
|
tools:context=".activities.SetupPasswordActivity">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/tvTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Change Password"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/tilOldPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:hint="Enter Old Password"
|
||||||
|
app:endIconMode="password_toggle"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvTitle">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/etOldPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:inputType="number" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/tilNewPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:hint="Enter New Password"
|
||||||
|
app:endIconMode="password_toggle"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tilOldPassword">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/etNewPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:inputType="number" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnChangePassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:text="Change Password"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tilNewPassword" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnResetPassword"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="Forgot Password?"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btnChangePassword" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
@@ -11,14 +12,28 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="8dp" />
|
android:padding="8dp" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<!-- <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton-->
|
||||||
|
<!-- android:id="@+id/fabAdd"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_gravity="bottom|end"-->
|
||||||
|
<!-- android:layout_margin="16dp"-->
|
||||||
|
<!-- android:contentDescription="Compose"-->
|
||||||
|
<!-- android:icon="@drawable/plus"-->
|
||||||
|
<!-- android:text="Add File"-->
|
||||||
|
<!-- app:elevation="6dp"/>-->
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
android:id="@+id/fabAdd"
|
android:id="@+id/fabAdd"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_marginEnd="25dp"
|
android:layout_marginEnd="25dp"
|
||||||
android:layout_marginBottom="35dp"
|
android:layout_marginBottom="35dp"
|
||||||
android:contentDescription="Add file"
|
android:contentDescription="Compose"
|
||||||
android:src="@android:drawable/ic_input_add" />
|
app:iconPadding="8dp"
|
||||||
|
app:icon="@android:drawable/ic_input_add"
|
||||||
|
android:text="Add file"/>
|
||||||
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/fabAdd"
|
android:id="@+id/fabAdd"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_marginEnd="25dp"
|
android:layout_marginEnd="25dp"
|
||||||
android:layout_marginBottom="35dp"
|
android:layout_marginBottom="35dp"
|
||||||
|
|||||||
@@ -9,14 +9,19 @@
|
|||||||
tools:context=".activities.MainActivity">
|
tools:context=".activities.MainActivity">
|
||||||
|
|
||||||
<!-- Calculator Display -->
|
<!-- Calculator Display -->
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/display"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="160dp"
|
android:layout_height="160dp"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="right|bottom">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/display"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end|bottom"
|
android:gravity="end|bottom"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
@@ -27,6 +32,23 @@
|
|||||||
android:autoSizeStepGranularity="2sp"
|
android:autoSizeStepGranularity="2sp"
|
||||||
tools:ignore="Suspicious0dp" />
|
tools:ignore="Suspicious0dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/total"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="end|bottom"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="26sp"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
|
android:autoSizeMinTextSize="20sp"
|
||||||
|
android:autoSizeMaxTextSize="48sp"
|
||||||
|
android:autoSizeStepGranularity="2sp"
|
||||||
|
tools:ignore="Suspicious0dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1006 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 776 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.0 KiB |
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#3DDC84</color>
|
||||||
|
</resources>
|
||||||