/CornerView

switch between fragments from corner by dragging or on click.

Primary LanguageKotlinApache License 2.0Apache-2.0

Android CornerView

switch between two fragments from corner by dragging or on click.



Installing

Add it in your root build.gradle at the end of repositories:

  allprojects {
  	repositories {
  		...
  		maven { url 'https://jitpack.io' }
  	}
  }

Step 2. Add the dependency

dependencies {
  	    implementation 'com.github.ahmedmamdouh13:CornerView:1.0'
  }

How To Use It

  • create your fragment instances
 val first = MatchesFragment()
 val second = FavoriteFragment()
  • add them to Controller fragment instance
 val controller = Controller().apply {
     this.first = first
     this.second = second
 }            
  • add the collapsed icon of the first and second fragment
 controller.setFirstCollapseIcon(R.drawable.ic_list_black_24dp)
 controller.setSecondCollapseIcon(R.drawable.ic_favorite_black_24dp)
  • same for colors
 controller.setFirstCollapseColor(android.R.color.black)
 controller.setSecondCollapseColor(R.color.colorAccent)
  • add the Controller fragment to your layout
 supportFragmentManager.beginTransaction()
     .replace(
         R.id.main_container_mainactivity,
         controller, "Controller"
     ).commit()
  • That's it :).
  Copyright 2020 Ahmed Mamdouh

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.