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