mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-06 14:26:55 +00:00
Update typing indicator intro screen.
This commit is contained in:
parent
1f9a65e389
commit
5a53268534
@ -1,36 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="vertical"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:background="#FF2090ea">
|
tools:background="#FF2090ea">
|
||||||
|
|
||||||
<TextView android:layout_width="match_parent"
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
android:id="@+id/blurb"
|
android:id="@+id/blurb"
|
||||||
android:textSize="@dimen/onboarding_title_size"
|
android:layout_width="match_parent"
|
||||||
android:textIsSelectable="false"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:paddingLeft="20dp"
|
android:paddingLeft="20dp"
|
||||||
android:paddingRight="20dp"
|
android:paddingRight="20dp"
|
||||||
android:fontFamily="sans-serif-light"
|
|
||||||
android:text="@string/ExperienceUpgradeActivity_introducing_typing_indicators"
|
android:text="@string/ExperienceUpgradeActivity_introducing_typing_indicators"
|
||||||
android:layout_marginTop="20dp"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textColor="@android:color/white" />
|
android:textColor="@android:color/white"
|
||||||
|
android:textIsSelectable="false"
|
||||||
|
android:textSize="@dimen/onboarding_title_size" />
|
||||||
|
|
||||||
<FrameLayout android:layout_width="wrap_content"
|
<FrameLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginTop="20dp">
|
android:layout_marginBottom="20dp">
|
||||||
|
|
||||||
<ImageView android:layout_width="170dp"
|
<ImageView
|
||||||
|
android:layout_width="170dp"
|
||||||
android:layout_height="170dp"
|
android:layout_height="170dp"
|
||||||
android:src="@drawable/circle_tintable"
|
android:scaleType="fitCenter"
|
||||||
android:scaleType="fitCenter"/>
|
android:src="@drawable/circle_tintable" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="120dp"
|
android:layout_width="120dp"
|
||||||
@ -43,35 +51,57 @@
|
|||||||
android:id="@+id/typing_indicator"
|
android:id="@+id/typing_indicator"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:scaleX="2.5"
|
android:scaleX="2.5"
|
||||||
android:scaleY="2.5"
|
android:scaleY="2.5" />
|
||||||
android:layout_gravity="center" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<TextView android:layout_width="match_parent"
|
<TextView
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/subblurb"
|
android:id="@+id/subblurb"
|
||||||
android:textSize="@dimen/onboarding_subtitle_size"
|
android:layout_width="match_parent"
|
||||||
android:textIsSelectable="false"
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:paddingLeft="20dp"
|
android:paddingLeft="20dp"
|
||||||
android:paddingRight="20dp"
|
android:paddingRight="20dp"
|
||||||
android:fontFamily="sans-serif-light"
|
|
||||||
android:text="@string/ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed"
|
android:text="@string/ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed"
|
||||||
android:textColor="@android:color/white" />
|
android:textColor="@color/core_white"
|
||||||
|
android:textIsSelectable="false"
|
||||||
|
android:textSize="@dimen/onboarding_subtitle_size" />
|
||||||
|
|
||||||
<android.support.v7.widget.SwitchCompat
|
<TextView
|
||||||
android:id="@+id/preference"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:text="@string/ExperienceUpgradeActivity_would_you_like_to_enable_them_now"
|
||||||
|
android:textColor="@color/core_white"
|
||||||
|
android:textIsSelectable="false"
|
||||||
|
android:textSize="@dimen/onboarding_subtitle_size" />
|
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatButton
|
||||||
|
android:id="@+id/experience_yes_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="8dp"
|
||||||
android:enabled="true"
|
android:text="@string/ExperienceUpgradeActivity_yes_turn_on_typing_indicators"
|
||||||
android:checked="true"
|
android:textColor="@color/core_blue"
|
||||||
android:text="@string/ExperienceUpgradeActivity_enable_typing_indicators"
|
app:backgroundTint="@color/core_white" />
|
||||||
android:textSize="20sp"
|
|
||||||
android:textColor="@android:color/white"
|
<android.support.v7.widget.AppCompatButton
|
||||||
app:theme="@style/Color1SwitchStyle"/>
|
android:id="@+id/experience_no_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:text="@string/ExperienceUpgradeActivity_no_thanks"
|
||||||
|
android:textColor="@color/core_white"
|
||||||
|
app:backgroundTint="@color/conversation_blue" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
@ -318,9 +318,12 @@
|
|||||||
<string name="ExperienceUpgradeActivity_signal_profiles_are_here">Signal profiles are here</string>
|
<string name="ExperienceUpgradeActivity_signal_profiles_are_here">Signal profiles are here</string>
|
||||||
|
|
||||||
<string name="ExperienceUpgradeActivity_introducing_typing_indicators">Introducing typing indicators.</string>
|
<string name="ExperienceUpgradeActivity_introducing_typing_indicators">Introducing typing indicators.</string>
|
||||||
<string name="ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed">Now you can optionally see and share when messages are being typed</string>
|
<string name="ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed">Now you can optionally see and share when messages are being typed.</string>
|
||||||
|
<string name="ExperienceUpgradeActivity_would_you_like_to_enable_them_now">Would you like to enable them now?</string>
|
||||||
<string name="ExperienceUpgradeActivity_typing_ui_title">Typing indicators are here</string>
|
<string name="ExperienceUpgradeActivity_typing_ui_title">Typing indicators are here</string>
|
||||||
<string name="ExperienceUpgradeActivity_enable_typing_indicators">Enable typing indicators</string>
|
<string name="ExperienceUpgradeActivity_enable_typing_indicators">Enable typing indicators</string>
|
||||||
|
<string name="ExperienceUpgradeActivity_yes_turn_on_typing_indicators">Yes, turn on typing indicators.</string>
|
||||||
|
<string name="ExperienceUpgradeActivity_no_thanks">No thanks.</string>
|
||||||
|
|
||||||
<!-- GcmBroadcastReceiver -->
|
<!-- GcmBroadcastReceiver -->
|
||||||
<string name="GcmBroadcastReceiver_retrieving_a_message">Retrieving a message...</string>
|
<string name="GcmBroadcastReceiver_retrieving_a_message">Retrieving a message...</string>
|
||||||
|
@ -12,6 +12,7 @@ import android.support.annotation.Nullable;
|
|||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import com.melnykov.fab.FloatingActionButton;
|
import com.melnykov.fab.FloatingActionButton;
|
||||||
import com.nineoldandroids.animation.ArgbEvaluator;
|
import com.nineoldandroids.animation.ArgbEvaluator;
|
||||||
@ -28,7 +29,7 @@ import org.whispersystems.libsignal.util.guava.Optional;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
public class ExperienceUpgradeActivity extends BaseActionBarActivity implements TypingIndicatorIntroFragment.Controller {
|
||||||
private static final String TAG = ExperienceUpgradeActivity.class.getSimpleName();
|
private static final String TAG = ExperienceUpgradeActivity.class.getSimpleName();
|
||||||
private static final String DISMISS_ACTION = "org.thoughtcrime.securesms.ExperienceUpgradeActivity.DISMISS_ACTION";
|
private static final String DISMISS_ACTION = "org.thoughtcrime.securesms.ExperienceUpgradeActivity.DISMISS_ACTION";
|
||||||
private static final int NOTIFICATION_ID = 1339;
|
private static final int NOTIFICATION_ID = 1339;
|
||||||
@ -42,7 +43,8 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
R.string.ExperienceUpgradeActivity_welcome_to_signal_excited,
|
R.string.ExperienceUpgradeActivity_welcome_to_signal_excited,
|
||||||
R.string.ExperienceUpgradeActivity_textsecure_is_now_signal,
|
R.string.ExperienceUpgradeActivity_textsecure_is_now_signal,
|
||||||
R.string.ExperienceUpgradeActivity_textsecure_is_now_signal_long,
|
R.string.ExperienceUpgradeActivity_textsecure_is_now_signal_long,
|
||||||
null),
|
null,
|
||||||
|
false),
|
||||||
VIDEO_CALLS(245,
|
VIDEO_CALLS(245,
|
||||||
new IntroPage(0xFF2090EA,
|
new IntroPage(0xFF2090EA,
|
||||||
BasicIntroFragment.newInstance(R.drawable.video_splash,
|
BasicIntroFragment.newInstance(R.drawable.video_splash,
|
||||||
@ -51,7 +53,8 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
R.string.ExperienceUpgradeActivity_say_hello_to_video_calls,
|
R.string.ExperienceUpgradeActivity_say_hello_to_video_calls,
|
||||||
R.string.ExperienceUpgradeActivity_signal_now_supports_secure_video_calling,
|
R.string.ExperienceUpgradeActivity_signal_now_supports_secure_video_calling,
|
||||||
R.string.ExperienceUpgradeActivity_signal_now_supports_secure_video_calling_long,
|
R.string.ExperienceUpgradeActivity_signal_now_supports_secure_video_calling_long,
|
||||||
null),
|
null,
|
||||||
|
false),
|
||||||
PROFILES(286,
|
PROFILES(286,
|
||||||
new IntroPage(0xFF2090EA,
|
new IntroPage(0xFF2090EA,
|
||||||
BasicIntroFragment.newInstance(R.drawable.profile_splash,
|
BasicIntroFragment.newInstance(R.drawable.profile_splash,
|
||||||
@ -60,21 +63,24 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
R.string.ExperienceUpgradeActivity_signal_profiles_are_here,
|
R.string.ExperienceUpgradeActivity_signal_profiles_are_here,
|
||||||
R.string.ExperienceUpgradeActivity_now_you_can_share_a_profile_photo_and_name_with_friends_on_signal,
|
R.string.ExperienceUpgradeActivity_now_you_can_share_a_profile_photo_and_name_with_friends_on_signal,
|
||||||
R.string.ExperienceUpgradeActivity_now_you_can_share_a_profile_photo_and_name_with_friends_on_signal,
|
R.string.ExperienceUpgradeActivity_now_you_can_share_a_profile_photo_and_name_with_friends_on_signal,
|
||||||
CreateProfileActivity.class),
|
CreateProfileActivity.class,
|
||||||
|
false),
|
||||||
READ_RECEIPTS(299,
|
READ_RECEIPTS(299,
|
||||||
new IntroPage(0xFF2090EA,
|
new IntroPage(0xFF2090EA,
|
||||||
ReadReceiptsIntroFragment.newInstance()),
|
ReadReceiptsIntroFragment.newInstance()),
|
||||||
R.string.experience_upgrade_preference_fragment__read_receipts_are_here,
|
R.string.experience_upgrade_preference_fragment__read_receipts_are_here,
|
||||||
R.string.experience_upgrade_preference_fragment__optionally_see_and_share_when_messages_have_been_read,
|
R.string.experience_upgrade_preference_fragment__optionally_see_and_share_when_messages_have_been_read,
|
||||||
R.string.experience_upgrade_preference_fragment__optionally_see_and_share_when_messages_have_been_read,
|
R.string.experience_upgrade_preference_fragment__optionally_see_and_share_when_messages_have_been_read,
|
||||||
null),
|
null,
|
||||||
TYPING_INDICATORS(430,
|
false),
|
||||||
|
TYPING_INDICATORS(435,
|
||||||
new IntroPage(0xFF2090EA,
|
new IntroPage(0xFF2090EA,
|
||||||
TypingIndicatorIntroFragment.newInstance()),
|
TypingIndicatorIntroFragment.newInstance()),
|
||||||
R.string.ExperienceUpgradeActivity_introducing_typing_indicators,
|
R.string.ExperienceUpgradeActivity_introducing_typing_indicators,
|
||||||
R.string.ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed,
|
R.string.ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed,
|
||||||
R.string.ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed,
|
R.string.ExperienceUpgradeActivity_now_you_can_optionally_see_and_share_when_messages_are_being_typed,
|
||||||
null);
|
null,
|
||||||
|
true);
|
||||||
|
|
||||||
private int version;
|
private int version;
|
||||||
private List<IntroPage> pages;
|
private List<IntroPage> pages;
|
||||||
@ -82,13 +88,15 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
private @StringRes int notificationText;
|
private @StringRes int notificationText;
|
||||||
private @StringRes int notificationBigText;
|
private @StringRes int notificationBigText;
|
||||||
private @Nullable Class nextIntent;
|
private @Nullable Class nextIntent;
|
||||||
|
private boolean handlesNavigation;
|
||||||
|
|
||||||
ExperienceUpgrade(int version,
|
ExperienceUpgrade(int version,
|
||||||
@NonNull List<IntroPage> pages,
|
@NonNull List<IntroPage> pages,
|
||||||
@StringRes int notificationTitle,
|
@StringRes int notificationTitle,
|
||||||
@StringRes int notificationText,
|
@StringRes int notificationText,
|
||||||
@StringRes int notificationBigText,
|
@StringRes int notificationBigText,
|
||||||
@Nullable Class nextIntent)
|
@Nullable Class nextIntent,
|
||||||
|
boolean handlesNavigation)
|
||||||
{
|
{
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.pages = pages;
|
this.pages = pages;
|
||||||
@ -96,6 +104,7 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
this.notificationText = notificationText;
|
this.notificationText = notificationText;
|
||||||
this.notificationBigText = notificationBigText;
|
this.notificationBigText = notificationBigText;
|
||||||
this.nextIntent = nextIntent;
|
this.nextIntent = nextIntent;
|
||||||
|
this.handlesNavigation = handlesNavigation;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExperienceUpgrade(int version,
|
ExperienceUpgrade(int version,
|
||||||
@ -103,9 +112,10 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
@StringRes int notificationTitle,
|
@StringRes int notificationTitle,
|
||||||
@StringRes int notificationText,
|
@StringRes int notificationText,
|
||||||
@StringRes int notificationBigText,
|
@StringRes int notificationBigText,
|
||||||
@Nullable Class nextIntent)
|
@Nullable Class nextIntent,
|
||||||
|
boolean handlesNavigation)
|
||||||
{
|
{
|
||||||
this(version, Collections.singletonList(page), notificationTitle, notificationText, notificationBigText, nextIntent);
|
this(version, Collections.singletonList(page), notificationTitle, notificationText, notificationBigText, nextIntent, handlesNavigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVersion() {
|
public int getVersion() {
|
||||||
@ -131,6 +141,10 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
public int getNotificationBigText() {
|
public int getNotificationBigText() {
|
||||||
return notificationBigText;
|
return notificationBigText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean handlesNavigation() {
|
||||||
|
return handlesNavigation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -150,7 +164,12 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
|
|
||||||
pager.setAdapter(new IntroPagerAdapter(getSupportFragmentManager(), upgrade.get().getPages()));
|
pager.setAdapter(new IntroPagerAdapter(getSupportFragmentManager(), upgrade.get().getPages()));
|
||||||
|
|
||||||
|
if (upgrade.get().handlesNavigation()) {
|
||||||
|
fab.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
fab.setVisibility(View.VISIBLE);
|
||||||
fab.setOnClickListener(v -> onContinue(upgrade));
|
fab.setOnClickListener(v -> onContinue(upgrade));
|
||||||
|
}
|
||||||
|
|
||||||
getWindow().setBackgroundDrawable(new ColorDrawable(upgrade.get().getPage(0).backgroundColor));
|
getWindow().setBackgroundDrawable(new ColorDrawable(upgrade.get().getPage(0).backgroundColor));
|
||||||
ServiceUtil.getNotificationManager(this).cancel(NOTIFICATION_ID);
|
ServiceUtil.getNotificationManager(this).cancel(NOTIFICATION_ID);
|
||||||
@ -195,6 +214,11 @@ public class ExperienceUpgradeActivity extends BaseActionBarActivity {
|
|||||||
return eligibleUpgrade;
|
return eligibleUpgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinished() {
|
||||||
|
onContinue(Optional.of(ExperienceUpgrade.TYPING_INDICATORS));
|
||||||
|
}
|
||||||
|
|
||||||
private final class OnPageChangeListener implements ViewPager.OnPageChangeListener {
|
private final class OnPageChangeListener implements ViewPager.OnPageChangeListener {
|
||||||
private final ArgbEvaluator evaluator = new ArgbEvaluator();
|
private final ArgbEvaluator evaluator = new ArgbEvaluator();
|
||||||
private final ExperienceUpgrade upgrade;
|
private final ExperienceUpgrade upgrade;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.widget.SwitchCompat;
|
import android.support.v7.widget.SwitchCompat;
|
||||||
@ -15,6 +16,8 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
|||||||
|
|
||||||
public class TypingIndicatorIntroFragment extends Fragment {
|
public class TypingIndicatorIntroFragment extends Fragment {
|
||||||
|
|
||||||
|
private Controller controller;
|
||||||
|
|
||||||
public static TypingIndicatorIntroFragment newInstance() {
|
public static TypingIndicatorIntroFragment newInstance() {
|
||||||
TypingIndicatorIntroFragment fragment = new TypingIndicatorIntroFragment();
|
TypingIndicatorIntroFragment fragment = new TypingIndicatorIntroFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
@ -29,24 +32,45 @@ public class TypingIndicatorIntroFragment extends Fragment {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
|
||||||
|
if (!(getActivity() instanceof Controller)) {
|
||||||
|
throw new IllegalStateException("Parent activity must implement the Controller interface.");
|
||||||
|
}
|
||||||
|
|
||||||
|
controller = (Controller) getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View v = inflater.inflate(R.layout.experience_upgrade_typing_indicators_fragment, container, false);
|
View view = inflater.inflate(R.layout.experience_upgrade_typing_indicators_fragment, container, false);
|
||||||
SwitchCompat preference = ViewUtil.findById(v, R.id.preference);
|
View yesButton = view.findViewById(R.id.experience_yes_button);
|
||||||
|
View noButton = view.findViewById(R.id.experience_no_button);
|
||||||
|
|
||||||
((TypingIndicatorView) v.findViewById(R.id.typing_indicator)).startAnimation();
|
((TypingIndicatorView) view.findViewById(R.id.typing_indicator)).startAnimation();
|
||||||
|
|
||||||
preference.setChecked(TextSecurePreferences.isTypingIndicatorsEnabled(getContext()));
|
|
||||||
preference.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
yesButton.setOnClickListener(v -> onButtonClicked(true));
|
||||||
TextSecurePreferences.setTypingIndicatorsEnabled(getContext(), isChecked);
|
noButton.setOnClickListener(v -> onButtonClicked(false));
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onButtonClicked(boolean typingEnabled) {
|
||||||
|
TextSecurePreferences.setTypingIndicatorsEnabled(getContext(), typingEnabled);
|
||||||
ApplicationContext.getInstance(requireContext())
|
ApplicationContext.getInstance(requireContext())
|
||||||
.getJobManager()
|
.getJobManager()
|
||||||
.add(new MultiDeviceConfigurationUpdateJob(getContext(),
|
.add(new MultiDeviceConfigurationUpdateJob(getContext(),
|
||||||
TextSecurePreferences.isReadReceiptsEnabled(requireContext()),
|
TextSecurePreferences.isReadReceiptsEnabled(requireContext()),
|
||||||
isChecked,
|
typingEnabled,
|
||||||
TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(getContext())));
|
TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(getContext())));
|
||||||
});
|
|
||||||
|
|
||||||
return v;
|
controller.onFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Controller {
|
||||||
|
void onFinished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user