Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LoginActivity extends AppCompatActivity {
- private Context context;
- private boolean status = false;
- FragmentTransaction fT;
- FragmentManager fM;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login);
- context = this;
- Glide.with(this).load(R.drawable.login_header_image)
- .bitmapTransform(new BlurTransformation(context, 20))
- .into((ImageView) findViewById(R.id.login_background));
- fM = getSupportFragmentManager();
- fT = fM.beginTransaction();
- if (!status) {
- LoginFragment f1 = new LoginFragment();
- fT.add(R.id.login_cardView, f1);
- fT.commit();
- status = true;
- }
- FloatingActionButton f = (FloatingActionButton) findViewById(R.id.login_registerButton);
- f.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (!status) {
- LoginFragment f1 = new LoginFragment();
- fM.beginTransaction().add(R.id.login_cardView, f1)
- .commit();
- status = true;
- }else {
- RegisterFragment f2 = new RegisterFragment();
- fM.beginTransaction().add(R.id.login_cardView, f2)
- .commit();
- status = false;
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement