Search in sources :

Example 1 with SecretInputFragment

use of com.auth0.sharelock.fragment.SecretInputFragment in project sharelock-android by auth0.

the class ComposeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_compose);
    Toolbar toolbar = (Toolbar) findViewById(R.id.sharelock_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(null);
    bus = EventBus.getDefault();
    handler = new Handler();
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();
    String sharedText = null;
    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
        }
    }
    if (savedInstanceState == null) {
        final SecretInputFragment fragment = new SecretInputFragment();
        if (sharedText != null) {
            Bundle arguments = new Bundle();
            arguments.putString(SecretInputFragment.SECRET_INPUT_FRAGMENT_SECRET_ARGUMENT, sharedText);
            fragment.setArguments(arguments);
        }
        getSupportFragmentManager().beginTransaction().replace(R.id.sharelock_compose_container, fragment).commit();
    } else {
        secret = savedInstanceState.getParcelable(COMPOSE_CREATED_SECRET);
    }
}
Also used : Bundle(android.os.Bundle) SecretInputFragment(com.auth0.sharelock.fragment.SecretInputFragment) Handler(android.os.Handler) Intent(android.content.Intent) Crashlytics(com.crashlytics.android.Crashlytics) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 Toolbar (android.support.v7.widget.Toolbar)1 SecretInputFragment (com.auth0.sharelock.fragment.SecretInputFragment)1 Crashlytics (com.crashlytics.android.Crashlytics)1