Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
VijayMakwana committed Feb 20, 2018
1 parent cc280b1 commit 4583793
Show file tree
Hide file tree
Showing 65 changed files with 2,159 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
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
3 changes: 3 additions & 0 deletions .idea/dictionaries/HP.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
38 changes: 38 additions & 0 deletions app/build.gradle
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')
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
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)
}
}
24 changes: 24 additions & 0 deletions app/src/main/AndroidManifest.xml
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>
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)
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
}
}
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
}
}
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()))
}
}
Loading

0 comments on commit 4583793

Please sign in to comment.