├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── handmall
│ │ └── tabbar
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── handmall
│ │ │ └── tabbar
│ │ │ ├── activity
│ │ │ ├── MainActivity.java
│ │ │ └── PullToRefreshActivity.java
│ │ │ ├── fragment
│ │ │ ├── BaseRefreshFragment.java
│ │ │ ├── CityFragment.java
│ │ │ ├── HomeFragment.java
│ │ │ ├── ListViewFragment.java
│ │ │ ├── MessageFragment.java
│ │ │ ├── PersonFragment.java
│ │ │ └── RecyclerViewFragment.java
│ │ │ ├── util
│ │ │ └── ThemeUtils.java
│ │ │ └── widget
│ │ │ ├── MainNavigateTabBar.java
│ │ │ └── PullToRefresh
│ │ │ ├── PullToRefreshView.java
│ │ │ ├── refresh_view
│ │ │ ├── BaseRefreshView.java
│ │ │ └── SunRefreshView.java
│ │ │ └── util
│ │ │ ├── Logger.java
│ │ │ └── Utils.java
│ └── res
│ │ ├── drawable-hdpi
│ │ ├── buildings.png
│ │ ├── icon_1.png
│ │ ├── icon_2.png
│ │ ├── icon_3.png
│ │ ├── lib_icon.png
│ │ ├── sky.png
│ │ └── sun.png
│ │ ├── drawable-mdpi
│ │ ├── buildings.png
│ │ ├── icon_1.png
│ │ ├── icon_2.png
│ │ ├── icon_3.png
│ │ ├── lib_icon.png
│ │ ├── sky.png
│ │ └── sun.png
│ │ ├── drawable-xhdpi
│ │ ├── buildings.png
│ │ ├── icon_1.png
│ │ ├── icon_2.png
│ │ ├── icon_3.png
│ │ ├── lib_icon.png
│ │ ├── sky.png
│ │ └── sun.png
│ │ ├── drawable-xxhdpi
│ │ ├── buildings.png
│ │ ├── icon_1.png
│ │ ├── icon_2.png
│ │ ├── icon_3.png
│ │ ├── lib_icon.png
│ │ ├── sky.png
│ │ └── sun.png
│ │ ├── drawable-xxxhdpi
│ │ ├── buildings.png
│ │ ├── icon_1.png
│ │ ├── icon_2.png
│ │ ├── icon_3.png
│ │ ├── lib_icon.png
│ │ ├── sky.png
│ │ └── sun.png
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_pull_to_refresh.xml
│ │ ├── comui_tab_view.xml
│ │ ├── fragment_city.xml
│ │ ├── fragment_home.xml
│ │ ├── fragment_list_view.xml
│ │ ├── fragment_message.xml
│ │ ├── fragment_person.xml
│ │ ├── fragment_recycler_view.xml
│ │ └── list_item.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ ├── comui_bar_top_shadow.png
│ │ ├── comui_tab_city.png
│ │ ├── comui_tab_city_selected.png
│ │ ├── comui_tab_find.png
│ │ ├── comui_tab_find_selected.png
│ │ ├── comui_tab_home.png
│ │ ├── comui_tab_home_selected.png
│ │ ├── comui_tab_message.png
│ │ ├── comui_tab_message_selected.png
│ │ ├── comui_tab_person.png
│ │ ├── comui_tab_person_selected.png
│ │ ├── comui_tab_post.png
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ ├── attr.xml
│ │ └── dimens.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── handmall
│ └── tabbar
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshots
└── 1.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # tabbar
2 | 
3 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 | defaultConfig {
7 | applicationId "com.handmall.tabbar"
8 | minSdkVersion 19
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile('com.android.support:design:23.1.1') {
28 | force = true;
29 | }
30 | compile('com.android.support:recyclerview-v7:23.1.1') {
31 | force = true;
32 | }
33 | compile('com.android.support:appcompat-v7:23.1.1') {
34 | force = true;
35 | }
36 | testCompile 'junit:junit:4.12'
37 | }
38 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/java/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/handmall/tabbar/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.handmall.tabbar;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.handmall.tabbar", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/handmall/tabbar/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.handmall.tabbar.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.widget.Toast;
7 |
8 | import com.handmall.tabbar.R;
9 | import com.handmall.tabbar.fragment.CityFragment;
10 | import com.handmall.tabbar.fragment.HomeFragment;
11 | import com.handmall.tabbar.fragment.ListViewFragment;
12 | import com.handmall.tabbar.fragment.MessageFragment;
13 | import com.handmall.tabbar.fragment.PersonFragment;
14 | import com.handmall.tabbar.widget.MainNavigateTabBar;
15 |
16 |
17 | public class MainActivity extends AppCompatActivity {
18 |
19 | private static final String TAG_PAGE_HOME = "首页";
20 | private static final String TAG_PAGE_CITY = "同城";
21 | private static final String TAG_PAGE_PUBLISH = "发布";
22 | private static final String TAG_PAGE_MESSAGE = "消息";
23 | private static final String TAG_PAGE_PERSON = "我的";
24 |
25 |
26 | private MainNavigateTabBar mNavigateTabBar;
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_main);
32 |
33 | mNavigateTabBar = (MainNavigateTabBar) findViewById(R.id.mainTabBar);
34 |
35 | mNavigateTabBar.onRestoreInstanceState(savedInstanceState);
36 |
37 | mNavigateTabBar.addTab(ListViewFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_home, R.mipmap.comui_tab_home_selected, TAG_PAGE_HOME));
38 | mNavigateTabBar.addTab(CityFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_city, R.mipmap.comui_tab_city_selected, TAG_PAGE_CITY));
39 | mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(0, 0, TAG_PAGE_PUBLISH));
40 | mNavigateTabBar.addTab(MessageFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_message, R.mipmap.comui_tab_message_selected, TAG_PAGE_MESSAGE));
41 | mNavigateTabBar.addTab(PersonFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_person, R.mipmap.comui_tab_person_selected, TAG_PAGE_PERSON));
42 | }
43 |
44 |
45 | @Override
46 | protected void onSaveInstanceState(Bundle outState) {
47 | super.onSaveInstanceState(outState);
48 | mNavigateTabBar.onSaveInstanceState(outState);
49 | }
50 |
51 |
52 | public void onClickPublish(View v) {
53 | Toast.makeText(this, "发布", Toast.LENGTH_LONG).show();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/handmall/tabbar/activity/PullToRefreshActivity.java:
--------------------------------------------------------------------------------
1 | package com.handmall.tabbar.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.TabLayout;
5 | import android.app.Fragment;
6 | import android.support.v4.app.FragmentManager;
7 | import android.support.v4.app.FragmentPagerAdapter;
8 | import android.support.v4.view.ViewPager;
9 | import android.support.v7.app.AppCompatActivity;
10 | import android.support.v7.widget.Toolbar;
11 |
12 | import com.handmall.tabbar.R;
13 | import com.handmall.tabbar.fragment.ListViewFragment;
14 | import com.handmall.tabbar.fragment.RecyclerViewFragment;
15 |
16 | /**
17 | * Created by Oleksii Shliama.
18 | */
19 | public class PullToRefreshActivity extends AppCompatActivity {
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_pull_to_refresh);
25 |
26 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
27 | TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
28 | ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
29 |
30 | if (toolbar != null) {
31 | setSupportActionBar(toolbar);
32 | }
33 |
34 | viewPager.setAdapter(new SectionPagerAdapter(getSupportFragmentManager()));
35 | tabLayout.setupWithViewPager(viewPager);
36 | }
37 |
38 | public class SectionPagerAdapter extends FragmentPagerAdapter {
39 |
40 | public SectionPagerAdapter(FragmentManager fm) {
41 | super(fm);
42 | }
43 |
44 | @Override
45 | public android.support.v4.app.Fragment getItem(int position) {
46 | return null;
47 | }
48 |
49 | // @Override
50 | // public Fragment getItem(int position) {
51 | // switch (position) {
52 | // case 0:
53 | // return new ListViewFragment();
54 | // case 1:
55 | // default:
56 | // return new RecyclerViewFragment();
57 | // }
58 | // }
59 |
60 | @Override
61 | public int getCount() {
62 | return 2;
63 | }
64 |
65 | @Override
66 | public CharSequence getPageTitle(int position) {
67 | switch (position) {
68 | case 0:
69 | return "ListView";
70 | case 1:
71 | default:
72 | return "RecyclerView";
73 | }
74 | }
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/handmall/tabbar/fragment/BaseRefreshFragment.java:
--------------------------------------------------------------------------------
1 | package com.handmall.tabbar.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.app.Fragment;
5 |
6 | import com.handmall.tabbar.R;
7 |
8 | import java.util.ArrayList;
9 | import java.util.HashMap;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | /**
14 | * Created by Oleksii Shliama.
15 | */
16 | public class BaseRefreshFragment extends Fragment {
17 |
18 | public static final int REFRESH_DELAY = 2000;
19 |
20 | public static final String KEY_ICON = "icon";
21 | public static final String KEY_COLOR = "color";
22 |
23 | protected List