If you are not read yet the part-08 blog then first of all you read and implement part-08 visit CLICK HERE also you can watch our YouTube video Click Here.

In this blog we are creating in the MainActivity.java file means HomePage of your android application. We implement all remaining code of this application.

First, we create a variable content which is using under on Create class. So we can take three types of variable layout.

  1. ViewPagerAdapter
  2. CardView Layout
  3. flot
ViewPagerAdapter viewPagerAdapter;
CardView facebook, google, phone;
float v = 0;

Now we can implement all layouts which we have created in the previous blog under the onCreate method class like Tab layout, ViewPager, Facebook, Google, and Phone. These names are implemented in the activity_main.xml layout file.

TabLayout tabLayout = findViewById(R.id.tabLayout);
ViewPager viewPager = findViewById(R.id.viewPager);
facebook = findViewById(R.id.facebookLogin);
google = findViewById(R.id.googleLogin);
phone = findViewById(R.id.phoneLogin);
viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());

Now, we can add all fragment layouts which was we created means Login Fragment and Signup Fragment and we can set tab gravity system and also set adapter with ViewPager and tab layout set with view pager.

// Add Fragment
viewPagerAdapter.AddFragment(new LoginFragment(), "Login");
viewPagerAdapter.AddFragment(new SignupFragment(), "Signup");
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
viewPager.setAdapter(viewPagerAdapter);
tabLayout.setupWithViewPager(viewPager);

Next, we can set a default animation method which was created in the Login Fragment layout if you still did not read it yet then we will suggest you first read that blog then you can follow this blog. All blogs are connected with each other.

We can set the translationY method in Facebook, Google, Phone, and Tab Layout.

facebook.setTranslationY(300);
google.setTranslationY(300);
phone.setTranslationY(300);
tabLayout.setTranslationY(300);

Next, we can set the Alpha values in Facebook, Google, Phone, and Tab Layout.

facebook.setAlpha(v);
google.setAlpha(v);
phone.setAlpha(v);
tabLayout.setAlpha(v);

Next, we can set animation with delay time as per our requirement in Facebook, Google, Phone, and Tab Layout.

facebook.animate().translationY(0).alpha(1).setDuration(1000).setStartDelay(400).start();
google.animate().translationY(0).alpha(1).setDuration(1000).setStartDelay(600).start();
phone.animate().translationY(0).alpha(1).setDuration(1000).setStartDelay(800).start();
tabLayout.animate().translationY(0).alpha(1).setDuration(1000).setStartDelay(100).start();

Finally, we created a complete app with these blog parts. If you want to buy the complete package CLICK HERE and also you can watch our complete Tutorial CLICK HERE.


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *