notify about unconfigured child databases. finishes implementation of child databases, thus closes #174
This commit is contained in:
@@ -53,6 +53,7 @@ namespace keepass2android
|
||||
{ Resource.Id.cancel_insert_element, 20 },
|
||||
{ Resource.Id.insert_element, 20 },
|
||||
//only use the same id if elements can be shown simultaneously!
|
||||
{ Resource.Id.child_db_infotext, 13 },
|
||||
{ Resource.Id.fingerprint_infotext, 12 },
|
||||
{ Resource.Id.autofill_infotext, 11 },
|
||||
{ Resource.Id.notification_info_android8_infotext, 10 },
|
||||
@@ -246,6 +247,7 @@ namespace keepass2android
|
||||
AppTask.StartInGroupActivity(this);
|
||||
AppTask.SetupGroupBaseActivityButtons(this);
|
||||
|
||||
UpdateChildDbInfo();
|
||||
UpdateFingerprintInfo();
|
||||
UpdateAutofillInfo();
|
||||
UpdateAndroid8NotificationInfo();
|
||||
@@ -485,6 +487,23 @@ namespace keepass2android
|
||||
};
|
||||
}
|
||||
|
||||
if (FindViewById(Resource.Id.configure_child_db) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.configure_child_db).Click += (sender, args) =>
|
||||
{
|
||||
StartActivity(typeof(ConfigureChildDatabasesActivity));
|
||||
};
|
||||
}
|
||||
|
||||
if (FindViewById(Resource.Id.info_dont_show_child_db_again) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.info_dont_show_child_db_again).Click += (sender, args) =>
|
||||
{
|
||||
_prefs.Edit().PutBoolean(childdb_ignore_prefskey + App.Kp2a.CurrentDb.CurrentFingerprintPrefKey, true).Commit();
|
||||
UpdateAutofillInfo();
|
||||
};
|
||||
}
|
||||
|
||||
if (FindViewById(Resource.Id.fabCancelAddNew) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.fabAddNew).Click += (sender, args) =>
|
||||
@@ -597,6 +616,7 @@ namespace keepass2android
|
||||
return _prefs.GetBoolean("InfoTextDisabled_" + infoTextKey, false);
|
||||
}
|
||||
|
||||
const string childdb_ignore_prefskey = "childdb_ignore_prefskey";
|
||||
const string autofillservicewasenabled_prefskey = "AutofillServiceWasEnabled";
|
||||
const string fingerprintinfohidden_prefskey = "fingerprintinfohidden_prefskey";
|
||||
|
||||
@@ -655,6 +675,27 @@ namespace keepass2android
|
||||
UpdateBottomBarElementVisibility(Resource.Id.fingerprint_infotext, canShowFingerprintInfo);
|
||||
}
|
||||
|
||||
private void UpdateChildDbInfo()
|
||||
{
|
||||
bool canShow = Group == App.Kp2a.CurrentDb.Root
|
||||
&& KeeAutoExecExt.GetAutoExecItems(App.Kp2a.CurrentDb.KpDatabase).Any(item =>
|
||||
{
|
||||
bool isexplicit;
|
||||
KeeAutoExecExt.IsDeviceEnabled(item, KeeAutoExecExt.ThisDeviceId, out isexplicit);
|
||||
return !isexplicit;
|
||||
});
|
||||
|
||||
bool disabledForDatabase = _prefs.GetBoolean(childdb_ignore_prefskey+ App.Kp2a.CurrentDb.CurrentFingerprintPrefKey, false);
|
||||
|
||||
if (canShow && !disabledForDatabase)
|
||||
{
|
||||
RegisterInfoTextDisplay("ChildDb"); //this ensures that we don't show the general info texts too soon
|
||||
|
||||
}
|
||||
UpdateBottomBarElementVisibility(Resource.Id.child_db_infotext, canShow);
|
||||
}
|
||||
|
||||
|
||||
protected void UpdateBottomBarElementVisibility(int resourceId, bool canShow)
|
||||
{
|
||||
if (canShow)
|
||||
|
||||
@@ -53,18 +53,23 @@ namespace keepass2android
|
||||
{
|
||||
public const string _ifDevice = "IfDevice";
|
||||
|
||||
private static string _thisDevice = null;
|
||||
|
||||
public static string ThisDeviceId
|
||||
{
|
||||
get {
|
||||
get
|
||||
{
|
||||
if (_thisDevice != null)
|
||||
return _thisDevice;
|
||||
String android_id = Settings.Secure.GetString(Application.Context.ContentResolver, Settings.Secure.AndroidId);
|
||||
|
||||
string deviceName = Build.Manufacturer+" "+Build.Model;
|
||||
string deviceId = deviceName + " (" + android_id + ")";
|
||||
_thisDevice = deviceName + " (" + android_id + ")";
|
||||
|
||||
deviceId = deviceId.Replace("!", "_");
|
||||
deviceId = deviceId.Replace(",", "_");
|
||||
deviceId = deviceId.Replace(";", "_");
|
||||
return deviceId;
|
||||
_thisDevice = _thisDevice.Replace("!", "_");
|
||||
_thisDevice = _thisDevice.Replace(",", "_");
|
||||
_thisDevice = _thisDevice.Replace(";", "_");
|
||||
return _thisDevice;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -135,7 +135,49 @@
|
||||
android:text="@string/dont_show_again"
|
||||
style="@style/BottomBarButton" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/child_db_infotext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView android:id="@+id/myinfotext" android:text="@string/unconfigured_child_dbs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/child_db_buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<Button
|
||||
android:id="@+id/configure_child_db"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:paddingTop="4dp"
|
||||
android:text="@string/configure_child_dbs"
|
||||
style="@style/BottomBarButton" />
|
||||
</RelativeLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/info_dont_show_child_db_again"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="4dp"
|
||||
android:text="@string/dont_show_again"
|
||||
style="@style/BottomBarButton" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/notification_info_android8_infotext"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -744,6 +744,7 @@
|
||||
<string name="child_db_enable_on_this_device">Enable on this device</string>
|
||||
<string name="child_db_disable_on_this_device">Disable on this device</string>
|
||||
<string name="child_db_enable_a_copy_for_this_device">Copy for this device</string>
|
||||
<string name="unconfigured_child_dbs">Your database contains new child databases in the "AutoOpen" group. Please specify if these child databases should be used on this device.</string>
|
||||
<string name="add_child_db">Add child database...</string>
|
||||
<string name="EnableCopyForThisDevice_Info">This will create and enable a copy of the child database settings. These copied settings can then be adjusted specifically for this device.</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user