From 5111bfcb658b03d901ac9a1fc877e07b3d79ed9d Mon Sep 17 00:00:00 2001 From: gilgoldzweig Date: Fri, 9 Sep 2016 00:58:38 +0300 Subject: [PATCH] A new version with bug fix new features and fun --- .idea/.name | 1 - .idea/gradle.xml | 11 +- .idea/inspectionProfiles/Project_Default.xml | 10 - .../inspectionProfiles/profiles_settings.xml | 7 - .idea/misc.xml | 18 +- .idea/vcs.xml | 3 +- app/build.gradle | 5 +- .../goldzweigapps/easytabs/MainActivity.java | 67 +- .../res/drawable/ic_favorite_white_36dp.xml | 2 +- .../main/res/drawable/ic_help_white_36dp.xml | 2 +- .../res/drawable/ic_person_white_36dp.xml | 2 +- .../drawable/ic_photo_camera_white_36dp.xml | 4 +- app/src/main/res/layout/activity_main.xml | 44 +- app/src/main/res/layout/frag.xml | 8 +- app/src/main/res/values/styles.xml | 2 +- build.gradle | 6 +- gradle/wrapper/gradle-wrapper.properties | 4 +- tabs/build.gradle | 14 +- .../tabs/Builder/EasyTabsBuilder.java | 2125 +++++++++++------ .../goldzweigapps/tabs/Builder/TabItem.java | 20 +- .../goldzweigapps/tabs/EasyTabsColors.java | 326 ++- .../tabs/Interface/TabsListener.java | 11 + 22 files changed, 1650 insertions(+), 1042 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 tabs/src/main/java/goldzweigapps/tabs/Interface/TabsListener.java diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 2388fa3..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -EasyTabs \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 445db82..e186963 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -3,8 +3,9 @@ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index aa2d359..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 3b31283..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 2890ad8..671fecf 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -44,10 +44,26 @@ - + + + + + + 1.8 + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 1167a91..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,7 +1,6 @@ - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 014dca7..681e6f4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ android { defaultConfig { applicationId "goldzweigapps.easytabs" - minSdkVersion 16 + minSdkVersion 17 targetSdkVersion 23 versionCode 1 versionName "1.0" @@ -26,4 +26,7 @@ dependencies { compile 'com.jakewharton:butterknife:7.0.1' compile 'com.android.support:design:23.3.0' compile project(':tabs') + compile 'com.android.support:leanback-v17:23.4.0' + compile 'com.android.support:support-v4:23.4.0' + compile 'com.android.support:recyclerview-v7:23.4.0' } diff --git a/app/src/main/java/goldzweigapps/easytabs/MainActivity.java b/app/src/main/java/goldzweigapps/easytabs/MainActivity.java index 30828d3..3ad59dc 100644 --- a/app/src/main/java/goldzweigapps/easytabs/MainActivity.java +++ b/app/src/main/java/goldzweigapps/easytabs/MainActivity.java @@ -2,60 +2,59 @@ import android.graphics.Typeface; import android.support.design.widget.TabLayout; +import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.util.Log; import butterknife.Bind; import butterknife.ButterKnife; import goldzweigapps.tabs.Builder.EasyTabsBuilder; import goldzweigapps.tabs.Builder.TabItem; import goldzweigapps.tabs.EasyTabsColors; -import goldzweigapps.tabs.transforms.AccordionTransformer; -import goldzweigapps.tabs.transforms.CubeInTransformer; -import goldzweigapps.tabs.transforms.CubeOutTransformer; +import goldzweigapps.tabs.Interface.TabsListener; +import goldzweigapps.tabs.transforms.EasyTabletTransformer; public class MainActivity extends AppCompatActivity { - EasyTabsBuilder builder; - EasyTabsColors colors; - @Bind(R.id.pager) - ViewPager pager; @Bind(R.id.tabs) TabLayout tabs; + @Bind(R.id.pager) + ViewPager pager; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); - Typeface selected; - selected = Typeface.createFromAsset(getAssets(), "fonts/bubble.ttf"); - colors = new EasyTabsColors(); -builder = new EasyTabsBuilder(this, tabs, pager) - .addTabs(false, - new TabItem(new frag1(), "number 1"), - new TabItem(new frag2(), "number 2"), - new TabItem(new frag3(), "number 3"), - new TabItem(new frag4(), "number 4"), - new TabItem(new frag1(), "number 1"), + + EasyTabsBuilder.init(this,tabs,pager).addTabs( //this = AppCompactActivity, tabs = TabsLayout, pager = ViewPager + new TabItem(new frag1(), "number 1"), // Add four Tab items with fragment and title new TabItem(new frag2(), "number 2"), new TabItem(new frag3(), "number 3"), - new TabItem(new frag4(), "number 4"), - new TabItem(new frag1(), "number 5") - ) - .setBackgroundColor(colors.RoyalBlue) - .setIndicatorColor(colors.White) - - .setTextColors(colors.White, colors.DarkSlateBlue) - .addIcons(R.drawable.ic_person_white_36dp, - R.drawable.ic_photo_camera_white_36dp, - R.drawable.ic_favorite_white_36dp, - R.drawable.ic_help_white_36dp, - R.drawable.ic_person_white_36dp) - .setTransformation(true, new CubeOutTransformer()) - .setTabLayoutScrolable(false) - .setTypeface(selected) - .setToRTL(false) - .withIconFading(true); + new TabItem(new frag4(), "number 4")) + .HideTitle(false) + .setBackgroundColor(EasyTabsColors.White) + .setIndicatorColor(EasyTabsColors.Black) + .setTextColors(EasyTabsColors.Black, EasyTabsColors.RoyalBlue) //Setting two colors selected one and unselected one + .addIcons( + R.drawable.ic_person_white_36dp, + R.drawable.ic_photo_camera_white_36dp, + R.drawable.ic_favorite_white_36dp, + R.drawable.ic_help_white_36dp) //Adding four icons + .setTransformation(true, new EasyTabletTransformer()) + .setTabLayoutScrollable(false) + .setCustomTypeface(Typeface.createFromAsset(getAssets(), "fonts/bubble.ttf")) + .setRTLPosition(true) + .withListener(new TabsListener() { + @Override + public void onScreenPosition(int position) { + Log.d("tag", String.valueOf(position)); + } + }) + .setIconFading(true) + .Build(); } + } diff --git a/app/src/main/res/drawable/ic_favorite_white_36dp.xml b/app/src/main/res/drawable/ic_favorite_white_36dp.xml index 924ee0e..0c14cf0 100644 --- a/app/src/main/res/drawable/ic_favorite_white_36dp.xml +++ b/app/src/main/res/drawable/ic_favorite_white_36dp.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/ic_help_white_36dp.xml b/app/src/main/res/drawable/ic_help_white_36dp.xml index cd3f820..965bcd7 100644 --- a/app/src/main/res/drawable/ic_help_white_36dp.xml +++ b/app/src/main/res/drawable/ic_help_white_36dp.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/ic_person_white_36dp.xml b/app/src/main/res/drawable/ic_person_white_36dp.xml index ce03f40..0c4272b 100644 --- a/app/src/main/res/drawable/ic_person_white_36dp.xml +++ b/app/src/main/res/drawable/ic_person_white_36dp.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/ic_photo_camera_white_36dp.xml b/app/src/main/res/drawable/ic_photo_camera_white_36dp.xml index 1bb6c60..5d88d89 100644 --- a/app/src/main/res/drawable/ic_photo_camera_white_36dp.xml +++ b/app/src/main/res/drawable/ic_photo_camera_white_36dp.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index adbe9b1..2e69918 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,20 +1,52 @@ - + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + tools:context="goldzweigapps.easytabs.MainActivity" + xmlns:android="http://schemas.android.com/apk/res/android"> + + + + android:background="@color/Gold" + android:layout_below="@+id/toolbar" + android:layout_alignParentStart="true"> + + + + + + android:layout_below="@+id/tabs" + android:layout_alignParentStart="true" /> diff --git a/app/src/main/res/layout/frag.xml b/app/src/main/res/layout/frag.xml index 495f87d..e119ba8 100644 --- a/app/src/main/res/layout/frag.xml +++ b/app/src/main/res/layout/frag.xml @@ -2,11 +2,5 @@ - + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 5885930..0eb88fe 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -