2013-06-14 00:14:50 -04:00
|
|
|
using System;
|
|
|
|
using Android.Content;
|
2013-06-25 15:27:41 -04:00
|
|
|
using Android.OS;
|
2013-06-14 00:14:50 -04:00
|
|
|
using KeePassLib.Serialization;
|
2013-07-09 03:59:17 -04:00
|
|
|
using keepass2android.Io;
|
2013-06-14 00:14:50 -04:00
|
|
|
|
|
|
|
namespace keepass2android
|
|
|
|
{
|
2013-06-15 16:02:48 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Interface through which Activities and the logic layer can access some app specific functionalities and Application static data
|
|
|
|
/// </summary>
|
|
|
|
/// This also contains methods which are UI specific and should be replacable for testing.
|
2013-06-14 00:14:50 -04:00
|
|
|
public interface IKp2aApp
|
|
|
|
{
|
2013-06-15 16:02:48 -04:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the flag that the database needs to be locked.
|
|
|
|
/// </summary>
|
2013-06-14 00:14:50 -04:00
|
|
|
void SetShutdown();
|
2013-06-15 16:02:48 -04:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns the current database
|
|
|
|
/// </summary>
|
2013-06-14 00:14:50 -04:00
|
|
|
Database GetDb();
|
|
|
|
|
2013-06-15 16:02:48 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Tell the app that the file from ioc was opened with keyfile.
|
|
|
|
/// </summary>
|
2013-06-14 00:14:50 -04:00
|
|
|
void StoreOpenedFileAsRecent(IOConnectionInfo ioc, string keyfile);
|
|
|
|
|
2013-06-15 16:02:48 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new database and returns it
|
|
|
|
/// </summary>
|
2013-06-14 00:14:50 -04:00
|
|
|
Database CreateNewDatabase();
|
|
|
|
|
2013-06-15 16:02:48 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Returns the user-displayable string identified by stringKey
|
|
|
|
/// </summary>
|
2013-06-14 00:14:50 -04:00
|
|
|
string GetResourceString(UiStringKey stringKey);
|
|
|
|
|
2013-06-15 16:02:48 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Returns the value from the preferences corresponding to key
|
|
|
|
/// </summary>
|
2013-06-14 00:14:50 -04:00
|
|
|
bool GetBooleanPreference(PreferenceKey key);
|
|
|
|
|
2013-06-15 16:02:48 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Asks the user the question "messageKey" with the options Yes/No/Cancel, calls the handler corresponding to the answer.
|
|
|
|
/// </summary>
|
2013-06-14 00:14:50 -04:00
|
|
|
void AskYesNoCancel(UiStringKey titleKey, UiStringKey messageKey,
|
|
|
|
EventHandler<DialogClickEventArgs> yesHandler,
|
|
|
|
EventHandler<DialogClickEventArgs> noHandler,
|
|
|
|
EventHandler<DialogClickEventArgs> cancelHandler,
|
|
|
|
Context ctx);
|
2013-06-25 15:27:41 -04:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a Handler object which can run tasks on the UI thread
|
|
|
|
/// </summary>
|
|
|
|
Handler UiThreadHandler { get; }
|
|
|
|
|
|
|
|
IProgressDialog CreateProgressDialog(Context ctx);
|
2013-07-09 03:59:17 -04:00
|
|
|
IFileStorage GetFileStorage(IOConnectionInfo iocInfo);
|
|
|
|
|
2013-06-14 00:14:50 -04:00
|
|
|
}
|
|
|
|
}
|