add FAB for TOTP, add activity for showing TOTP entries
This commit is contained in:
@@ -40,6 +40,7 @@ using Android.Views.Autofill;
|
||||
using CursorAdapter = Android.Support.V4.Widget.CursorAdapter;
|
||||
using Object = Java.Lang.Object;
|
||||
using Android.Text;
|
||||
using keepass2android.search;
|
||||
using KeeTrayTOTP.Libraries;
|
||||
|
||||
namespace keepass2android
|
||||
@@ -118,6 +119,7 @@ namespace keepass2android
|
||||
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = (showAddGroup || showAddEntry) ? ViewStates.Visible : ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabSearch).Visibility = (showAddGroup || showAddEntry) ? ViewStates.Visible : ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabTotpOverview).Visibility = CanShowTotpFab() ? ViewStates.Visible : ViewStates.Gone;
|
||||
}
|
||||
|
||||
UpdateBottomBarElementVisibility(Resource.Id.insert_element, false);
|
||||
@@ -625,6 +627,14 @@ namespace keepass2android
|
||||
};
|
||||
}
|
||||
|
||||
if (FindViewById(Resource.Id.fabTotpOverview) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.fabTotpOverview).Click += (sender, args) =>
|
||||
{
|
||||
SearchTotpResults.Launch(this, this.AppTask);
|
||||
};
|
||||
}
|
||||
|
||||
if (FindViewById(Resource.Id.fabCancelAddNew) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.fabAddNew).Click += (sender, args) =>
|
||||
@@ -634,6 +644,7 @@ namespace keepass2android
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = AddEntryEnabled ? ViewStates.Visible : ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabSearch).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabTotpOverview).Visibility = ViewStates.Gone;
|
||||
};
|
||||
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Click += (sender, args) =>
|
||||
@@ -643,6 +654,7 @@ namespace keepass2android
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = ViewStates.Visible;
|
||||
FindViewById(Resource.Id.fabSearch).Visibility = ViewStates.Visible;
|
||||
FindViewById(Resource.Id.fabTotpOverview).Visibility = CanShowTotpFab() ? ViewStates.Visible : ViewStates.Gone;
|
||||
};
|
||||
|
||||
|
||||
@@ -722,7 +734,12 @@ namespace keepass2android
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected virtual bool CanShowTotpFab()
|
||||
{
|
||||
return App.Kp2a.CurrentDb.HasTotpEntries && Group == App.Kp2a.CurrentDb.Root;
|
||||
}
|
||||
|
||||
private bool IsTimeForInfotext(out string lastInfoText)
|
||||
{
|
||||
DateTime lastDisplayTime = new DateTime(_prefs.GetLong("LastInfoTextTime", 0));
|
||||
|
BIN
src/keepass2android/Resources/drawable-mdpi/ic_fab_totp.png
Normal file
BIN
src/keepass2android/Resources/drawable-mdpi/ic_fab_totp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
BIN
src/keepass2android/Resources/drawable-xhdpi/ic_fab_totp.png
Normal file
BIN
src/keepass2android/Resources/drawable-xhdpi/ic_fab_totp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
@@ -409,5 +409,14 @@
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="88dp"
|
||||
android:visibility="gone"/>
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabTotpOverview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom|right"
|
||||
android:src="@drawable/ic_fab_totp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="160dp"
|
||||
android:visibility="gone"/>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</RelativeLayout>
|
@@ -227,6 +227,7 @@
|
||||
<Compile Include="fileselect\FileSelectActivity.cs" />
|
||||
<Compile Include="fileselect\FileDbHelper.cs" />
|
||||
<Compile Include="search\SearchProvider.cs" />
|
||||
<Compile Include="search\SearchTotpResults.cs" />
|
||||
<Compile Include="SelectStorageLocationActivity.cs" />
|
||||
<Compile Include="services\AutofillBase\AutofillFieldMetadata.cs" />
|
||||
<Compile Include="services\AutofillBase\AutofillFieldMetadataCollection.cs" />
|
||||
@@ -1994,6 +1995,12 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_fab_search.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_fab_totp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_fab_totp.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
Reference in New Issue
Block a user