forked from signalapp/Signal-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
// FREEBIE
- Loading branch information
Showing
9 changed files
with
188 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView android:id="@+id/right_summary" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="right|center_vertical" | ||
android:gravity="right|center_vertical" | ||
android:textSize="16sp" | ||
android:textColor="@color/signal_primary_dark"/> | ||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<ListPreference android:key="pref_theme" | ||
android:title="@string/preferences__theme" | ||
android:entries="@array/pref_theme_entries" | ||
android:entryValues="@array/pref_theme_values" | ||
android:defaultValue="light"> | ||
</ListPreference> | ||
<org.thoughtcrime.securesms.preferences.SignalListPreference | ||
android:key="pref_theme" | ||
android:title="@string/preferences__theme" | ||
android:entries="@array/pref_theme_entries" | ||
android:entryValues="@array/pref_theme_values" | ||
android:defaultValue="light"> | ||
</org.thoughtcrime.securesms.preferences.SignalListPreference> | ||
|
||
<ListPreference android:key="pref_language" | ||
android:title="@string/preferences__language" | ||
android:entries="@array/language_entries" | ||
android:entryValues="@array/language_values" | ||
android:defaultValue="zz"/> | ||
<org.thoughtcrime.securesms.preferences.SignalListPreference | ||
android:key="pref_language" | ||
android:title="@string/preferences__language" | ||
android:entries="@array/language_entries" | ||
android:entryValues="@array/language_values" | ||
android:defaultValue="zz"/> | ||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/org/thoughtcrime/securesms/preferences/SignalListPreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
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); | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/org/thoughtcrime/securesms/preferences/SignalRingtonePreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.thoughtcrime.securesms.preferences; | ||
|
||
|
||
import android.content.Context; | ||
import android.os.Build; | ||
import android.preference.RingtonePreference; | ||
import android.support.annotation.RequiresApi; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
|
||
import org.thoughtcrime.securesms.R; | ||
|
||
public class SignalRingtonePreference extends RingtonePreference { | ||
|
||
private TextView rightSummary; | ||
private CharSequence summary; | ||
|
||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) | ||
public SignalRingtonePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | ||
super(context, attrs, defStyleAttr, defStyleRes); | ||
initialize(); | ||
} | ||
|
||
public SignalRingtonePreference(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
initialize(); | ||
} | ||
|
||
public SignalRingtonePreference(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
initialize(); | ||
} | ||
|
||
public SignalRingtonePreference(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(summary); | ||
} | ||
|
||
@Override | ||
public void setSummary(CharSequence summary) { | ||
this.summary = summary; | ||
|
||
super.setSummary(null); | ||
|
||
if (rightSummary != null) { | ||
rightSummary.setText(summary); | ||
} | ||
} | ||
|
||
} |