X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/93de9f91d56ec3ff6ccd1d26df75dc1293e861bb..0f2376806f4ed54291ef29d6ebd9f76f736a0da5:/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java diff --git a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java index d5bdc59d..7e620840 100644 --- a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java +++ b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java @@ -111,9 +111,8 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); - setSupportProgressBarIndeterminateVisibility(false); -// Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(getApplicationContext())); + Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(getApplicationContext())); if(savedInstanceState != null) { mDirs = savedInstanceState.getStringArray(KEY_DIR_ARRAY); @@ -131,24 +130,21 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements initDelayedTilAccountAvailabe(); - // PIN CODE request - // best location is to decide; let's try this first - boolean pinStart = false; - SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - pinStart = appPrefs.getBoolean("set_passcode", false); - - if (pinStart) { - Intent i = new Intent(getApplicationContext(), PinCodeActivity.class); - i.putExtra("activity", "splash"); - startActivity(i); + // PIN CODE request ; best location is to decide, let's try this first + //if (savedInstanceState == null) { + if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_MAIN) && savedInstanceState == null) { + requestPinCode(); } + } else { setContentView(R.layout.no_account_available); getSupportActionBar().setNavigationMode(ActionBar.DISPLAY_SHOW_TITLE); findViewById(R.id.setup_account).setOnClickListener(this); - + + setSupportProgressBarIndeterminateVisibility(false); + Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); intent.putExtra(android.provider.Settings.EXTRA_AUTHORITIES, new String[] { AccountAuthenticator.AUTH_TOKEN_TYPE }); startActivity(intent); // although the code is here, the activity won't be created until this.onStart() and this.onResume() are finished; @@ -633,11 +629,14 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements if (account_name.equals(AccountUtils.getCurrentOwnCloudAccount(context).name)) { String synchFolderRemotePath = intent.getStringExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH); - - if (mCurrentDir == null) + + boolean fillBlankRoot = false; + if (mCurrentDir == null) { mCurrentDir = mStorageManager.getFileByPath("/"); + fillBlankRoot = (mCurrentDir != null); + } - if (synchFolderRemotePath != null && mCurrentDir != null && mCurrentDir.getRemotePath().equals(synchFolderRemotePath) ) { + if (synchFolderRemotePath != null && mCurrentDir != null && (mCurrentDir.getRemotePath().equals(synchFolderRemotePath) || fillBlankRoot) ) { FileListFragment fileListFragment = (FileListFragment) getSupportFragmentManager() .findFragmentById(R.id.fileList); mCurrentDir = getStorageManager().getFileByPath(synchFolderRemotePath); @@ -764,7 +763,22 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements transaction.replace(R.id.file_details_container, new FileDetailFragment(null, null)); // empty FileDetailFragment transaction.commit(); } + setSupportProgressBarIndeterminateVisibility(false); + } + + /** + * Launch an intent to request the PIN code to the user before letting him use the app + */ + private void requestPinCode() { + boolean pinStart = false; + SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + pinStart = appPrefs.getBoolean("set_pincode", false); + if (pinStart) { + Intent i = new Intent(getApplicationContext(), PinCodeActivity.class); + i.putExtra(PinCodeActivity.EXTRA_ACTIVITY, "FileDisplayActivity"); + startActivity(i); + } }