├── settings.gradle
├── bin
├── classes.dex
├── TabSample.apk
├── resources.ap_
└── app
│ └── tabsample
│ ├── R.class
│ ├── R$attr.class
│ ├── R$id.class
│ ├── R$array.class
│ ├── R$color.class
│ ├── R$dimen.class
│ ├── R$layout.class
│ ├── R$string.class
│ ├── R$style.class
│ ├── R$drawable.class
│ ├── TabSample.class
│ ├── ArrowsActivity.class
│ └── OptionsActivity.class
├── screenshot.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── app
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ ├── icon.png
│ │ │ ├── home_normal.png
│ │ │ ├── home_blue_tint.png
│ │ │ ├── home_selected.png
│ │ │ ├── search_normal.png
│ │ │ ├── search_selected.png
│ │ │ └── search_blue_tint.png
│ │ ├── drawable-ldpi
│ │ │ └── icon.png
│ │ ├── drawable-mdpi
│ │ │ ├── icon.png
│ │ │ ├── home_normal.png
│ │ │ ├── home_blue_tint.png
│ │ │ ├── home_selected.png
│ │ │ ├── search_normal.png
│ │ │ ├── search_selected.png
│ │ │ └── search_blue_tint.png
│ │ ├── drawable
│ │ │ ├── tab_home.xml
│ │ │ ├── tab_home_legacy.xml
│ │ │ ├── tab_search.xml
│ │ │ ├── tab_search_legacy.xml
│ │ │ ├── tab_background.xml
│ │ │ ├── tab_unselected.xml
│ │ │ ├── tab_indicator.xml
│ │ │ ├── tab_selected.xml
│ │ │ ├── tab_press.xml
│ │ │ └── tab_focus.xml
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── dimensions.xml
│ │ │ ├── colors.xml
│ │ │ └── styles.xml
│ │ ├── menu
│ │ │ └── main_activity.xml
│ │ ├── layout
│ │ │ ├── home_layout.xml
│ │ │ ├── tab_activity.xml
│ │ │ ├── search_layout.xml
│ │ │ ├── activity_main.xml
│ │ │ └── tab_indicator.xml
│ │ └── values-v21
│ │ │ └── styles.xml
│ │ ├── java
│ │ └── app
│ │ │ └── tabsample
│ │ │ ├── legacy
│ │ │ ├── ArrowsActivity.java
│ │ │ ├── OptionsActivity.java
│ │ │ └── TabSample.java
│ │ │ ├── fragments
│ │ │ ├── HomeFragment.java
│ │ │ └── SearchFragment.java
│ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
└── build.gradle
├── .gitignore
├── default.properties
├── AndroidManifest.xml
├── LICENSE
├── README.md
├── gradlew.bat
└── gradlew
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/classes.dex
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/screenshot.png
--------------------------------------------------------------------------------
/bin/TabSample.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/TabSample.apk
--------------------------------------------------------------------------------
/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/resources.ap_
--------------------------------------------------------------------------------
/bin/app/tabsample/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$attr.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$id.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$array.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$array.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$color.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$color.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$dimen.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$layout.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$string.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$style.class
--------------------------------------------------------------------------------
/bin/app/tabsample/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/R$drawable.class
--------------------------------------------------------------------------------
/bin/app/tabsample/TabSample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/TabSample.class
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/bin/app/tabsample/ArrowsActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/ArrowsActivity.class
--------------------------------------------------------------------------------
/bin/app/tabsample/OptionsActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/bin/app/tabsample/OptionsActivity.class
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/home_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-hdpi/home_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/home_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-mdpi/home_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/home_blue_tint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-hdpi/home_blue_tint.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/home_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-hdpi/home_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/search_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-hdpi/search_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/search_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-hdpi/search_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/home_blue_tint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-mdpi/home_blue_tint.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/home_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-mdpi/home_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/search_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-mdpi/search_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/search_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-mdpi/search_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/search_blue_tint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-hdpi/search_blue_tint.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/search_blue_tint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdilSoomro/Iphone-Tab-in-Android/HEAD/app/src/main/res/drawable-mdpi/search_blue_tint.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | *.iml
3 | .idea/*
4 | .metadata/*
5 | build/*
6 | local.properties
7 | app/build/*
8 | androidTest/*
9 | release/*
10 | debug/*
11 | gen/*
12 | *.class
13 |
14 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_home_legacy.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_search_legacy.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, Tab at Bottom!
4 | Tabs at Bottom
5 |
6 | - One
7 | - Two
8 | - Three
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimensions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 8dp
4 | 4dp
5 | 0dp
6 | 3dp
7 | 36sp
8 | 6sp
9 |
--------------------------------------------------------------------------------
/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-7
12 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_activity.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/app/tabsample/legacy/ArrowsActivity.java:
--------------------------------------------------------------------------------
1 | package app.tabsample.legacy;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import app.tabsample.R;
7 |
8 | /**
9 | * @author Adil Soomro
10 | *
11 | */
12 | public class ArrowsActivity extends Activity {
13 |
14 | public void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.home_layout);
17 | }
18 | }
--------------------------------------------------------------------------------
/app/src/main/java/app/tabsample/legacy/OptionsActivity.java:
--------------------------------------------------------------------------------
1 | package app.tabsample.legacy;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import app.tabsample.R;
7 |
8 | /**
9 | * @author Adil Soomro
10 | *
11 | */
12 | public class OptionsActivity extends Activity {
13 | public void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.search_layout);
16 |
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #2B2B2B
7 | #000000
8 | #10ffffff
9 |
10 |
11 | #1c9359
12 | #3aaf75
13 | #084e43
14 |
15 |
16 | #a7a7aa
17 | #f6f6f7
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/home_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "22.0.1"
6 |
7 | defaultConfig {
8 | applicationId "app.tabsample"
9 | minSdkVersion 16
10 | targetSdkVersion 22
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17 | }
18 | }
19 | }
20 | dependencies {
21 | compile 'com.android.support:appcompat-v7:22.2.0'
22 | compile 'com.android.support:design:22.2.0'
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_unselected.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/java/app/tabsample/fragments/HomeFragment.java:
--------------------------------------------------------------------------------
1 | package app.tabsample.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import app.tabsample.R;
10 |
11 | /**
12 | * Created by adilsoomro on 8/19/16.
13 | */
14 | public class HomeFragment extends Fragment{
15 |
16 | @Override
17 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
18 | Bundle savedInstanceState) {
19 | // Inflate the layout for this fragment
20 | return inflater.inflate(R.layout.home_layout, container, false);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/app/tabsample/fragments/SearchFragment.java:
--------------------------------------------------------------------------------
1 | package app.tabsample.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import app.tabsample.R;
10 |
11 | /**
12 | * Created by adilsoomro on 8/19/16.
13 | */
14 | public class SearchFragment extends Fragment{
15 |
16 | @Override
17 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
18 | Bundle savedInstanceState) {
19 | // Inflate the layout for this fragment
20 | return inflater.inflate(R.layout.search_layout, container, false);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
8 |
11 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/search_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
14 |
15 |
16 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_indicator.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_indicator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
8 |
9 |
10 |
12 |
14 |
15 |
16 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
20 |
21 |
22 |
29 |
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Adil Soomro
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_selected.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 | -
19 |
20 |
23 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_press.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
7 |
8 |
9 |
10 |
11 | -
12 |
13 |
14 |
15 |
16 | -
18 |
19 |
24 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_focus.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 | -
21 |
22 |
27 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/java/app/tabsample/legacy/TabSample.java:
--------------------------------------------------------------------------------
1 | package app.tabsample.legacy;
2 |
3 | import android.app.TabActivity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.widget.ImageView;
9 | import android.widget.TabHost;
10 | import android.widget.TextView;
11 |
12 | import app.tabsample.R;
13 |
14 |
15 | /**
16 | * @author Adil Soomro
17 | *
18 | */
19 | public class TabSample extends TabActivity {
20 | /** Called when the activity is first created. */
21 |
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.tab_activity);
25 | setTabs() ;
26 | }
27 | private void setTabs()
28 | {
29 | addTab("Home", R.drawable.tab_home_legacy, ArrowsActivity.class);
30 | addTab("Search", R.drawable.tab_search_legacy, OptionsActivity.class);
31 |
32 | addTab("Home", R.drawable.tab_home_legacy, ArrowsActivity.class);
33 | addTab("Search", R.drawable.tab_search_legacy, OptionsActivity.class);
34 | }
35 |
36 | private void addTab(String labelId, int drawableId, Class> c)
37 | {
38 | TabHost tabHost = getTabHost();
39 | Intent intent = new Intent(this, c);
40 | TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);
41 |
42 | View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
43 | TextView title = (TextView) tabIndicator.findViewById(R.id.title);
44 | title.setText(labelId);
45 | ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
46 | icon.setImageResource(drawableId);
47 |
48 | spec.setIndicator(tabIndicator);
49 | spec.setContent(intent);
50 | tabHost.addTab(spec);
51 | }
52 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Android tabs at bottom!
2 | ===================
3 |
4 |
5 | This repository contains sample of setting android `TabLayout` at bottom and showing `Fragment` embedded in `ViewPager`. The magic happens very simply. You need to arrange them properly to stick tabs at bottom.
6 |
7 |
12 |
18 |
25 |
26 |
27 | Screenshot
28 | ----------
29 |
30 |
31 | 
32 |
33 |
34 |
35 | Licence
36 | ----------
37 | The MIT License (MIT)
38 |
39 | Copyright (c) 2014 Adil Soomro
40 |
41 | Permission is hereby granted, free of charge, to any person obtaining a copy
42 | of this software and associated documentation files (the "Software"), to deal
43 | in the Software without restriction, including without limitation the rights
44 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45 | copies of the Software, and to permit persons to whom the Software is
46 | furnished to do so, subject to the following conditions:
47 |
48 | The above copyright notice and this permission notice shall be included in all
49 | copies or substantial portions of the Software.
50 |
51 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57 | SOFTWARE.
58 |
59 | Happy Coding!
60 | ----------
61 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/app/tabsample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package app.tabsample;
2 |
3 |
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.design.widget.TabLayout;
7 | import android.support.v4.app.Fragment;
8 | import android.support.v4.app.FragmentManager;
9 | import android.support.v4.app.FragmentPagerAdapter;
10 | import android.support.v4.view.ViewPager;
11 | import android.support.v7.app.AppCompatActivity;
12 | import android.view.Menu;
13 | import android.view.MenuInflater;
14 | import android.view.MenuItem;
15 |
16 | import java.util.ArrayList;
17 | import java.util.List;
18 |
19 | import app.tabsample.fragments.HomeFragment;
20 | import app.tabsample.fragments.SearchFragment;
21 | import app.tabsample.legacy.TabSample;
22 |
23 |
24 | /**
25 | * @author Adil Soomro
26 | *
27 | */
28 | public class MainActivity extends AppCompatActivity {
29 | /** Called when the activity is first created. */
30 |
31 | public void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_main);
34 | int[] icons = {R.drawable.tab_home,
35 | R.drawable.tab_search,
36 | R.drawable.tab_home,
37 | R.drawable.tab_search
38 | };
39 | TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
40 | ViewPager viewPager = (ViewPager) findViewById(R.id.main_tab_content);
41 |
42 | setupViewPager(viewPager);
43 |
44 |
45 | tabLayout.setupWithViewPager(viewPager);
46 |
47 | for (int i = 0; i < icons.length; i++) {
48 | tabLayout.getTabAt(i).setIcon(icons[i]);
49 | }
50 | tabLayout.getTabAt(0).select();
51 | }
52 |
53 | private void setupViewPager(ViewPager viewPager) {
54 | ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
55 | adapter.insertNewFragment(new HomeFragment());
56 | adapter.insertNewFragment(new SearchFragment());
57 | adapter.insertNewFragment(new HomeFragment());
58 | adapter.insertNewFragment(new SearchFragment());
59 | viewPager.setAdapter(adapter);
60 | }
61 |
62 | class ViewPagerAdapter extends FragmentPagerAdapter {
63 | private final List mFragmentList = new ArrayList<>();
64 | public ViewPagerAdapter(FragmentManager manager) {
65 | super(manager);
66 | }
67 |
68 | @Override
69 | public Fragment getItem(int position) {
70 | return mFragmentList.get(position);
71 | }
72 |
73 | @Override
74 | public int getCount() {
75 | return mFragmentList.size();
76 | }
77 |
78 | public void insertNewFragment(Fragment fragment) {
79 | mFragmentList.add(fragment);
80 | }
81 | }
82 |
83 | @Override
84 | public boolean onCreateOptionsMenu(Menu menu) {
85 | MenuInflater inflater = this.getMenuInflater();
86 | inflater.inflate(R.menu.main_activity, menu);
87 | return true;
88 | }
89 |
90 | @Override
91 | public boolean onOptionsItemSelected(MenuItem item) {
92 | switch (item.getItemId()) {
93 |
94 | case R.id.action_settings:
95 | Intent settingsIntent = new Intent(this, TabSample.class);
96 | startActivity(settingsIntent);
97 | default:
98 | return super.onOptionsItemSelected(item);
99 | }
100 | }
101 |
102 | }
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------