-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
android { | ||
compileSdk 32 | ||
|
||
defaultConfig { | ||
minSdk 21 | ||
targetSdk 32 | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles "consumer-rules.pro" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.core:core-ktx:1.8.0' | ||
implementation 'androidx.appcompat:appcompat:1.4.2' | ||
implementation 'com.google.android.material:material:1.6.1' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
27 changes: 27 additions & 0 deletions
27
...dTest/java/com/blueiobase/api/android/parallaxnavigationdrawer/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.blueiobase.api.android.parallaxnavigationdrawer | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals( | ||
"com.blueiobase.api.android.parallaxnavigationdrawer.test", | ||
appContext.packageName | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="com.blueiobase.api.android.parallaxnavigationdrawer"/> |
13 changes: 13 additions & 0 deletions
13
.../main/kotlin/com/blueiobase/api/android/parallaxnavigationdrawer/annotation/DrawerMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.blueiobase.api.android.parallaxnavigationdrawer.annotation | ||
|
||
import androidx.annotation.IntDef | ||
import com.blueiobase.api.android.parallaxnavigationdrawer.base.IParallaxDrawer | ||
|
||
@IntDef( | ||
IParallaxDrawer.DRAWER_MODE_LEFT, | ||
IParallaxDrawer.DRAWER_MODE_RIGHT, | ||
IParallaxDrawer.DRAWER_MODE_BOTH, | ||
IParallaxDrawer.DRAWER_MODE_NONE | ||
) | ||
@Retention(AnnotationRetention.SOURCE) | ||
annotation class DrawerMode |
116 changes: 116 additions & 0 deletions
116
...c/main/kotlin/com/blueiobase/api/android/parallaxnavigationdrawer/base/IParallaxDrawer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package com.blueiobase.api.android.parallaxnavigationdrawer.base | ||
|
||
import android.view.View | ||
import androidx.annotation.ColorRes | ||
import androidx.annotation.FloatRange | ||
import com.blueiobase.api.android.parallaxnavigationdrawer.annotation.DrawerMode | ||
import com.blueiobase.api.android.parallaxnavigationdrawer.listener.OnDrawerCloseListener | ||
import com.blueiobase.api.android.parallaxnavigationdrawer.listener.OnDrawerOpenListener | ||
import com.blueiobase.api.android.parallaxnavigationdrawer.listener.OnDrawerStateListener | ||
|
||
|
||
interface IParallaxDrawer { | ||
|
||
companion object { | ||
const val DRAWER_MODE_NONE = 0 | ||
|
||
const val DRAWER_MODE_LEFT = 1 | ||
|
||
const val DRAWER_MODE_RIGHT = 2 | ||
|
||
const val DRAWER_MODE_BOTH = 3 | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
fun setDrawerMode(@DrawerMode slideMode: Int) | ||
|
||
/** | ||
* | ||
* | ||
* @param slidePadding | ||
*/ | ||
fun setDrawerPadding(slidePadding: Int) | ||
|
||
/** | ||
* | ||
* | ||
* @param drawerDuration | ||
*/ | ||
fun setDrawerAnimationDuration(drawerDuration: Int) | ||
|
||
/** | ||
* | ||
* | ||
* @param parallax | ||
*/ | ||
fun setParallaxEnabled(parallax: Boolean) | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
fun setMainContentAlpha(@FloatRange(from = 0.0, to = 1.0) contentAlpha: Float) | ||
|
||
/** | ||
* | ||
* | ||
* @param color | ||
*/ | ||
fun setMainContentShadowColor(@ColorRes color: Int) | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
fun setMainContentCloseOnTouch(canCloseFromMainContent: Boolean) | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
fun setAllowDragging(allowDragging: Boolean) | ||
|
||
/** | ||
* | ||
* | ||
* @return [View] | ||
*/ | ||
fun getLeftDrawerView(): View? | ||
|
||
/** | ||
* | ||
* | ||
* @return [View] | ||
*/ | ||
fun getRightDrawerView(): View? | ||
|
||
/** | ||
* | ||
* | ||
* @return [View] | ||
*/ | ||
fun getMainContentView(): View? | ||
|
||
fun toggleLeftDrawer() | ||
|
||
fun openLeftDrawer() | ||
|
||
fun closeLeftDrawer() | ||
|
||
fun isLeftDrawerOpen(): Boolean | ||
|
||
fun toggleRightDrawer() | ||
|
||
fun openRightDrawer() | ||
|
||
fun closeRightDrawer() | ||
|
||
fun isRightDrawerOpen(): Boolean | ||
|
||
fun setOnDrawerOpenListener(listener: OnDrawerOpenListener?) | ||
|
||
fun setOnDrawerCloseListener(listener: OnDrawerCloseListener?) | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...lin/com/blueiobase/api/android/parallaxnavigationdrawer/listener/OnDrawerCloseListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.blueiobase.api.android.parallaxnavigationdrawer.listener | ||
|
||
import com.blueiobase.api.android.parallaxnavigationdrawer.ParallaxNavigationDrawer | ||
|
||
interface OnDrawerCloseListener { | ||
|
||
fun onDrawerClose ( | ||
parallaxNavigationDrawer: ParallaxNavigationDrawer, | ||
isLeftDrawerClose: Boolean, | ||
isRightDrawerClose: Boolean | ||
) | ||
} |
11 changes: 11 additions & 0 deletions
11
...tlin/com/blueiobase/api/android/parallaxnavigationdrawer/listener/OnDrawerOpenListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.blueiobase.api.android.parallaxnavigationdrawer.listener | ||
|
||
import com.blueiobase.api.android.parallaxnavigationdrawer.ParallaxNavigationDrawer | ||
|
||
interface OnDrawerOpenListener { | ||
fun onDrawerOpen( | ||
parallaxNavigationDrawer: ParallaxNavigationDrawer, | ||
isLeftDrawerOpen: Boolean, | ||
isRightDrawerOpen: Boolean | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<!--侧滑菜单的属性--> | ||
<declare-styleable name="ParallaxNavigationDrawer"> | ||
<attr format="enum" name="drawerMode"> | ||
<enum name="left" value="1"/> | ||
<enum name="right" value="2"/> | ||
<enum name="both" value="3"/> | ||
<enum name="none" value="0"/> | ||
</attr> | ||
<attr format="dimension" name="drawerPadding"/> | ||
<attr format="integer" name="duration"/> | ||
<attr format="boolean" name="parallax"/> | ||
<attr format="float" name="mainContentAlpha"/> | ||
<attr format="color" name="mainContentShadowColor"/> | ||
<attr format="boolean" name="mainContentCloseOnTouch"/> | ||
<attr format="boolean" name="allowDragging"/> | ||
</declare-styleable> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="app_name">Parallax Navigation Drawer</string> | ||
</resources> |
17 changes: 17 additions & 0 deletions
17
library/src/test/java/com/blueiobase/api/android/parallaxnavigationdrawer/ExampleUnitTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.blueiobase.api.android.parallaxnavigationdrawer | ||
|
||
import org.junit.Test | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Example local unit test, which will execute on the development machine (host). | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
class ExampleUnitTest { | ||
@Test | ||
fun addition_isCorrect() { | ||
assertEquals(4, 2 + 2) | ||
} | ||
} |