Skip to content

Commit

Permalink
Fixes issue #8. Adds AndroidX widgets support and bumps up the minimu…
Browse files Browse the repository at this point in the history
…m API level to 21
  • Loading branch information
wajahatkarim3 committed May 11, 2020
1 parent 63e66ec commit 2965b12
Show file tree
Hide file tree
Showing 24 changed files with 77 additions and 79 deletions.
15 changes: 8 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ android {
compileSdkVersion 28
defaultConfig {
applicationId "com.wajahatkarim3.easyflipviewpager.demo"
minSdkVersion 15
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
Expand All @@ -25,15 +25,16 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

implementation 'net.alexandroid.utils:indicators:1.6'
implementation "androidx.viewpager2:viewpager2:1.0.0"

implementation project(":easyflipviewpager")
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'me.relex:circleindicator:1.2.2'
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.wajahatkarim3.easyflipviewpager.demo

import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.wajahatkarim3.easyflipviewpager.demo

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.view.PagerAdapter
import android.support.v4.view.ViewPager
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import com.wajahatkarim3.easyflipviewpager.BookFlipPageTransformer
import com.wajahatkarim3.easyflipviewpager.CardFlipPageTransformer

class BookOnboardingActivity : AppCompatActivity() {

Expand All @@ -21,7 +19,7 @@ class BookOnboardingActivity : AppCompatActivity() {
setContentView(R.layout.activity_book_onboarding)

// Instantiate a ViewPager and a PagerAdapter.
mPager = findViewById<ViewPager>(R.id.pager)
mPager = findViewById(R.id.pager)
mPagerAdapter = BookOnboardingPagerAdapter(supportFragmentManager)
mPager.adapter = mPagerAdapter
mPager.clipToPadding = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.wajahatkarim3.easyflipviewpager.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.wajahatkarim3.easyflipviewpager.demo

import android.content.Intent
import android.os.Bundle
import android.support.v4.app.Fragment
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package com.wajahatkarim3.easyflipviewpager.demo

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.app.FragmentStatePagerAdapter
import android.support.v4.view.PagerAdapter
import android.support.v4.view.ViewPager
import android.widget.CheckBox
import android.widget.RadioGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import com.wajahatkarim3.easyflipviewpager.BookFlipPageTransformer
import com.wajahatkarim3.easyflipviewpager.CardFlipPageTransformer

Expand All @@ -29,7 +27,7 @@ class MainActivity : AppCompatActivity() {
setContentView(R.layout.activity_main)

radioGroupFlipAnimation = findViewById(R.id.rgFlipAnimation)
checkEnableScale = findViewById<CheckBox>(R.id.checkEnableScale)
checkEnableScale = findViewById(R.id.checkEnableScale)

// Book Flip Transformer
bookFlipTransformer.isEnableScale = true
Expand All @@ -40,7 +38,7 @@ class MainActivity : AppCompatActivity() {
cardFlipTransformer.flipOrientation = CardFlipPageTransformer.VERTICAL

// Instantiate a ViewPager and a PagerAdapter.
mPager = findViewById<ViewPager>(R.id.pager)
mPager = findViewById(R.id.pager)
mPagerAdapter = DemoPagerAdapter(supportFragmentManager)
mPager.adapter = mPagerAdapter
mPager.clipToPadding = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.wajahatkarim3.easyflipviewpager.demo

import android.support.v4.view.ViewPager
import android.support.v7.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.wajahatkarim3.easyflipviewpager.CardFlipPageTransformer
import me.relex.circleindicator.CircleIndicator

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.wajahatkarim3.easyflipviewpager.demo;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatImageView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;

import com.wajahatkarim3.easyflipviewpager.CardFlipPageTransformer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.wajahatkarim3.easyflipviewpager.demo

import android.graphics.Color
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentStatePagerAdapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter

/**
* A simple pager adapter that represents 5 ScreenSlidePageFragment objects, in
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_book_onboarding.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
Expand All @@ -19,7 +19,7 @@
</ImageView>


<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -30,4 +30,4 @@
tools:layout_marginBottom="30dp"/>


</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_height="match_parent"
tools:context=".MainActivity">

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_picture_gallery_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
android:padding="30dp"
tools:context=".PictureGalleryDemoActivity">

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/galleryViewPager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/indicator"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"></android.support.v4.view.ViewPager>
android:layout_centerInParent="true"></androidx.viewpager.widget.ViewPager>

<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_poker_card_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
tools:context=".PokerCardDemoActivity"
android:padding="20dp">

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/pokerViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
</androidx.viewpager.widget.ViewPager>

</RelativeLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/card_image_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imgCardSide"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_book_page_layout.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand Down Expand Up @@ -66,11 +66,11 @@
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintVertical_bias="0.07999998" />

<android.support.constraint.Guideline
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.70" />

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_demo_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:textStyle="bold"
tools:text="Image Title" />

<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_dummy_layout.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand All @@ -20,4 +20,4 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_gallery_page_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:layout_margin="20dp">

<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
Expand All @@ -19,7 +19,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">

<android.support.v7.widget.AppCompatImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="200dp"
Expand Down Expand Up @@ -47,5 +47,5 @@

</LinearLayout>

</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
</RelativeLayout>
12 changes: 6 additions & 6 deletions easyflipviewpager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ext {
libraryName = 'easyflipviewpager'
artifact = 'easyflipviewpager'

libraryVersion = '1.0.0'
libraryVersion = '1.2.0'

libraryDescription = 'The library for creating book and card flip animations in ViewPager in Android'

Expand All @@ -31,12 +31,12 @@ android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 15
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

}

Expand All @@ -52,10 +52,10 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}

//Add these lines to publish library to bintray. This is the ready-made scripts to make uploading to bintray easy.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.wajahatkarim3.easyflipviewpager;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Loading

0 comments on commit 2965b12

Please sign in to comment.