mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Better magikeyboard views
This commit is contained in:
@@ -30,9 +30,12 @@ import android.view.*
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.BlendModeColorFilterCompat
|
||||
import androidx.core.graphics.BlendModeCompat
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.activities.EntrySelectionLauncherActivity
|
||||
import com.kunzisoft.keepass.adapters.FieldsAdapter
|
||||
@@ -55,7 +58,10 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
|
||||
private var mDatabase: Database? = null
|
||||
|
||||
private var keyboardView: KeyboardView? = null
|
||||
private var entryContainer: View? = null
|
||||
private var entryText: TextView? = null
|
||||
private var databaseText: TextView? = null
|
||||
private var databaseColorView: ImageView? = null
|
||||
private var packageText: TextView? = null
|
||||
private var keyboard: Keyboard? = null
|
||||
private var keyboardEntry: Keyboard? = null
|
||||
@@ -91,7 +97,10 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
|
||||
override fun onCreateInputView(): View {
|
||||
|
||||
val rootKeyboardView = layoutInflater.inflate(R.layout.keyboard_container, null)
|
||||
entryContainer = rootKeyboardView.findViewById(R.id.magikeyboard_entry_container)
|
||||
entryText = rootKeyboardView.findViewById(R.id.magikeyboard_entry_text)
|
||||
databaseText = rootKeyboardView.findViewById(R.id.magikeyboard_database_text)
|
||||
databaseColorView = rootKeyboardView.findViewById(R.id.magikeyboard_database_color)
|
||||
packageText = rootKeyboardView.findViewById(R.id.magikeyboard_package_text)
|
||||
keyboardView = rootKeyboardView.findViewById(R.id.magikeyboard_view)
|
||||
|
||||
@@ -163,6 +172,24 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
|
||||
keyboardView?.isHapticFeedbackEnabled = PreferencesUtil.isKeyboardVibrationEnable(this)
|
||||
playSoundDuringCLick = PreferencesUtil.isKeyboardSoundEnable(this)
|
||||
}
|
||||
setDatabaseViews()
|
||||
}
|
||||
|
||||
private fun setDatabaseViews() {
|
||||
if (mDatabase == null) {
|
||||
entryContainer?.visibility = View.GONE
|
||||
} else {
|
||||
entryContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
databaseText?.text = mDatabase?.name ?: ""
|
||||
val databaseColor = mDatabase?.customColor
|
||||
if (databaseColor != null) {
|
||||
databaseColorView?.drawable?.colorFilter = BlendModeColorFilterCompat
|
||||
.createBlendModeColorFilterCompat(databaseColor, BlendModeCompat.SRC_IN)
|
||||
databaseColorView?.visibility = View.VISIBLE
|
||||
} else {
|
||||
databaseColorView?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun populateEntryInfoInView(entryInfo: EntryInfo) {
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
android:right="0dp"
|
||||
android:top="12dp"
|
||||
android:bottom="12dp"/>
|
||||
<stroke android:width="1dp" android:color="@color/grey_blue_slight" />
|
||||
<solid android:color="@color/grey_blue_slight"/>
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/grey_blue_slight" />
|
||||
<solid
|
||||
android:color="@color/grey_blue_slight"/>
|
||||
</shape>
|
||||
31
app/src/main/res/drawable/key_border.xml
Normal file
31
app/src/main/res/drawable/key_border.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2022 Jeremy Jamet / Kunzisoft.
|
||||
|
||||
This file is part of KeePassDX.
|
||||
|
||||
KeePassDX is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
KeePassDX is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:radius="12dp" />
|
||||
<padding
|
||||
android:left="0dp"
|
||||
android:right="0dp"
|
||||
android:top="12dp"
|
||||
android:bottom="12dp"/>
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/grey_blue_slighter" />
|
||||
</shape>
|
||||
@@ -20,25 +20,73 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="@color/grey_blue_deep"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/magikeyboard_entry_text"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:id="@+id/magikeyboard_entry_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/grey_blue_deep"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"/>
|
||||
android:layout_gravity="center"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@drawable/key_border"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/magikeyboard_entry_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="16sp"
|
||||
tools:text="Git account signup"
|
||||
android:textColor="@color/white"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/magikeyboard_database_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<ImageView
|
||||
android:id="@+id/magikeyboard_database_color"
|
||||
android:layout_width="6dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/content_description_database_color"
|
||||
android:src="@drawable/background_icon" />
|
||||
<TextView
|
||||
android:id="@+id/magikeyboard_database_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:textSize="11sp"
|
||||
tools:text="Database A"
|
||||
android:textColor="@color/grey_blue_slighter"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/magikeyboard_package_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/grey_blue_deep"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/reply_blue"/>
|
||||
android:textSize="12sp"
|
||||
tools:text="com.kunzisoft.keepass"
|
||||
android:textColor="@color/grey_blue_slighter"/>
|
||||
<com.kunzisoft.keepass.magikeyboard.KeyboardView
|
||||
android:id="@+id/magikeyboard_view"
|
||||
style="@style/KeepassDXStyle.Keyboard"
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
<color name="grey_slight">#202124</color>
|
||||
<color name="grey_slight_transparent">#E0202124</color>
|
||||
<color name="grey_black_slight">#3E4247</color>
|
||||
<color name="grey_blue_slighter">#4F5F66</color>
|
||||
<color name="grey_blue_slight">#3c474c</color>
|
||||
<color name="grey_blue_deep">#263238</color>
|
||||
<color name="blue_slight">#5E97F6</color>
|
||||
|
||||
Reference in New Issue
Block a user