mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Merge branch '1833-update-onboarding-ui' into '804-self-destructing-messages'
Update self-destructing onboarding See merge request briar/briar!1385
This commit is contained in:
@@ -5,7 +5,7 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
@@ -13,6 +13,7 @@ import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.widget.OnboardingFullDialogFragment;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -95,7 +96,7 @@ public class ConversationSettingsDialog extends DialogFragment {
|
||||
switchDisappearingMessages.setOnCheckedChangeListener(
|
||||
(button, value) -> viewModel.setAutoDeleteTimerEnabled(value));
|
||||
|
||||
TextView buttonLearnMore =
|
||||
Button buttonLearnMore =
|
||||
view.findViewById(R.id.buttonLearnMore);
|
||||
buttonLearnMore.setOnClickListener(e -> showLearnMoreDialog());
|
||||
|
||||
@@ -113,10 +114,10 @@ public class ConversationSettingsDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
private void showLearnMoreDialog() {
|
||||
ConversationSettingsLearnMoreDialog
|
||||
dialog = new ConversationSettingsLearnMoreDialog();
|
||||
dialog.show(getChildFragmentManager(),
|
||||
ConversationSettingsLearnMoreDialog.TAG);
|
||||
OnboardingFullDialogFragment.newInstance(
|
||||
R.string.disappearing_messages_title,
|
||||
R.string.disappearing_messages_explanation_long
|
||||
).show(getChildFragmentManager(), OnboardingFullDialogFragment.TAG);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package org.briarproject.briar.android.conversation;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class ConversationSettingsLearnMoreDialog extends DialogFragment {
|
||||
|
||||
final static String TAG =
|
||||
ConversationSettingsLearnMoreDialog.class.getName();
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
FragmentActivity activity = requireActivity();
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity,
|
||||
R.style.OnboardingDialogTheme);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(builder.getContext());
|
||||
View view = inflater.inflate(
|
||||
R.layout.fragment_conversation_settings_learn_more, null);
|
||||
builder.setView(view);
|
||||
|
||||
builder.setTitle(R.string.disappearing_messages_title);
|
||||
builder.setPositiveButton(R.string.ok, null);
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.briarproject.briar.android.widget;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
@NotNullByDefault
|
||||
public class OnboardingFullDialogFragment extends DialogFragment {
|
||||
|
||||
public final static String TAG =
|
||||
OnboardingFullDialogFragment.class.getName();
|
||||
|
||||
private final static String RES_TITLE = "resTitle";
|
||||
private final static String RES_CONTENT = "resContent";
|
||||
|
||||
public static OnboardingFullDialogFragment newInstance(@StringRes int title,
|
||||
@StringRes int content) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(RES_TITLE, title);
|
||||
args.putInt(RES_CONTENT, content);
|
||||
OnboardingFullDialogFragment f = new OnboardingFullDialogFragment();
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStyle(DialogFragment.STYLE_NORMAL,
|
||||
R.style.BriarFullScreenDialogTheme);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_onboarding_full,
|
||||
container, false);
|
||||
|
||||
Bundle args = requireArguments();
|
||||
|
||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationOnClickListener(v -> dismiss());
|
||||
toolbar.setTitle(args.getInt(RES_TITLE));
|
||||
|
||||
TextView contentView = view.findViewById(R.id.contentView);
|
||||
contentView.setText(args.getInt(RES_CONTENT));
|
||||
|
||||
view.findViewById(R.id.button).setOnClickListener(v -> dismiss());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,6 @@
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:paddingHorizontal="@dimen/margin_large"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -43,24 +42,25 @@
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/switchDisappearingMessages"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_margin="16dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/disappearing_messages_summary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageViewBomb" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageViewBomb"
|
||||
tools:enabled="true" />
|
||||
|
||||
<TextView
|
||||
<Button
|
||||
android:id="@+id/buttonLearnMore"
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_large"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
android:text="@string/learn_more"
|
||||
android:textColor="@color/briar_text_link"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/switchDisappearingMessages" />
|
||||
|
||||
@@ -68,4 +68,4 @@
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView 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="match_parent"
|
||||
android:paddingHorizontal="?dialogPreferredPadding">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/disappearing_messages_explanation_long"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</ScrollView>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/BriarToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navigationIcon="@drawable/abc_ic_ab_back_material"
|
||||
tools:title="Onboarding Fullscreen Dialog" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/briar_primary"
|
||||
android:fillViewport="true">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_margin="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_info_white"
|
||||
app:tint="@color/briar_text_secondary_inverse"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contentView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:textColor="@color/briar_text_secondary_inverse"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/got_it"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -581,15 +581,16 @@
|
||||
<!-- Conversation Settings -->
|
||||
<string name="disappearing_messages_title">Disappearing messages</string>
|
||||
<string name="disappearing_messages_explanation_long">Turning on this setting will make new
|
||||
messages in this conversation automatically disappear 7\u00A0days 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 in this conversation automatically disappear after 7\u00A0days.
|
||||
\n\nThe countdown for the sender\'s copy of the message starts after it has been delivered.
|
||||
The countdown starts for the recipient after they have read the message.
|
||||
\n\nMessages that will disappear are marked with a bomb icon.
|
||||
\n\nKeep in mind that recipients can still make copies of the messages you send.
|
||||
\n\nIf you change this setting, it will apply to your messages immediately and to your
|
||||
contact\'s messages once they receive your next message.</string>
|
||||
\n\nIf you change this setting, it will apply to your new messages immediately and to your
|
||||
contact\'s messages once they receive your next message.
|
||||
Your contact can also change this setting for the both of you.</string>
|
||||
<string name="learn_more">Learn more</string>
|
||||
<string name="disappearing_messages_summary">Make future messages in this conversation automatically disappear 7\u00A0days after being received.</string>
|
||||
<string name="disappearing_messages_summary">Make future messages in this conversation automatically disappear after 7\u00A0days.</string>
|
||||
|
||||
<!-- Settings Feedback -->
|
||||
<string name="feedback_settings_title">Feedback</string>
|
||||
|
||||
Reference in New Issue
Block a user