All Projects → dipanshukr → Reside-Menu

dipanshukr / Reside-Menu

Licence: other
By applying viewpager animation you can also make AMAZING Reside Menu's

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Reside-Menu

Awesome Android Ui
😎 A curated list of awesome Android UI/UX libraries
Stars: ✭ 353 (+390.28%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Notzz App
📝 A Simple Note-Taking App built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, State Flow, Hilt-Dependency Injection, Jetpack DataStore, Architecture Components, MVVM, Room, Material Design Components).
Stars: ✭ 158 (+119.44%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Zoomrecylerlayout
🎢 Zoom Recycler Layout Manager For Android Kotlin
Stars: ✭ 618 (+758.33%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Modern Android Development
Modern Android Development tools & key points
Stars: ✭ 219 (+204.17%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Android-daily-read-tips
log for articles and info in android for every developer
Stars: ✭ 13 (-81.94%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Androidkex
Extensions for Kotlin. Use the power of Kotlin to make your code smaller and beautiful.
Stars: ✭ 35 (-51.39%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Biometric-Authentication-Android
A sample implementation of AndroidX biometrics API using Kotlin. Authenticate using biometrics or PIN/Password if biometrics isn't available on device. Fully implemented in Jetpack compose using Material 3 dynamic theming and also has a separate implementation in xml with MDC 3.
Stars: ✭ 29 (-59.72%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Mediapicker
Easy customizable picker for all your needs in Android application
Stars: ✭ 105 (+45.83%)
Mutual labels:  android-development, android-ui, android-studio, android-app
media-picker
Easy customizable picker for all your needs in Android application
Stars: ✭ 167 (+131.94%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Cameraxdemo
A sample camera app with CameraX API from Android Jetpack
Stars: ✭ 112 (+55.56%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Ibackdrop
A library to simply use Backdrop in your project (make it easy). Read more ->
Stars: ✭ 137 (+90.28%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Android Inappbilling
A sample which uses Google's Play Billing Library and it does InApp Purchases and Subscriptions.
Stars: ✭ 114 (+58.33%)
Mutual labels:  android-development, android-ui, android-studio, android-app
android-custom-view
No description or website provided.
Stars: ✭ 15 (-79.17%)
Mutual labels:  android-development, android-ui, android-studio, android-app
Dinocompose
Chrome's Dino T-Rex game developed in Jetpack Compose
Stars: ✭ 170 (+136.11%)
Mutual labels:  android-development, android-studio, android-app
Awesomedialog
A Beautiful Dialog Library for Kotlin Android
Stars: ✭ 163 (+126.39%)
Mutual labels:  android-development, android-ui, android-app
Advancedrecycleview
♻ RecycleView with multiple view types, inner horizontal RecycleView and layout animation
Stars: ✭ 172 (+138.89%)
Mutual labels:  android-development, android-ui, android-studio
Customrefreshview
一个支持网络错误重试,无数据页(可自定义),无网络界面(可自定义)的上拉加载更多,下拉刷新控件
Stars: ✭ 160 (+122.22%)
Mutual labels:  android-development, android-ui, android-studio
Bottomsheet
BottomSheet dialog library for Android
Stars: ✭ 219 (+204.17%)
Mutual labels:  android-development, android-ui, android-app
VideoPreLoading
Demo for video PreLoading/ PreCaching using ExoPlayer 2.13.3 in Android.
Stars: ✭ 61 (-15.28%)
Mutual labels:  android-development, android-ui, android-studio
Whatsapp Android App
This is sample code for layout for chatting app like Whatsapp.
Stars: ✭ 32 (-55.56%)
Mutual labels:  android-development, android-ui, android-studio

Reside Menu

In this project I implemented a menu using view pager. To implement this menu , i use view pager. First and third page are the menu page and second page is our content frame.

When we slide our page , say left to right. when first menu appear. What i have done is.

  • Set the page translation of first page (one with negative position offset) to 0.
  • Resize The content page.
  • Shift the content page to align to parent right.

PageTransformer is the interface which will control all our transformation.

public class HorizontalReside implements ViewPager.PageTransformer {
   @Override
   public void transformPage(View page, float position) {

       //Hiding those pages which are way off-screen to the left or to the right.
       if (position < -1) {
           page.setAlpha(0);
       } else if (position > 1) {
           page.setAlpha(0);
       } else {
           page.setAlpha(1);
       }


       if (page.getId() == R.id.menuFirst){
           //putting fragment to the start of the screen
           page.setTranslationX(-position*page.getWidth());
       }
       else if (page.getId() == R.id.contentPage){
           //when we swipe to left this code applied
           if (position <= 0){
              //for each transformation CODE is mentioned below
           }
           //when we swipe to right this code applied
           else if (position > 0){
             //for each transformation CODE is mentioned below
           }
       }
       else if (page.getId() == R.id.menuSecond){
           //putting fragment to the start of the screen
           page.setTranslationX(-position*page.getWidth());
       }
   }
}

In above code R.id.menuFirst & R.id.menuSecond are left and right menu fragments respectively, so we set them to the start of the screen.

R.id.contentPage is the fragment which is always visible to user when the user starts the app. For this we have to code the animation When the user swipe to left and When the user swipe to right. Also to show R.id.contentPage on top set this fragment parent layout elevation by doing this the fragment comes over the first frgament.

android:elevation="10dp"

To set R.id.contentPage is always shown to user whenever user starts the app you can use this

viewPager.setCurrentItem(1);

You can download the latest sample APK from Google Play store:

Android app on Google Play

Horizontal Reside Menu

Horizontal Reside Menu GIF

           if (position <= 0){

               //first we do scaling to 50%
               float scale = Math.max(0.6f,1-Math.abs(position));
               page.setScaleX(scale);
               page.setScaleY(scale);

               float deltaWidth = page.getWidth() - scale*page.getWidth();

               //place the fragment to the start of the screen and move the fragment to left
               page.setTranslationX(-position*page.getWidth() - deltaWidth/2);

           }
           //when we swipe to right this code applied
           else if (position > 0){

               //first we do scaling to 50%
               float scale = Math.max(0.6f,1-Math.abs(position));
               page.setScaleX(scale);
               page.setScaleY(scale);

               float deltaWidth = page.getWidth() - scale*page.getWidth();

               //place the fragment to the start of the screen and move the fragment to right
               page.setTranslationX(-position*page.getWidth() + deltaWidth/2);

           }

Vertical Reside Menu

Vertical Reside Menu GIF

            //when we swipe to left this code applied
            if (position <= 0){

                //first we do scaling to 50%
                float scale = Math.max(0.6f,1-Math.abs(position));
                page.setScaleX(scale);
                page.setScaleY(scale);

                float deltaHeight = page.getHeight() - scale*page.getHeight();

                //move the fragment to top
                page.setTranslationY(+deltaHeight/2);

            }
            //when we swipe to right this code applied
            else if (position > 0){

                //first we do scaling to 50%
                float scale = Math.max(0.6f,1-Math.abs(position));
                page.setScaleX(scale);
                page.setScaleY(scale);

                float deltaHeight = page.getHeight() - scale*page.getHeight();

                //move the fragment to bottom
                page.setTranslationY(-deltaHeight/2);

            }

Corner Reside Menu

Corner Reside Menu GIF

            //when we swipe to left this code applied
            if (position <= 0) {

                //first we do scaling to 50%
                float scale = Math.max(0.5f, 1 - Math.abs(position));
                page.setScaleX(scale);
                page.setScaleY(scale);

                float deltaHeight = page.getHeight() - scale * page.getHeight();
                float deltaWidth = page.getWidth() - scale * page.getWidth();

                //move the fragment to top
                page.setTranslationY(+deltaHeight / 2);
                //place the fragment to the start of the screen and move the fragment to left
                page.setTranslationX(-position * page.getWidth() - deltaWidth / 2);

            }
            //when we swipe to right this code applied
            else if (position > 0) {

                //first we do scaling to 50%
                float scale = Math.max(0.5f, 1 - Math.abs(position));
                page.setScaleX(scale);
                page.setScaleY(scale);

                float deltaHeight = page.getHeight() - scale * page.getHeight();
                float deltaWidth = page.getWidth() - scale * page.getWidth();

                //move the fragment to bottom
                page.setTranslationY(-deltaHeight / 2);
                //place the fragment to the start of the screen and move the fragment to right
                page.setTranslationX(-position * page.getWidth() + deltaWidth / 2);

            }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].