android:title="@string/prefs_select_oc_account"
android:summary="@string/prefs_summary_select_oc_account"
/ -->
- <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:title="@string/prefs_pincode" android:key="set_pincode"
- android:summary="@string/prefs_pincode_summary"/>
+ <android.preference.CheckBoxPreference android:title="@string/prefs_pincode" android:key="set_pincode" />
</PreferenceCategory>
- <PreferenceCategory android:title="@string/prefs_category_instant_uploading">
- <com.owncloud.android.ui.PreferenceWithLongSummary
- android:title="@string/prefs_instant_upload_path_title"
- android:key="instant_upload_path" />
- <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
+ <PreferenceCategory android:title="@string/prefs_category_instant_uploading" android:key="instant_uploading_category">
+ <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
android:title="@string/prefs_instant_upload"
android:summary="@string/prefs_instant_upload_summary"/>
- <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_uploading"
- android:disableDependentsState="true"
+ <com.owncloud.android.ui.PreferenceWithLongSummary
+ android:title="@string/prefs_instant_upload_path_title"
+ android:key="instant_upload_path" />
+ <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
android:title="@string/instant_upload_on_wifi"
android:key="instant_upload_on_wifi"/>
+ <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_video_uploading"
+ android:title="@string/prefs_instant_video_upload"
+ android:summary="@string/prefs_instant_video_upload_summary" />
<com.owncloud.android.ui.PreferenceWithLongSummary
android:title="@string/prefs_instant_video_upload_path_title"
android:key="instant_video_upload_path" />
private boolean mSyncInProgress = false;
- private String DIALOG_UNTRUSTED_CERT;
-
+ private static String DIALOG_UNTRUSTED_CERT = "DIALOG_UNTRUSTED_CERT";
+ private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER";
+ private static String DIALOG_UPLOAD_SOURCE = "DIALOG_UPLOAD_SOURCE";
+ private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED";
+
+
private OCFile mWaitingToSend;
+
+ private Boolean mUnlocked = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@Override
protected void onResume() {
+ Log_OC.d(TAG, "onResume() start");
super.onResume();
- Log_OC.e(TAG, "onResume() start");
-
+
+ if (PinCheck.checkIfPinEntry()){
+ Intent i = new Intent(MainApp.getAppContext(), PinCodeActivity.class);
+ i.putExtra(PinCodeActivity.EXTRA_ACTIVITY, "FileDisplayActivity");
+ startActivity(i);
+ }
+
// refresh list of files
refreshListOfFilesFragment();
mDownloadFinishReceiver = null;
}
-
+ PinCheck.setUnlockTimestamp();
- Log_OC.d(TAG, "onPause() end");
- super.onPause();
- }
-
-
- @Override
- protected Dialog onCreateDialog(int id) {
- Dialog dialog = null;
- AlertDialog.Builder builder;
- switch (id) {
- case DIALOG_SHORT_WAIT: {
- ProgressDialog working_dialog = new ProgressDialog(this);
- working_dialog.setMessage(getResources().getString(
- R.string.wait_a_moment));
- working_dialog.setIndeterminate(true);
- working_dialog.setCancelable(false);
- dialog = working_dialog;
- break;
- }
- case DIALOG_CHOOSE_UPLOAD_SOURCE: {
-
-
- String[] allTheItems = { getString(R.string.actionbar_upload_files),
- getString(R.string.actionbar_upload_from_apps) };
-
- builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.actionbar_upload);
- builder.setItems(allTheItems, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int item) {
- if (item == 0) {
- // if (!mDualPane) {
- Intent action = new Intent(FileDisplayActivity.this, UploadFilesActivity.class);
- action.putExtra(UploadFilesActivity.EXTRA_ACCOUNT, FileDisplayActivity.this.getAccount());
- startActivityForResult(action, ACTION_SELECT_MULTIPLE_FILES);
- // } else {
- // TODO create and handle new fragment
- // LocalFileListFragment
- // }
- } else if (item == 1) {
- Intent action = new Intent(Intent.ACTION_GET_CONTENT);
- action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
- //Intent.EXTRA_ALLOW_MULTIPLE is only supported on api level 18+, Jelly Bean
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
- action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
- }
- startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)),
- ACTION_SELECT_CONTENT_FROM_APPS);
- }
- }
- });
- dialog = builder.create();
- break;
- }
- case DIALOG_CERT_NOT_SAVED: {
- builder = new AlertDialog.Builder(this);
- builder.setMessage(getResources().getString(R.string.ssl_validator_not_saved));
- builder.setCancelable(false);
- builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- };
- });
- dialog = builder.create();
- break;
- }
- default:
- dialog = null;
- }
+
- return dialog;
- }
-
- /**
- * Translates a content URI of an content to a physical path on the disk
- *
- * @param uri The URI to resolve
- * @return The path to the content or null if it could not be found
- */
- public String getPath(Uri uri) {
- final boolean isKitKatOrLater = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
-
- // DocumentProvider
- if (isKitKatOrLater && DocumentsContract.isDocumentUri(getApplicationContext(), uri)) {
- // ExternalStorageProvider
- if (UriUtils.isExternalStorageDocument(uri)) {
- final String docId = DocumentsContract.getDocumentId(uri);
- final String[] split = docId.split(":");
- final String type = split[0];
-
- if ("primary".equalsIgnoreCase(type)) {
- return Environment.getExternalStorageDirectory() + "/" + split[1];
- }
- }
- // DownloadsProvider
- else if (UriUtils.isDownloadsDocument(uri)) {
-
- final String id = DocumentsContract.getDocumentId(uri);
- final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"),
- Long.valueOf(id));
-
- return UriUtils.getDataColumn(getApplicationContext(), contentUri, null, null);
- }
- // MediaProvider
- else if (UriUtils.isMediaDocument(uri)) {
- final String docId = DocumentsContract.getDocumentId(uri);
- final String[] split = docId.split(":");
- final String type = split[0];
-
- Uri contentUri = null;
- if ("image".equals(type)) {
- contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
- } else if ("video".equals(type)) {
- contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
- } else if ("audio".equals(type)) {
- contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
- }
-
- final String selection = "_id=?";
- final String[] selectionArgs = new String[] { split[1] };
-
- return UriUtils.getDataColumn(getApplicationContext(), contentUri, selection, selectionArgs);
- }
- // Documents providers returned as content://...
- else if (UriUtils.isContentDocument(uri)) {
- return uri.toString();
- }
- }
- // MediaStore (and general)
- else if ("content".equalsIgnoreCase(uri.getScheme())) {
-
- // Return the remote address
- if (UriUtils.isGooglePhotosUri(uri))
- return uri.getLastPathSegment();
-
- return UriUtils.getDataColumn(getApplicationContext(), uri, null, null);
- }
- // File
- else if ("file".equalsIgnoreCase(uri.getScheme())) {
- return uri.getPath();
- }
- return null;
+ super.onPause();
+ Log_OC.d(TAG, "onPause() end");
}
/**
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountAuthenticator;
+import com.owncloud.android.authentication.PinCheck;
+import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
+ import com.owncloud.android.lib.common.operations.RemoteOperation;
+ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
+ import com.owncloud.android.operations.CreateFolderOperation;
+ import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
import com.owncloud.android.utils.DisplayUtils;
+ import com.owncloud.android.utils.ErrorMessageAdapter;
+
/**
* This can be used to upload things to an ownCloud instance.
private final static int REQUEST_CODE_SETUP_ACCOUNT = 0;
+ private final static String KEY_PARENTS = "PARENTS";
+ private final static String KEY_FILE = "FILE";
+ private final static String KEY_ACCOUNT_SELECTED = "ACCOUNT_SELECTED";
+
@Override
protected void onCreate(Bundle savedInstanceState) {
+ prepareStreamsToUpload();
+
+ if (savedInstanceState == null) {
+ mParents = new Stack<String>();
+ mAccountSelected = false;
+ } else {
+ mParents = (Stack<String>) savedInstanceState.getSerializable(KEY_PARENTS);
+ mFile = savedInstanceState.getParcelable(KEY_FILE);
+ mAccountSelected = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTED);
+ }
super.onCreate(savedInstanceState);
- mParents = new Stack<String>();
-
+
+ // Check Pin entry
+ if (PinCheck.checkIfPinEntry()){
+ Intent i = new Intent(MainApp.getAppContext(), PinCodeActivity.class);
+ i.putExtra(PinCodeActivity.EXTRA_ACTIVITY, "ownCloudUploader");
+ startActivity(i);
+ }
+
ActionBar actionBar = getSupportActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());