\r
package eu.alefzero.owncloud.ui.activity;\r
\r
+import java.io.BufferedReader;\r
import java.io.File;\r
+import java.io.InputStreamReader;\r
+import java.lang.Thread.UncaughtExceptionHandler;\r
import java.net.URLEncoder;\r
import java.util.ArrayList;\r
\r
import android.net.Uri;\r
import android.os.Bundle;\r
import android.provider.MediaStore;\r
+import android.telephony.TelephonyManager;\r
import android.util.Log;\r
import android.view.View;\r
import android.view.ViewGroup;\r
import com.actionbarsherlock.view.Window;\r
\r
import eu.alefzero.owncloud.AccountUtils;\r
+import eu.alefzero.owncloud.CrashHandler;\r
import eu.alefzero.owncloud.R;\r
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;\r
import eu.alefzero.owncloud.datamodel.DataStorageManager;\r
\r
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);\r
setProgressBarIndeterminateVisibility(false);\r
- \r
+\r
+ Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(getApplicationContext()));\r
+\r
if(savedInstanceState != null){\r
mCurrentDir = (OCFile) savedInstanceState.getParcelable(KEY_CURRENT_DIR);\r
}\r
@Override\r
public boolean onCreateOptionsMenu(Menu menu) {\r
MenuInflater inflater = getSherlock().getMenuInflater();\r
- inflater.inflate(R.menu.menu, menu);\r
- return true;\r
+ inflater.inflate(R.menu.menu, menu);\r
+ return true;\r
}\r
\r
@Override\r
ACTION_SELECT_FILE);\r
break;\r
}\r
- case R.id.action_accounts: {\r
- Intent accountIntent = new Intent(this, AccountSelectActivity.class);\r
- startActivity(accountIntent);\r
+ case R.id.action_settings: {\r
+ Intent settingsIntent = new Intent(this, Preferences.class);\r
+ startActivity(settingsIntent);\r
}\r
case android.R.id.home: {\r
if(mCurrentDir != null && mCurrentDir.getParentId() != 0){\r
if (!remotepath.endsWith("/"))\r
remotepath += "/";\r
remotepath += URLEncoder.encode(new File(filepath).getName());\r
- Log.e("ASD", remotepath + "");\r
\r
i.putExtra(FileUploader.KEY_LOCAL_FILE, filepath);\r
i.putExtra(FileUploader.KEY_REMOTE_FILE, remotepath);\r
\r
@Override\r
public void onBackPressed() {\r
- if (mDirectories == null || mDirectories.getCount() == 1) {\r
+ if (mDirectories == null || mDirectories.getCount() <= 1) {\r
finish();\r
return;\r
}\r
if (mDirs != null)\r
for (String s : mDirs)\r
mDirectories.insert(s, 0);\r
+ mCurrentDir = savedInstanceState.getParcelable(KEY_CURRENT_DIR);\r
}\r
\r
@Override\r
\r
// Clear intent extra, so rotating the screen will not return us to this directory\r
getIntent().removeExtra(FileDetailFragment.EXTRA_FILE);\r
- } \r
+ } else {\r
+ mCurrentDir = mStorageManager.getFileByPath("/");\r
+ }\r
\r
// Drop-Down navigation and file list restore\r
mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);\r
unregisterReceiver(syncBroadcastRevceiver);\r
syncBroadcastRevceiver = null;\r
}\r
- \r
}\r
\r
@Override\r
builder.setTitle(R.string.uploader_info_dirname);\r
int typed_color = getResources().getColor(R.color.setup_text_typed);\r
dirNameInput.setTextColor(typed_color);\r
- \r
builder.setPositiveButton(android.R.string.ok,\r
new OnClickListener() {\r
public void onClick(DialogInterface dialog, int which) {\r
}\r
\r
// Figure out the path where the dir needs to be created\r
- String path = mCurrentDir.getRemotePath();\r
+ String path = FileDisplayActivity.this.mCurrentDir.getRemotePath();\r
\r
// Create directory\r
path += directoryName + "/";\r
- Thread thread = new Thread(new DirectoryCreator(\r
- path, a));\r
+ Thread thread = new Thread(new DirectoryCreator(path, a));\r
thread.start();\r
\r
// Save new directory in local database\r
String password = mAm.getPassword(mAccount);\r
\r
wdc.setCredentials(username, password);\r
- wdc.allowUnsignedCertificates();\r
+ wdc.allowSelfsignedCertificates();\r
wdc.createDirectory(mTargetPath);\r
}\r
\r
intent.putExtra("authorities", new String[] { AccountAuthenticator.AUTH_TOKEN_TYPE });\r
startActivity(intent);\r
}\r
- }\r
-\r
+ } \r
}\r