mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-12-23 15:38:47 -05:00
bug fix: prepareFileUsage didn't work when file was cached but device offline
This commit is contained in:
parent
75b64e5a87
commit
5619432177
@ -20,7 +20,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants>
|
||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
|
@ -169,7 +169,7 @@ namespace keepass2android.Io
|
||||
}
|
||||
}
|
||||
|
||||
public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode)
|
||||
public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess)
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
activity.IocToIntent(intent, ioc);
|
||||
|
@ -451,9 +451,10 @@ namespace keepass2android.Io
|
||||
_cachedStorage.StartSelectFile(activity, isForSave, requestCode, protocolId);
|
||||
}
|
||||
|
||||
public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode)
|
||||
public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess)
|
||||
{
|
||||
_cachedStorage.PrepareFileUsage(activity, ioc, requestCode);
|
||||
//we try to prepare the file usage by the underlying file storage but if the ioc is cached, set the flag to ignore errors
|
||||
_cachedStorage.PrepareFileUsage(activity, ioc, requestCode, alwaysReturnSuccess || IsCached(ioc));
|
||||
}
|
||||
|
||||
public void OnCreate(IFileStorageSetupActivity activity, Bundle savedInstanceState)
|
||||
|
@ -9,7 +9,7 @@ namespace keepass2android.Io
|
||||
public interface IFileStorageSetupInitiatorActivity
|
||||
{
|
||||
void StartSelectFileProcess(IOConnectionInfo ioc, bool isForSave, int requestCode);
|
||||
void StartFileUsageProcess(IOConnectionInfo ioc, int requestCode);
|
||||
void StartFileUsageProcess(IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess);
|
||||
void OnImmediateResult(int requestCode, int result, Intent intent);
|
||||
|
||||
Activity Activity { get; }
|
||||
|
@ -21,6 +21,7 @@ namespace keepass2android.Io
|
||||
public static String ProcessNameFileUsageSetup = "FILE_USAGE_SETUP";
|
||||
|
||||
public static String ExtraProcessName = "EXTRA_PROCESS_NAME";
|
||||
public static String ExtraAlwaysReturnSuccess = "EXTRA_ALWAYS_RETURN_SUCCESS";
|
||||
public static String ExtraPath = "PATH";
|
||||
public static String ExtraIsForSave = "IS_FOR_SAVE";
|
||||
public static String ExtraErrorMessage = "EXTRA_ERROR_MESSAGE";
|
||||
@ -136,8 +137,11 @@ namespace keepass2android.Io
|
||||
/// <summary>
|
||||
/// Initiates the process for choosing a file in the given file storage.
|
||||
/// The file storage should either call OnImmediateResult or StartFileUsageProcess
|
||||
/// If alwaysReturnSuccess is true, the activity should be finished with ResultCode Ok.
|
||||
/// This can make sense if a higher-level file storage has the file cached by still wants to
|
||||
/// give the cached storage the chance to initialize file access.
|
||||
/// </summary>
|
||||
void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode);
|
||||
void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess);
|
||||
|
||||
//Setup methods: these are called from the setup activity so the file storage can handle UI events for authorization etc.
|
||||
void OnCreate(IFileStorageSetupActivity activity, Bundle savedInstanceState);
|
||||
|
@ -98,7 +98,7 @@ namespace keepass2android.Io
|
||||
Kp2aLog.Log(e.Message);
|
||||
var ex = new Exception(e.LocalizedMessage ??
|
||||
e.Message ??
|
||||
_app.GetResourceString(UiStringKey.ErrorOcurred)+e, e);
|
||||
_app.GetResourceString(UiStringKey.ErrorOcurred)+e.GetType().Name, e);
|
||||
return ex;
|
||||
}
|
||||
|
||||
@ -249,9 +249,9 @@ namespace keepass2android.Io
|
||||
_jfs.StartSelectFile((IJavaFileStorageFileStorageSetupInitiatorActivity) activity, isForSave, requestCode);
|
||||
}
|
||||
|
||||
public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode)
|
||||
public void PrepareFileUsage(IFileStorageSetupInitiatorActivity activity, IOConnectionInfo ioc, int requestCode, Boolean alwaysReturnSuccess)
|
||||
{
|
||||
_jfs.PrepareFileUsage((IJavaFileStorageFileStorageSetupInitiatorActivity)activity, IocToPath(ioc), requestCode);
|
||||
_jfs.PrepareFileUsage((IJavaFileStorageFileStorageSetupInitiatorActivity)activity, IocToPath(ioc), requestCode, alwaysReturnSuccess);
|
||||
}
|
||||
|
||||
public void OnCreate(IFileStorageSetupActivity activity, Bundle savedInstanceState)
|
||||
|
@ -20,7 +20,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
@ -31,7 +31,7 @@ import com.dropbox.client2.session.Session.AccessType;
|
||||
|
||||
|
||||
|
||||
public class DropboxFileStorage implements JavaFileStorage {
|
||||
public class DropboxFileStorage extends JavaFileStorageBase {
|
||||
|
||||
//NOTE: also adjust secret!
|
||||
//final static private String APP_KEY = "i8shu7v1hgh7ynt"; //KP2A
|
||||
@ -405,7 +405,7 @@ public class DropboxFileStorage implements JavaFileStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareFileUsage(FileStorageSetupInitiatorActivity activity, String path, int requestCode) {
|
||||
public void prepareFileUsage(FileStorageSetupInitiatorActivity activity, String path, int requestCode, boolean alwaysReturnSuccess) {
|
||||
if (isConnected())
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
@ -414,7 +414,7 @@ public class DropboxFileStorage implements JavaFileStorage {
|
||||
}
|
||||
else
|
||||
{
|
||||
activity.startFileUsageProcess(path, requestCode);
|
||||
activity.startFileUsageProcess(path, requestCode, alwaysReturnSuccess);
|
||||
}
|
||||
|
||||
}
|
||||
@ -429,6 +429,9 @@ public class DropboxFileStorage implements JavaFileStorage {
|
||||
@Override
|
||||
public void onResume(FileStorageSetupActivity activity) {
|
||||
|
||||
if (activity.getProcessName().equals(PROCESS_NAME_SELECTFILE))
|
||||
activity.getState().putString(EXTRA_PATH, activity.getPath());
|
||||
|
||||
Log.d("KP2AJ", "OnResume. LoggedIn="+mLoggedIn);
|
||||
if (mLoggedIn)
|
||||
{
|
||||
@ -454,12 +457,8 @@ public class DropboxFileStorage implements JavaFileStorage {
|
||||
finishActivityWithSuccess(activity);
|
||||
return;
|
||||
|
||||
} catch (Throwable t) {
|
||||
Log.i(TAG, "Error authenticating", t);
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EXTRA_ERROR_MESSAGE, t.getMessage());
|
||||
((Activity)activity).setResult(Activity.RESULT_CANCELED, data);
|
||||
((Activity)activity).finish();
|
||||
} catch (Exception e) {
|
||||
finishWithError(activity, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -483,33 +482,6 @@ public class DropboxFileStorage implements JavaFileStorage {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void finishActivityWithSuccess(FileStorageSetupActivity setupActivity) {
|
||||
Log.d("KP2AJ", "Success with authentcating!");
|
||||
Activity activity = (Activity)setupActivity;
|
||||
|
||||
if (setupActivity.getProcessName().equals(PROCESS_NAME_FILE_USAGE_SETUP))
|
||||
{
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EXTRA_IS_FOR_SAVE, setupActivity.isForSave());
|
||||
data.putExtra(EXTRA_PATH, setupActivity.getPath());
|
||||
activity.setResult(RESULT_FILEUSAGE_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
if (setupActivity.getProcessName().equals(PROCESS_NAME_SELECTFILE))
|
||||
{
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EXTRA_PATH, setupActivity.getPath());
|
||||
activity.setResult(RESULT_FILECHOOSER_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.w("KP2AJ", "Unknown process: " + setupActivity.getProcessName());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -623,7 +623,7 @@ public class GoogleDriveFileStorage extends JavaFileStorageBase {
|
||||
try {
|
||||
gdrivePath.setPathWithoutVerify(accountNameOrPath);
|
||||
} catch (Exception e) {
|
||||
finishWithError((Activity)setupAct, e);
|
||||
finishWithError(setupAct, e);
|
||||
}
|
||||
accountNameTemp = gdrivePath.getAccount();
|
||||
}
|
||||
@ -676,7 +676,7 @@ public class GoogleDriveFileStorage extends JavaFileStorageBase {
|
||||
}
|
||||
else
|
||||
{
|
||||
finishWithError(activity, error);
|
||||
finishWithError(setupAct, error);
|
||||
}
|
||||
} else if ( isCancelled()) {
|
||||
// cancel handling here
|
||||
@ -703,18 +703,6 @@ public class GoogleDriveFileStorage extends JavaFileStorageBase {
|
||||
|
||||
|
||||
|
||||
private void finishWithError(final Activity activity,
|
||||
Exception error) {
|
||||
Log.e(TAG, "Exception: "+error.toString());
|
||||
error.printStackTrace();
|
||||
|
||||
Intent retData = new Intent();
|
||||
retData.putExtra(EXTRA_ERROR_MESSAGE, error.getMessage());
|
||||
activity.setResult(Activity.RESULT_CANCELED, retData);
|
||||
activity.finish();
|
||||
};
|
||||
|
||||
|
||||
private HashMap<String,FileSystemEntryData> buildFoldersCache(String accountName) throws IOException {
|
||||
|
||||
HashMap<String, FileSystemEntryData> folderCache = new HashMap<String, GoogleDriveFileStorage.FileSystemEntryData>();
|
||||
@ -740,42 +728,6 @@ public class GoogleDriveFileStorage extends JavaFileStorageBase {
|
||||
|
||||
}
|
||||
|
||||
private void finishActivityWithSuccess(FileStorageSetupActivity setupActivity) {
|
||||
//Log.d("KP2AJ", "Success with authentcating!");
|
||||
Activity activity = (Activity)setupActivity;
|
||||
|
||||
if (setupActivity.getProcessName().equals(PROCESS_NAME_FILE_USAGE_SETUP))
|
||||
{
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EXTRA_IS_FOR_SAVE, setupActivity.isForSave());
|
||||
data.putExtra(EXTRA_PATH, setupActivity.getPath());
|
||||
activity.setResult(RESULT_FILEUSAGE_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
if (setupActivity.getProcessName().equals(PROCESS_NAME_SELECTFILE))
|
||||
{
|
||||
Intent data = new Intent();
|
||||
/*if (setupActivity.getState() == null)
|
||||
Log.d(TAG, "getState is null");
|
||||
else
|
||||
if (setupActivity.getState().getString(EXTRA_PATH) == null)
|
||||
Log.d(TAG, "setupActivity.getState().getString(EXTRA_PATH) is null");
|
||||
else
|
||||
Log.d(TAG,setupActivity.getState().getString(EXTRA_PATH));
|
||||
*/
|
||||
String path = setupActivity.getState().getString(EXTRA_PATH);
|
||||
if (path != null)
|
||||
data.putExtra(EXTRA_PATH, path);
|
||||
activity.setResult(RESULT_FILECHOOSER_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.w("KP2AJ", "Unknown process: " + setupActivity.getProcessName());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSelectFile(JavaFileStorage.FileStorageSetupInitiatorActivity activity, boolean isForSave,
|
||||
@ -785,8 +737,8 @@ public class GoogleDriveFileStorage extends JavaFileStorageBase {
|
||||
|
||||
|
||||
@Override
|
||||
public void prepareFileUsage(JavaFileStorage.FileStorageSetupInitiatorActivity activity, String path, int requestCode) {
|
||||
((JavaFileStorage.FileStorageSetupInitiatorActivity)(activity)).startFileUsageProcess(path, requestCode);
|
||||
public void prepareFileUsage(JavaFileStorage.FileStorageSetupInitiatorActivity activity, String path, int requestCode, boolean alwaysReturnSuccess) {
|
||||
((JavaFileStorage.FileStorageSetupInitiatorActivity)(activity)).startFileUsageProcess(path, requestCode, alwaysReturnSuccess);
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,16 +12,18 @@ public interface JavaFileStorage {
|
||||
public static final String PROCESS_NAME_SELECTFILE = "SELECT_FILE";
|
||||
public static final String PROCESS_NAME_FILE_USAGE_SETUP = "FILE_USAGE_SETUP";
|
||||
|
||||
|
||||
public static final String EXTRA_PROCESS_NAME = "EXTRA_PROCESS_NAME";
|
||||
public static final String EXTRA_PATH = "fileName"; //match KP2A PasswordActivity Ioc-Path Extra key
|
||||
public static final String EXTRA_IS_FOR_SAVE = "IS_FOR_SAVE";
|
||||
public static final String EXTRA_ERROR_MESSAGE = "EXTRA_ERROR_MESSAGE";
|
||||
public static final String EXTRA_ALWAYS_RETURN_SUCCESS = "EXTRA_ALWAYS_RETURN_SUCCESS";;
|
||||
|
||||
|
||||
public interface FileStorageSetupInitiatorActivity
|
||||
{
|
||||
void startSelectFileProcess(String path, boolean isForSave, int requestCode);
|
||||
void startFileUsageProcess(String path, int requestCode);
|
||||
void startFileUsageProcess(String path, int requestCode, boolean alwaysReturnSuccess);
|
||||
void onImmediateResult(int requestCode, int result, Intent intent);
|
||||
Activity getActivity();
|
||||
}
|
||||
@ -112,7 +114,7 @@ public class FileEntry {
|
||||
|
||||
public void startSelectFile(FileStorageSetupInitiatorActivity activity, boolean isForSave, int requestCode);
|
||||
|
||||
public void prepareFileUsage(FileStorageSetupInitiatorActivity activity, String path, int requestCode);
|
||||
public void prepareFileUsage(FileStorageSetupInitiatorActivity activity, String path, int requestCode, boolean alwaysReturnSuccess);
|
||||
|
||||
public String getProtocolId();
|
||||
|
||||
|
@ -2,6 +2,10 @@ package keepass2android.javafilestorage;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public abstract class JavaFileStorageBase implements JavaFileStorage{
|
||||
|
||||
private static final String ISO_8859_1 = "ISO-8859-1";
|
||||
@ -42,4 +46,58 @@ public abstract class JavaFileStorageBase implements JavaFileStorage{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void finishWithError(final FileStorageSetupActivity setupAct, Exception error) {
|
||||
Log.e("KP2AJ", "Exception: " + error.toString());
|
||||
error.printStackTrace();
|
||||
|
||||
final Activity activity = (Activity)setupAct;
|
||||
|
||||
int resultCode = Activity.RESULT_CANCELED;
|
||||
|
||||
//check if we should return OK anyways.
|
||||
//This can make sense if there is a higher-level FileStorage which has the file cached.
|
||||
if (activity.getIntent().getBooleanExtra(EXTRA_ALWAYS_RETURN_SUCCESS, false))
|
||||
{
|
||||
Log.d(TAG, "Returning success as desired in intent despite of exception.");
|
||||
finishActivityWithSuccess(setupAct);
|
||||
return;
|
||||
}
|
||||
|
||||
Intent retData = new Intent();
|
||||
retData.putExtra(EXTRA_ERROR_MESSAGE, error.getMessage());
|
||||
activity.setResult(resultCode, retData);
|
||||
activity.finish();
|
||||
};
|
||||
|
||||
protected void finishActivityWithSuccess(
|
||||
FileStorageSetupActivity setupActivity) {
|
||||
//Log.d("KP2AJ", "Success with authenticating!");
|
||||
Activity activity = (Activity) setupActivity;
|
||||
|
||||
if (setupActivity.getProcessName()
|
||||
.equals(PROCESS_NAME_FILE_USAGE_SETUP)) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EXTRA_IS_FOR_SAVE, setupActivity.isForSave());
|
||||
data.putExtra(EXTRA_PATH, setupActivity.getPath());
|
||||
activity.setResult(RESULT_FILEUSAGE_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
if (setupActivity.getProcessName().equals(PROCESS_NAME_SELECTFILE)) {
|
||||
Intent data = new Intent();
|
||||
|
||||
String path = setupActivity.getState().getString(EXTRA_PATH);
|
||||
if (path != null)
|
||||
data.putExtra(EXTRA_PATH, path);
|
||||
activity.setResult(RESULT_FILECHOOSER_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.w("KP2AJ", "Unknown process: " + setupActivity.getProcessName());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
if (status == LiveStatus.CONNECTED) {
|
||||
initialize(activity, session);
|
||||
} else {
|
||||
finishWithError((Activity) activity, new Exception(
|
||||
finishWithError(activity, new Exception(
|
||||
"Error connecting to SkdDrive. Status is "
|
||||
+ status));
|
||||
}
|
||||
@ -307,7 +307,7 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
@Override
|
||||
public void onAuthError(LiveAuthException exception,
|
||||
Object userState) {
|
||||
finishWithError((Activity) activity, exception);
|
||||
finishWithError(activity, exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -338,7 +338,7 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
protected void onPostExecute(AsyncTaskResult<String> result) {
|
||||
Exception error = result.getError();
|
||||
if (error != null ) {
|
||||
finishWithError(activity, error);
|
||||
finishWithError(setupAct, error);
|
||||
} else if ( isCancelled()) {
|
||||
activity.setResult(Activity.RESULT_CANCELED);
|
||||
activity.finish();
|
||||
@ -446,9 +446,9 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
|
||||
@Override
|
||||
public void prepareFileUsage(FileStorageSetupInitiatorActivity activity,
|
||||
String path, int requestCode) {
|
||||
String path, int requestCode, boolean alwaysReturnSuccess) {
|
||||
((JavaFileStorage.FileStorageSetupInitiatorActivity) (activity))
|
||||
.startFileUsageProcess(path, requestCode);
|
||||
.startFileUsageProcess(path, requestCode, alwaysReturnSuccess);
|
||||
|
||||
}
|
||||
|
||||
@ -718,44 +718,6 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
|
||||
}
|
||||
|
||||
private void finishWithError(final Activity activity, Exception error) {
|
||||
Log.e("KP2AJ", "Exception: " + error.toString());
|
||||
error.printStackTrace();
|
||||
|
||||
Intent retData = new Intent();
|
||||
retData.putExtra(EXTRA_ERROR_MESSAGE, error.getMessage());
|
||||
activity.setResult(Activity.RESULT_CANCELED, retData);
|
||||
activity.finish();
|
||||
};
|
||||
|
||||
private void finishActivityWithSuccess(
|
||||
FileStorageSetupActivity setupActivity) {
|
||||
//Log.d("KP2AJ", "Success with authenticating!");
|
||||
Activity activity = (Activity) setupActivity;
|
||||
|
||||
if (setupActivity.getProcessName()
|
||||
.equals(PROCESS_NAME_FILE_USAGE_SETUP)) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EXTRA_IS_FOR_SAVE, setupActivity.isForSave());
|
||||
data.putExtra(EXTRA_PATH, setupActivity.getPath());
|
||||
activity.setResult(RESULT_FILEUSAGE_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
if (setupActivity.getProcessName().equals(PROCESS_NAME_SELECTFILE)) {
|
||||
Intent data = new Intent();
|
||||
|
||||
String path = setupActivity.getState().getString(EXTRA_PATH);
|
||||
if (path != null)
|
||||
data.putExtra(EXTRA_PATH, path);
|
||||
activity.setResult(RESULT_FILECHOOSER_PREPARED, data);
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.w("KP2AJ", "Unknown process: " + setupActivity.getProcessName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(final FileStorageSetupActivity activity) {
|
||||
@ -765,7 +727,7 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
finishWithError((Activity)activity, e);
|
||||
finishWithError(activity, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -774,7 +736,7 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
@Override
|
||||
public void onAuthError(LiveAuthException exception,
|
||||
Object userState) {
|
||||
finishWithError(((Activity) activity), exception);
|
||||
finishWithError(( activity), exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -800,11 +762,11 @@ public class SkyDriveFileStorage extends JavaFileStorageBase {
|
||||
//this may happen if an un-cancelled login progress is already in progress.
|
||||
//however, the activity might have been destroyed, so try again with another auth client next time
|
||||
mAuthClient = new LiveAuthClient(mAppContext, mClientId);
|
||||
finishWithError((Activity)activity, e);
|
||||
finishWithError(activity, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
finishWithError((Activity)activity, e);
|
||||
finishWithError(activity, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ namespace keepass2android
|
||||
confirmButton.Click += (sender, e) =>
|
||||
{
|
||||
App.Kp2a.GetFileStorage(_ioConnection)
|
||||
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), _ioConnection, 0);
|
||||
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), _ioConnection, 0, false);
|
||||
};
|
||||
|
||||
/*CheckBox checkBox = (CheckBox) FindViewById(Resource.Id.show_password);
|
||||
|
2945
src/keepass2android/Resources/Resource.designer.cs
generated
2945
src/keepass2android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -45,7 +45,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/divider2"
|
||||
android:text="@string/entry_and_or" />
|
||||
android:text="" />
|
||||
<LinearLayout
|
||||
android:id="@+id/passwordLine"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/browser_intall_text" />
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
<Button
|
||||
android:id="@+id/install_market"
|
||||
android:layout_width="200sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/install_from_market" />
|
||||
<Button
|
||||
android:id="@+id/install_web"
|
||||
android:layout_width="200sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/install_from_website" />
|
||||
<Button
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="200sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@android:string/cancel" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -41,7 +41,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/divider2"
|
||||
android:text="@string/entry_and_or" />
|
||||
android:text="" />
|
||||
<ImageButton
|
||||
android:id="@+id/toggle_password"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -282,7 +282,7 @@ namespace keepass2android
|
||||
IOConnectionInfo ioc = _DbHelper.CursorToIoc(cursor);
|
||||
|
||||
App.Kp2a.GetFileStorage(ioc)
|
||||
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), ioc, 0);
|
||||
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), ioc, 0, false);
|
||||
}
|
||||
private void OnOpenButton(String fileName)
|
||||
{
|
||||
|
@ -39,10 +39,11 @@ namespace keepass2android
|
||||
_activity.StartActivityForResult(fileStorageSetupIntent, requestCode);
|
||||
}
|
||||
|
||||
public void StartFileUsageProcess(IOConnectionInfo ioc, int requestCode)
|
||||
public void StartFileUsageProcess(IOConnectionInfo ioc, int requestCode, bool alwaysReturnSuccess)
|
||||
{
|
||||
Intent fileStorageSetupIntent = new Intent(_activity, typeof(FileStorageSetupActivity));
|
||||
fileStorageSetupIntent.PutExtra(FileStorageSetupDefs.ExtraProcessName, FileStorageSetupDefs.ProcessNameFileUsageSetup);
|
||||
fileStorageSetupIntent.PutExtra(FileStorageSetupDefs.ExtraAlwaysReturnSuccess, alwaysReturnSuccess);
|
||||
PasswordActivity.PutIoConnectionToIntent(ioc, fileStorageSetupIntent);
|
||||
|
||||
_activity.StartActivityForResult(fileStorageSetupIntent, requestCode);
|
||||
@ -67,9 +68,9 @@ namespace keepass2android
|
||||
_startManualFileSelect(protocolId + "://");
|
||||
}
|
||||
|
||||
public void StartFileUsageProcess(string p0, int p1)
|
||||
public void StartFileUsageProcess(string path, int requestCode, bool alwaysReturnSuccess)
|
||||
{
|
||||
StartFileUsageProcess(new IOConnectionInfo() { Path = p0 }, p1);
|
||||
StartFileUsageProcess(new IOConnectionInfo() { Path = path }, requestCode, alwaysReturnSuccess);
|
||||
}
|
||||
|
||||
public void StartSelectFileProcess(string p0, bool p1, int p2)
|
||||
|
@ -24,7 +24,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE</DefineConstants>
|
||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;EXCLUDE_KEYTRANSFORM;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
@ -364,7 +364,6 @@
|
||||
<AndroidResource Include="Resources\drawable\ic_launcher_folder_small.png" />
|
||||
<AndroidResource Include="Resources\drawable\notify.png" />
|
||||
<AndroidResource Include="Resources\layout\about.xml" />
|
||||
<AndroidResource Include="Resources\layout\browser_install.xml" />
|
||||
<AndroidResource Include="Resources\layout\database_settings.xml" />
|
||||
<AndroidResource Include="Resources\layout\entry_edit.xml" />
|
||||
<AndroidResource Include="Resources\layout\entry_list_entry.xml" />
|
||||
|
Loading…
Reference in New Issue
Block a user