added OneDriveStorage2 based on Graph SDK
This commit is contained in:
@@ -10,6 +10,8 @@ android {
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
|
||||
|
||||
}
|
||||
buildTypes {
|
||||
|
||||
@@ -59,6 +59,18 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.microsoft.identity.client.BrowserTabActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="@string/msalPrefix"
|
||||
android:host="auth" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
@@ -68,6 +80,8 @@
|
||||
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
|
||||
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
|
||||
|
||||
</manifest>
|
||||
@@ -89,6 +89,8 @@ extends Activity implements JavaFileStorage.FileStorageSetupActivity {
|
||||
@Override
|
||||
public String getPath() {
|
||||
// TODO Auto-generated method stub
|
||||
if (getState().containsKey(JavaFileStorage.EXTRA_PATH))
|
||||
return getState().getString(JavaFileStorage.EXTRA_PATH);
|
||||
return getIntent().getStringExtra(JavaFileStorage.EXTRA_PATH);
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,6 @@ package com.crocoapps.javafilestoragetest;
|
||||
import group.pals.android.lib.ui.filechooser.FileChooserActivity;
|
||||
import group.pals.android.lib.ui.filechooser.providers.BaseFileProviderUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -146,11 +145,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//import keepass2android.javafilestorage.DropboxCloudRailStorage;
|
||||
import keepass2android.javafilestorage.DropboxV2Storage;
|
||||
import keepass2android.javafilestorage.ICertificateErrorHandler;
|
||||
import keepass2android.javafilestorage.JavaFileStorage;
|
||||
import keepass2android.javafilestorage.JavaFileStorage.FileEntry;
|
||||
import keepass2android.javafilestorage.OneDriveStorage;
|
||||
import keepass2android.javafilestorage.OneDriveStorage2;
|
||||
import keepass2android.javafilestorage.SftpStorage;
|
||||
import keepass2android.javafilestorage.UserInteractionRequiredException;
|
||||
import keepass2android.javafilestorage.WebDavStorage;
|
||||
@@ -206,10 +203,17 @@ public class MainActivity extends Activity implements JavaFileStorage.FileStorag
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("KP2AJ",e.toString());
|
||||
//if exception because folder exists
|
||||
path = fs.createFilePath(parentPath, testPath);
|
||||
}
|
||||
|
||||
String textToUpload2 = "abcdefg";
|
||||
String filename2 = fs.createFilePath(parentPath, "file.txt");
|
||||
/*if (!path.endsWith("/"))
|
||||
path += "/";
|
||||
String filename = path+"file.text";*/
|
||||
fs.uploadFile(filename2,textToUpload2.getBytes(),true);
|
||||
|
||||
FileEntry e1 = fs.getFileEntry(parentPath);
|
||||
FileEntry e2 = fs.getFileEntry(path);
|
||||
@@ -531,9 +535,11 @@ public class MainActivity extends Activity implements JavaFileStorage.FileStorag
|
||||
}
|
||||
|
||||
static JavaFileStorage createStorageToTest(Context ctx, Context appContext, boolean simulateRestart) {
|
||||
storageToTest = new SftpStorage(ctx.getApplicationContext());
|
||||
//storageToTest = new SftpStorage(ctx.getApplicationContext());
|
||||
//storageToTest = new SkyDriveFileStorage("000000004010C234", appContext);
|
||||
//storageToTest = new OneDriveStorage(appContext, "000000004010C234");
|
||||
storageToTest = new OneDriveStorage2((Activity) ctx, "8374f801-0f55-407d-80cc-9a04fe86d9b2");
|
||||
|
||||
|
||||
//storageToTest = new GoogleDriveFileStorage();
|
||||
/*storageToTest = new WebDavStorage(new ICertificateErrorHandler() {
|
||||
@Override
|
||||
@@ -620,7 +626,7 @@ public class MainActivity extends Activity implements JavaFileStorage.FileStorag
|
||||
Toast.makeText(this, "requestCode: "+requestCode, Toast.LENGTH_LONG).show();
|
||||
if (requestCode == 1)
|
||||
//new PerformTestTask().execute(path,"TestFileStorage<67>", storageToTest); //use an umlaut to see how that works
|
||||
new PerformTestTask().execute(path,"TestFileStorage", storageToTest);
|
||||
new PerformTestTask().execute(path,"TestFileStorage", storageToTest);
|
||||
else
|
||||
if (requestCode == 2)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="msalPrefix">msal8374f801-0f55-407d-80cc-9a04fe86d9b2</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="hello_world">Hello world!</string>
|
||||
<string name="title_activity_file_storage_setup">FileStorageSetupActivity</string>
|
||||
|
||||
Reference in New Issue
Block a user