Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. public class LoginActivity extends AppCompatActivity {
  2.  
  3. private Context context;
  4. private boolean status = false;
  5. FragmentTransaction fT;
  6. FragmentManager fM;
  7.  
  8. @Override
  9. protected void onCreate(Bundle savedInstanceState) {
  10. super.onCreate(savedInstanceState);
  11. setContentView(R.layout.activity_login);
  12.  
  13. context = this;
  14.  
  15. Glide.with(this).load(R.drawable.login_header_image)
  16. .bitmapTransform(new BlurTransformation(context, 20))
  17. .into((ImageView) findViewById(R.id.login_background));
  18.  
  19. fM = getSupportFragmentManager();
  20. fT = fM.beginTransaction();
  21.  
  22. if (!status) {
  23. LoginFragment f1 = new LoginFragment();
  24. fT.add(R.id.login_cardView, f1);
  25. fT.commit();
  26. status = true;
  27. }
  28.  
  29. FloatingActionButton f = (FloatingActionButton) findViewById(R.id.login_registerButton);
  30. f.setOnClickListener(new View.OnClickListener() {
  31. @Override
  32. public void onClick(View view) {
  33.  
  34. if (!status) {
  35. LoginFragment f1 = new LoginFragment();
  36. fM.beginTransaction().add(R.id.login_cardView, f1)
  37. .commit();
  38. status = true;
  39. }else {
  40. RegisterFragment f2 = new RegisterFragment();
  41. fM.beginTransaction().add(R.id.login_cardView, f2)
  42. .commit();
  43. status = false;
  44. }
  45. }
  46. });
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement