import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.db.DbHandler;
-import com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.LongClickableCheckBoxPreference;
import com.owncloud.android.utils.DisplayUtils;
private DbHandler mDbHandler;
private CheckBoxPreference pCode;
- private CheckBoxPreference pSaveLocation;
private Preference pAboutApp;
private PreferenceCategory mAccountsPrefCategory = null;
if (obj != null && obj instanceof LongClickableCheckBoxPreference) {
mShowContextMenu = true;
- mAccountName = obj.toString();
+ mAccountName = ((LongClickableCheckBoxPreference) obj).getKey();
Preferences.this.openContextMenu(listView);
return false;
}
});
-
+
+ // Load package info
+ String temp;
+ try {
+ PackageInfo pkg = getPackageManager().getPackageInfo(getPackageName(), 0);
+ temp = pkg.versionName;
+ } catch (NameNotFoundException e) {
+ temp = "";
+ Log_OC.e(TAG, "Error while showing about dialog", e);
+ }
+ final String appVersion = temp;
+
// Register context menu for list of preferences.
registerForContextMenu(getListView());
}
- pSaveLocation = (CheckBoxPreferenceWithLongTitle) findPreference("save_last_upload_location");
- if(pSaveLocation != null){
- pSaveLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- //The saved path is removed when the preference is turned off
- if( newValue instanceof Boolean && !(Boolean) newValue) {
- SharedPreferences.Editor appPrefs = PreferenceManager
- .getDefaultSharedPreferences(getApplicationContext()).edit();
- appPrefs.remove("last_upload_path");
- appPrefs.commit();
- }
- return true;
- }
- });
- }
-
-
PreferenceCategory preferenceCategory = (PreferenceCategory) findPreference("more");
boolean helpEnabled = getResources().getBoolean(R.bool.help_enabled);
@Override
public boolean onPreferenceClick(Preference preference) {
String feedbackMail =(String) getText(R.string.mail_feedback);
- String feedback =(String) getText(R.string.prefs_feedback);
+ String feedback =(String) getText(R.string.prefs_feedback) + " - android v" + appVersion;
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, feedback);
pAboutApp = (Preference) findPreference("about_app");
if (pAboutApp != null) {
pAboutApp.setTitle(String.format(getString(R.string.about_android), getString(R.string.app_name)));
- PackageInfo pkg;
- try {
- pkg = getPackageManager().getPackageInfo(getPackageName(), 0);
- pAboutApp.setSummary(String.format(getString(R.string.about_version), pkg.versionName));
- } catch (NameNotFoundException e) {
- Log_OC.e(TAG, "Error while showing about dialog", e);
- }
+ pAboutApp.setSummary(String.format(getString(R.string.about_version), appVersion));
}
}
for (Account a : accounts) {
LongClickableCheckBoxPreference accountPreference = new LongClickableCheckBoxPreference(this);
accountPreference.setKey(a.name);
- accountPreference.setTitle(a.name);
+ // Handle internationalized domain names
+ accountPreference.setTitle(DisplayUtils.convertIdn(a.name, false));
mAccountsPrefCategory.addPreference(accountPreference);
// Check the current account that is being used