--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2006 The Android Open Source Project
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<!-- Layout used by CheckBoxPreference for the checkbox style. This is inflated
+inside android.R.layout.preference. -->
+<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
+android:id="@+android:id/checkbox"
+android:layout_width="wrap_content"
+android:layout_height="wrap_content"
+android:layout_gravity="center"
+android:focusable="false"
+android:clickable="false" />
\ No newline at end of file
+++ /dev/null
-package com.owncloud.android.ui;
-
-import android.content.Context;
-import android.preference.CheckBoxPreference;
-import android.view.View;
-
-public class LongClickableCheckBoxPreference extends CheckBoxPreference implements View.OnLongClickListener {
-
- public LongClickableCheckBoxPreference(Context context) {
- super(context);
- }
-
- @Override
- public boolean onLongClick(View v) {
- return true;
- }
-}
--- /dev/null
+package com.owncloud.android.ui;
+
+import android.content.Context;
+import android.preference.CheckBoxPreference;
+import android.view.View;
+
+import com.owncloud.android.R;
+
+public class RadioButtonPreference extends CheckBoxPreference implements View.OnLongClickListener {
+
+ public RadioButtonPreference(Context context) {
+ super(context, null, android.R.attr.checkBoxPreferenceStyle);
+ setWidgetLayoutResource(R.layout.preference_widget_radiobutton);
+ }
+
+ @Override
+ public boolean onLongClick(View v) {
+ return true;
+ }
+}
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.db.DbHandler;
import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.ui.LongClickableCheckBoxPreference;
+import com.owncloud.android.ui.RadioButtonPreference;
import com.owncloud.android.utils.DisplayUtils;
ListAdapter listAdapter = listView.getAdapter();
Object obj = listAdapter.getItem(position);
- if (obj != null && obj instanceof LongClickableCheckBoxPreference) {
+ if (obj != null && obj instanceof RadioButtonPreference) {
mShowContextMenu = true;
- mAccountName = ((LongClickableCheckBoxPreference) obj).getKey();
+ mAccountName = ((RadioButtonPreference) obj).getKey();
Preferences.this.openContextMenu(listView);
else {
for (Account a : accounts) {
- LongClickableCheckBoxPreference accountPreference = new LongClickableCheckBoxPreference(this);
+ RadioButtonPreference accountPreference = new RadioButtonPreference(this);
accountPreference.setKey(a.name);
// Handle internationalized domain names
accountPreference.setTitle(DisplayUtils.convertIdn(a.name, false));
AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
Account accounts[] = am.getAccountsByType(MainApp.getAccountType());
for (Account a : accounts) {
- CheckBoxPreference p = (CheckBoxPreference) findPreference(a.name);
+ RadioButtonPreference p = (RadioButtonPreference) findPreference(a.name);
if (key.equals(a.name)) {
boolean accountChanged = !p.isChecked();
p.setChecked(true);