-
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
1 parent
cc280b1
commit 4583793
Showing
65 changed files
with
2,159 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,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,38 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
apply plugin: 'kotlin-android' | ||
|
||
apply plugin: 'kotlin-android-extensions' | ||
|
||
apply plugin: 'kotlin-kapt' | ||
|
||
android { | ||
compileSdkVersion 27 | ||
defaultConfig { | ||
applicationId "com.easypageradapter.easypageradaptersample" | ||
minSdkVersion 14 | ||
targetSdkVersion 27 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
dataBinding.enabled = true | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" | ||
implementation 'com.android.support:appcompat-v7:27.0.2' | ||
implementation 'com.android.support:support-v4:27.0.2' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.1' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' | ||
kapt 'com.android.databinding:compiler:3.0.1' | ||
implementation project(':easypageradapter') | ||
} |
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 |
24 changes: 24 additions & 0 deletions
24
...c/androidTest/java/com/easypageradapter/easypageradaptersample/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,24 @@ | ||
package com.easypageradapter.easypageradaptersample | ||
|
||
import android.support.test.InstrumentationRegistry | ||
import android.support.test.runner.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.getTargetContext() | ||
assertEquals("com.easypageradapter.easypageradaptersample", 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,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.easypageradapter.easypageradaptersample"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".ui.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".ui.JavaDemoActivity" /> | ||
<activity android:name=".ui.KotlinDemoActivity" /> | ||
<activity android:name=".ui.FragmentPagerActivity" /> | ||
</application> | ||
|
||
</manifest> |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/easypageradapter/easypageradaptersample/data/data.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,6 @@ | ||
package com.easypageradapter.easypageradaptersample.data | ||
|
||
|
||
data class ImageModel(val image: Int, val name: String) | ||
|
||
data class PersonDetail(var name: String, val age: String, val designation: String, val profilePic: Int) |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/easypageradapter/easypageradaptersample/ui/FragmentA.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,20 @@ | ||
package com.easypageradapter.easypageradaptersample.ui | ||
|
||
import android.databinding.DataBindingUtil | ||
import android.os.Bundle | ||
import android.support.v4.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.easypageradapter.easypageradaptersample.R | ||
import com.easypageradapter.easypageradaptersample.databinding.FragmentABinding | ||
|
||
/** | ||
* Created by HP on 29-01-2018. | ||
*/ | ||
class FragmentA : Fragment() { | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
val fragmentBinding = DataBindingUtil.inflate<FragmentABinding>(inflater, R.layout.fragment_a, container, false) | ||
return fragmentBinding.root | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/easypageradapter/easypageradaptersample/ui/FragmentB.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,20 @@ | ||
package com.easypageradapter.easypageradaptersample.ui | ||
|
||
import android.databinding.DataBindingUtil | ||
import android.os.Bundle | ||
import android.support.v4.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.easypageradapter.easypageradaptersample.R | ||
import com.easypageradapter.easypageradaptersample.databinding.FragmentBBinding | ||
|
||
/** | ||
* Created by HP on 29-01-2018. | ||
*/ | ||
class FragmentB : Fragment() { | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
val fragmentBinding = DataBindingUtil.inflate<FragmentBBinding>(inflater, R.layout.fragment_b, container, false) | ||
return fragmentBinding.root | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/easypageradapter/easypageradaptersample/ui/FragmentPagerActivity.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,45 @@ | ||
package com.easypageradapter.easypageradaptersample.ui | ||
|
||
import android.databinding.DataBindingUtil | ||
import android.os.Bundle | ||
import android.support.v7.app.AppCompatActivity | ||
import com.easypageradapter.easypageradaptersample.R | ||
import com.easypageradapter.easypageradaptersample.databinding.ActivityFragmentPagerBinding | ||
import com.easypageradapter.setEasyFragmentPagerAdapter | ||
import com.easypageradapter.setEasyFragmentStatePagerAdapter | ||
|
||
class FragmentPagerActivity : AppCompatActivity() { | ||
|
||
private lateinit var mBinding: ActivityFragmentPagerBinding | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_fragment_pager) | ||
initViews() | ||
} | ||
|
||
private fun initViews() { | ||
// Kotlin code | ||
//For Fragment Pager | ||
setFragmentPagerAdapterKotlinCode() | ||
|
||
//For Fragment State Pager | ||
/*setFragmentStatePagerAdapterKotlinCode()*/ | ||
|
||
// JAVA code, Below code is not work here (because this is kotlin file) You need to use this code in Java file | ||
//For Fragment Pager | ||
/*new EasyFragmentPagerAdapter(supportFragmentManager, arrayListOf(FragmentA(), FragmentB())).into(mBinding.viewPager);*/ | ||
|
||
//For Fragment State Pager | ||
/*new EasyFragmentStatePagerAdapter(supportFragmentManager, arrayListOf(FragmentA(), FragmentB())).into(mBinding.viewPager);*/ | ||
|
||
/*If You are working with TabLayout then pageTitle() method is available to add tab name*/ | ||
} | ||
|
||
private fun setFragmentStatePagerAdapterKotlinCode() { | ||
mBinding.viewPager.setEasyFragmentStatePagerAdapter(supportFragmentManager, arrayListOf(FragmentA(), FragmentB())) | ||
} | ||
|
||
private fun setFragmentPagerAdapterKotlinCode() { | ||
mBinding.viewPager.setEasyFragmentPagerAdapter(supportFragmentManager, arrayListOf(FragmentA(), FragmentB())) | ||
} | ||
} |
Oops, something went wrong.