mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Add explanation and learn more button
This commit is contained in:
@@ -29,6 +29,10 @@ public class ConversationSettingsFragment extends PreferenceFragmentCompat
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String DM_ENABLE = "pref_key_disappearing_messages";
|
||||
private static final String DM_EXPLANATION =
|
||||
"pref_key_disappearing_messages_explanation";
|
||||
private static final String DM_LEARN_MORE =
|
||||
"pref_key_disappearing_messages_learn_more";
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(ConversationSettingsFragment.class.getName());
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.briarproject.briar.android.conversation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
class LinkPreference extends Preference {
|
||||
|
||||
public LinkPreference(Context context,
|
||||
AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
init();
|
||||
}
|
||||
|
||||
public LinkPreference(Context context, AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
public LinkPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public LinkPreference(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setLayoutResource(
|
||||
R.layout.conversation_settings_disappearing_messages_learn_more);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
TextView link = (TextView) holder.findViewById(R.id.link);
|
||||
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder();
|
||||
ssb.append(link.getText());
|
||||
ssb.setSpan(new URLSpan("#"), 0, ssb.length(),
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
link.setText(ssb, TextView.BufferType.SPANNABLE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/margin_large">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewTimer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="⏳"
|
||||
android:textSize="40dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/barrier"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textViewBomb"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewBomb"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:autoLink=""
|
||||
android:gravity="center_vertical"
|
||||
android:text="💣"
|
||||
android:textSize="40dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/barrier"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/textViewTimer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:src="@drawable/message_delivered"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/barrier"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textViewTimer"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewExplanation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/disappearing_messages_explanation"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/margin_large">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/link"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/learn_more"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -548,9 +548,18 @@
|
||||
<string name="cannot_load_ringtone">Cannot load ringtone</string>
|
||||
|
||||
<!-- Conversation Settings -->
|
||||
<string name="disappearing_messages_cat_title">Disappearing messages</string>
|
||||
<string name="disappearing_messages_title">Let messages disappear automatically</string>
|
||||
<string name="disappearing_messages_summary">Messages in this conversation will automatically disappear 7 days after being received. This applies to both messages you send to your contact and messages your contact sends to you.</string>
|
||||
<string name="disappearing_messages_cat_title">Self-destructing messages</string>
|
||||
<string name="disappearing_messages_explanation">You can configure disappearing messages here.
|
||||
Turning on this setting will make new messages to this conversation automatically disappear 7 days after being received.
|
||||
This applies to messages you send to your contact as well as messages your contact sends to you.
|
||||
Your contact can also change this setting for the both of you.
|
||||
Messages that will disappear are marked with a bomb icon.
|
||||
Keep in mind that recipients can still make analogue copies of the messages you sent.
|
||||
If you change this setting, it will apply to your messages immediately and to messages of
|
||||
your contact once they receive any message from you after changing the setting.</string>
|
||||
<string name="learn_more">Learn more</string>
|
||||
<string name="disappearing_messages_title">Disappearing messages</string>
|
||||
<string name="disappearing_messages_summary">Make future messages in this conversation automatically disappear 7\u00A0days after being received.</string>
|
||||
|
||||
<!-- Settings Feedback -->
|
||||
<string name="feedback_settings_title">Feedback</string>
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
android:layout="@layout/preferences_category"
|
||||
android:title="@string/disappearing_messages_cat_title">
|
||||
|
||||
<Preference
|
||||
android:key="pref_key_disappearing_messages_explanation"
|
||||
android:layout="@layout/conversation_settings_disappearing_messages_explanation"
|
||||
android:selectable="false" />
|
||||
|
||||
<org.briarproject.briar.android.conversation.LinkPreference
|
||||
android:key="pref_key_disappearing_messages_learn_more"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="pref_key_disappearing_messages"
|
||||
|
||||
Reference in New Issue
Block a user