Skip to content

Commit

Permalink
Merge branch 'release/3.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed May 11, 2022
2 parents f907aa5 + 831b649 commit 1c0f1a0
Show file tree
Hide file tree
Showing 52 changed files with 304 additions and 143 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
KeePassDX(3.4.4)
* Fix crash in New Android 13 #1321
* Better backstack management for selection mode
* Prevent Tapjacking #1318
* Small changes #1298

KeePassDX(3.4.3)
* Remove "Select share info" setting for Magikeyboard #1304
* Fix quick search and better loadGroup implementation #1302
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.kunzisoft.keepass"
minSdkVersion 15
targetSdkVersion 31
versionCode = 112
versionName = "3.4.3"
versionCode = 113
versionName = "3.4.4"
multiDexEnabled true

testApplicationId = "com.kunzisoft.keepass.tests"
Expand Down Expand Up @@ -105,7 +105,7 @@ dependencies {
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.biometric:biometric:1.1.0'
implementation 'androidx.media:media:1.5.0'
implementation 'androidx.media:media:1.6.0'
// Lifecycle - LiveData - ViewModel - Coroutines
implementation "androidx.core:core-ktx:$android_core_version"
implementation 'androidx.fragment:fragment-ktx:1.4.1'
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
<activity
android:name="com.kunzisoft.keepass.activities.AutofillLauncherActivity"
android:theme="@style/Theme.Transparent"
android:configChanges="keyboardHidden" />
android:configChanges="keyboardHidden"
android:excludeFromRecents="true"/>
<activity
android:name="com.kunzisoft.keepass.settings.SettingsAdvancedUnlockActivity" />
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.core.text.HtmlCompat
import com.kunzisoft.keepass.BuildConfig
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.stylish.StylishActivity
import com.kunzisoft.keepass.utils.UriUtil
import org.joda.time.DateTime

class AboutActivity : StylishActivity() {
Expand All @@ -45,6 +46,12 @@ class AboutActivity : StylishActivity() {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)

val appName = if (UriUtil.contributingUser(this))
getString(R.string.app_name) + " " + getString(R.string.app_name_part3)
else
getString(R.string.app_name)
findViewById<TextView>(R.id.activity_about_app_name).text = appName

var version: String
var build: String
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import com.kunzisoft.keepass.database.search.SearchHelper
import com.kunzisoft.keepass.magikeyboard.MagikeyboardService
import com.kunzisoft.keepass.model.SearchInfo
import com.kunzisoft.keepass.otp.OtpEntryFields
import com.kunzisoft.keepass.settings.PreferencesUtil

/**
* Activity to search or select entry in database,
Expand All @@ -44,7 +43,7 @@ class EntrySelectionLauncherActivity : DatabaseModeActivity() {
}

override fun finishActivityIfReloadRequested(): Boolean {
return true
return false
}

override fun onDatabaseRetrieved(database: Database?) {
Expand Down Expand Up @@ -74,27 +73,40 @@ class EntrySelectionLauncherActivity : DatabaseModeActivity() {
sharedWebDomain = Uri.parse(extra).host
}
}
launchSelection(database, sharedWebDomain, otpString)
}
Intent.ACTION_VIEW -> {
// Retrieve OTP
intent.dataString?.let { extra ->
if (OtpEntryFields.isOTPUri(extra))
otpString = extra
}
launchSelection(database, sharedWebDomain, otpString)
}
else -> {
if (database != null) {
GroupActivity.launch(this, database)
} else {
FileDatabaseSelectActivity.launch(this)
}
}
else -> {}
}
}
finish()
}

// Build domain search param
val searchInfo = SearchInfo().apply {
this.webDomain = sharedWebDomain
this.otpString = otpString
}
private fun launchSelection(database: Database?,
sharedWebDomain: String?,
otpString: String?) {
// Build domain search param
val searchInfo = SearchInfo().apply {
this.webDomain = sharedWebDomain
this.otpString = otpString
}

SearchInfo.getConcreteWebDomain(this, searchInfo.webDomain) { concreteWebDomain ->
searchInfo.webDomain = concreteWebDomain
launch(database, searchInfo)
}
SearchInfo.getConcreteWebDomain(this, searchInfo.webDomain) { concreteWebDomain ->
searchInfo.webDomain = concreteWebDomain
launch(database, searchInfo)
}
}

Expand Down Expand Up @@ -188,7 +200,6 @@ class EntrySelectionLauncherActivity : DatabaseModeActivity() {
}
}
)
finish()
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,6 @@ class FileDatabaseSelectActivity : DatabaseModeActivity(),
}
}

override fun onValidateSpecialMode() {
super.onValidateSpecialMode()
finish()
}

override fun onCancelSpecialMode() {
super.onCancelSpecialMode()
finish()
}

private fun launchPasswordActivityWithPath(databaseUri: Uri) {
launchPasswordActivity(databaseUri, null)
// Delete flickering for kitkat <=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,6 @@ class MainCredentialActivity : DatabaseModeActivity(), AdvancedUnlockFragment.Bu
}
}

override fun onValidateSpecialMode() {
super.onValidateSpecialMode()
finish()
}

override fun onCancelSpecialMode() {
super.onCancelSpecialMode()
finish()
}

override fun retrieveCredentialForEncryption(): ByteArray {
return mainCredentialView?.retrieveCredentialForStorage(credentialStorageListener)
?: byteArrayOf()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.kunzisoft.keepass.activities.legacy

import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.View
import android.widget.Toast
import com.kunzisoft.keepass.R
Expand Down Expand Up @@ -96,9 +93,8 @@ abstract class DatabaseModeActivity : DatabaseActivity() {

private fun backToTheMainAppAndFinish() {
// To move the app in background and return to the main app
// Not visible as opened with FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
moveTaskToBack(true)
// Not finish() to prevent service kill
// Not using FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS or finish() because kills the service
}

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.EntrySelectionLauncherActivity
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
Expand Down Expand Up @@ -93,6 +95,14 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
switchToPreviousKeyboard()
}

fieldsAdapter = FieldsAdapter(this)
fieldsAdapter?.onItemClickListener = object : FieldsAdapter.OnItemClickListener {
override fun onItemClick(item: Field) {
currentInputConnection.commitText(getEntryInfo()?.getGeneratedFieldValue(item.name) , 1)
actionTabAutomatically()
}
}

registerLockReceiver(lockReceiver, true)
}

Expand Down Expand Up @@ -121,15 +131,8 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
contentView = popupFieldsView
}

val recyclerView = popupFieldsView.findViewById<androidx.recyclerview.widget.RecyclerView>(R.id.keyboard_popup_fields_list)
fieldsAdapter = FieldsAdapter(this)
fieldsAdapter?.onItemClickListener = object : FieldsAdapter.OnItemClickListener {
override fun onItemClick(item: Field) {
currentInputConnection.commitText(getEntryInfo()?.getGeneratedFieldValue(item.name) , 1)
actionTabAutomatically()
}
}
recyclerView.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this, androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL, true)
val recyclerView = popupFieldsView.findViewById<RecyclerView>(R.id.keyboard_popup_fields_list)
recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true)
recyclerView.adapter = fieldsAdapter

val closeView = popupFieldsView.findViewById<View>(R.id.keyboard_popup_close)
Expand All @@ -141,7 +144,7 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
return rootKeyboardView
}

return super.onCreateInputView()
return rootKeyboardView
}

private fun getEntryInfo(): EntryInfo? {
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,18 @@ object UriUtil {

fun contributingUser(context: Context): Boolean {
return (Education.isEducationScreenReclickedPerformed(context)
|| isExternalAppInstalled(context, "com.kunzisoft.keepass.pro")
|| isExternalAppInstalled(context, "com.kunzisoft.keepass.pro", false)
)
}

private fun isExternalAppInstalled(context: Context, packageName: String): Boolean {
private fun isExternalAppInstalled(context: Context, packageName: String, showError: Boolean = true): Boolean {
try {
context.applicationContext.packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES)
Education.setEducationScreenReclickedPerformed(context)
return true
} catch (e: Exception) {
Log.e(TAG, "App not accessible", e)
if (showError)
Log.e(TAG, "App not accessible", e)
}
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,52 @@ import android.content.Context
import android.text.InputType
import android.util.AttributeSet
import android.widget.ArrayAdapter
import android.widget.Filter
import androidx.annotation.LayoutRes
import androidx.appcompat.widget.AppCompatAutoCompleteTextView
import com.kunzisoft.keepass.R

class InheritedCompletionView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : AppCompatAutoCompleteTextView(context, attrs) {

val adapter = ArrayAdapter(
private val adapter = ArrayAdapterNoFilter(
context,
android.R.layout.simple_list_item_1,
InheritedStatus.listOfStrings(context))
android.R.layout.simple_list_item_1
)

private class ArrayAdapterNoFilter(context: Context,
@LayoutRes private val layoutResource: Int)
: ArrayAdapter<String>(context, layoutResource) {
val items = InheritedStatus.listOfStrings(context)

override fun getCount(): Int {
return items.size
}

override fun getItem(position: Int): String {
return items[position]
}

override fun getItemId(position: Int): Long {
// Or just return p0
return items[position].hashCode().toLong()
}

override fun getFilter(): Filter {
return object : Filter() {
override fun performFiltering(p0: CharSequence?): FilterResults {
return FilterResults().apply {
values = items
}
}

override fun publishResults(p0: CharSequence?, p1: FilterResults?) {
notifyDataSetChanged()
}
}
}
}

init {
setAdapter(adapter)
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout-v23/view_advanced_unlock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fingerprint_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:filterTouchesWhenObscured="true">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/biometric_image"
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:filterTouchesWhenObscured="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">

Expand Down Expand Up @@ -71,28 +72,29 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toEndOf="@+id/activity_about_icon"
android:layout_toRightOf="@+id/activity_about_icon"
android:layout_toEndOf="@+id/activity_about_icon">
android:orientation="vertical">

<TextView
android:id="@+id/activity_about_app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="18sp"
android:textStyle="bold"/>
android:textStyle="bold" />

<TextView
android:id="@+id/activity_about_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"/>
android:textAppearance="@android:style/TextAppearance.Small" />

<TextView
android:id="@+id/activity_about_build"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"/>
android:textAppearance="@android:style/TextAppearance.Small" />
</LinearLayout>
</RelativeLayout>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:id="@+id/toolbar_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:filterTouchesWhenObscured="true"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_entry_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
android:importantForAutofill="noExcludeDescendants"
tools:targetApi="o"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:filterTouchesWhenObscured="true">

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/entry_edit_coordinator_layout"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_file_selection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:filterTouchesWhenObscured="true"
android:importantForAutofill="noExcludeDescendants"
tools:targetApi="o">

Expand Down
Loading

0 comments on commit 1c0f1a0

Please sign in to comment.