mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-22 19:40:07 +01:00
Use updated security API
This commit is contained in:
parent
bd28e3e4a1
commit
fadf9bed7e
@ -57,7 +57,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
// implementation 'com.github.SimpleMobileTools:Simple-Commons:c45f0d662a'
|
||||
implementation 'com.github.qwertyfinger:Simple-Commons:d61a1c0910'
|
||||
implementation 'com.github.qwertyfinger:Simple-Commons:615349768d'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
|
||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||
|
||||
|
@ -83,7 +83,8 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
initViewPager(intent.getLongExtra(OPEN_NOTE_ID, -1L))
|
||||
pager_title_strip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getPercentageFontSize())
|
||||
pager_title_strip.layoutParams.height = (pager_title_strip.height + resources.getDimension(R.dimen.activity_margin) * 2 * (config.fontSizePercentage / 100f)).toInt()
|
||||
pager_title_strip.layoutParams.height =
|
||||
(pager_title_strip.height + resources.getDimension(R.dimen.activity_margin) * 2 * (config.fontSizePercentage / 100f)).toInt()
|
||||
checkWhatsNewDialog()
|
||||
checkIntents(intent)
|
||||
|
||||
@ -1080,18 +1081,22 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun unlockNote() {
|
||||
SecurityDialog(this, mCurrentNote.protectionHash, mCurrentNote.protectionType) { hash, type, success ->
|
||||
if (success) {
|
||||
mCurrentNote.protectionHash = ""
|
||||
mCurrentNote.protectionType = PROTECTION_NONE
|
||||
NotesHelper(this).insertOrUpdateNote(mCurrentNote) {
|
||||
getCurrentFragment()?.apply {
|
||||
shouldShowLockedContent = true
|
||||
checkLockState()
|
||||
}
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
performSecurityCheck(
|
||||
protectionType = mCurrentNote.protectionType,
|
||||
requiredHash = mCurrentNote.protectionHash,
|
||||
successCallback = { _, _ -> removeProtection() }
|
||||
)
|
||||
}
|
||||
|
||||
private fun removeProtection() {
|
||||
mCurrentNote.protectionHash = ""
|
||||
mCurrentNote.protectionType = PROTECTION_NONE
|
||||
NotesHelper(this).insertOrUpdateNote(mCurrentNote) {
|
||||
getCurrentFragment()?.apply {
|
||||
shouldShowLockedContent = true
|
||||
checkLockState()
|
||||
}
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@ import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.dialogs.SecurityDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
|
||||
@ -105,13 +104,12 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||
|
||||
if (mNotes.size == 1 && note == null) {
|
||||
note = mNotes.first()
|
||||
SecurityDialog(this, note.protectionHash, note.protectionType) { hash, type, success ->
|
||||
if (success) {
|
||||
updateCurrentNote(note)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
performSecurityCheck(
|
||||
protectionType = note.protectionType,
|
||||
requiredHash = note.protectionHash,
|
||||
successCallback = { _, _ -> updateCurrentNote(note) },
|
||||
failureCallback = { finish() }
|
||||
)
|
||||
} else {
|
||||
if (note != null) {
|
||||
updateCurrentNote(note)
|
||||
@ -132,11 +130,11 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||
if (note.protectionType == PROTECTION_NONE) {
|
||||
updateCurrentNote(note)
|
||||
} else {
|
||||
SecurityDialog(this, note.protectionHash, note.protectionType) { hash, type, success ->
|
||||
if (success) {
|
||||
updateCurrentNote(note)
|
||||
}
|
||||
}
|
||||
performSecurityCheck(
|
||||
protectionType = note.protectionType,
|
||||
requiredHash = note.protectionHash,
|
||||
successCallback = { _, _ -> updateCurrentNote(note) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ package com.simplemobiletools.notes.pro.fragments
|
||||
import android.util.TypedValue
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.simplemobiletools.commons.dialogs.SecurityDialog
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.performSecurityCheck
|
||||
import com.simplemobiletools.commons.helpers.PROTECTION_NONE
|
||||
import com.simplemobiletools.notes.pro.extensions.config
|
||||
import com.simplemobiletools.notes.pro.extensions.getPercentageFontSize
|
||||
@ -22,10 +22,10 @@ abstract class NoteFragment : Fragment() {
|
||||
note_locked_layout.beVisibleIf(note.isLocked() && !shouldShowLockedContent)
|
||||
note_locked_image.applyColorFilter(config!!.textColor)
|
||||
|
||||
note_locked_label.setTextColor(context!!.config.textColor)
|
||||
note_locked_label.setTextColor(requireContext().config.textColor)
|
||||
note_locked_label.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getPercentageFontSize())
|
||||
|
||||
note_locked_show.setTextColor(context!!.getAdjustedPrimaryColor())
|
||||
note_locked_show.setTextColor(requireContext().getAdjustedPrimaryColor())
|
||||
note_locked_show.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getPercentageFontSize())
|
||||
note_locked_show.setOnClickListener {
|
||||
handleUnlocking()
|
||||
@ -39,13 +39,15 @@ abstract class NoteFragment : Fragment() {
|
||||
return
|
||||
}
|
||||
|
||||
SecurityDialog(activity!!, note!!.protectionHash, note!!.protectionType) { hash, type, success ->
|
||||
if (success) {
|
||||
activity?.performSecurityCheck(
|
||||
protectionType = note!!.protectionType,
|
||||
requiredHash = note!!.protectionHash,
|
||||
successCallback = { _, _ ->
|
||||
shouldShowLockedContent = true
|
||||
checkLockState()
|
||||
callback?.invoke()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
abstract fun checkLockState()
|
||||
|
Loading…
x
Reference in New Issue
Block a user