Add navigation drawer

This commit is contained in:
J-Jamet
2022-02-11 15:24:59 +01:00
parent 6ceecbfd0f
commit 17c26e2a96
13 changed files with 464 additions and 178 deletions

View File

@@ -66,7 +66,6 @@ import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ActionRunnable
import com.kunzisoft.keepass.tasks.AttachmentFileBinderManager import com.kunzisoft.keepass.tasks.AttachmentFileBinderManager
import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.timeout.TimeoutHelper
import com.kunzisoft.keepass.utils.MenuUtil
import com.kunzisoft.keepass.utils.UriUtil import com.kunzisoft.keepass.utils.UriUtil
import com.kunzisoft.keepass.utils.UuidUtil import com.kunzisoft.keepass.utils.UuidUtil
import com.kunzisoft.keepass.view.changeControlColor import com.kunzisoft.keepass.view.changeControlColor
@@ -370,7 +369,6 @@ class EntryActivity : DatabaseLockActivity() {
super.onCreateOptionsMenu(menu) super.onCreateOptionsMenu(menu)
if (mEntryLoaded) { if (mEntryLoaded) {
val inflater = menuInflater val inflater = menuInflater
MenuUtil.contributionMenuInflater(inflater, menu)
inflater.inflate(R.menu.entry, menu) inflater.inflate(R.menu.entry, menu)
inflater.inflate(R.menu.database, menu) inflater.inflate(R.menu.database, menu)
@@ -443,10 +441,6 @@ class EntryActivity : DatabaseLockActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.menu_contribute -> {
MenuUtil.onContributionItemSelected(this)
return true
}
R.id.menu_edit -> { R.id.menu_edit -> {
mDatabase?.let { database -> mDatabase?.let { database ->
mMainEntryId?.let { entryId -> mMainEntryId?.let { entryId ->

View File

@@ -36,14 +36,21 @@ import android.widget.*
import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.ActivityResultLauncher
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ActionMode import androidx.appcompat.view.ActionMode
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.core.view.GravityCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat import androidx.core.view.WindowInsetsControllerCompat
import androidx.drawerlayout.widget.DrawerLayout
import androidx.navigation.ui.AppBarConfiguration
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.navigation.NavigationView
import com.kunzisoft.keepass.R import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.dialogs.* import com.kunzisoft.keepass.activities.dialogs.*
import com.kunzisoft.keepass.activities.fragments.GroupFragment import com.kunzisoft.keepass.activities.fragments.GroupFragment
@@ -68,14 +75,16 @@ import com.kunzisoft.keepass.services.DatabaseTaskNotificationService.Companion.
import com.kunzisoft.keepass.services.DatabaseTaskNotificationService.Companion.NEW_NODES_KEY import com.kunzisoft.keepass.services.DatabaseTaskNotificationService.Companion.NEW_NODES_KEY
import com.kunzisoft.keepass.services.DatabaseTaskNotificationService.Companion.getListNodesFromBundle import com.kunzisoft.keepass.services.DatabaseTaskNotificationService.Companion.getListNodesFromBundle
import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.settings.SettingsActivity
import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ActionRunnable
import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.timeout.TimeoutHelper
import com.kunzisoft.keepass.utils.MenuUtil import com.kunzisoft.keepass.utils.UriUtil
import com.kunzisoft.keepass.view.* import com.kunzisoft.keepass.view.*
import com.kunzisoft.keepass.viewmodels.GroupEditViewModel import com.kunzisoft.keepass.viewmodels.GroupEditViewModel
import com.kunzisoft.keepass.viewmodels.GroupViewModel import com.kunzisoft.keepass.viewmodels.GroupViewModel
import org.joda.time.DateTime import org.joda.time.DateTime
class GroupActivity : DatabaseLockActivity(), class GroupActivity : DatabaseLockActivity(),
DatePickerDialog.OnDateSetListener, DatePickerDialog.OnDateSetListener,
TimePickerDialog.OnTimeSetListener, TimePickerDialog.OnTimeSetListener,
@@ -86,6 +95,13 @@ class GroupActivity : DatabaseLockActivity(),
SortDialogFragment.SortSelectionListener { SortDialogFragment.SortSelectionListener {
// Views // Views
private var drawerLayout: DrawerLayout? = null
private var databaseNavView: NavigationView? = null
private var databaseNavContainerView: View? = null
private var databaseNavIconView: ImageView? = null
private var databaseNavColorView: ImageView? = null
private var databaseNavNameView: TextView? = null
private var databaseNavVersionView: TextView? = null
private var rootContainerView: ViewGroup? = null private var rootContainerView: ViewGroup? = null
private var coordinatorLayout: CoordinatorLayout? = null private var coordinatorLayout: CoordinatorLayout? = null
private var lockView: View? = null private var lockView: View? = null
@@ -102,6 +118,8 @@ class GroupActivity : DatabaseLockActivity(),
private var breadcrumbListView: RecyclerView? = null private var breadcrumbListView: RecyclerView? = null
private var loadingView: ProgressBar? = null private var loadingView: ProgressBar? = null
private lateinit var appBarConfiguration: AppBarConfiguration
private val mGroupViewModel: GroupViewModel by viewModels() private val mGroupViewModel: GroupViewModel by viewModels()
private val mGroupEditViewModel: GroupEditViewModel by viewModels() private val mGroupEditViewModel: GroupEditViewModel by viewModels()
@@ -215,6 +233,13 @@ class GroupActivity : DatabaseLockActivity(),
setContentView(layoutInflater.inflate(R.layout.activity_group, null)) setContentView(layoutInflater.inflate(R.layout.activity_group, null))
// Initialize views // Initialize views
drawerLayout = findViewById(R.id.drawer_layout)
databaseNavView = findViewById(R.id.database_nav_view)
databaseNavContainerView = databaseNavView?.getHeaderView(0)
databaseNavIconView = databaseNavContainerView?.findViewById(R.id.nav_database_icon)
databaseNavColorView = databaseNavContainerView?.findViewById(R.id.nav_database_color)
databaseNavNameView = databaseNavContainerView?.findViewById(R.id.nav_database_name)
databaseNavVersionView = databaseNavContainerView?.findViewById(R.id.nav_database_version)
rootContainerView = findViewById(R.id.activity_group_container_view) rootContainerView = findViewById(R.id.activity_group_container_view)
coordinatorLayout = findViewById(R.id.group_coordinator) coordinatorLayout = findViewById(R.id.group_coordinator)
numberChildrenView = findViewById(R.id.group_numbers) numberChildrenView = findViewById(R.id.group_numbers)
@@ -236,6 +261,35 @@ class GroupActivity : DatabaseLockActivity(),
toolbar?.title = "" toolbar?.title = ""
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
val toggle = ActionBarDrawerToggle(
this, drawerLayout, toolbar,
R.string.navigation_drawer_open, R.string.navigation_drawer_close
)
drawerLayout?.addDrawerListener(toggle)
toggle.syncState()
// Menu in drawer
databaseNavView?.apply {
inflateMenu(R.menu.settings)
inflateMenu(R.menu.database_extra)
inflateMenu(R.menu.about)
setNavigationItemSelectedListener { menuItem ->
when (menuItem.itemId) {
R.id.menu_app_settings -> {
// To avoid flickering when launch settings in a LockingActivity
SettingsActivity.launch(this@GroupActivity, true)
}
R.id.menu_contribute -> {
UriUtil.gotoUrl(this@GroupActivity, R.string.contribution_url)
}
R.id.menu_about -> {
startActivity(Intent(this@GroupActivity, AboutActivity::class.java))
}
}
false
}
}
searchFiltersView?.closeAdvancedFilters() searchFiltersView?.closeAdvancedFilters()
@@ -512,15 +566,22 @@ class GroupActivity : DatabaseLockActivity(),
// Search suggestion // Search suggestion
database?.let { database?.let {
databaseNameView?.text = if (it.name.isNotEmpty()) it.name else getString(R.string.database) val databaseName = it.name.ifEmpty { getString(R.string.database) }
databaseNavNameView?.text = databaseName
databaseNameView?.text = databaseName
databaseNavVersionView?.text = it.version
val customColor = it.customColor val customColor = it.customColor
if (customColor != null) { if (customColor != null) {
databaseNavColorView?.drawable?.colorFilter = BlendModeColorFilterCompat
.createBlendModeColorFilterCompat(customColor, BlendModeCompat.SRC_IN)
databaseNavColorView?.visibility = View.VISIBLE
databaseColorView?.visibility = View.VISIBLE databaseColorView?.visibility = View.VISIBLE
databaseColorView?.setColorFilter( databaseColorView?.setColorFilter(
customColor, customColor,
PorterDuff.Mode.SRC_IN PorterDuff.Mode.SRC_IN
) )
} else { } else {
databaseNavColorView?.visibility = View.GONE
databaseColorView?.visibility = View.GONE databaseColorView?.visibility = View.GONE
} }
mBreadcrumbAdapter?.iconDrawableFactory = it.iconDrawableFactory mBreadcrumbAdapter?.iconDrawableFactory = it.iconDrawableFactory
@@ -1060,9 +1121,7 @@ class GroupActivity : DatabaseLockActivity(),
if (!mMergeDataAllowed) { if (!mMergeDataAllowed) {
menu.findItem(R.id.menu_merge_database)?.isVisible = false menu.findItem(R.id.menu_merge_database)?.isVisible = false
} }
if (mSpecialMode == SpecialMode.DEFAULT) { if (mSpecialMode != SpecialMode.DEFAULT) {
MenuUtil.defaultMenuInflater(inflater, menu)
} else {
menu.findItem(R.id.menu_merge_database)?.isVisible = false menu.findItem(R.id.menu_merge_database)?.isVisible = false
menu.findItem(R.id.menu_reload_database)?.isVisible = false menu.findItem(R.id.menu_reload_database)?.isVisible = false
} }
@@ -1174,7 +1233,7 @@ class GroupActivity : DatabaseLockActivity(),
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
android.R.id.home -> { android.R.id.home -> {
// TODO change database drawerLayout?.openDrawer(GravityCompat.START)
return true return true
} }
R.id.menu_search -> { R.id.menu_search -> {
@@ -1203,8 +1262,6 @@ class GroupActivity : DatabaseLockActivity(),
return true return true
} }
else -> { else -> {
// Check the time lock before launching settings
MenuUtil.onDefaultMenuOptionsItemSelected(this, item, true)
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
} }

View File

@@ -43,7 +43,6 @@ import com.kunzisoft.keepass.services.DatabaseTaskNotificationService
import com.kunzisoft.keepass.settings.preference.* import com.kunzisoft.keepass.settings.preference.*
import com.kunzisoft.keepass.settings.preferencedialogfragment.* import com.kunzisoft.keepass.settings.preferencedialogfragment.*
import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ActionRunnable
import com.kunzisoft.keepass.utils.MenuUtil
import com.kunzisoft.keepass.viewmodels.DatabaseViewModel import com.kunzisoft.keepass.viewmodels.DatabaseViewModel
class NestedDatabaseSettingsFragment : NestedSettingsFragment(), DatabaseRetrieval { class NestedDatabaseSettingsFragment : NestedSettingsFragment(), DatabaseRetrieval {
@@ -673,19 +672,21 @@ class NestedDatabaseSettingsFragment : NestedSettingsFragment(), DatabaseRetriev
} }
R.id.menu_merge_database -> { R.id.menu_merge_database -> {
mergeDatabase() mergeDatabase()
return true true
} }
R.id.menu_reload_database -> { R.id.menu_reload_database -> {
reloadDatabase() reloadDatabase()
return true true
} }
R.id.menu_app_settings -> {
else -> {
// Check the time lock before launching settings // Check the time lock before launching settings
// TODO activity menu // TODO activity menu
(activity as SettingsActivity?)?.let { (activity as SettingsActivity?)?.let {
MenuUtil.onDefaultMenuOptionsItemSelected(it, item, true) SettingsActivity.launch(it, true)
} }
true
}
else -> {
super.onOptionsItemSelected(item) super.onOptionsItemSelected(item)
} }
} }

View File

@@ -32,18 +32,11 @@ import com.kunzisoft.keepass.settings.SettingsActivity
object MenuUtil { object MenuUtil {
fun contributionMenuInflater(inflater: MenuInflater, menu: Menu) {
if (!(BuildConfig.FULL_VERSION && BuildConfig.CLOSED_STORE))
inflater.inflate(R.menu.contribution, menu)
}
fun defaultMenuInflater(inflater: MenuInflater, menu: Menu) { fun defaultMenuInflater(inflater: MenuInflater, menu: Menu) {
contributionMenuInflater(inflater, menu) inflater.inflate(R.menu.settings, menu)
inflater.inflate(R.menu.default_menu, menu) inflater.inflate(R.menu.about, menu)
} if (!(BuildConfig.FULL_VERSION && BuildConfig.CLOSED_STORE))
menu.findItem(R.id.menu_contribute)?.isVisible = false
fun onContributionItemSelected(context: Context) {
UriUtil.gotoUrl(context, R.string.contribution_url)
} }
/* /*
@@ -54,7 +47,7 @@ object MenuUtil {
timeoutEnable: Boolean = false) { timeoutEnable: Boolean = false) {
when (item.itemId) { when (item.itemId) {
R.id.menu_contribute -> { R.id.menu_contribute -> {
onContributionItemSelected(activity) UriUtil.gotoUrl(activity, R.string.contribution_url)
} }
R.id.menu_app_settings -> { R.id.menu_app_settings -> {
// To avoid flickering when launch settings in a LockingActivity // To avoid flickering when launch settings in a LockingActivity

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<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:strokeWidth="0.04285714"
android:pathData="M 23.835938,5.7167969 C 13.70451,5.7167969 5,9.3383264 5,13.855469 c 0,4.512856 8.70451,8.167969 18.835938,8.167969 10.135713,0 18.835937,-3.655113 18.835937,-8.167969 0,-4.5171426 -8.700224,-8.1386721 -18.835937,-8.1386721 z M 42.671875,18.09375 c 0,4.517142 -8.700224,8.171875 -18.835937,8.171875 C 13.70451,26.265625 5,22.610513 5,18.097656 v 6.248047 c 0,4.512857 8.70451,8.167969 18.835938,8.167969 10.135713,0 18.835937,-3.655112 18.835937,-8.167969 z M 5,28.582031 v 6.25 C 5,39.344888 13.70451,43 23.835938,43 33.971651,43 42.671875,39.344888 42.671875,34.832031 v -6.25 c 0,4.517143 -8.700224,8.169922 -18.835937,8.169922 C 13.70451,36.751953 5,33.094888 5,28.582031 Z" />
</vector>

View File

@@ -17,139 +17,161 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with KeePassDX. If not, see <http://www.gnu.org/licenses/>. along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
--> -->
<RelativeLayout <androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_group_container_view" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.kunzisoft.keepass.view.SpecialModeView <RelativeLayout
android:id="@+id/special_mode_view" android:id="@+id/activity_group_container_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/toolbarSpecialAppearance" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:title="@string/app_name"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_below="@+id/special_mode_view"
android:background="?attr/colorPrimary"
android:theme="?attr/toolbarAppearance" >
<LinearLayout
android:id="@+id/database_name_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/database_color"
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@drawable/background_rounded_square"
android:layout_marginRight="12dp"
android:layout_marginEnd="12dp"
android:contentDescription="@string/content_description_database_color"/>
<TextView
android:id="@+id/database_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Database"
style="@style/KeepassDXStyle.TextAppearance.Title.TextOnPrimary" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/group_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:layout_above="@+id/toolbar_action">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:targetApi="lollipop"
android:fitsSystemWindows="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|snap|enterAlways">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_breadcrumb"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="?attr/toolbarAppearance"
tools:targetApi="lollipop">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/breadcrumb_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal" />
</androidx.appcompat.widget.Toolbar>
<com.kunzisoft.keepass.view.SearchFiltersView
android:id="@+id/search_filters"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/node_list_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_below="@+id/toolbar">
<FrameLayout
android:id="@+id/nodes_list_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/windowBackground" />
</RelativeLayout>
<com.kunzisoft.keepass.view.AddNodeButtonView
android:id="@+id/add_node_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@+id/node_list_container"
app:layout_anchorGravity="end|bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.kunzisoft.keepass.view.ToolbarAction
android:id="@+id/toolbar_action"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:visibility="gone"
android:theme="?attr/toolbarActionAppearance"
android:layout_alignParentBottom="true" />
<FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ProgressBar <com.kunzisoft.keepass.view.SpecialModeView
android:id="@+id/loading" android:id="@+id/special_mode_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/toolbarSpecialAppearance" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:title="@string/app_name"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_below="@+id/special_mode_view"
android:background="?attr/colorPrimary"
android:theme="?attr/toolbarAppearance" >
<FrameLayout
android:id="@+id/database_name_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/database_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
tools:text="Database"
style="@style/KeepassDXStyle.TextAppearance.Title.TextOnPrimary" />
</FrameLayout>
</androidx.appcompat.widget.Toolbar>
<ImageView
android:id="@+id/database_color"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginTop="22dp"
android:layout_marginStart="54dp"
android:layout_marginLeft="54dp"
android:layout_below="@+id/special_mode_view"
android:src="@drawable/background_rounded_square"
android:contentDescription="@string/content_description_database_color"/>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/group_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:layout_above="@+id/toolbar_action">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:targetApi="lollipop"
android:fitsSystemWindows="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|snap|enterAlways">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_breadcrumb"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="?attr/toolbarAppearance"
tools:targetApi="lollipop">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/breadcrumb_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal" />
</androidx.appcompat.widget.Toolbar>
<com.kunzisoft.keepass.view.SearchFiltersView
android:id="@+id/search_filters"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="@+id/node_list_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_below="@+id/toolbar">
<FrameLayout
android:id="@+id/nodes_list_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/windowBackground" />
</RelativeLayout>
<com.kunzisoft.keepass.view.AddNodeButtonView
android:id="@+id/add_node_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@+id/node_list_container"
app:layout_anchorGravity="end|bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.kunzisoft.keepass.view.ToolbarAction
android:id="@+id/toolbar_action"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:visibility="gone"
android:theme="?attr/toolbarActionAppearance"
android:layout_alignParentBottom="true" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true" />
</FrameLayout>
<include
layout="@layout/view_button_lock"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_alignParentBottom="true"/>
android:indeterminate="true" />
</FrameLayout>
<include </RelativeLayout>
layout="@layout/view_button_lock"
<com.google.android.material.navigation.NavigationView
android:id="@+id/database_nav_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_alignParentBottom="true"/> android:layout_gravity="start"
app:headerLayout="@layout/nav_header_main"
app:itemTextColor="?android:attr/textColor"
app:subheaderColor="?attr/colorAccent"
android:fitsSystemWindows="true" />
</RelativeLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@@ -0,0 +1,63 @@
<?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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:gravity="bottom"
android:orientation="vertical"
android:layout_marginTop="18dp"
android:layout_marginBottom="4dp"
android:elevation="6dp"
android:paddingLeft="@dimen/default_margin"
android:paddingTop="@dimen/default_margin"
android:paddingRight="@dimen/default_margin"
android:paddingBottom="@dimen/default_margin"
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/nav_database_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
style="@style/KeepassDXStyle.TextAppearance.Info"
android:textSize="10sp"
tools:text="version" />
<ImageView
android:id="@+id/nav_database_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/content_description_nav_header"
app:layout_constraintTop_toBottomOf="@+id/nav_database_version"
app:layout_constraintBottom_toTopOf="@+id/nav_database_name"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginBottom="12dp"
app:srcCompat="@drawable/ic_database_white_48dp"
app:tint="?attr/textColorInverse"/>
<ImageView
android:id="@+id/nav_database_color"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/content_description_database_color"
android:src="@drawable/background_icon"
app:layout_constraintBottom_toBottomOf="@+id/nav_database_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/nav_database_name" />
<TextView
android:id="@+id/nav_database_name"
style="@style/KeepassDXStyle.TextAppearance.Title.TextOnPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/database"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -19,16 +19,18 @@
--> -->
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu 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">
<item android:id="@+id/menu_app_settings" <group>
android:icon="@drawable/ic_settings_white_24dp" <item android:id="@+id/menu_about"
android:title="@string/settings" android:icon="@drawable/ic_help_white_24dp"
android:orderInCategory="91" android:title="@string/about"
app:iconTint="?attr/colorControlNormal" android:orderInCategory="92"
app:showAsAction="ifRoom" /> app:iconTint="?attr/colorControlNormal"
<item android:id="@+id/menu_about" app:showAsAction="ifRoom" />
android:icon="@drawable/ic_help_white_24dp" <item android:id="@+id/menu_contribute"
android:title="@string/about" android:icon="@drawable/ic_heart_white_24dp"
android:orderInCategory="101" android:title="@string/contribute"
app:iconTint="?attr/colorControlNormal" android:orderInCategory="93"
app:showAsAction="ifRoom" /> app:iconTint="?attr/colorControlNormal"
app:showAsAction="ifRoom" />
</group>
</menu> </menu>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 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/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<group android:id="@+id/group_merge">
<item android:id="@+id/menu_merge_from_database"
android:icon="@drawable/ic_merge_white_24dp"
android:title="@string/menu_merge_from"
android:orderInCategory="80"
app:iconTint="?attr/colorControlNormal"
app:showAsAction="ifRoom" />
<item android:id="@+id/menu_merge_from_xml"
android:icon="@drawable/ic_saving_white_24dp"
android:title="@string/menu_save_to"
android:orderInCategory="81"
app:iconTint="?attr/colorControlNormal"
app:showAsAction="ifRoom" />
</group>
</menu>

View File

@@ -22,7 +22,7 @@
<item android:id="@+id/menu_open_file_read_mode_key" <item android:id="@+id/menu_open_file_read_mode_key"
android:icon="@drawable/ic_read_write_white_24dp" android:icon="@drawable/ic_read_write_white_24dp"
android:title="@string/menu_open_file_read_and_write" android:title="@string/menu_open_file_read_and_write"
android:orderInCategory="85" android:orderInCategory="61"
app:iconTint="?attr/colorControlNormal" app:iconTint="?attr/colorControlNormal"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
</menu> </menu>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2017 Jeremy Jamet / Kunzisoft. Copyright 2019 Jeremy Jamet / Kunzisoft.
This file is part of KeePassDX. This file is part of KeePassDX.
KeePassDX is free software: you can redistribute it and/or modify KeePassDX is free software: you can redistribute it and/or modify
@@ -19,10 +19,10 @@
--> -->
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu 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">
<item android:id="@+id/menu_contribute" <item android:id="@+id/menu_app_settings"
android:icon="@drawable/ic_heart_white_24dp" android:icon="@drawable/ic_settings_white_24dp"
android:title="@string/contribute" android:title="@string/settings"
android:orderInCategory="99" android:orderInCategory="71"
app:iconTint="?attr/colorControlNormal" app:iconTint="?attr/colorControlNormal"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
</menu> </menu>

View File

@@ -61,6 +61,9 @@
<string name="content_description_database_color">Database color</string> <string name="content_description_database_color">Database color</string>
<string name="content_description_entry_foreground_color">Entry foreground color</string> <string name="content_description_entry_foreground_color">Entry foreground color</string>
<string name="content_description_entry_background_color">Entry background color</string> <string name="content_description_entry_background_color">Entry background color</string>
<string name="content_description_nav_header">Navigation header</string>
<string name="navigation_drawer_open">Navigation drawer open</string>
<string name="navigation_drawer_close">Navigation drawer close</string>
<string name="validate">Validate</string> <string name="validate">Validate</string>
<string name="discard_changes">Discard changes?</string> <string name="discard_changes">Discard changes?</string>
<string name="discard">Discard</string> <string name="discard">Discard</string>
@@ -242,6 +245,8 @@
<string name="menu_save_database">Save data</string> <string name="menu_save_database">Save data</string>
<string name="menu_merge_database">Merge data</string> <string name="menu_merge_database">Merge data</string>
<string name="menu_reload_database">Reload data</string> <string name="menu_reload_database">Reload data</string>
<string name="menu_merge_from">Merge from file</string>
<string name="menu_save_to">Save to file</string>
<string name="menu_open">Open</string> <string name="menu_open">Open</string>
<string name="menu_search">Search</string> <string name="menu_search">Search</string>
<string name="menu_showpass">Show password</string> <string name="menu_showpass">Show password</string>

102
art/ic_database.svg Normal file
View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="48"
id="svg4830"
version="1.1"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
inkscape:export-filename="/home/joker/Project/Scratcheck/TestExport.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:docname="ic_database.svg">
<defs
id="defs4832" />
<sodipodi:namedview
id="base"
pagecolor="#acacac"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="7.9999997"
inkscape:cx="25.017278"
inkscape:cy="12.774208"
inkscape:current-layer="g824"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="1920"
inkscape:window-y="27"
inkscape:window-maximized="1">
<sodipodi:guide
position="0.99999471,22.999999"
orientation="22,0"
id="guide2987"
inkscape:locked="false" />
<sodipodi:guide
position="0.99999471,0.99999888"
orientation="0,22"
id="guide2989"
inkscape:locked="false" />
<sodipodi:guide
position="47,24"
orientation="-22,0"
id="guide2991"
inkscape:locked="false" />
<sodipodi:guide
position="38,47"
orientation="0,-22"
id="guide2993"
inkscape:locked="false" />
<inkscape:grid
type="xygrid"
id="grid2989" />
</sodipodi:namedview>
<metadata
id="metadata4835">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,16)">
<g
id="g4770"
transform="matrix(1.7777778,0,0,1.7777778,-205.48441,-31.997877)">
<g
id="Layer_1"
transform="matrix(-0.00397893,0,0,0.00397893,125.58386,23.674135)" />
<g
id="g824"
transform="matrix(0.02410714,0,0,0.02410714,116.939,11.007737)"
style="fill:#ffffff;fill-opacity:1">
<path
style="fill:#ffffff;fill-opacity:1;stroke-width:0.04285714"
d="M 23.835938,5.7167969 C 13.70451,5.7167969 5,9.3383264 5,13.855469 c 0,4.512856 8.70451,8.167969 18.835938,8.167969 10.135713,0 18.835937,-3.655113 18.835937,-8.167969 0,-4.5171426 -8.700224,-8.1386721 -18.835937,-8.1386721 z M 42.671875,18.09375 c 0,4.517142 -8.700224,8.171875 -18.835937,8.171875 C 13.70451,26.265625 5,22.610513 5,18.097656 v 6.248047 c 0,4.512857 8.70451,8.167969 18.835938,8.167969 10.135713,0 18.835937,-3.655112 18.835937,-8.167969 z M 5,28.582031 v 6.25 C 5,39.344888 13.70451,43 23.835938,43 33.971651,43 42.671875,39.344888 42.671875,34.832031 v -6.25 c 0,4.517143 -8.700224,8.169922 -18.835937,8.169922 C 13.70451,36.751953 5,33.094888 5,28.582031 Z"
transform="matrix(23.333336,0,0,23.333336,-56.166796,-83.333456)"
id="path822"
inkscape:connector-curvature="0" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB