1package eu.siacs.conversations.ui;
2
3import android.content.Intent;
4import android.content.SharedPreferences;
5import android.content.pm.ActivityInfo;
6import android.os.Bundle;
7import android.preference.PreferenceManager;
8import android.text.Html;
9import android.text.method.LinkMovementMethod;
10import android.widget.Button;
11import android.widget.TextView;
12
13import androidx.appcompat.app.ActionBar;
14
15import eu.siacs.conversations.R;
16
17public class TosActivity extends XmppActivity {
18
19 @Override
20 protected void refreshUiReal() {
21
22 }
23
24 @Override
25 void onBackendConnected() {
26
27 }
28
29 @Override
30 public void onStart() {
31 super.onStart();
32 final int theme = findTheme();
33 if (this.mTheme != theme) {
34 recreate();
35 }
36 }
37
38 @Override
39 public void onNewIntent(Intent intent) {
40 super.onNewIntent(intent);
41 if (intent != null) {
42 setIntent(intent);
43 }
44 }
45
46 @Override
47 protected void onCreate(final Bundle savedInstanceState) {
48 if (getResources().getBoolean(R.bool.portrait_only)) {
49 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
50 }
51 super.onCreate(savedInstanceState);
52 setContentView(R.layout.activity_tos);
53 setSupportActionBar(findViewById(R.id.toolbar));
54 final ActionBar ab = getSupportActionBar();
55 if (ab != null) {
56 ab.setDisplayShowHomeEnabled(false);
57 ab.setDisplayHomeAsUpEnabled(false);
58 }
59 final Button agreeButton = findViewById(R.id.agree);
60 final TextView welcomeText = findViewById(R.id.welcome_text);
61 agreeButton.setOnClickListener(v -> {
62 final Intent intent = new Intent(this, EnterPhoneNumberActivity.class);
63 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
64 preferences.edit().putBoolean("tos", true).apply();
65 addInviteUri(intent);
66 startActivity(intent);
67 finish();
68 });
69 welcomeText.setText(Html.fromHtml(getString(R.string.welcome_text_quicksy)));
70 welcomeText.setMovementMethod(LinkMovementMethod.getInstance());
71
72 }
73
74 public void addInviteUri(Intent intent) {
75 StartConversationActivity.addInviteUri(intent, getIntent());
76 }
77}