mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
simplify SignalPreference to Preference
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
android:entryValues="@array/pref_theme_values"
|
||||
android:defaultValue="light"/>
|
||||
|
||||
<org.thoughtcrime.securesms.preferences.widgets.SignalPreference
|
||||
<Preference
|
||||
android:key="pref_chat_background"
|
||||
android:title="@string/pref_background"/>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:title="@string/pref_notifications"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<org.thoughtcrime.securesms.preferences.widgets.SignalPreference
|
||||
<Preference
|
||||
android:dependency="pref_key_enable_notifications"
|
||||
android:key="pref_key_ringtone"
|
||||
android:title="@string/pref_sound"
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package org.thoughtcrime.securesms.preferences.widgets;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class SignalPreference extends Preference {
|
||||
|
||||
private TextView rightSummary;
|
||||
private CharSequence summary;
|
||||
|
||||
public SignalPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public SignalPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public SignalPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public SignalPreference(Context context) {
|
||||
super(context);
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
setWidgetLayoutResource(R.layout.preference_right_summary_widget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||
super.onBindViewHolder(view);
|
||||
|
||||
this.rightSummary = (TextView)view.findViewById(R.id.right_summary);
|
||||
setSummary(this.summary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSummary(CharSequence summary) {
|
||||
super.setSummary(null);
|
||||
|
||||
this.summary = summary;
|
||||
|
||||
if (this.rightSummary != null) {
|
||||
this.rightSummary.setText(summary);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user