import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
String accountName = ((TextView) v.findViewById(android.R.id.text1))
.getText().toString();
AccountUtils.setCurrentOwnCloudAccount(this, accountName);
+
+ // trigger synchronization when current account is changed
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
+ ContentResolver.requestSync(AccountUtils.getCurrentOwnCloudAccount(this), "org.owncloud", bundle);
+
Intent i = new Intent(this, FileDisplayActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
import android.preference.Preference.OnPreferenceChangeListener;\r
import android.preference.Preference.OnPreferenceClickListener;\r
import android.util.Log;\r
-import android.view.ContextMenu;\r
-import android.view.ContextMenu.ContextMenuInfo;\r
-import android.view.View;\r
-import android.widget.AdapterView.AdapterContextMenuInfo;\r
\r
import com.actionbarsherlock.app.ActionBar;\r
import com.actionbarsherlock.app.SherlockPreferenceActivity;\r
import com.actionbarsherlock.view.Menu;\r
-import com.actionbarsherlock.view.MenuInflater;\r
import com.actionbarsherlock.view.MenuItem;\r
\r
import eu.alefzero.owncloud.AccountUtils;\r
import eu.alefzero.owncloud.R;\r
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;\r
import eu.alefzero.owncloud.db.DbHandler;\r
-import eu.alefzero.owncloud.syncadapter.FileSyncAdapter;\r
\r
/**\r
* An Activity that allows the user to change the application's settings.\r
private final int mEditSession = 48;\r
private DbHandler mDbHandler;\r
private Vector<OwnCloudSession> mSessions;\r
- private Account[] mAccounts;\r
- private ListPreference mAccountList;\r
+ //private Account[] mAccounts;\r
+ //private ListPreference mAccountList;\r
private ListPreference mTrackingUpdateInterval;\r
private CheckBoxPreference mDeviceTracking;\r
private CheckBoxPreference pCode;\r
mDbHandler = new DbHandler(getBaseContext());\r
mSessions = new Vector<OwnCloudSession>();\r
addPreferencesFromResource(R.xml.preferences);\r
- populateAccountList();\r
+ //populateAccountList();\r
ActionBar actionBar = getSherlock().getActionBar();\r
actionBar.setDisplayHomeAsUpEnabled(true);\r
Preference p = findPreference("manage_account");\r
\r
/**\r
* Populates the account selector\r
- */\r
+ *-/\r
private void populateAccountList() {\r
AccountManager accMan = AccountManager.get(this);\r
mAccounts = accMan.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);\r
\r
mAccountList.setEntries(accNames);\r
mAccountList.setEntryValues(accNames);\r
- }\r
+ }*/\r
\r
\r
\r
*/\r
public boolean onPreferenceChange(Preference preference, Object newValue) {\r
// Update current account summary\r
- if (preference.equals(mAccountList)) {\r
+ /*if (preference.equals(mAccountList)) {\r
mAccountList.setSummary(newValue.toString());\r
}\r
\r
// Update tracking interval summary\r
- else if (preference.equals(mTrackingUpdateInterval)) {\r
+ else*/ if (preference.equals(mTrackingUpdateInterval)) {\r
String trackingSummary = getResources().getString(\r
R.string.prefs_trackmydevice_interval_summary);\r
trackingSummary = String.format(trackingSummary,\r