2013-03-26 04:26:03 +00:00
|
|
|
package org.thoughtcrime.securesms;
|
|
|
|
|
2017-02-20 20:00:03 +00:00
|
|
|
import android.content.Context;
|
2013-03-26 04:26:03 +00:00
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.Intent;
|
2017-06-02 16:59:23 +00:00
|
|
|
import android.content.pm.ApplicationInfo;
|
|
|
|
import android.content.pm.PackageManager;
|
2017-04-30 17:26:10 +00:00
|
|
|
import android.graphics.PorterDuff;
|
2013-03-26 04:26:03 +00:00
|
|
|
import android.os.Bundle;
|
2017-04-30 17:26:10 +00:00
|
|
|
import android.support.v4.content.ContextCompat;
|
2015-05-20 21:36:30 +00:00
|
|
|
import android.support.v7.app.AlertDialog;
|
2013-03-26 04:26:03 +00:00
|
|
|
import android.text.Editable;
|
2014-11-12 19:15:05 +00:00
|
|
|
import android.text.TextUtils;
|
2013-03-26 04:26:03 +00:00
|
|
|
import android.text.TextWatcher;
|
|
|
|
import android.util.Log;
|
2015-07-09 15:03:45 +00:00
|
|
|
import android.view.KeyEvent;
|
2013-03-26 04:26:03 +00:00
|
|
|
import android.view.MotionEvent;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.Spinner;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
2014-07-23 22:40:45 +00:00
|
|
|
import com.google.android.gms.common.ConnectionResult;
|
2017-02-20 20:00:03 +00:00
|
|
|
import com.google.android.gms.common.GoogleApiAvailability;
|
2013-03-26 04:26:03 +00:00
|
|
|
import com.google.i18n.phonenumbers.AsYouTypeFormatter;
|
|
|
|
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
|
|
|
import com.google.i18n.phonenumbers.Phonenumber;
|
2014-01-08 22:29:05 +00:00
|
|
|
|
2014-12-15 20:25:55 +00:00
|
|
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
2014-03-01 00:32:00 +00:00
|
|
|
import org.thoughtcrime.securesms.util.Dialogs;
|
2014-07-23 22:40:45 +00:00
|
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
2014-11-12 19:15:05 +00:00
|
|
|
import org.thoughtcrime.securesms.util.Util;
|
2017-08-02 19:51:46 +00:00
|
|
|
import org.whispersystems.libsignal.util.guava.Optional;
|
2016-03-23 17:34:41 +00:00
|
|
|
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
2013-03-26 04:26:03 +00:00
|
|
|
|
|
|
|
/**
|
2013-07-11 00:54:38 +00:00
|
|
|
* The register account activity. Prompts ths user for their registration information
|
|
|
|
* and begins the account registration process.
|
2013-03-26 04:26:03 +00:00
|
|
|
*
|
|
|
|
* @author Moxie Marlinspike
|
|
|
|
*
|
|
|
|
*/
|
2015-04-03 00:14:08 +00:00
|
|
|
public class RegistrationActivity extends BaseActionBarActivity {
|
2013-03-26 04:26:03 +00:00
|
|
|
|
|
|
|
private static final int PICK_COUNTRY = 1;
|
2016-08-14 10:23:51 +00:00
|
|
|
private static final String TAG = RegistrationActivity.class.getSimpleName();
|
2013-03-26 04:26:03 +00:00
|
|
|
|
2017-02-20 20:00:03 +00:00
|
|
|
private enum PlayServicesStatus {
|
|
|
|
SUCCESS,
|
|
|
|
MISSING,
|
|
|
|
NEEDS_UPDATE,
|
|
|
|
TRANSIENT_ERROR
|
|
|
|
}
|
|
|
|
|
2013-07-09 23:36:15 +00:00
|
|
|
private AsYouTypeFormatter countryFormatter;
|
2013-03-26 04:26:03 +00:00
|
|
|
private ArrayAdapter<String> countrySpinnerAdapter;
|
2013-07-09 23:36:15 +00:00
|
|
|
private Spinner countrySpinner;
|
|
|
|
private TextView countryCode;
|
2013-03-26 04:26:03 +00:00
|
|
|
private TextView number;
|
2017-03-31 01:18:04 +00:00
|
|
|
private TextView createButton;
|
|
|
|
private TextView skipButton;
|
|
|
|
private TextView informationView;
|
|
|
|
private View informationToggle;
|
|
|
|
private TextView informationToggleText;
|
2013-03-26 04:26:03 +00:00
|
|
|
|
2013-08-15 15:25:30 +00:00
|
|
|
private MasterSecret masterSecret;
|
|
|
|
|
2013-03-26 04:26:03 +00:00
|
|
|
@Override
|
2015-04-03 00:14:08 +00:00
|
|
|
public void onCreate(Bundle icicle) {
|
|
|
|
super.onCreate(icicle);
|
2013-03-26 04:26:03 +00:00
|
|
|
setContentView(R.layout.registration_activity);
|
|
|
|
|
2015-09-23 20:35:18 +00:00
|
|
|
getSupportActionBar().setTitle(getString(R.string.RegistrationActivity_connect_with_signal));
|
2013-03-26 04:26:03 +00:00
|
|
|
|
|
|
|
initializeResources();
|
2013-07-11 00:54:38 +00:00
|
|
|
initializeSpinner();
|
2013-03-26 04:26:03 +00:00
|
|
|
initializeNumber();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
if (requestCode == PICK_COUNTRY && resultCode == RESULT_OK && data != null) {
|
|
|
|
this.countryCode.setText(data.getIntExtra("country_code", 1)+"");
|
|
|
|
setCountryDisplay(data.getStringExtra("country_name"));
|
|
|
|
setCountryFormatter(data.getIntExtra("country_code", 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void initializeResources() {
|
2015-04-03 00:14:08 +00:00
|
|
|
this.masterSecret = getIntent().getParcelableExtra("master_secret");
|
2017-03-31 01:18:04 +00:00
|
|
|
this.countrySpinner = (Spinner) findViewById(R.id.country_spinner);
|
|
|
|
this.countryCode = (TextView) findViewById(R.id.country_code);
|
|
|
|
this.number = (TextView) findViewById(R.id.number);
|
|
|
|
this.createButton = (TextView) findViewById(R.id.registerButton);
|
|
|
|
this.skipButton = (TextView) findViewById(R.id.skipButton);
|
|
|
|
this.informationView = (TextView) findViewById(R.id.registration_information);
|
|
|
|
this.informationToggle = findViewById(R.id.information_link_container);
|
|
|
|
this.informationToggleText = (TextView) findViewById(R.id.information_label);
|
|
|
|
|
2017-04-30 17:26:10 +00:00
|
|
|
this.createButton.getBackground().setColorFilter(ContextCompat.getColor(this, R.color.signal_primary),
|
|
|
|
PorterDuff.Mode.MULTIPLY);
|
|
|
|
this.skipButton.getBackground().setColorFilter(ContextCompat.getColor(this, R.color.grey_400),
|
|
|
|
PorterDuff.Mode.MULTIPLY);
|
2013-03-26 04:26:03 +00:00
|
|
|
|
2013-07-11 00:54:38 +00:00
|
|
|
this.countryCode.addTextChangedListener(new CountryCodeChangedListener());
|
|
|
|
this.number.addTextChangedListener(new NumberChangedListener());
|
|
|
|
this.createButton.setOnClickListener(new CreateButtonListener());
|
2013-07-11 21:58:40 +00:00
|
|
|
this.skipButton.setOnClickListener(new CancelButtonListener());
|
2017-03-31 01:18:04 +00:00
|
|
|
this.informationToggle.setOnClickListener(new InformationToggleListener());
|
2014-11-04 14:19:48 +00:00
|
|
|
|
|
|
|
if (getIntent().getBooleanExtra("cancel_button", false)) {
|
2015-03-11 21:23:45 +00:00
|
|
|
this.skipButton.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
this.skipButton.setVisibility(View.INVISIBLE);
|
2014-11-04 14:19:48 +00:00
|
|
|
}
|
2013-07-11 00:54:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void initializeSpinner() {
|
2014-11-12 19:15:05 +00:00
|
|
|
this.countrySpinnerAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item);
|
2013-03-26 04:26:03 +00:00
|
|
|
this.countrySpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
2013-07-11 00:54:38 +00:00
|
|
|
|
2013-07-09 23:36:15 +00:00
|
|
|
setCountryDisplay(getString(R.string.RegistrationActivity_select_your_country));
|
2013-03-26 04:26:03 +00:00
|
|
|
|
|
|
|
this.countrySpinner.setAdapter(this.countrySpinnerAdapter);
|
|
|
|
this.countrySpinner.setOnTouchListener(new View.OnTouchListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onTouch(View v, MotionEvent event) {
|
|
|
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
|
|
|
Intent intent = new Intent(RegistrationActivity.this, CountrySelectionActivity.class);
|
|
|
|
startActivityForResult(intent, PICK_COUNTRY);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
2015-07-09 15:03:45 +00:00
|
|
|
this.countrySpinner.setOnKeyListener(new View.OnKeyListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER && event.getAction() == KeyEvent.ACTION_UP) {
|
|
|
|
Intent intent = new Intent(RegistrationActivity.this, CountrySelectionActivity.class);
|
|
|
|
startActivityForResult(intent, PICK_COUNTRY);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2013-03-26 04:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void initializeNumber() {
|
2017-08-02 19:51:46 +00:00
|
|
|
Optional<Phonenumber.PhoneNumber> localNumber = Util.getDeviceNumber(this);
|
2013-03-26 04:26:03 +00:00
|
|
|
|
2017-08-02 19:51:46 +00:00
|
|
|
if (localNumber.isPresent()) {
|
|
|
|
this.countryCode.setText(String.valueOf(localNumber.get().getCountryCode()));
|
|
|
|
this.number.setText(String.valueOf(localNumber.get().getNationalNumber()));
|
|
|
|
} else {
|
|
|
|
Optional<String> simCountryIso = Util.getSimCountryIso(this);
|
2014-06-04 02:16:27 +00:00
|
|
|
|
2017-08-02 19:51:46 +00:00
|
|
|
if (simCountryIso.isPresent() && !TextUtils.isEmpty(simCountryIso.get())) {
|
|
|
|
this.countryCode.setText(PhoneNumberUtil.getInstance().getCountryCodeForRegion(simCountryIso.get())+"");
|
2013-03-26 04:26:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void setCountryDisplay(String value) {
|
|
|
|
this.countrySpinnerAdapter.clear();
|
|
|
|
this.countrySpinnerAdapter.add(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void setCountryFormatter(int countryCode) {
|
|
|
|
PhoneNumberUtil util = PhoneNumberUtil.getInstance();
|
|
|
|
String regionCode = util.getRegionCodeForCountryCode(countryCode);
|
|
|
|
|
2013-07-09 23:36:15 +00:00
|
|
|
if (regionCode == null) this.countryFormatter = null;
|
|
|
|
else this.countryFormatter = util.getAsYouTypeFormatter(regionCode);
|
2013-03-26 04:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private String getConfiguredE164Number() {
|
|
|
|
return PhoneNumberFormatter.formatE164(countryCode.getText().toString(),
|
|
|
|
number.getText().toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
private class CreateButtonListener implements View.OnClickListener {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
final RegistrationActivity self = RegistrationActivity.this;
|
|
|
|
|
2014-11-12 19:15:05 +00:00
|
|
|
if (TextUtils.isEmpty(countryCode.getText())) {
|
2013-07-09 23:36:15 +00:00
|
|
|
Toast.makeText(self,
|
|
|
|
getString(R.string.RegistrationActivity_you_must_specify_your_country_code),
|
2013-03-26 04:26:03 +00:00
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-12 19:15:05 +00:00
|
|
|
if (TextUtils.isEmpty(number.getText())) {
|
2013-07-09 23:36:15 +00:00
|
|
|
Toast.makeText(self,
|
|
|
|
getString(R.string.RegistrationActivity_you_must_specify_your_phone_number),
|
2013-03-26 04:26:03 +00:00
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
final String e164number = getConfiguredE164Number();
|
|
|
|
|
|
|
|
if (!PhoneNumberFormatter.isValidNumber(e164number)) {
|
2014-03-01 00:32:00 +00:00
|
|
|
Dialogs.showAlertDialog(self,
|
2013-07-09 23:36:15 +00:00
|
|
|
getString(R.string.RegistrationActivity_invalid_number),
|
|
|
|
String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid),
|
|
|
|
e164number));
|
2013-03-26 04:26:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:00:03 +00:00
|
|
|
PlayServicesStatus gcmStatus = checkPlayServices(self);
|
2014-07-23 22:40:45 +00:00
|
|
|
|
2017-02-20 20:00:03 +00:00
|
|
|
if (gcmStatus == PlayServicesStatus.SUCCESS) {
|
|
|
|
promptForRegistrationStart(self, e164number, true);
|
|
|
|
} else if (gcmStatus == PlayServicesStatus.MISSING) {
|
|
|
|
promptForNoPlayServices(self, e164number);
|
|
|
|
} else if (gcmStatus == PlayServicesStatus.NEEDS_UPDATE) {
|
2017-03-12 17:56:51 +00:00
|
|
|
GoogleApiAvailability.getInstance().getErrorDialog(self, ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, 0).show();
|
2017-02-20 20:00:03 +00:00
|
|
|
} else {
|
|
|
|
Dialogs.showAlertDialog(self, getString(R.string.RegistrationActivity_play_services_error),
|
|
|
|
getString(R.string.RegistrationActivity_google_play_services_is_updating_or_unavailable));
|
2013-03-26 04:26:03 +00:00
|
|
|
}
|
2017-02-20 20:00:03 +00:00
|
|
|
}
|
2013-03-26 04:26:03 +00:00
|
|
|
|
2017-02-20 20:00:03 +00:00
|
|
|
private void promptForRegistrationStart(final Context context, final String e164number, final boolean gcmSupported) {
|
|
|
|
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
|
2015-03-25 08:48:55 +00:00
|
|
|
dialog.setTitle(PhoneNumberFormatter.getInternationalFormatFromE164(e164number));
|
2015-03-25 19:02:07 +00:00
|
|
|
dialog.setMessage(R.string.RegistrationActivity_we_will_now_verify_that_the_following_number_is_associated_with_your_device_s);
|
2013-07-09 23:36:15 +00:00
|
|
|
dialog.setPositiveButton(getString(R.string.RegistrationActivity_continue),
|
2013-03-26 04:26:03 +00:00
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
2017-02-20 20:00:03 +00:00
|
|
|
Intent intent = new Intent(context, RegistrationProgressActivity.class);
|
|
|
|
intent.putExtra(RegistrationProgressActivity.NUMBER_EXTRA, e164number);
|
|
|
|
intent.putExtra(RegistrationProgressActivity.MASTER_SECRET_EXTRA, masterSecret);
|
|
|
|
intent.putExtra(RegistrationProgressActivity.GCM_SUPPORTED_EXTRA, gcmSupported);
|
2013-03-26 04:26:03 +00:00
|
|
|
startActivity(intent);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
});
|
2013-07-09 23:36:15 +00:00
|
|
|
dialog.setNegativeButton(getString(R.string.RegistrationActivity_edit), null);
|
2013-03-26 04:26:03 +00:00
|
|
|
dialog.show();
|
|
|
|
}
|
2017-02-20 20:00:03 +00:00
|
|
|
|
|
|
|
private void promptForNoPlayServices(final Context context, final String e164number) {
|
|
|
|
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
|
|
|
|
dialog.setTitle(R.string.RegistrationActivity_missing_google_play_services);
|
|
|
|
dialog.setMessage(R.string.RegistrationActivity_this_device_is_missing_google_play_services);
|
|
|
|
dialog.setPositiveButton(R.string.RegistrationActivity_i_understand, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
promptForRegistrationStart(context, e164number, false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialog.setNegativeButton(android.R.string.cancel, null);
|
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
private PlayServicesStatus checkPlayServices(Context context) {
|
|
|
|
int gcmStatus = 0;
|
|
|
|
|
|
|
|
try {
|
|
|
|
gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
|
|
|
|
} catch (Throwable t) {
|
|
|
|
Log.w(TAG, t);
|
|
|
|
return PlayServicesStatus.MISSING;
|
|
|
|
}
|
|
|
|
|
|
|
|
Log.w(TAG, "Play Services: " + gcmStatus);
|
|
|
|
|
|
|
|
switch (gcmStatus) {
|
|
|
|
case ConnectionResult.SUCCESS:
|
|
|
|
return PlayServicesStatus.SUCCESS;
|
|
|
|
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
|
2017-06-02 16:59:23 +00:00
|
|
|
try {
|
|
|
|
ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo("com.google.android.gms", 0);
|
|
|
|
|
|
|
|
if (applicationInfo != null && !applicationInfo.enabled) {
|
|
|
|
return PlayServicesStatus.MISSING;
|
|
|
|
}
|
|
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
|
|
Log.w(TAG, e);
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:00:03 +00:00
|
|
|
return PlayServicesStatus.NEEDS_UPDATE;
|
|
|
|
case ConnectionResult.SERVICE_DISABLED:
|
|
|
|
case ConnectionResult.SERVICE_MISSING:
|
|
|
|
case ConnectionResult.SERVICE_INVALID:
|
|
|
|
case ConnectionResult.API_UNAVAILABLE:
|
|
|
|
case ConnectionResult.SERVICE_MISSING_PERMISSION:
|
|
|
|
return PlayServicesStatus.MISSING;
|
|
|
|
default:
|
|
|
|
return PlayServicesStatus.TRANSIENT_ERROR;
|
|
|
|
}
|
|
|
|
}
|
2013-03-26 04:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private class CountryCodeChangedListener implements TextWatcher {
|
|
|
|
@Override
|
|
|
|
public void afterTextChanged(Editable s) {
|
2014-11-12 19:15:05 +00:00
|
|
|
if (TextUtils.isEmpty(s)) {
|
2013-07-09 23:36:15 +00:00
|
|
|
setCountryDisplay(getString(R.string.RegistrationActivity_select_your_country));
|
2013-03-26 04:26:03 +00:00
|
|
|
countryFormatter = null;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int countryCode = Integer.parseInt(s.toString());
|
|
|
|
String regionCode = PhoneNumberUtil.getInstance().getRegionCodeForCountryCode(countryCode);
|
2013-07-09 23:36:15 +00:00
|
|
|
|
2013-03-26 04:26:03 +00:00
|
|
|
setCountryFormatter(countryCode);
|
|
|
|
setCountryDisplay(PhoneNumberFormatter.getRegionDisplayName(regionCode));
|
|
|
|
|
2014-11-12 19:15:05 +00:00
|
|
|
if (!TextUtils.isEmpty(regionCode) && !regionCode.equals("ZZ")) {
|
2013-03-26 04:26:03 +00:00
|
|
|
number.requestFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private class NumberChangedListener implements TextWatcher {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
if (countryFormatter == null)
|
|
|
|
return;
|
|
|
|
|
2014-11-12 19:15:05 +00:00
|
|
|
if (TextUtils.isEmpty(s))
|
2013-03-26 04:26:03 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
countryFormatter.clear();
|
|
|
|
|
|
|
|
String number = s.toString().replaceAll("[^\\d.]", "");
|
|
|
|
String formattedNumber = null;
|
|
|
|
|
|
|
|
for (int i=0;i<number.length();i++) {
|
|
|
|
formattedNumber = countryFormatter.inputDigit(number.charAt(i));
|
|
|
|
}
|
|
|
|
|
2014-05-08 22:18:35 +00:00
|
|
|
if (formattedNumber != null && !s.toString().equals(formattedNumber)) {
|
2013-03-26 04:26:03 +00:00
|
|
|
s.replace(0, s.length(), formattedNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2013-07-11 21:58:40 +00:00
|
|
|
|
|
|
|
private class CancelButtonListener implements View.OnClickListener {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
TextSecurePreferences.setPromptedPushRegistration(RegistrationActivity.this, true);
|
|
|
|
Intent nextIntent = getIntent().getParcelableExtra("next_intent");
|
|
|
|
|
|
|
|
if (nextIntent == null) {
|
2014-12-15 20:25:55 +00:00
|
|
|
nextIntent = new Intent(RegistrationActivity.this, ConversationListActivity.class);
|
2013-07-11 21:58:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
startActivity(nextIntent);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
2017-03-31 01:18:04 +00:00
|
|
|
|
|
|
|
private class InformationToggleListener implements View.OnClickListener {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
if (informationView.getVisibility() == View.VISIBLE) {
|
|
|
|
informationView.setVisibility(View.GONE);
|
|
|
|
informationToggleText.setText(R.string.RegistrationActivity_more_information);
|
|
|
|
} else {
|
|
|
|
informationView.setVisibility(View.VISIBLE);
|
|
|
|
informationToggleText.setText(R.string.RegistrationActivity_less_information);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-26 04:26:03 +00:00
|
|
|
}
|