From: David A. Velasco Date: Wed, 19 Mar 2014 15:59:24 +0000 (+0100) Subject: Merge pull request #441 from owncloud/allow_multiline_checkbox_preferences_pr_395_wit... X-Git-Tag: oc-android-1.5.5~5^2~8 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/f5a9c9600edc35f2e5e21d1751a09ff1241c0876?hp=d3980d480fc8b343401ff9fdf0c2dcdb6d7b7dff Merge pull request #441 from owncloud/allow_multiline_checkbox_preferences_pr_395_with_develop Allow multiline preferences, not just checkboxes --- diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 26c00a10..4c6ee40d 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -25,8 +25,8 @@ android:title="@string/prefs_select_oc_account" android:summary="@string/prefs_summary_select_oc_account" / --> - - + . * */ + package com.owncloud.android.ui; + import android.content.Context; import android.util.AttributeSet; import android.view.View; @@ -39,7 +40,8 @@ public class CheckBoxPreferenceWithLongTitle extends CheckBoxPreference{ protected void onBindView(View view) { super.onBindView(view); TextView titleView = (TextView) view.findViewById(android.R.id.title); - titleView.setSingleLine(false); + titleView.setSingleLine(false); titleView.setMaxLines(3); + titleView.setEllipsize(null); } } \ No newline at end of file diff --git a/src/com/owncloud/android/ui/PreferenceMultiline.java b/src/com/owncloud/android/ui/PreferenceMultiline.java new file mode 100644 index 00000000..28b3621e --- /dev/null +++ b/src/com/owncloud/android/ui/PreferenceMultiline.java @@ -0,0 +1,53 @@ +/* ownCloud Android client application + * Copyright (C) 2014 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +package com.owncloud.android.ui; + +import android.content.Context; +import android.preference.Preference; +import android.util.AttributeSet; +import android.view.View; +import android.widget.TextView; + +/** + * Allow multiline titles in preferences + * + * @author masensio + * + */ +public class PreferenceMultiline extends Preference { + + public PreferenceMultiline(Context context) { + super(context); + } + + public PreferenceMultiline(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public PreferenceMultiline(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + protected void onBindView(View view) { + super.onBindView(view); + TextView titleView = (TextView) view.findViewById(android.R.id.title); + titleView.setSingleLine(false); + titleView.setMaxLines(3); + } +}