anotherim/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java

78 lines
2.3 KiB
Java
Raw Normal View History

2018-11-09 16:47:36 +00:00
package eu.siacs.conversations.ui;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.widget.Button;
import android.widget.TextView;
2021-01-19 12:53:47 +00:00
import androidx.appcompat.app.ActionBar;
2018-11-09 16:47:36 +00:00
import eu.siacs.conversations.R;
public class TosActivity extends XmppActivity {
@Override
protected void refreshUiReal() {
}
@Override
void onBackendConnected() {
}
@Override
public void onStart() {
super.onStart();
final int theme = findTheme();
if (this.mTheme != theme) {
recreate();
}
}
@Override
public void onNewIntent(Intent intent) {
2021-01-19 12:53:47 +00:00
super.onNewIntent(intent);
2018-11-09 16:47:36 +00:00
if (intent != null) {
setIntent(intent);
}
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
if (getResources().getBoolean(R.bool.portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tos);
setSupportActionBar(findViewById(R.id.toolbar));
final ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayHomeAsUpEnabled(false);
}
final Button agreeButton = findViewById(R.id.agree);
final TextView welcomeText = findViewById(R.id.welcome_text);
agreeButton.setOnClickListener(v -> {
final Intent intent = new Intent(this, EnterPhoneNumberActivity.class);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
preferences.edit().putBoolean("tos", true).apply();
addInviteUri(intent);
startActivity(intent);
finish();
});
welcomeText.setText(Html.fromHtml(getString(R.string.welcome_text_quicksy_static)));
2018-11-09 16:47:36 +00:00
welcomeText.setMovementMethod(LinkMovementMethod.getInstance());
}
public void addInviteUri(Intent intent) {
StartConversationActivity.addInviteUri(intent, getIntent());
}
}