mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 23:43:39 +00:00
2dceef50b7
// FREEBIE
66 lines
1.6 KiB
Java
66 lines
1.6 KiB
Java
package org.thoughtcrime.securesms.preferences;
|
|
|
|
|
|
import android.content.Context;
|
|
import android.os.Build;
|
|
import android.preference.ListPreference;
|
|
import android.support.annotation.RequiresApi;
|
|
import android.util.AttributeSet;
|
|
import android.util.TypedValue;
|
|
import android.view.View;
|
|
import android.widget.TextView;
|
|
|
|
import org.thoughtcrime.securesms.R;
|
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
|
|
|
public class SignalListPreference extends ListPreference {
|
|
|
|
private TextView rightSummary;
|
|
private CharSequence summary;
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
public SignalListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
super(context, attrs, defStyleAttr, defStyleRes);
|
|
initialize();
|
|
}
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
public SignalListPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
super(context, attrs, defStyleAttr);
|
|
initialize();
|
|
}
|
|
|
|
public SignalListPreference(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
initialize();
|
|
}
|
|
|
|
public SignalListPreference(Context context) {
|
|
super(context);
|
|
initialize();
|
|
}
|
|
|
|
private void initialize() {
|
|
setWidgetLayoutResource(R.layout.preference_right_summary_widget);
|
|
}
|
|
|
|
@Override
|
|
protected void onBindView(View view) {
|
|
super.onBindView(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);
|
|
}
|
|
}
|
|
}
|