mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-25 10:42:17 -05:00
Hidden toast if not launch from searchResult
This commit is contained in:
parent
5b6786d0a2
commit
96b5aba684
@ -95,6 +95,29 @@ namespace keepass2android
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// represents data stored in an intent or bundle as extra bool
|
||||||
|
/// </summary>
|
||||||
|
public class BoolExtra: IExtra
|
||||||
|
{
|
||||||
|
public string Key { get; set; }
|
||||||
|
public bool Value{ get; set; }
|
||||||
|
|
||||||
|
#region IExtra implementation
|
||||||
|
|
||||||
|
public void ToBundle(Bundle b)
|
||||||
|
{
|
||||||
|
b.PutBoolean(Key, Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ToIntent(Intent i)
|
||||||
|
{
|
||||||
|
i.PutExtra(Key, Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// represents data stored in an intent or bundle as extra string array
|
/// represents data stored in an intent or bundle as extra string array
|
||||||
@ -675,6 +698,7 @@ namespace keepass2android
|
|||||||
public const String numberOfGroupsKey = "NumberOfGroups";
|
public const String numberOfGroupsKey = "NumberOfGroups";
|
||||||
public const String gUuidKey = "gUuidKey";
|
public const String gUuidKey = "gUuidKey";
|
||||||
public const String fullGroupNameKey = "fullGroupNameKey";
|
public const String fullGroupNameKey = "fullGroupNameKey";
|
||||||
|
public const String toastEnableKey = "toastEnableKey";
|
||||||
|
|
||||||
#if INCLUDE_DEBUG_MOVE_GROUPNAME
|
#if INCLUDE_DEBUG_MOVE_GROUPNAME
|
||||||
public const String gNameKey = "gNameKey";
|
public const String gNameKey = "gNameKey";
|
||||||
@ -689,14 +713,27 @@ namespace keepass2android
|
|||||||
set ;
|
set ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected bool toastEnable {
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public NavigateAndLaunchTask() {
|
public NavigateAndLaunchTask() {
|
||||||
this.taskToBeLaunchAfterNavigation = new NullTask();
|
this.taskToBeLaunchAfterNavigation = new NullTask();
|
||||||
fullGroupName = "";
|
fullGroupName = "";
|
||||||
|
toastEnable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected NavigateAndLaunchTask(PwGroup groups, AppTask taskToBeLaunchAfterNavigation) {
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="keepass2android.NavigateAndLaunchTask"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="groups">Groups.</param>
|
||||||
|
/// <param name="taskToBeLaunchAfterNavigation">Task to be launched after navigation.</param>
|
||||||
|
/// <param name="toastEnable">If set to <c>true</c>, toast will be displayed after navigation.</param>
|
||||||
|
protected NavigateAndLaunchTask(PwGroup groups, AppTask taskToBeLaunchAfterNavigation, bool toastEnable = false) {
|
||||||
this.taskToBeLaunchAfterNavigation = taskToBeLaunchAfterNavigation;
|
this.taskToBeLaunchAfterNavigation = taskToBeLaunchAfterNavigation;
|
||||||
populateGroups (groups);
|
populateGroups (groups);
|
||||||
|
this.toastEnable = toastEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populateGroups(PwGroup groups) {
|
public void populateGroups(PwGroup groups) {
|
||||||
@ -736,13 +773,13 @@ namespace keepass2android
|
|||||||
public override void Setup(Bundle b)
|
public override void Setup(Bundle b)
|
||||||
{
|
{
|
||||||
int numberOfGroups = b.GetInt(numberOfGroupsKey);
|
int numberOfGroups = b.GetInt(numberOfGroupsKey);
|
||||||
|
|
||||||
groupUuid = new LinkedList<String>{};
|
groupUuid = new LinkedList<String>{};
|
||||||
#if INCLUDE_DEBUG_MOVE_GROUPNAME
|
#if INCLUDE_DEBUG_MOVE_GROUPNAME
|
||||||
groupNameList = new LinkedList<String>{};
|
groupNameList = new LinkedList<String>{};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
fullGroupName = "";
|
|
||||||
|
|
||||||
while (i < numberOfGroups) {
|
while (i < numberOfGroups) {
|
||||||
|
|
||||||
@ -754,7 +791,8 @@ namespace keepass2android
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fullGroupName = b.GetString (fullGroupNameKey);
|
fullGroupName = b.GetString (fullGroupNameKey);
|
||||||
|
toastEnable = b.GetBoolean (toastEnableKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -783,6 +821,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
yield return new IntExtra{ Key = numberOfGroupsKey, Value = i };
|
yield return new IntExtra{ Key = numberOfGroupsKey, Value = i };
|
||||||
yield return new StringExtra{ Key = fullGroupNameKey, Value = fullGroupName };
|
yield return new StringExtra{ Key = fullGroupNameKey, Value = fullGroupName };
|
||||||
|
yield return new BoolExtra{ Key = toastEnableKey, Value = toastEnable };
|
||||||
|
|
||||||
// Return afterTaskExtras
|
// Return afterTaskExtras
|
||||||
IEnumerator<IExtra> afterTaskExtras = taskToBeLaunchAfterNavigation.Extras.GetEnumerator();
|
IEnumerator<IExtra> afterTaskExtras = taskToBeLaunchAfterNavigation.Extras.GetEnumerator();
|
||||||
@ -799,9 +838,11 @@ namespace keepass2android
|
|||||||
|
|
||||||
if (GroupIsFound(groupBaseActivity) ){ // Group has been found: display toaster and stop here
|
if (GroupIsFound(groupBaseActivity) ){ // Group has been found: display toaster and stop here
|
||||||
|
|
||||||
String toastMessage = groupBaseActivity.GetString(Resource.String.NavigationToGroupCompleted_message);
|
if (toastEnable) {
|
||||||
|
String toastMessage = groupBaseActivity.GetString (Resource.String.NavigationToGroupCompleted_message);
|
||||||
toastMessage = toastMessage.Replace ("%0", this.fullGroupName);
|
toastMessage = toastMessage.Replace ("%0", this.fullGroupName);
|
||||||
Toast.MakeText (groupBaseActivity, toastMessage, ToastLength.Long).Show ();
|
Toast.MakeText (groupBaseActivity, toastMessage, ToastLength.Long).Show ();
|
||||||
|
}
|
||||||
|
|
||||||
groupBaseActivity.StartTask (taskToBeLaunchAfterNavigation);
|
groupBaseActivity.StartTask (taskToBeLaunchAfterNavigation);
|
||||||
return;
|
return;
|
||||||
@ -840,7 +881,8 @@ namespace keepass2android
|
|||||||
public NavigateToFolder():base() {
|
public NavigateToFolder():base() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public NavigateToFolder(PwGroup groups): base(groups, new NullTask()) {
|
public NavigateToFolder(PwGroup groups, bool toastEnable = false)
|
||||||
|
: base(groups, new NullTask(), toastEnable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,8 +895,8 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public NavigateToFolderAndLaunchMoveElementTask(PwGroup groups, PwUuid Uuid):
|
public NavigateToFolderAndLaunchMoveElementTask(PwGroup groups, PwUuid Uuid, bool toastEnable = false)
|
||||||
base(groups, new MoveElementTask() { Uuid = Uuid }) {
|
:base(groups, new MoveElementTask() { Uuid = Uuid }, toastEnable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Setup(Bundle b) {
|
public override void Setup(Bundle b) {
|
||||||
|
@ -213,11 +213,11 @@ namespace keepass2android.view
|
|||||||
return true;
|
return true;
|
||||||
case MenuMove:
|
case MenuMove:
|
||||||
NavigateToFolderAndLaunchMoveElementTask navMove =
|
NavigateToFolderAndLaunchMoveElementTask navMove =
|
||||||
new NavigateToFolderAndLaunchMoveElementTask(_entry.ParentGroup, _entry.Uuid);
|
new NavigateToFolderAndLaunchMoveElementTask(_entry.ParentGroup, _entry.Uuid, _isSearchResult);
|
||||||
_groupActivity.StartTask (navMove);
|
_groupActivity.StartTask (navMove);
|
||||||
return true;
|
return true;
|
||||||
case MenuNavigate:
|
case MenuNavigate:
|
||||||
NavigateToFolder navNavigate = new NavigateToFolder(_entry.ParentGroup);
|
NavigateToFolder navNavigate = new NavigateToFolder(_entry.ParentGroup, true);
|
||||||
_groupActivity.StartTask (navNavigate);
|
_groupActivity.StartTask (navNavigate);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user