diff --git a/src/Kp2aBusinessLogic/IKp2aApp.cs b/src/Kp2aBusinessLogic/IKp2aApp.cs
index c7f47b91..23cd5962 100644
--- a/src/Kp2aBusinessLogic/IKp2aApp.cs
+++ b/src/Kp2aBusinessLogic/IKp2aApp.cs
@@ -4,19 +4,46 @@ using KeePassLib.Serialization;
namespace keepass2android
{
+ ///
+ /// Interface through which Activities and the logic layer can access some app specific functionalities and Application static data
+ ///
+ /// This also contains methods which are UI specific and should be replacable for testing.
public interface IKp2aApp
{
+
+ ///
+ /// Set the flag that the database needs to be locked.
+ ///
void SetShutdown();
+
+ ///
+ /// Returns the current database
+ ///
Database GetDb();
+ ///
+ /// Tell the app that the file from ioc was opened with keyfile.
+ ///
void StoreOpenedFileAsRecent(IOConnectionInfo ioc, string keyfile);
+ ///
+ /// Creates a new database and returns it
+ ///
Database CreateNewDatabase();
+ ///
+ /// Returns the user-displayable string identified by stringKey
+ ///
string GetResourceString(UiStringKey stringKey);
+ ///
+ /// Returns the value from the preferences corresponding to key
+ ///
bool GetBooleanPreference(PreferenceKey key);
+ ///
+ /// Asks the user the question "messageKey" with the options Yes/No/Cancel, calls the handler corresponding to the answer.
+ ///
void AskYesNoCancel(UiStringKey titleKey, UiStringKey messageKey,
EventHandler yesHandler,
EventHandler noHandler,
diff --git a/src/Kp2aBusinessLogic/KeyFileException.cs b/src/Kp2aBusinessLogic/KeyFileException.cs
index fe8190f1..1eb4d824 100644
--- a/src/Kp2aBusinessLogic/KeyFileException.cs
+++ b/src/Kp2aBusinessLogic/KeyFileException.cs
@@ -16,20 +16,12 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
*/
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using Android.App;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
namespace keepass2android
{
-
+ ///
+ /// Thrown when there is an error adding the keyfie to the user key
+ ///
[Serializable]
public class KeyFileException : Exception
{
diff --git a/src/Kp2aBusinessLogic/PreferenceKey.cs b/src/Kp2aBusinessLogic/PreferenceKey.cs
index c0dfe42d..6e62362a 100644
--- a/src/Kp2aBusinessLogic/PreferenceKey.cs
+++ b/src/Kp2aBusinessLogic/PreferenceKey.cs
@@ -1,5 +1,8 @@
namespace keepass2android
{
+ ///
+ /// Keys which can be used to get a preference setting
+ ///
public enum PreferenceKey
{
remember_keyfile,
diff --git a/src/Kp2aBusinessLogic/ProgressTask.cs b/src/Kp2aBusinessLogic/ProgressTask.cs
index 5c75d0ed..878b722c 100644
--- a/src/Kp2aBusinessLogic/ProgressTask.cs
+++ b/src/Kp2aBusinessLogic/ProgressTask.cs
@@ -22,6 +22,9 @@ using Java.Lang;
namespace keepass2android
{
+ ///
+ /// Class to run a task while a progress dialog is shown
+ ///
public class ProgressTask {
private readonly Handler _handler;
private readonly RunnableOnFinish _task;
diff --git a/src/Kp2aBusinessLogic/SearchDbHelper.cs b/src/Kp2aBusinessLogic/SearchDbHelper.cs
index 4a8498df..b3c77733 100644
--- a/src/Kp2aBusinessLogic/SearchDbHelper.cs
+++ b/src/Kp2aBusinessLogic/SearchDbHelper.cs
@@ -23,6 +23,9 @@ using KeePassLib.Utility;
namespace keepass2android
{
+ ///
+ /// Helper class providing methods to search a given database for specific things
+ ///
public class SearchDbHelper
{
private readonly IKp2aApp _app;
@@ -86,21 +89,21 @@ namespace keepass2android
}
- private String extractHost(String url)
+ private static String ExtractHost(String url)
{
return UrlUtil.GetHost(url.Trim());
}
public PwGroup SearchForHost(Database database, String url, bool allowSubdomains)
{
- String host = extractHost(url);
+ String host = ExtractHost(url);
string strGroupName = _app.GetResourceString(UiStringKey.search_results) + " (\"" + host + "\")";
PwGroup pgResults = new PwGroup(true, true, strGroupName, PwIcon.EMailSearch) {IsVirtual = true};
if (String.IsNullOrWhiteSpace(host))
return pgResults;
foreach (PwEntry entry in database.Entries.Values)
{
- String otherHost = extractHost(entry.Strings.ReadSafe(PwDefs.UrlField));
+ String otherHost = ExtractHost(entry.Strings.ReadSafe(PwDefs.UrlField));
if ((allowSubdomains) && (otherHost.StartsWith("www.")))
otherHost = otherHost.Substring(4); //remove "www."
if (String.IsNullOrWhiteSpace(otherHost))
diff --git a/src/Kp2aBusinessLogic/UpdateStatus.cs b/src/Kp2aBusinessLogic/UpdateStatus.cs
index cb623498..66c98f23 100644
--- a/src/Kp2aBusinessLogic/UpdateStatus.cs
+++ b/src/Kp2aBusinessLogic/UpdateStatus.cs
@@ -22,6 +22,9 @@ using KeePassLib.Interfaces;
namespace keepass2android
{
+ ///
+ /// StatusLogger implementation which shows the progress in a progress dialog
+ ///
public class UpdateStatus: IStatusLogger {
private readonly ProgressDialog _progressDialog;
readonly IKp2aApp _app;
diff --git a/src/keepass2android/AttachmentContentProvider.cs b/src/keepass2android/AttachmentContentProvider.cs
index 52a99961..59b0378d 100644
--- a/src/keepass2android/AttachmentContentProvider.cs
+++ b/src/keepass2android/AttachmentContentProvider.cs
@@ -6,6 +6,9 @@ using Java.IO;
namespace keepass2android
{
+ ///
+ /// Makes attachments of PwEntries accessible when they are stored in the app cache
+ ///
[ContentProvider(new[]{"keepass2android."+AppNames.PackagePart+".provider"})]
public class AttachmentContentProvider : ContentProvider {
diff --git a/src/keepass2android/BitmapDrawableCompat.cs b/src/keepass2android/BitmapDrawableCompat.cs
deleted file mode 100644
index 90a37c92..00000000
--- a/src/keepass2android/BitmapDrawableCompat.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
-
- Keepass2Android 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 2 of the License, or
- (at your option) any later version.
-
- Keepass2Android 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 Keepass2Android. If not, see .
- */
-
-using Android.Graphics.Drawables;
-using Android.Content.Res;
-using Android.Graphics;
-
-namespace keepass2android
-{
-
- public class BitmapDrawableCompat {
-
- public static BitmapDrawable GetBitmapDrawable(Resources res, Bitmap bitmap) {
- return new BitmapDrawable(res, bitmap);
- }
-
- }
-
-}
-
diff --git a/src/keepass2android/KeePass.cs b/src/keepass2android/KeePass.cs
index d89d2d05..ce078f38 100644
--- a/src/keepass2android/KeePass.cs
+++ b/src/keepass2android/KeePass.cs
@@ -27,6 +27,9 @@ using Android.Text.Method;
namespace keepass2android
{
+ ///
+ /// Launcher activity of Keepass2Android. This activity usually forwards to FileSelect but may show the revision dialog after installation or updates.
+ ///
[Activity (Label = AppNames.AppName, MainLauncher = true, Theme="@style/Base")]
public class KeePass : LifecycleDebugActivity
{
diff --git a/src/keepass2android/LockCloseActivity.cs b/src/keepass2android/LockCloseActivity.cs
index f04ba86b..ffd4d2cc 100644
--- a/src/keepass2android/LockCloseActivity.cs
+++ b/src/keepass2android/LockCloseActivity.cs
@@ -20,6 +20,10 @@ using KeePassLib.Serialization;
namespace keepass2android
{
+ ///
+ /// Base class for activities displaying sensitive information.
+ ///
+ /// Checks in OnResume whether the timeout occured and the database must be locked/closed.
public class LockCloseActivity : LockingActivity {
IOConnectionInfo _ioc;
diff --git a/src/keepass2android/LockCloseListActivity.cs b/src/keepass2android/LockCloseListActivity.cs
index 24f49db3..afe0215b 100644
--- a/src/keepass2android/LockCloseListActivity.cs
+++ b/src/keepass2android/LockCloseListActivity.cs
@@ -22,7 +22,10 @@ using KeePassLib.Serialization;
namespace keepass2android
{
-
+ ///
+ /// Base class for list activities displaying sensitive information.
+ ///
+ /// Checks in OnResume whether the timeout occured and the database must be locked/closed.
public class LockCloseListActivity : LockingListActivity {
public LockCloseListActivity()
{
diff --git a/src/keepass2android/LockingActivity.cs b/src/keepass2android/LockingActivity.cs
index 00d66c00..023e0e43 100644
--- a/src/keepass2android/LockingActivity.cs
+++ b/src/keepass2android/LockingActivity.cs
@@ -20,7 +20,9 @@ using Android.Runtime;
namespace keepass2android
{
-
+ ///
+ /// Base class for activities. Notifies the TimeoutHelper whether the app is active or not.
+ ///
public class LockingActivity : LifecycleDebugActivity {
public LockingActivity (IntPtr javaReference, JniHandleOwnership transfer)
diff --git a/src/keepass2android/PasswordActivity.cs b/src/keepass2android/PasswordActivity.cs
index 7b864872..8b9ce4a2 100644
--- a/src/keepass2android/PasswordActivity.cs
+++ b/src/keepass2android/PasswordActivity.cs
@@ -366,7 +366,7 @@ namespace keepass2android
Handler handler = new Handler();
LoadDb task = new LoadDb(App.Kp2a, _ioConnection, pass, key, new AfterLoad(handler, this));
ProgressTask pt = new ProgressTask(App.Kp2a, this, task, UiStringKey.loading_database);
- pt.run();
+ pt.Run();
};
/*CheckBox checkBox = (CheckBox) FindViewById(Resource.Id.show_password);
@@ -556,7 +556,7 @@ namespace keepass2android
private class AfterLoad : OnFinish {
readonly PasswordActivity _act;
public AfterLoad(Handler handler, PasswordActivity act):base(handler) {
- this._act = act;
+ _act = act;
}
diff --git a/src/keepass2android/Utils/Interaction.cs b/src/keepass2android/Utils/Interaction.cs
deleted file mode 100644
index 39affe20..00000000
--- a/src/keepass2android/Utils/Interaction.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
-
- Keepass2Android 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 2 of the License, or
- (at your option) any later version.
-
- Keepass2Android 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 Keepass2Android. If not, see .
- */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using Android.App;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-using Android.Content.PM;
-
-namespace keepass2android
-{
-
- public class Interaction {
- /**
- * Indicates whether the specified action can be used as an intent. This
- * method queries the package manager for installed packages that can
- * respond to an intent with the specified action. If no suitable package is
- * found, this method returns false.
- *
- * @param context The application's environment.
- * @param action The Intent action to check for availability.
- *
- * @return True if an Intent with the specified action can be sent and
- * responded to, false otherwise.
- */
- public static bool isIntentAvailable(Context context, String action, String type) {
- PackageManager packageManager = context.PackageManager;
- Intent intent = new Intent(action);
- if (type != null)
- intent.SetType(type);
- IList list =
- packageManager.QueryIntentActivities(intent,
- PackageInfoFlags.MatchDefaultOnly);
- foreach (ResolveInfo i in list)
- Android.Util.Log.Debug("DEBUG", i.ActivityInfo.ApplicationInfo.PackageName);
- return list.Count > 0;
- }
- }
-
-}
-
diff --git a/src/keepass2android/Utils/Util.cs b/src/keepass2android/Utils/Util.cs
index 79c16c46..d1710d4f 100644
--- a/src/keepass2android/Utils/Util.cs
+++ b/src/keepass2android/Utils/Util.cs
@@ -101,18 +101,43 @@ namespace keepass2android
te.Text = str;
}
}
-
+
+ /**
+ * Indicates whether the specified action can be used as an intent. This
+ * method queries the package manager for installed packages that can
+ * respond to an intent with the specified action. If no suitable package is
+ * found, this method returns false.
+ *
+ * @param context The application's environment.
+ * @param action The Intent action to check for availability.
+ *
+ * @return True if an Intent with the specified action can be sent and
+ * responded to, false otherwise.
+ */
+ static bool IsIntentAvailable(Context context, String action, String type)
+ {
+ PackageManager packageManager = context.PackageManager;
+ Intent intent = new Intent(action);
+ if (type != null)
+ intent.SetType(type);
+ IList list =
+ packageManager.QueryIntentActivities(intent,
+ PackageInfoFlags.MatchDefaultOnly);
+ foreach (ResolveInfo i in list)
+ Android.Util.Log.Debug("DEBUG", i.ActivityInfo.ApplicationInfo.PackageName);
+ return list.Count > 0;
+ }
public static void showBrowseDialog(string filename, Activity act, int requestCodeBrowse, bool forSaving)
{
- if ((!forSaving) && (Interaction.isIntentAvailable(act, Intent.ActionGetContent, "file/*"))) {
+ if ((!forSaving) && (IsIntentAvailable(act, Intent.ActionGetContent, "file/*"))) {
Intent i = new Intent(Intent.ActionGetContent);
i.SetType("file/*");
act.StartActivityForResult(i, requestCodeBrowse);
return;
}
- if (Interaction.isIntentAvailable(act, Intents.FileBrowse, null))
+ if (IsIntentAvailable(act, Intents.FileBrowse, null))
{
Intent i = new Intent(Intents.FileBrowse);
if (filename != null)
diff --git a/src/keepass2android/app/App.cs b/src/keepass2android/app/App.cs
index f88b5357..38944bb3 100644
--- a/src/keepass2android/app/App.cs
+++ b/src/keepass2android/app/App.cs
@@ -25,6 +25,9 @@ using Android.Preferences;
namespace keepass2android
{
#if NoNet
+ ///
+ /// Static strings containing App names for the Offline ("nonet") release
+ ///
public static class AppNames
{
public const string AppName = "@string/app_name_nonet";
@@ -33,6 +36,9 @@ namespace keepass2android
public const string PackagePart = "keepass2android_nonet";
}
#else
+ ///
+ /// Static strings containing App names for the Online release
+ ///
public static class AppNames
{
public const string AppName = "@string/app_name";
diff --git a/src/keepass2android/app/AppTask.cs b/src/keepass2android/app/AppTask.cs
index 8e39a5df..006160e5 100644
--- a/src/keepass2android/app/AppTask.cs
+++ b/src/keepass2android/app/AppTask.cs
@@ -63,8 +63,11 @@ namespace keepass2android
}
///
- /// base class for "tasks": this are things the user wants to do and which require several activities
+ /// base class for "tasks": these are things the user wants to do and which require several activities
///
+ /// Therefore AppTasks need to be serializable to bundles and intents to "survive" saving to instance state and changing activities.
+ /// An AppTask has a type and may have several parameters ("extras").
+ /// Activities call the task at special points so tasks can change the behaviour at these points.
public abstract class AppTask
{
///
diff --git a/src/keepass2android/compat/ActivityCompat.cs b/src/keepass2android/compat/ActivityCompat.cs
index 6f558ced..cdb2a459 100644
--- a/src/keepass2android/compat/ActivityCompat.cs
+++ b/src/keepass2android/compat/ActivityCompat.cs
@@ -23,22 +23,22 @@ namespace keepass2android
{
public class ActivityCompat {
- private static MethodInfo invalidateOptMenuMethod;
+ private static MethodInfo _invalidateOptMenuMethod;
public static void InvalidateOptionsMenu(Activity act) {
try {
- invalidateOptMenuMethod = act.GetType().GetMethod("InvalidateOptionsMenu", new Type[]{});
+ _invalidateOptMenuMethod = act.GetType().GetMethod("InvalidateOptionsMenu", new Type[]{});
} catch (Exception)
{
// Do nothing if method doesn't exist
}
- if (invalidateOptMenuMethod != null) {
+ if (_invalidateOptMenuMethod != null) {
try {
- invalidateOptMenuMethod.Invoke(act, (new Object[]{}));
+ _invalidateOptMenuMethod.Invoke(act, (new Object[]{}));
} catch (Exception)
{
// Do nothing
diff --git a/src/keepass2android/fileselect/BrowserDialog.cs b/src/keepass2android/fileselect/BrowserDialog.cs
index df61d77a..0528a0e1 100644
--- a/src/keepass2android/fileselect/BrowserDialog.cs
+++ b/src/keepass2android/fileselect/BrowserDialog.cs
@@ -24,7 +24,9 @@ using Android.Content.PM;
namespace keepass2android
{
-
+ ///
+ /// Dialog to offer to install OpenIntent file manager if there's no other browser installed
+ ///
public class BrowserDialog : Dialog {
public BrowserDialog(Context context) : base(context)
diff --git a/src/keepass2android/fileselect/FileDbHelper.cs b/src/keepass2android/fileselect/FileDbHelper.cs
index 57432a80..c5f45983 100644
--- a/src/keepass2android/fileselect/FileDbHelper.cs
+++ b/src/keepass2android/fileselect/FileDbHelper.cs
@@ -24,6 +24,9 @@ using KeePassLib.Serialization;
namespace keepass2android
{
+ ///
+ /// Class to store the recent files in a database
+ ///
public class FileDbHelper {
public const String LastFilename = "lastFile";
diff --git a/src/keepass2android/fileselect/FileSelectActivity.cs b/src/keepass2android/fileselect/FileSelectActivity.cs
index d9df85b7..68fb7cda 100644
--- a/src/keepass2android/fileselect/FileSelectActivity.cs
+++ b/src/keepass2android/fileselect/FileSelectActivity.cs
@@ -27,7 +27,9 @@ using KeePassLib.Serialization;
namespace keepass2android
{
-
+ ///
+ /// Activity to select the file to use
+ ///
[Activity (Label = "@string/app_name",
ConfigurationChanges=ConfigChanges.Orientation|
ConfigChanges.KeyboardHidden,
@@ -171,7 +173,7 @@ namespace keepass2android
App.Kp2a,
this, create,
UiStringKey.progress_create);
- createTask.run();
+ createTask.Run();
};
diff --git a/src/keepass2android/icons/DrawableFactory.cs b/src/keepass2android/icons/DrawableFactory.cs
index ee9f4f9c..1d4ece2c 100644
--- a/src/keepass2android/icons/DrawableFactory.cs
+++ b/src/keepass2android/icons/DrawableFactory.cs
@@ -24,6 +24,9 @@ using Android.Graphics;
namespace keepass2android
{
+ ///
+ /// Factory to create password icons
+ ///
public class DrawableFactory: IDrawableFactory
{
private static Drawable _blank;
@@ -42,7 +45,7 @@ namespace keepass2android
*/
private readonly Dictionary _standardIconMap = new Dictionary();
- public void assignDrawableTo (ImageView iv, Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId)
+ public void AssignDrawableTo (ImageView iv, Resources res, PwDatabase db, PwIcon icon, PwUuid customIconId)
{
Drawable draw = GetIconDrawable (res, db, icon, customIconId);
iv.SetImageDrawable (draw);
diff --git a/src/keepass2android/icons/Icons.cs b/src/keepass2android/icons/Icons.cs
index d5772b09..2f477362 100644
--- a/src/keepass2android/icons/Icons.cs
+++ b/src/keepass2android/icons/Icons.cs
@@ -22,42 +22,43 @@ using KeePassLib;
namespace keepass2android
{
-
+ ///
+ /// Stores the default pw entry icons
+ ///
public class Icons
{
private static Dictionary _icons;
private static void BuildList()
{
- if (_icons == null)
+ if (_icons != null) return;
+
+ _icons = new Dictionary();
+
+ FieldInfo[] fields = typeof(Resource.Drawable).GetFields(BindingFlags.Static | BindingFlags.Public);
+ foreach (FieldInfo fieldInfo in fields)
{
- _icons = new Dictionary();
+ String fieldName = fieldInfo.Name;
- FieldInfo[] fields = typeof(Resource.Drawable).GetFields(BindingFlags.Static | BindingFlags.Public);
- foreach (FieldInfo fieldInfo in fields)
+ if (fieldName.StartsWith("ic") && (fieldName.Length >= 4))
{
- String fieldName = fieldInfo.Name;
- if (fieldName.StartsWith("ic") && (fieldName.Length >= 4))
+ String sNum = fieldName.Substring(2, 2);
+ int num;
+ if (int.TryParse(sNum, out num) && (num < (int)PwIcon.Count))
{
- String sNum = fieldName.Substring(2, 2);
- int num;
- if (int.TryParse(sNum, out num) && (num < (int)PwIcon.Count))
+ int resId;
+ try
{
-
- int resId;
- try
- {
- resId = (int)fieldInfo.GetValue(null);
- }
- catch (Exception)
- {
- continue;
- }
-
- _icons[(PwIcon)num] = resId;
+ resId = (int)fieldInfo.GetValue(null);
}
+ catch (Exception)
+ {
+ continue;
+ }
+
+ _icons[(PwIcon)num] = resId;
}
}
}
diff --git a/src/keepass2android/intents/Intents.cs b/src/keepass2android/intents/Intents.cs
index 12d15f89..59762065 100644
--- a/src/keepass2android/intents/Intents.cs
+++ b/src/keepass2android/intents/Intents.cs
@@ -19,7 +19,9 @@ using System;
namespace keepass2android
{
-
+ ///
+ /// Contains constants to be used in intents
+ ///
public class Intents {
public const String Timeout = "keepass2android.timeout";
diff --git a/src/keepass2android/password/PasswordGenerator.cs b/src/keepass2android/password/PasswordGenerator.cs
index e79a7701..d13cb9f7 100644
--- a/src/keepass2android/password/PasswordGenerator.cs
+++ b/src/keepass2android/password/PasswordGenerator.cs
@@ -21,7 +21,9 @@ using Android.Content;
namespace keepass2android
{
-
+ ///
+ /// Password generator
+ ///
public class PasswordGenerator {
private const String UpperCaseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
private const String LowerCaseChars = "abcdefghijklmnopqrstuvwxyz";
diff --git a/src/keepass2android/search/SearchActivity.cs b/src/keepass2android/search/SearchActivity.cs
index 845b179a..b1c2d23d 100644
--- a/src/keepass2android/search/SearchActivity.cs
+++ b/src/keepass2android/search/SearchActivity.cs
@@ -25,6 +25,9 @@ using keepass2android.search;
namespace keepass2android
{
+ ///
+ /// Activity to display search options
+ ///
[Activity (Label = "@string/app_name", Theme="@style/Base")]
public class SearchActivity : LifecycleDebugActivity
{
diff --git a/src/keepass2android/search/SearchResults.cs b/src/keepass2android/search/SearchResults.cs
index f2cd100b..ceca0626 100644
--- a/src/keepass2android/search/SearchResults.cs
+++ b/src/keepass2android/search/SearchResults.cs
@@ -25,6 +25,9 @@ using KeePassLib;
namespace keepass2android.search
{
+ ///
+ /// Activity to show search results
+ ///
[Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")]
[MetaData("android.app.searchable",Resource="@xml/searchable")]
[IntentFilter(new[]{Intent.ActionSearch}, Categories=new[]{Intent.CategoryDefault})]
diff --git a/src/keepass2android/services/CopyToClipboardService.cs b/src/keepass2android/services/CopyToClipboardService.cs
index 16bb68ea..d2230481 100644
--- a/src/keepass2android/services/CopyToClipboardService.cs
+++ b/src/keepass2android/services/CopyToClipboardService.cs
@@ -33,6 +33,12 @@ using KeePass.Util.Spr;
namespace keepass2android
{
+ ///
+ /// Service to show the notifications to make the current entry accessible through clipboard or the KP2A keyboard.
+ ///
+ /// The name reflects only the possibility through clipboard because keyboard was introduced later.
+ /// The notifications require to be displayed by a service in order to be kept when the activity is closed
+ /// after searching for a URL.
[Service]
public class CopyToClipboardService: Service
{
diff --git a/src/keepass2android/services/QuickUnlockForegroundService.cs b/src/keepass2android/services/QuickUnlockForegroundService.cs
index e12a9d5d..73e76c25 100644
--- a/src/keepass2android/services/QuickUnlockForegroundService.cs
+++ b/src/keepass2android/services/QuickUnlockForegroundService.cs
@@ -23,9 +23,11 @@ using Android.Graphics;
namespace keepass2android
{
- //This service is started as soon as a Database with QuickUnlock enabled is opened.
- //Its only purpose is to be a foreground service which prevents the App from being killed (in most situations)
- [Service]
+ ///
+ /// This service is started as soon as a Database with QuickUnlock enabled is opened.
+ /// Its only purpose is to be a foreground service which prevents the App from being killed (in most situations)
+ ///
+[Service]
public class QuickUnlockForegroundService : Service
{
public override IBinder OnBind(Intent intent)
diff --git a/src/keepass2android/services/TimeoutService.cs b/src/keepass2android/services/TimeoutService.cs
index e8cdfbd9..3c960f92 100644
--- a/src/keepass2android/services/TimeoutService.cs
+++ b/src/keepass2android/services/TimeoutService.cs
@@ -24,6 +24,9 @@ using Android.Util;
namespace keepass2android
{
+ ///
+ /// Manages timeout to lock the database after some idle time
+ ///
[Service]
public class TimeoutService : Service {
private const String Tag = "KeePass2Android Timer";
diff --git a/src/keepass2android/settings/AppSettingsActivity.cs b/src/keepass2android/settings/AppSettingsActivity.cs
index 2cfbb55d..2f617f99 100644
--- a/src/keepass2android/settings/AppSettingsActivity.cs
+++ b/src/keepass2android/settings/AppSettingsActivity.cs
@@ -26,6 +26,9 @@ using KeePassLib.Cryptography.Cipher;
namespace keepass2android
{
+ ///
+ /// Activity to configure the app
+ ///
[Activity (Label = "@string/app_name", Theme="@style/NoTitleBar")]
public class AppSettingsActivity : LockingClosePreferenceActivity {
public static bool KeyfileDefault = false;
@@ -80,7 +83,7 @@ namespace keepass2android
}
}));
ProgressTask pt = new ProgressTask(App.Kp2a, this, save, UiStringKey.saving_database);
- pt.run();
+ pt.Run();
};
Preference databaseName = FindPreference(GetString(Resource.String.database_name_key));
@@ -102,7 +105,7 @@ namespace keepass2android
}
}));
ProgressTask pt = new ProgressTask(App.Kp2a, this, save, UiStringKey.saving_database);
- pt.run();
+ pt.Run();
};
diff --git a/src/keepass2android/settings/PrefsUtil.cs b/src/keepass2android/settings/PrefsUtil.cs
index d054cbe3..5f1580fe 100644
--- a/src/keepass2android/settings/PrefsUtil.cs
+++ b/src/keepass2android/settings/PrefsUtil.cs
@@ -21,7 +21,9 @@ using Android.Preferences;
namespace keepass2android
{
-
+ ///
+ /// Utility class to simplify access to the app preferences
+ ///
public class PrefsUtil {
public static float GetListTextSize(Context ctx) {
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx);
diff --git a/src/keepass2android/settings/RoundsPreference.cs b/src/keepass2android/settings/RoundsPreference.cs
index bf6eda45..2f0abf58 100644
--- a/src/keepass2android/settings/RoundsPreference.cs
+++ b/src/keepass2android/settings/RoundsPreference.cs
@@ -26,7 +26,9 @@ using Android.Util;
namespace keepass2android.settings
{
-
+ ///
+ /// Represents the setting for the number of key transformation rounds. Changing this requires to save the database.
+ ///
public class RoundsPreference : DialogPreference {
internal PwDatabase PwDatabase;
@@ -80,7 +82,7 @@ namespace keepass2android.settings
Handler handler = new Handler();
SaveDb save = new SaveDb(Context, App.Kp2a.GetDb(), new AfterSave(Context, handler, oldRounds, this));
ProgressTask pt = new ProgressTask(App.Kp2a, Context, save, UiStringKey.saving_database);
- pt.run();
+ pt.Run();
}
diff --git a/src/keepass2android/timeout/TimeoutHelper.cs b/src/keepass2android/timeout/TimeoutHelper.cs
index 41a75424..f83c4b23 100644
--- a/src/keepass2android/timeout/TimeoutHelper.cs
+++ b/src/keepass2android/timeout/TimeoutHelper.cs
@@ -23,8 +23,66 @@ using KeePassLib.Serialization;
namespace keepass2android
{
-
+ ///
+ /// Helper class to simplify usage of timeout (lock after idle time) from the activities
+ ///
public class TimeoutHelper {
+
+ class Timeout
+ {
+ private const int RequestId = 0;
+ private const long DefaultTimeout = 5 * 60 * 1000; // 5 minutes
+ private const String Tag = "Keepass2Android Timeout";
+
+ private static PendingIntent BuildIntent(Context ctx)
+ {
+ Intent intent = new Intent(Intents.Timeout);
+ PendingIntent sender = PendingIntent.GetBroadcast(ctx, RequestId, intent, PendingIntentFlags.CancelCurrent);
+
+ return sender;
+ }
+
+ public static void Start(Context ctx)
+ {
+
+
+ ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx);
+ String sTimeout = prefs.GetString(ctx.GetString(Resource.String.app_timeout_key), ctx.GetString(Resource.String.clipboard_timeout_default));
+
+ long timeout;
+ if (!long.TryParse(sTimeout, out timeout))
+ {
+ timeout = DefaultTimeout;
+ }
+
+ if (timeout == -1)
+ {
+ // No timeout don't start timeout service
+ return;
+ }
+
+ ctx.StartService(new Intent(ctx, typeof(TimeoutService)));
+
+ long triggerTime = Java.Lang.JavaSystem.CurrentTimeMillis() + timeout;
+ AlarmManager am = (AlarmManager)ctx.GetSystemService(Context.AlarmService);
+
+ Log.Debug(Tag, "Timeout start");
+ am.Set(AlarmType.Rtc, triggerTime, BuildIntent(ctx));
+ }
+
+ public static void Cancel(Context ctx)
+ {
+ AlarmManager am = (AlarmManager)ctx.GetSystemService(Context.AlarmService);
+
+ Log.Debug(Tag, "Timeout cancel");
+ am.Cancel(BuildIntent(ctx));
+
+ ctx.StopService(new Intent(ctx, typeof(TimeoutService)));
+
+ }
+
+ }
+
public static void Pause(Activity act) {
// Record timeout time in case timeout service is killed
long time = Java.Lang.JavaSystem.CurrentTimeMillis();
diff --git a/src/keepass2android/timers/Timeout.cs b/src/keepass2android/timers/Timeout.cs
deleted file mode 100644
index 86c4a07d..00000000
--- a/src/keepass2android/timers/Timeout.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
-
- Keepass2Android 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 2 of the License, or
- (at your option) any later version.
-
- Keepass2Android 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 Keepass2Android. If not, see .
- */
-
-using System;
-using Android.App;
-using Android.Content;
-using Android.Preferences;
-using Android.Util;
-
-namespace keepass2android
-{
-
- public class Timeout {
- private const int RequestId = 0;
- private const long DefaultTimeout = 5 * 60 * 1000; // 5 minutes
- private const String Tag = "Keepass2Android Timeout";
-
- private static PendingIntent BuildIntent(Context ctx) {
- Intent intent = new Intent(Intents.Timeout);
- PendingIntent sender = PendingIntent.GetBroadcast(ctx, RequestId, intent, PendingIntentFlags.CancelCurrent);
-
- return sender;
- }
-
- public static void Start(Context ctx) {
-
-
- ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx);
- String sTimeout = prefs.GetString(ctx.GetString(Resource.String.app_timeout_key), ctx.GetString(Resource.String.clipboard_timeout_default));
-
- long timeout;
- if (!long.TryParse(sTimeout, out timeout))
- {
- timeout = DefaultTimeout;
- }
-
- if ( timeout == -1 ) {
- // No timeout don't start timeout service
- return;
- }
-
- ctx.StartService(new Intent(ctx, typeof(TimeoutService)));
-
- long triggerTime = Java.Lang.JavaSystem.CurrentTimeMillis() + timeout;
- AlarmManager am = (AlarmManager) ctx.GetSystemService(Context.AlarmService);
-
- Log.Debug(Tag, "Timeout start");
- am.Set(AlarmType.Rtc, triggerTime, BuildIntent(ctx));
- }
-
- public static void Cancel(Context ctx) {
- AlarmManager am = (AlarmManager) ctx.GetSystemService(Context.AlarmService);
-
- Log.Debug(Tag, "Timeout cancel");
- am.Cancel(BuildIntent(ctx));
-
- ctx.StopService(new Intent(ctx, typeof(TimeoutService)));
-
- }
-
- }
-}
-