├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── jiangqq.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── FastDev4Android.iml ├── README.md ├── ViewPagerIndicator ├── .gitignore ├── ViewPagerIndicator.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── chinaztt │ │ └── fda │ │ └── viewpagerindicator │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── chinaztt │ │ └── fda │ │ └── viewpagerindicator │ │ ├── CirclePageIndicator.java │ │ ├── IconPageIndicator.java │ │ ├── IconPagerAdapter.java │ │ ├── IcsLinearLayout.java │ │ ├── LinePageIndicator.java │ │ ├── PageIndicator.java │ │ ├── TabPageIndicator.java │ │ ├── TitlePageIndicator.java │ │ └── UnderlinePageIndicator.java │ └── res │ ├── color │ ├── vpi__dark_theme.xml │ └── vpi__light_theme.xml │ ├── drawable-hdpi │ ├── vpi__tab_selected_focused_holo.9.png │ ├── vpi__tab_selected_holo.9.png │ ├── vpi__tab_selected_pressed_holo.9.png │ ├── vpi__tab_unselected_focused_holo.9.png │ ├── vpi__tab_unselected_holo.9.png │ └── vpi__tab_unselected_pressed_holo.9.png │ ├── drawable-mdpi │ ├── vpi__tab_selected_focused_holo.9.png │ ├── vpi__tab_selected_holo.9.png │ ├── vpi__tab_selected_pressed_holo.9.png │ ├── vpi__tab_unselected_focused_holo.9.png │ ├── vpi__tab_unselected_holo.9.png │ └── vpi__tab_unselected_pressed_holo.9.png │ ├── drawable-xhdpi │ ├── vpi__tab_selected_focused_holo.9.png │ ├── vpi__tab_selected_holo.9.png │ ├── vpi__tab_selected_pressed_holo.9.png │ ├── vpi__tab_unselected_focused_holo.9.png │ ├── vpi__tab_unselected_holo.9.png │ └── vpi__tab_unselected_pressed_holo.9.png │ ├── drawable │ └── vpi__tab_indicator.xml │ └── values │ ├── strings.xml │ ├── vpi__attrs.xml │ ├── vpi__colors.xml │ ├── vpi__defaults.xml │ └── vpi__styles.xml ├── Volley ├── .gitignore ├── Android.mk ├── build.gradle ├── build.xml ├── custom_rules.xml ├── libs │ └── gson-2.2.4.jar ├── pom.xml ├── proguard-project.txt ├── proguard.cfg ├── rules.gradle └── src │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ ├── android │ │ └── volley │ │ │ ├── AuthFailureError.java │ │ │ ├── Cache.java │ │ │ ├── CacheDispatcher.java │ │ │ ├── DefaultRetryPolicy.java │ │ │ ├── ExecutorDelivery.java │ │ │ ├── Network.java │ │ │ ├── NetworkDispatcher.java │ │ │ ├── NetworkError.java │ │ │ ├── NetworkResponse.java │ │ │ ├── NoConnectionError.java │ │ │ ├── ParseError.java │ │ │ ├── Request.java │ │ │ ├── RequestQueue.java │ │ │ ├── Response.java │ │ │ ├── ResponseDelivery.java │ │ │ ├── RetryPolicy.java │ │ │ ├── ServerError.java │ │ │ ├── TimeoutError.java │ │ │ ├── VolleyError.java │ │ │ ├── VolleyLog.java │ │ │ └── toolbox │ │ │ ├── AndroidAuthenticator.java │ │ │ ├── Authenticator.java │ │ │ ├── BasicNetwork.java │ │ │ ├── ByteArrayPool.java │ │ │ ├── ClearCacheRequest.java │ │ │ ├── DiskBasedCache.java │ │ │ ├── GsonRequest.java │ │ │ ├── HttpClientStack.java │ │ │ ├── HttpHeaderParser.java │ │ │ ├── HttpStack.java │ │ │ ├── HurlStack.java │ │ │ ├── ImageLoader.java │ │ │ ├── ImageRequest.java │ │ │ ├── JsonArrayRequest.java │ │ │ ├── JsonObjectRequest.java │ │ │ ├── JsonRequest.java │ │ │ ├── NetworkImageView.java │ │ │ ├── NoCache.java │ │ │ ├── PoolingByteArrayOutputStream.java │ │ │ ├── RequestFuture.java │ │ │ ├── StringRequest.java │ │ │ └── Volley.java │ │ └── chinaztt │ │ └── fdv │ │ ├── Fdv_BaseRequest.java │ │ ├── Fdv_CallBackListener.java │ │ ├── Fdv_ImageCache.java │ │ ├── Fdv_JsonArrayRequest.java │ │ ├── Fdv_JsonObjectRequest.java │ │ ├── Fdv_Log.java │ │ ├── Fdv_StringRequest.java │ │ └── Fdv_Volley.java │ └── test │ ├── java │ └── com │ │ └── android │ │ └── volley │ │ ├── CacheDispatcherTest.java │ │ ├── NetworkDispatcherTest.java │ │ ├── RequestQueueIntegrationTest.java │ │ ├── RequestQueueTest.java │ │ ├── RequestTest.java │ │ ├── ResponseDeliveryTest.java │ │ ├── mock │ │ ├── MockCache.java │ │ ├── MockHttpClient.java │ │ ├── MockHttpStack.java │ │ ├── MockHttpURLConnection.java │ │ ├── MockNetwork.java │ │ ├── MockRequest.java │ │ ├── MockResponseDelivery.java │ │ ├── ShadowSystemClock.java │ │ ├── TestRequest.java │ │ └── WaitableQueue.java │ │ ├── toolbox │ │ ├── AndroidAuthenticatorTest.java │ │ ├── BasicNetworkTest.java │ │ ├── ByteArrayPoolTest.java │ │ ├── CacheTest.java │ │ ├── DiskBasedCacheTest.java │ │ ├── HttpClientStackTest.java │ │ ├── HttpHeaderParserTest.java │ │ ├── HurlStackTest.java │ │ ├── ImageLoaderTest.java │ │ ├── ImageRequestTest.java │ │ ├── JsonRequestCharsetTest.java │ │ ├── JsonRequestTest.java │ │ ├── NetworkImageViewTest.java │ │ ├── PoolingByteArrayOutputStreamTest.java │ │ ├── RequestFutureTest.java │ │ ├── RequestQueueTest.java │ │ ├── RequestTest.java │ │ ├── ResponseTest.java │ │ └── StringRequestTest.java │ │ └── utils │ │ ├── CacheTestUtils.java │ │ └── ImmediateResponseDelivery.java │ └── resources │ └── org.robolectric.Config.properties ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── libs │ ├── gson-2.2.4.jar │ └── org.apache.http.legacy.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── chinaztt │ │ └── fda │ │ └── ui │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ ├── com │ │ └── chinaztt │ │ │ └── fda │ │ │ ├── adapter │ │ │ ├── CNKFixedPagerAdapter.java │ │ │ ├── GalleryRecyclerAdapter.java │ │ │ ├── RefreshFootAdapter.java │ │ │ ├── RefreshRecyclerAdapter.java │ │ │ ├── TestRecyclerAdapter.java │ │ │ └── base │ │ │ │ ├── BaseAdapterHelper.java │ │ │ │ ├── BaseQuickAdapter.java │ │ │ │ ├── EnhancedQuickAdapter.java │ │ │ │ ├── FixedPagerAdapter.java │ │ │ │ └── QuickAdapter.java │ │ │ ├── application │ │ │ └── FDApplication.java │ │ │ ├── biz │ │ │ ├── IPersonBiz.java │ │ │ ├── LoginRequestCallBack.java │ │ │ └── imp │ │ │ │ └── PersonBizImp.java │ │ │ ├── cache │ │ │ ├── ACache.java │ │ │ └── CacheConsts.java │ │ │ ├── crash │ │ │ └── CustomCrash.java │ │ │ ├── entity │ │ │ ├── CardDataUtils.java │ │ │ ├── CardViewBean.java │ │ │ ├── GalleryModel.java │ │ │ ├── ModuleBean.java │ │ │ ├── PersonBean.java │ │ │ └── UpdateBean.java │ │ │ ├── event │ │ │ ├── TestEventFirst.java │ │ │ ├── TestEventSecond.java │ │ │ └── TestEventThird.java │ │ │ ├── fragment │ │ │ ├── FourFragment.java │ │ │ ├── InfoFragment.java │ │ │ ├── MainInfoFragment.java │ │ │ ├── OneFragment.java │ │ │ ├── TabInfoFragment.java │ │ │ ├── ThreeFragment.java │ │ │ └── TwoFragment.java │ │ │ ├── html5 │ │ │ ├── HTML5CustomWebView.java │ │ │ └── HTML5WebViewCustomAD.java │ │ │ ├── listlogic │ │ │ └── RequestCallBack.java │ │ │ ├── presenter │ │ │ └── LoginPresenter.java │ │ │ ├── spreference │ │ │ ├── SharedPreferencesHelper.java │ │ │ └── SharedPreferencesTag.java │ │ │ ├── test │ │ │ ├── AVLoadingIndicatorActivity.java │ │ │ ├── AnnotationsTestActivity.java │ │ │ ├── BaseAdapterTestActivity.java │ │ │ ├── CardView │ │ │ │ ├── CardViewActivity.java │ │ │ │ ├── CardViewAdapter.java │ │ │ │ └── CardViewRecyclerActivity.java │ │ │ ├── ComInstance │ │ │ │ ├── AdvanceComInstanceActivity.java │ │ │ │ ├── AdvanceComInstanceAdapter.java │ │ │ │ ├── AdvanceInstanceBean.java │ │ │ │ ├── AdvanceIntanceDataUtils.java │ │ │ │ ├── ComInstanceActivity.java │ │ │ │ ├── ComInstanceAdapter.java │ │ │ │ ├── InstanceBean.java │ │ │ │ └── InstanceDataUtils.java │ │ │ ├── CrashTestActivity.java │ │ │ ├── DataUtils.java │ │ │ ├── EventBusTestActivity.java │ │ │ ├── EventBusTestTwoActivity.java │ │ │ ├── GalleryIndicatorActivity.java │ │ │ ├── MVPTestActivity.java │ │ │ ├── MainFrameActivity.java │ │ │ ├── MainInfoActivity.java │ │ │ ├── PullListviewActivity.java │ │ │ ├── RecyclerDemoActivity.java │ │ │ ├── RecyclerGalleryActivity.java │ │ │ ├── RecyclerViewAA │ │ │ │ ├── AAUserAdapter.java │ │ │ │ ├── AAUserFinder.java │ │ │ │ ├── AAUserItemView.java │ │ │ │ ├── ImMemoryUserFinder.java │ │ │ │ ├── RecyclerViewAdapterBase.java │ │ │ │ ├── TestUserBean.java │ │ │ │ └── ViewWrapper.java │ │ │ ├── RecyclerViewAAActivity.java │ │ │ ├── RecyclerViewRefresh │ │ │ │ ├── RecyclerFootActivity.java │ │ │ │ └── RecyclerRefreshActivity.java │ │ │ ├── RecyclerViewTestActivity.java │ │ │ ├── SPCacheActivity.java │ │ │ ├── TabLayoutActivity.java │ │ │ ├── TextDrawablesTestActivity.java │ │ │ ├── TranslucentActivity.java │ │ │ ├── ViewDragHelper │ │ │ │ ├── ViewGragHelperActivity.java │ │ │ │ └── ViewGragOne.java │ │ │ ├── VolleyLoaderActivity.java │ │ │ ├── VolleyTestActivity.java │ │ │ └── okhttp │ │ │ │ └── OkhttpDemoActivity.java │ │ │ ├── ui │ │ │ ├── MainActvity.java │ │ │ ├── base │ │ │ │ ├── BaseActivity.java │ │ │ │ └── BaseFrameActvity.java │ │ │ └── view │ │ │ │ └── ILoginView.java │ │ │ ├── utils │ │ │ ├── DateUtils.java │ │ │ ├── GuideUtils.java │ │ │ ├── IoUtils.java │ │ │ ├── JudgeNetWorker.java │ │ │ ├── Log.java │ │ │ ├── ManagerActivity.java │ │ │ ├── StrUtils.java │ │ │ └── UIUtils.java │ │ │ └── widget │ │ │ ├── AdvanceDecoration.java │ │ │ ├── AutoGallery.java │ │ │ ├── CustomLinearLayoutManager.java │ │ │ ├── CustomSwipeRefreshLayout.java │ │ │ ├── FlowIndicator.java │ │ │ ├── PullToRefreshListView.java │ │ │ └── TestDecoration.java │ └── uk │ │ └── co │ │ └── senab │ │ └── photoview │ │ ├── Compat.java │ │ ├── IPhotoView.java │ │ ├── PhotoView.java │ │ ├── PhotoViewAttacher.java │ │ ├── SDK16.java │ │ ├── ScrollerProxy.java │ │ └── VersionedGestureDetector.java │ └── res │ ├── anim │ ├── move_pop_in.xml │ └── move_pop_out.xml │ ├── drawable-hdpi │ ├── baby.jpg │ ├── bottom_line_blue.9.png │ ├── bottom_line_gray.9.png │ ├── four.jpg │ ├── header_back.png │ ├── hui.png │ ├── ic_item_gallery.png │ ├── ic_loading.png │ ├── ic_loading_s.png │ ├── ic_poi_meal.png │ ├── ic_refresh_down.png │ ├── ic_right_arrow_meal.png │ ├── lan.png │ ├── line_read_option.png │ ├── liuyan.jpg │ ├── meinv.jpg │ ├── moren.png │ ├── one.jpg │ ├── three.jpg │ └── two.jpg │ ├── drawable │ ├── ic_loading_refresh.xml │ └── loading_small.xml │ ├── layout │ ├── activity_demo.xml │ ├── activity_main.xml │ ├── advance_com_instance_item_layout.xml │ ├── av_loading_indicator_layout.xml │ ├── base_adapter_test_layout.xml │ ├── card_view_layout.xml │ ├── card_view_recycler_layout.xml │ ├── com_instance_item_layout.xml │ ├── com_instance_layout.xml │ ├── common_custom_screen.xml │ ├── common_top_bar_layout.xml │ ├── crash_test_layout.xml │ ├── dragger_inject_layout.xml │ ├── event_bus_test_layout.xml │ ├── event_bus_test_two_layout.xml │ ├── four_frag_layout.xml │ ├── gallery_indicator_layout.xml │ ├── headline_gallery_item.xml │ ├── heart_rate_layout.xml │ ├── horizontal_item_layout.xml │ ├── info_fragment_layout.xml │ ├── instance_load_more_layout.xml │ ├── item_cardview_layout.xml │ ├── item_gallery_recycler.xml │ ├── item_recycler_layout.xml │ ├── item_user_item.xml │ ├── load_more_footview_layout.xml │ ├── lv_item_base_layout.xml │ ├── lv_main_item.xml │ ├── main_frame_layout.xml │ ├── main_info_fragment_layout.xml │ ├── main_info_layout.xml │ ├── mvp_test_layout.xml │ ├── ok_http_demo_layout.xml │ ├── one_frag_layout.xml │ ├── pull_listview_layout.xml │ ├── pull_to_refresh_header.xml │ ├── recycler_aa_layout.xml │ ├── recycler_custom_layout.xml │ ├── recycler_demo_layout.xml │ ├── recycler_footview_layout.xml │ ├── recycler_gallery_layout.xml │ ├── recycler_load_more_layout.xml │ ├── recycler_refresh_layout.xml │ ├── recyclerview_test_layout.xml │ ├── sp_cache_layout.xml │ ├── swipe_back_layout.xml │ ├── tab_info_fragment_layout.xml │ ├── tab_item_layout.xml │ ├── tab_layout_activity_layout.xml │ ├── text_drawables_item_layout.xml │ ├── text_drawables_layout.xml │ ├── three_frag_layout.xml │ ├── translucent_layout.xml │ ├── two_frag_layout.xml │ ├── view_grag_helper_layout.xml │ └── volley_test_layout.xml │ ├── menu │ └── main.xml │ ├── mipmap-hdpi │ ├── four.png │ ├── ic_launcher.png │ ├── one.png │ ├── three.png │ └── two.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── arrays.xml │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── demo.gif ├── fdv_okhttp ├── .gitignore ├── build.gradle ├── fdv_okhttp.iml ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── res │ └── values │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshots └── pull_1.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | FastDev4Android -------------------------------------------------------------------------------- /.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/dictionaries/jiangqq.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /FastDev4Android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ViewPagerIndicator/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ViewPagerIndicator/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | compile 'com.android.support:appcompat-v7:23.0.1' 24 | } 25 | -------------------------------------------------------------------------------- /ViewPagerIndicator/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/jiangqq/Documents/android-sdk-macosx/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 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/androidTest/java/com/chinaztt/fda/viewpagerindicator/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.viewpagerindicator; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/java/com/chinaztt/fda/viewpagerindicator/IconPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.viewpagerindicator; 2 | 3 | public interface IconPagerAdapter { 4 | /** 5 | * Get icon representing the page at {@code index} in the adapter. 6 | */ 7 | int getIconResId(int index); 8 | 9 | // From PagerAdapter 10 | int getCount(); 11 | } 12 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/java/com/chinaztt/fda/viewpagerindicator/PageIndicator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Patrik Akerfeldt 3 | * Copyright (C) 2011 Jake Wharton 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.chinaztt.fda.viewpagerindicator; 19 | 20 | import android.support.v4.view.ViewPager; 21 | 22 | /** 23 | * A PageIndicator is responsible to show an visual indicator on the total views 24 | * number and the current visible view. 25 | */ 26 | public interface PageIndicator extends ViewPager.OnPageChangeListener { 27 | /** 28 | * Bind the indicator to a ViewPager. 29 | * 30 | * @param view 31 | */ 32 | void setViewPager(ViewPager view); 33 | 34 | /** 35 | * Bind the indicator to a ViewPager. 36 | * 37 | * @param view 38 | * @param initialPosition 39 | */ 40 | void setViewPager(ViewPager view, int initialPosition); 41 | 42 | /** 43 | *

Set the current page of both the ViewPager and indicator.

44 | * 45 | *

This must be used if you need to set the page before 46 | * the views are drawn on screen (e.g., default start page).

47 | * 48 | * @param item 49 | */ 50 | void setCurrentItem(int item); 51 | 52 | /** 53 | * Set a page change listener which will receive forwarded events. 54 | * 55 | * @param listener 56 | */ 57 | void setOnPageChangeListener(ViewPager.OnPageChangeListener listener); 58 | 59 | /** 60 | * Notify the indicator that the fragment list has changed. 61 | */ 62 | void notifyDataSetChanged(); 63 | } 64 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/color/vpi__dark_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/color/vpi__light_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_selected_focused_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_selected_focused_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_selected_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_selected_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_selected_pressed_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_selected_pressed_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_unselected_focused_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_unselected_focused_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_unselected_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_unselected_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_unselected_pressed_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-hdpi/vpi__tab_unselected_pressed_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_selected_focused_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_selected_focused_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_selected_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_selected_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_selected_pressed_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_selected_pressed_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_unselected_focused_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_unselected_focused_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_unselected_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_unselected_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_unselected_pressed_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-mdpi/vpi__tab_unselected_pressed_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_selected_focused_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_selected_focused_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_selected_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_selected_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_selected_pressed_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_selected_pressed_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_unselected_focused_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_unselected_focused_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_unselected_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_unselected_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_unselected_pressed_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/ViewPagerIndicator/src/main/res/drawable-xhdpi/vpi__tab_unselected_pressed_holo.9.png -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ViewPagerIndicator 3 | 4 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/values/vpi__colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | #ff000000 19 | #fff3f3f3 20 | @color/vpi__background_holo_light 21 | @color/vpi__background_holo_dark 22 | #ff4c4c4c 23 | #ffb2b2b2 24 | @color/vpi__bright_foreground_holo_light 25 | @color/vpi__bright_foreground_holo_dark 26 | 27 | -------------------------------------------------------------------------------- /ViewPagerIndicator/src/main/res/values/vpi__styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 22 | 23 | 25 | 26 | 37 | 38 | 42 | 43 | 47 | 48 | -------------------------------------------------------------------------------- /Volley/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | gen 3 | .gradle 4 | build 5 | .settings 6 | target 7 | *.iml 8 | .idea 9 | local.properties 10 | -------------------------------------------------------------------------------- /Volley/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2011 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(call my-dir) 18 | 19 | include $(CLEAR_VARS) 20 | 21 | LOCAL_MODULE := volley 22 | LOCAL_SDK_VERSION := 17 23 | LOCAL_SRC_FILES := $(call all-java-files-under, src/main/java) 24 | 25 | include $(BUILD_STATIC_JAVA_LIBRARY) 26 | 27 | # Include this library in the build server's output directory 28 | # TODO: Not yet. 29 | #$(call dist-for-goals, dist_files, $(LOCAL_BUILT_MODULE):volley.jar) 30 | 31 | # Include build files in subdirectories 32 | include $(call all-makefiles-under,$(LOCAL_PATH)) 33 | 34 | -------------------------------------------------------------------------------- /Volley/build.gradle: -------------------------------------------------------------------------------- 1 | // NOTE: The only changes that belong in this file are the definitions 2 | // of tool versions (gradle plugin, compile SDK, build tools), so that 3 | // Volley can be built via gradle as a standalone project. 4 | // 5 | // Any other changes to the build config belong in rules.gradle, which 6 | // is used by projects that depend on Volley but define their own 7 | // tools versions across all dependencies to ensure a consistent build. 8 | // 9 | // Most users should just add this line to settings.gradle: 10 | // include(":volley") 11 | // 12 | // If you have a more complicated Gradle setup you can choose to use 13 | // this instead: 14 | // include(":volley") 15 | // project(':volley').buildFileName = 'rules.gradle' 16 | buildscript { 17 | repositories { 18 | jcenter() 19 | } 20 | dependencies { 21 | classpath 'com.android.tools.build:gradle:1.3.1' 22 | } 23 | } 24 | apply plugin: 'com.android.library' 25 | repositories { 26 | jcenter() 27 | } 28 | android { 29 | compileSdkVersion 22 30 | buildToolsVersion = '22.0.1' 31 | } 32 | apply from: 'rules.gradle' 33 | 34 | dependencies { 35 | compile files('libs/gson-2.2.4.jar') 36 | } -------------------------------------------------------------------------------- /Volley/custom_rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Volley/libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/Volley/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /Volley/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /Volley/proguard.cfg: -------------------------------------------------------------------------------- 1 | -optimizationpasses 5 2 | -dontusemixedcaseclassnames 3 | -dontskipnonpubliclibraryclasses 4 | -dontpreverify 5 | -verbose 6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* 7 | 8 | -keep public class * extends android.app.Activity 9 | -keep public class * extends android.app.Application 10 | -keep public class * extends android.app.Service 11 | -keep public class * extends android.content.BroadcastReceiver 12 | -keep public class * extends android.content.ContentProvider 13 | -keep public class * extends android.app.backup.BackupAgentHelper 14 | -keep public class * extends android.preference.Preference 15 | -keep public class com.android.vending.licensing.ILicensingService 16 | 17 | -keepclasseswithmembernames class * { 18 | native ; 19 | } 20 | 21 | -keepclasseswithmembers class * { 22 | public (android.content.Context, android.util.AttributeSet); 23 | } 24 | 25 | -keepclasseswithmembers class * { 26 | public (android.content.Context, android.util.AttributeSet, int); 27 | } 28 | 29 | -keepclassmembers class * extends android.app.Activity { 30 | public void *(android.view.View); 31 | } 32 | 33 | -keepclassmembers enum * { 34 | public static **[] values(); 35 | public static ** valueOf(java.lang.String); 36 | } 37 | 38 | -keep class * implements android.os.Parcelable { 39 | public static final android.os.Parcelable$Creator *; 40 | } 41 | -------------------------------------------------------------------------------- /Volley/rules.gradle: -------------------------------------------------------------------------------- 1 | // See build.gradle for an explanation of what this file is. 2 | 3 | apply plugin: 'com.android.library' 4 | 5 | // Check if the android plugin version supports unit testing. 6 | if (configurations.findByName("testCompile")) { 7 | dependencies { 8 | testCompile "junit:junit:4.10" 9 | testCompile "org.mockito:mockito-core:1.9.5" 10 | testCompile "org.robolectric:robolectric:3.0" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Volley/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/AuthFailureError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | import android.content.Intent; 20 | 21 | /** 22 | * Error indicating that there was an authentication failure when performing a Request. 23 | */ 24 | @SuppressWarnings("serial") 25 | public class AuthFailureError extends VolleyError { 26 | /** An intent that can be used to resolve this exception. (Brings up the password dialog.) */ 27 | private Intent mResolutionIntent; 28 | 29 | public AuthFailureError() { } 30 | 31 | public AuthFailureError(Intent intent) { 32 | mResolutionIntent = intent; 33 | } 34 | 35 | public AuthFailureError(NetworkResponse response) { 36 | super(response); 37 | } 38 | 39 | public AuthFailureError(String message) { 40 | super(message); 41 | } 42 | 43 | public AuthFailureError(String message, Exception reason) { 44 | super(message, reason); 45 | } 46 | 47 | public Intent getResolutionIntent() { 48 | return mResolutionIntent; 49 | } 50 | 51 | @Override 52 | public String getMessage() { 53 | if (mResolutionIntent != null) { 54 | return "User needs to (re)enter credentials."; 55 | } 56 | return super.getMessage(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/Network.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * An interface for performing requests. 21 | */ 22 | public interface Network { 23 | /** 24 | * Performs the specified request. 25 | * @param request Request to process 26 | * @return A {@link NetworkResponse} with data and caching metadata; will never be null 27 | * @throws VolleyError on errors 28 | */ 29 | public NetworkResponse performRequest(Request request) throws VolleyError; 30 | } 31 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/NetworkError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * Indicates that there was a network error when performing a Volley request. 21 | */ 22 | @SuppressWarnings("serial") 23 | public class NetworkError extends VolleyError { 24 | public NetworkError() { 25 | super(); 26 | } 27 | 28 | public NetworkError(Throwable cause) { 29 | super(cause); 30 | } 31 | 32 | public NetworkError(NetworkResponse networkResponse) { 33 | super(networkResponse); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/NoConnectionError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * Error indicating that no connection could be established when performing a Volley request. 21 | */ 22 | @SuppressWarnings("serial") 23 | public class NoConnectionError extends NetworkError { 24 | public NoConnectionError() { 25 | super(); 26 | } 27 | 28 | public NoConnectionError(Throwable reason) { 29 | super(reason); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/ParseError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * Indicates that the server's response could not be parsed. 21 | */ 22 | @SuppressWarnings("serial") 23 | public class ParseError extends VolleyError { 24 | public ParseError() { } 25 | 26 | public ParseError(NetworkResponse networkResponse) { 27 | super(networkResponse); 28 | } 29 | 30 | public ParseError(Throwable cause) { 31 | super(cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/ResponseDelivery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | public interface ResponseDelivery { 20 | /** 21 | * Parses a response from the network or cache and delivers it. 22 | */ 23 | public void postResponse(Request request, Response response); 24 | 25 | /** 26 | * Parses a response from the network or cache and delivers it. The provided 27 | * Runnable will be executed after delivery. 28 | */ 29 | public void postResponse(Request request, Response response, Runnable runnable); 30 | 31 | /** 32 | * Posts an error for the given request. 33 | */ 34 | public void postError(Request request, VolleyError error); 35 | } 36 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/RetryPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * Retry policy for a request. 21 | */ 22 | public interface RetryPolicy { 23 | 24 | /** 25 | * Returns the current timeout (used for logging). 26 | */ 27 | public int getCurrentTimeout(); 28 | 29 | /** 30 | * Returns the current retry count (used for logging). 31 | */ 32 | public int getCurrentRetryCount(); 33 | 34 | /** 35 | * Prepares for the next retry by applying a backoff to the timeout. 36 | * @param error The error code of the last attempt. 37 | * @throws VolleyError In the event that the retry could not be performed (for example if we 38 | * ran out of attempts), the passed in error is thrown. 39 | */ 40 | public void retry(VolleyError error) throws VolleyError; 41 | } 42 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/ServerError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * Indicates that the server responded with an error response. 21 | */ 22 | @SuppressWarnings("serial") 23 | public class ServerError extends VolleyError { 24 | public ServerError(NetworkResponse networkResponse) { 25 | super(networkResponse); 26 | } 27 | 28 | public ServerError() { 29 | super(); 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/TimeoutError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * Indicates that the connection or the socket timed out. 21 | */ 22 | @SuppressWarnings("serial") 23 | public class TimeoutError extends VolleyError { } 24 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/VolleyError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley; 18 | 19 | /** 20 | * Exception style class encapsulating Volley errors 21 | */ 22 | @SuppressWarnings("serial") 23 | public class VolleyError extends Exception { 24 | public final NetworkResponse networkResponse; 25 | private long networkTimeMs; 26 | 27 | public VolleyError() { 28 | networkResponse = null; 29 | } 30 | 31 | public VolleyError(NetworkResponse response) { 32 | networkResponse = response; 33 | } 34 | 35 | public VolleyError(String exceptionMessage) { 36 | super(exceptionMessage); 37 | networkResponse = null; 38 | } 39 | 40 | public VolleyError(String exceptionMessage, Throwable reason) { 41 | super(exceptionMessage, reason); 42 | networkResponse = null; 43 | } 44 | 45 | public VolleyError(Throwable cause) { 46 | super(cause); 47 | networkResponse = null; 48 | } 49 | 50 | /* package */ void setNetworkTimeMs(long networkTimeMs) { 51 | this.networkTimeMs = networkTimeMs; 52 | } 53 | 54 | public long getNetworkTimeMs() { 55 | return networkTimeMs; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/toolbox/Authenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.AuthFailureError; 20 | 21 | /** 22 | * An interface for interacting with auth tokens. 23 | */ 24 | public interface Authenticator { 25 | /** 26 | * Synchronously retrieves an auth token. 27 | * 28 | * @throws AuthFailureError If authentication did not succeed 29 | */ 30 | public String getAuthToken() throws AuthFailureError; 31 | 32 | /** 33 | * Invalidates the provided auth token. 34 | */ 35 | public void invalidateAuthToken(String authToken); 36 | } 37 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/toolbox/HttpStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.AuthFailureError; 20 | import com.android.volley.Request; 21 | 22 | import org.apache.http.HttpResponse; 23 | 24 | import java.io.IOException; 25 | import java.util.Map; 26 | 27 | /** 28 | * An HTTP stack abstraction. 29 | */ 30 | public interface HttpStack { 31 | /** 32 | * Performs an HTTP request with the given parameters. 33 | * 34 | *

A GET request is sent if request.getPostBody() == null. A POST request is sent otherwise, 35 | * and the Content-Type header is set to request.getPostBodyContentType().

36 | * 37 | * @param request the request to perform 38 | * @param additionalHeaders additional headers to be sent together with 39 | * {@link Request#getHeaders()} 40 | * @return the HTTP response 41 | */ 42 | public HttpResponse performRequest(Request request, Map additionalHeaders) 43 | throws IOException, AuthFailureError; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/android/volley/toolbox/NoCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.Cache; 20 | 21 | /** 22 | * A cache that doesn't. 23 | */ 24 | public class NoCache implements Cache { 25 | @Override 26 | public void clear() { 27 | } 28 | 29 | @Override 30 | public Entry get(String key) { 31 | return null; 32 | } 33 | 34 | @Override 35 | public void put(String key, Entry entry) { 36 | } 37 | 38 | @Override 39 | public void invalidate(String key, boolean fullExpire) { 40 | } 41 | 42 | @Override 43 | public void remove(String key) { 44 | } 45 | 46 | @Override 47 | public void initialize() { 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/chinaztt/fdv/Fdv_CallBackListener.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fdv; 2 | 3 | import com.android.volley.VolleyError; 4 | 5 | /** 6 | * 当前类注释: 7 | * 项目名:FastDev4Android 8 | * 包名:com.chinaztt.fdv 9 | * 作者:江清清 on 15/11/11 23:18 10 | * 邮箱:jiangqqlmj@163.com 11 | * QQ: 781931404 12 | * 公司:江苏中天科技软件技术有限公司 13 | */ 14 | public interface Fdv_CallBackListener { 15 | void onSuccessResponse(T response); 16 | void onErrorResponse(VolleyError error); 17 | } 18 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/chinaztt/fdv/Fdv_ImageCache.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fdv; 2 | import android.graphics.Bitmap; 3 | import android.util.LruCache; 4 | import com.android.volley.toolbox.ImageLoader; 5 | /** 6 | * 当前类注释:图片缓存器,实现ImageLoder.ImageCache实现其中的方法,具体图片怎么样缓存让我们自己来实现 7 | * 这样可以考虑到将来的扩展性 8 | * 项目名:FastDev4Android 9 | * 包名:com.chinaztt.fdv 10 | * 作者:江清清 on 15/11/12 12:31 11 | * 邮箱:jiangqqlmj@163.com 12 | * QQ: 781931404 13 | * 公司:江苏中天科技软件技术有限公司 14 | */ 15 | public class Fdv_ImageCache implements ImageLoader.ImageCache { 16 | private LruCache mCache=null; 17 | private static final int CACHE_MAX_SIZE = 8 * 1024 * 1024; //默认缓存大小为8M 18 | public Fdv_ImageCache(){ 19 | if(mCache==null){ 20 | mCache = new LruCache(CACHE_MAX_SIZE) { 21 | @Override 22 | protected int sizeOf(String key, Bitmap bitmap) { 23 | return bitmap.getRowBytes() * bitmap.getHeight(); 24 | } 25 | }; 26 | } 27 | } 28 | /** 29 | * 从缓存中获取图片 30 | * @param url 获取图片key 当然该key可以根据实际情况 使用url进行变换修改 31 | * @return 32 | */ 33 | @Override 34 | public Bitmap getBitmap(String url) { 35 | return mCache.get(url); 36 | } 37 | /** 38 | * 向缓存中添加图片 39 | * @param url 缓存图片key,当然该key可以根据实际情况 使用url进行变换修改 不过规格需要和上面方法的key保持一致 40 | * @param bitmap 需要缓存的图片 41 | */ 42 | @Override 43 | public void putBitmap(String url, Bitmap bitmap) { 44 | mCache.put(url,bitmap); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Volley/src/main/java/com/chinaztt/fdv/Fdv_Volley.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fdv; 2 | 3 | import android.content.Context; 4 | 5 | import com.android.volley.RequestQueue; 6 | import com.android.volley.toolbox.Volley; 7 | 8 | /** 9 | * 当前类注释:全局Fdv_Volley封装类管理类 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fdv 12 | * 作者:江清清 on 15/11/11 23:02 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | public class Fdv_Volley { 18 | private static RequestQueue instance; 19 | public static RequestQueue getInstace(Context pContext){ 20 | if(instance==null){ 21 | instance= Volley.newRequestQueue(pContext); 22 | } 23 | return instance; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/mock/MockCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.mock; 18 | 19 | import com.android.volley.Cache; 20 | 21 | public class MockCache implements Cache { 22 | 23 | public boolean clearCalled = false; 24 | @Override 25 | public void clear() { 26 | clearCalled = true; 27 | } 28 | 29 | public boolean getCalled = false; 30 | private Entry mFakeEntry = null; 31 | 32 | public void setEntryToReturn(Entry entry) { 33 | mFakeEntry = entry; 34 | } 35 | 36 | @Override 37 | public Entry get(String key) { 38 | getCalled = true; 39 | return mFakeEntry; 40 | } 41 | 42 | public boolean putCalled = false; 43 | public String keyPut = null; 44 | public Entry entryPut = null; 45 | 46 | @Override 47 | public void put(String key, Entry entry) { 48 | putCalled = true; 49 | keyPut = key; 50 | entryPut = entry; 51 | } 52 | 53 | @Override 54 | public void invalidate(String key, boolean fullExpire) { 55 | } 56 | 57 | @Override 58 | public void remove(String key) { 59 | } 60 | 61 | @Override 62 | public void initialize() { 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/mock/MockHttpURLConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.mock; 18 | 19 | import java.io.ByteArrayOutputStream; 20 | import java.io.IOException; 21 | import java.io.OutputStream; 22 | import java.net.HttpURLConnection; 23 | import java.net.MalformedURLException; 24 | import java.net.URL; 25 | 26 | public class MockHttpURLConnection extends HttpURLConnection { 27 | 28 | private boolean mDoOutput; 29 | private String mRequestMethod; 30 | private OutputStream mOutputStream; 31 | 32 | public MockHttpURLConnection() throws MalformedURLException { 33 | super(new URL("http://foo.com")); 34 | mDoOutput = false; 35 | mRequestMethod = "GET"; 36 | mOutputStream = new ByteArrayOutputStream(); 37 | } 38 | 39 | @Override 40 | public void setDoOutput(boolean flag) { 41 | mDoOutput = flag; 42 | } 43 | 44 | @Override 45 | public boolean getDoOutput() { 46 | return mDoOutput; 47 | } 48 | 49 | @Override 50 | public void setRequestMethod(String method) { 51 | mRequestMethod = method; 52 | } 53 | 54 | @Override 55 | public String getRequestMethod() { 56 | return mRequestMethod; 57 | } 58 | 59 | @Override 60 | public OutputStream getOutputStream() { 61 | return mOutputStream; 62 | } 63 | 64 | @Override 65 | public void disconnect() { 66 | } 67 | 68 | @Override 69 | public boolean usingProxy() { 70 | return false; 71 | } 72 | 73 | @Override 74 | public void connect() throws IOException { 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/mock/MockNetwork.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.mock; 18 | 19 | import com.android.volley.Network; 20 | import com.android.volley.NetworkResponse; 21 | import com.android.volley.Request; 22 | import com.android.volley.ServerError; 23 | import com.android.volley.VolleyError; 24 | 25 | public class MockNetwork implements Network { 26 | public final static int ALWAYS_THROW_EXCEPTIONS = -1; 27 | 28 | private int mNumExceptionsToThrow = 0; 29 | private byte[] mDataToReturn = null; 30 | 31 | /** 32 | * @param numExceptionsToThrow number of times to throw an exception or 33 | * {@link #ALWAYS_THROW_EXCEPTIONS} 34 | */ 35 | public void setNumExceptionsToThrow(int numExceptionsToThrow) { 36 | mNumExceptionsToThrow = numExceptionsToThrow; 37 | } 38 | 39 | public void setDataToReturn(byte[] data) { 40 | mDataToReturn = data; 41 | } 42 | 43 | public Request requestHandled = null; 44 | 45 | @Override 46 | public NetworkResponse performRequest(Request request) throws VolleyError { 47 | if (mNumExceptionsToThrow > 0 || mNumExceptionsToThrow == ALWAYS_THROW_EXCEPTIONS) { 48 | if (mNumExceptionsToThrow != ALWAYS_THROW_EXCEPTIONS) { 49 | mNumExceptionsToThrow--; 50 | } 51 | throw new ServerError(); 52 | } 53 | 54 | requestHandled = request; 55 | return new NetworkResponse(mDataToReturn); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/mock/MockResponseDelivery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.mock; 18 | 19 | import com.android.volley.Request; 20 | import com.android.volley.Response; 21 | import com.android.volley.ResponseDelivery; 22 | import com.android.volley.VolleyError; 23 | 24 | public class MockResponseDelivery implements ResponseDelivery { 25 | 26 | public boolean postResponse_called = false; 27 | public boolean postError_called = false; 28 | 29 | public boolean wasEitherResponseCalled() { 30 | return postResponse_called || postError_called; 31 | } 32 | 33 | public Response responsePosted = null; 34 | @Override 35 | public void postResponse(Request request, Response response) { 36 | postResponse_called = true; 37 | responsePosted = response; 38 | } 39 | 40 | @Override 41 | public void postResponse(Request request, Response response, Runnable runnable) { 42 | postResponse_called = true; 43 | responsePosted = response; 44 | runnable.run(); 45 | } 46 | 47 | @Override 48 | public void postError(Request request, VolleyError error) { 49 | postError_called = true; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/mock/ShadowSystemClock.java: -------------------------------------------------------------------------------- 1 | package com.android.volley.mock; 2 | 3 | import android.os.SystemClock; 4 | import org.robolectric.annotation.Implements; 5 | 6 | @Implements(value = SystemClock.class, callThroughByDefault = true) 7 | public class ShadowSystemClock { 8 | public static long elapsedRealtime() { 9 | return 0; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/toolbox/CacheTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.Cache; 20 | import org.junit.Test; 21 | import org.junit.runner.RunWith; 22 | import org.robolectric.RobolectricTestRunner; 23 | 24 | import static org.junit.Assert.assertNotNull; 25 | 26 | @RunWith(RobolectricTestRunner.class) 27 | public class CacheTest { 28 | 29 | @Test 30 | public void publicMethods() throws Exception { 31 | // Catch-all test to find API-breaking changes. 32 | assertNotNull(Cache.class.getMethod("get", String.class)); 33 | assertNotNull(Cache.class.getMethod("put", String.class, Cache.Entry.class)); 34 | assertNotNull(Cache.class.getMethod("initialize")); 35 | assertNotNull(Cache.class.getMethod("invalidate", String.class, boolean.class)); 36 | assertNotNull(Cache.class.getMethod("remove", String.class)); 37 | assertNotNull(Cache.class.getMethod("clear")); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/toolbox/RequestFutureTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.Request; 20 | import org.junit.Test; 21 | import org.junit.runner.RunWith; 22 | import org.robolectric.RobolectricTestRunner; 23 | 24 | import static org.junit.Assert.assertNotNull; 25 | 26 | @RunWith(RobolectricTestRunner.class) 27 | public class RequestFutureTest { 28 | 29 | @Test 30 | public void publicMethods() throws Exception { 31 | // Catch-all test to find API-breaking changes. 32 | assertNotNull(RequestFuture.class.getMethod("newFuture")); 33 | assertNotNull(RequestFuture.class.getMethod("setRequest", Request.class)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/toolbox/RequestQueueTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.*; 20 | import org.junit.Test; 21 | import org.junit.runner.RunWith; 22 | import org.robolectric.RobolectricTestRunner; 23 | 24 | import static org.junit.Assert.assertNotNull; 25 | 26 | @RunWith(RobolectricTestRunner.class) 27 | public class RequestQueueTest { 28 | 29 | @Test 30 | public void publicMethods() throws Exception { 31 | // Catch-all test to find API-breaking changes. 32 | assertNotNull(RequestQueue.class.getConstructor(Cache.class, Network.class, int.class, 33 | ResponseDelivery.class)); 34 | assertNotNull(RequestQueue.class.getConstructor(Cache.class, Network.class, int.class)); 35 | assertNotNull(RequestQueue.class.getConstructor(Cache.class, Network.class)); 36 | 37 | assertNotNull(RequestQueue.class.getMethod("start")); 38 | assertNotNull(RequestQueue.class.getMethod("stop")); 39 | assertNotNull(RequestQueue.class.getMethod("getSequenceNumber")); 40 | assertNotNull(RequestQueue.class.getMethod("getCache")); 41 | assertNotNull(RequestQueue.class.getMethod("cancelAll", RequestQueue.RequestFilter.class)); 42 | assertNotNull(RequestQueue.class.getMethod("cancelAll", Object.class)); 43 | assertNotNull(RequestQueue.class.getMethod("add", Request.class)); 44 | assertNotNull(RequestQueue.class.getDeclaredMethod("finish", Request.class)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/toolbox/ResponseTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.Cache; 20 | import com.android.volley.NetworkResponse; 21 | import com.android.volley.Response; 22 | import com.android.volley.VolleyError; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.robolectric.RobolectricTestRunner; 26 | 27 | import java.util.Map; 28 | 29 | import static org.junit.Assert.assertNotNull; 30 | 31 | @RunWith(RobolectricTestRunner.class) 32 | public class ResponseTest { 33 | 34 | @Test 35 | public void publicMethods() throws Exception { 36 | // Catch-all test to find API-breaking changes. 37 | assertNotNull(Response.class.getMethod("success", Object.class, Cache.Entry.class)); 38 | assertNotNull(Response.class.getMethod("error", VolleyError.class)); 39 | assertNotNull(Response.class.getMethod("isSuccess")); 40 | 41 | assertNotNull(Response.Listener.class.getDeclaredMethod("onResponse", Object.class)); 42 | 43 | assertNotNull(Response.ErrorListener.class.getDeclaredMethod("onErrorResponse", 44 | VolleyError.class)); 45 | 46 | assertNotNull(NetworkResponse.class.getConstructor(int.class, byte[].class, Map.class, 47 | boolean.class, long.class)); 48 | assertNotNull(NetworkResponse.class.getConstructor(int.class, byte[].class, Map.class, 49 | boolean.class)); 50 | assertNotNull(NetworkResponse.class.getConstructor(byte[].class)); 51 | assertNotNull(NetworkResponse.class.getConstructor(byte[].class, Map.class)); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/toolbox/StringRequestTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.volley.toolbox; 18 | 19 | import com.android.volley.Response; 20 | import org.junit.Test; 21 | import org.junit.runner.RunWith; 22 | import org.robolectric.RobolectricTestRunner; 23 | 24 | import static org.junit.Assert.assertNotNull; 25 | 26 | @RunWith(RobolectricTestRunner.class) 27 | public class StringRequestTest { 28 | 29 | @Test 30 | public void publicMethods() throws Exception { 31 | // Catch-all test to find API-breaking changes. 32 | assertNotNull(StringRequest.class.getConstructor(String.class, Response.Listener.class, 33 | Response.ErrorListener.class)); 34 | assertNotNull(StringRequest.class.getConstructor(int.class, String.class, 35 | Response.Listener.class, Response.ErrorListener.class)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/utils/CacheTestUtils.java: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All Rights Reserved. 2 | 3 | package com.android.volley.utils; 4 | 5 | import com.android.volley.Cache; 6 | 7 | import java.util.Random; 8 | 9 | public class CacheTestUtils { 10 | 11 | /** 12 | * Makes a random cache entry. 13 | * @param data Data to use, or null to use random data 14 | * @param isExpired Whether the TTLs should be set such that this entry is expired 15 | * @param needsRefresh Whether the TTLs should be set such that this entry needs refresh 16 | */ 17 | public static Cache.Entry makeRandomCacheEntry( 18 | byte[] data, boolean isExpired, boolean needsRefresh) { 19 | Random random = new Random(); 20 | Cache.Entry entry = new Cache.Entry(); 21 | if (data != null) { 22 | entry.data = data; 23 | } else { 24 | entry.data = new byte[random.nextInt(1024)]; 25 | } 26 | entry.etag = String.valueOf(random.nextLong()); 27 | entry.lastModified = random.nextLong(); 28 | entry.ttl = isExpired ? 0 : Long.MAX_VALUE; 29 | entry.softTtl = needsRefresh ? 0 : Long.MAX_VALUE; 30 | return entry; 31 | } 32 | 33 | /** 34 | * Like {@link #makeRandomCacheEntry(byte[], boolean, boolean)} but 35 | * defaults to an unexpired entry. 36 | */ 37 | public static Cache.Entry makeRandomCacheEntry(byte[] data) { 38 | return makeRandomCacheEntry(data, false, false); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Volley/src/test/java/com/android/volley/utils/ImmediateResponseDelivery.java: -------------------------------------------------------------------------------- 1 | // Copyright 2011 Google Inc. All rights reserved. 2 | 3 | package com.android.volley.utils; 4 | 5 | import com.android.volley.ExecutorDelivery; 6 | 7 | import java.util.concurrent.Executor; 8 | 9 | /** 10 | * A ResponseDelivery for testing that immediately delivers responses 11 | * instead of posting back to the main thread. 12 | */ 13 | public class ImmediateResponseDelivery extends ExecutorDelivery { 14 | 15 | public ImmediateResponseDelivery() { 16 | super(new Executor() { 17 | @Override 18 | public void execute(Runnable command) { 19 | command.run(); 20 | } 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Volley/src/test/resources/org.robolectric.Config.properties: -------------------------------------------------------------------------------- 1 | manifest=src/main/AndroidManifest.xml 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /app/libs/org.apache.http.legacy.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/libs/org.apache.http.legacy.jar -------------------------------------------------------------------------------- /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/jiangqq/Documents/android-sdk-macosx/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/chinaztt/fda/ui/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.ui; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/adapter/base/FixedPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.adapter.base; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentStatePagerAdapter; 6 | import android.view.ViewGroup; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | /** 12 | * 当前类注释:Fragment自定义适配器 13 | * 项目名:FastDev4Android 14 | * 包名:com.chinaztt.fda.adapter.base 15 | * 作者:江清清 on 15/11/16 13:57 16 | * 邮箱:jiangqqlmj@163.com 17 | * QQ: 781931404 18 | * 公司:江苏中天科技软件技术有限公司 19 | */ 20 | public class FixedPagerAdapter extends FragmentStatePagerAdapter{ 21 | private String[] titles; 22 | private List fragments; 23 | public FixedPagerAdapter(FragmentManager fm) { 24 | super(fm); 25 | titles=new String[]{"第一个","第二个","第三个","第四个"}; 26 | } 27 | 28 | @Override 29 | public Fragment getItem(int position) { 30 | return this.fragments.get(position); 31 | } 32 | @Override 33 | public int getCount() { 34 | return this.fragments.size(); 35 | } 36 | 37 | @Override 38 | public Object instantiateItem(ViewGroup container, int position) { 39 | Fragment fragment=null; 40 | try { 41 | fragment=(Fragment)super.instantiateItem(container,position); 42 | }catch (Exception e){ 43 | 44 | } 45 | return fragment; 46 | } 47 | 48 | @Override 49 | public void destroyItem(ViewGroup container, int position, Object object) { 50 | 51 | } 52 | 53 | @Override 54 | public CharSequence getPageTitle(int position) 55 | { 56 | return titles[position % titles.length]; 57 | } 58 | 59 | public List getFragments() { 60 | return fragments; 61 | } 62 | public void setFragments(List fragments) { 63 | this.fragments = fragments; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/application/FDApplication.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.application; 2 | 3 | import android.app.Application; 4 | 5 | import com.chinaztt.fda.crash.CustomCrash; 6 | 7 | import org.androidannotations.annotations.EApplication; 8 | 9 | import java.util.HashMap; 10 | import java.util.Objects; 11 | 12 | /** 13 | * 当前类注释:自定义全局 application 主要进全局引用,行存储全局变量,全局配置/设置,初始化等相关工作 14 | * 项目名:FastDev4Android 15 | * 包名:com.chinaztt.fda.application 16 | * 作者:江清清 on 15/10/22 08:50 17 | * 邮箱:jiangqqlmj@163.com 18 | * QQ: 781931404 19 | * 公司:江苏中天科技软件技术有限公司 20 | */ 21 | @EApplication 22 | public class FDApplication extends Application{ 23 | private HashMap mTemp=new HashMap(); 24 | private static FDApplication instance; 25 | public static FDApplication getInstance(){ 26 | return instance; 27 | } 28 | @Override 29 | public void onCreate() { 30 | super.onCreate(); 31 | this.instance=this; 32 | //初始化崩溃日志收集器 33 | CustomCrash mCustomCrash=CustomCrash.getInstance(); 34 | //mCustomCrash.setCustomCrashInfo(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/biz/IPersonBiz.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.biz; 2 | 3 | /** 4 | * 当前类注释:用户相关业务操作接口 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.biz 7 | * 作者:江清清 on 15/10/27 16:32 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public interface IPersonBiz { 13 | void login(String username,String password,LoginRequestCallBack valueCallBack); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/biz/LoginRequestCallBack.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.biz; 2 | 3 | import com.chinaztt.fda.entity.PersonBean; 4 | /** 5 | * 当前类注释:登录请求结果回调 6 | * 项目名:FastDev4Android 7 | * 包名:com.chinaztt.fda.biz 8 | * 作者:江清清 on 15/10/27 19:50 9 | * 邮箱:jiangqqlmj@163.com 10 | * QQ: 781931404 11 | * 公司:江苏中天科技软件技术有限公司 12 | */ 13 | public interface LoginRequestCallBack { 14 | //登录成功回调方法 15 | void loginSuccess(PersonBean personBean); 16 | //登录失败回调方法 17 | void loginFailed(); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/biz/imp/PersonBizImp.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.biz.imp; 2 | 3 | import com.chinaztt.fda.biz.IPersonBiz; 4 | import com.chinaztt.fda.biz.LoginRequestCallBack; 5 | import com.chinaztt.fda.entity.PersonBean; 6 | import com.chinaztt.fda.utils.Log; 7 | 8 | /** 9 | * 当前类注释:用户相关业务逻辑实现类 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.biz.imp 12 | * 作者:江清清 on 15/10/27 16:33 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | public class PersonBizImp implements IPersonBiz{ 18 | private static final String TAG="PersonBizImp"; 19 | @Override 20 | public void login(final String username, final String password, final LoginRequestCallBack valueCallBack) { 21 | Log.d(TAG,"username:"+username+",password:"+password); 22 | new Thread(new Runnable() { 23 | @Override 24 | public void run() { 25 | try { 26 | Thread.sleep(4500); 27 | } catch (InterruptedException e) { 28 | e.printStackTrace(); 29 | } 30 | //进行开始登录,这边应该进行请求服务器,进行数据验证 31 | if(username.equals("jiangqq")&&password.equals("12345")){ 32 | valueCallBack.loginSuccess(new PersonBean(username,password)); 33 | }else{ 34 | valueCallBack.loginFailed(); 35 | } 36 | } 37 | }).start(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/cache/CacheConsts.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.cache; 2 | 3 | /** 4 | * 当前类注释:数据Cache配置缓存标志 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.cache 7 | * 作者:江清清 on 15/10/25 17:30 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class CacheConsts{ 13 | //缓存类型数据 key 14 | public static final String DEMO_CACHE_KEY="demo_cache_key"; 15 | //缓存数据的时间 16 | public static final int DEMO_CACHE_TIME=4*ACache.TIME_HOUR; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/entity/CardDataUtils.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.entity; 2 | 3 | import com.chinaztt.fda.ui.R; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * 当前类注释: 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.entity 12 | * 作者:江清清 on 15/11/23 20:12 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | public class CardDataUtils { 18 | public static List getCardViewDatas(){ 19 | List beans=new ArrayList(); 20 | int[] colors=new int[]{R.color.color_0,R.color.color_1, 21 | R.color.color_2,R.color.color_3,R.color.color_4, 22 | R.color.color_5,R.color.color_6,R.color.color_7, 23 | R.color.color_8,R.color.color_9,R.color.color_10,}; 24 | for(int i=0;i<11;i++){ 25 | beans.add(new CardViewBean(colors[i],"CardView测试Item"+i)); 26 | } 27 | return beans; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/entity/CardViewBean.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.entity; 2 | 3 | /** 4 | * 当前类注释:CardView结合RecyclerView实现列表,为Item提供数据的实体bean 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.entity 7 | * 作者:江清清 on 15/11/23 19:46 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class CardViewBean { 13 | private int color; 14 | private String title; 15 | 16 | public CardViewBean() { 17 | } 18 | 19 | public CardViewBean(int color, String title) { 20 | this.color = color; 21 | this.title = title; 22 | } 23 | 24 | public int getColor() { 25 | return color; 26 | } 27 | 28 | public void setColor(int color) { 29 | this.color = color; 30 | } 31 | 32 | public String getTitle() { 33 | return title; 34 | } 35 | 36 | public void setTitle(String title) { 37 | this.title = title; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "CardViewBean{" + 43 | "color=" + color + 44 | ", title='" + title + '\'' + 45 | '}'; 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/entity/GalleryModel.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.entity; 2 | 3 | /** 4 | * 当前类注释:模拟Gallery提供数据的实体类 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.entity 7 | * 作者:江清清 on 15/11/19 20:55 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class GalleryModel { 13 | private int imgurl; 14 | private String title; 15 | 16 | public GalleryModel() { 17 | } 18 | 19 | public GalleryModel(int imgurl, String title) { 20 | this.imgurl = imgurl; 21 | this.title = title; 22 | } 23 | 24 | public int getImgurl() { 25 | return imgurl; 26 | } 27 | 28 | public void setImgurl(int imgurl) { 29 | this.imgurl = imgurl; 30 | } 31 | 32 | public String getTitle() { 33 | return title; 34 | } 35 | 36 | public void setTitle(String title) { 37 | this.title = title; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "GalleryModel{" + 43 | "imgurl=" + imgurl + 44 | ", title='" + title + '\'' + 45 | '}'; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/entity/ModuleBean.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.entity; 2 | 3 | /** 4 | * 当前类注释:列表数据测试数据实体类 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.entity 7 | * 作者:江清清 on 15/11/8 17:56 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class ModuleBean { 13 | private String modulename; 14 | private String imgurl; 15 | private String description; 16 | 17 | public ModuleBean() { 18 | } 19 | 20 | public ModuleBean(String modulename, String imgurl, String description) { 21 | this.modulename = modulename; 22 | this.imgurl = imgurl; 23 | this.description = description; 24 | } 25 | 26 | public String getModulename() { 27 | return modulename; 28 | } 29 | 30 | public void setModulename(String modulename) { 31 | this.modulename = modulename; 32 | } 33 | 34 | public String getImgurl() { 35 | return imgurl; 36 | } 37 | 38 | public void setImgurl(String imgurl) { 39 | this.imgurl = imgurl; 40 | } 41 | 42 | public String getDescription() { 43 | return description; 44 | } 45 | 46 | public void setDescription(String description) { 47 | this.description = description; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "ModuleBean{" + 53 | "modulename='" + modulename + '\'' + 54 | ", imgurl='" + imgurl + '\'' + 55 | ", description='" + description + '\'' + 56 | '}'; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/entity/PersonBean.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.entity; 2 | 3 | /** 4 | * 当前类注释:用户信息实体类 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.entity 7 | * 作者:江清清 on 15/10/27 14:13 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class PersonBean { 13 | private String username; 14 | private String password; 15 | 16 | public PersonBean() { 17 | } 18 | 19 | public PersonBean(String username, String password) { 20 | this.username = username; 21 | this.password = password; 22 | } 23 | 24 | public String getUsername() { 25 | return username; 26 | } 27 | 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getPassword() { 33 | return password; 34 | } 35 | 36 | public void setPassword(String password) { 37 | this.password = password; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "PersonBean{" + 43 | "username='" + username + '\'' + 44 | ", password='" + password + '\'' + 45 | '}'; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/event/TestEventFirst.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.event; 2 | 3 | /** 4 | * 当前类注释:EventBus测试 First事件类 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.event 7 | * 作者:江清清 on 15/11/3 14:25 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class TestEventFirst { 13 | private String msg; 14 | 15 | public String getMsg() { 16 | return msg; 17 | } 18 | 19 | public void setMsg(String msg) { 20 | this.msg = msg; 21 | } 22 | 23 | public TestEventFirst(String msg){ 24 | this.msg=msg; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/event/TestEventSecond.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.event; 2 | 3 | /** 4 | * 当前类注释:EventBus测试 First事件类 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.event 7 | * 作者:江清清 on 15/11/4 10:54 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class TestEventSecond { 13 | private String msg; 14 | 15 | public String getMsg() { 16 | return msg; 17 | } 18 | 19 | public void setMsg(String msg) { 20 | this.msg = msg; 21 | } 22 | 23 | public TestEventSecond(String msg){ 24 | this.msg=msg; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/event/TestEventThird.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.event; 2 | 3 | /** 4 | * 当前类注释: 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.event 7 | * 作者:江清清 on 15/11/4 10:55 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class TestEventThird { 13 | private String msg; 14 | 15 | public String getMsg() { 16 | return msg; 17 | } 18 | 19 | public void setMsg(String msg) { 20 | this.msg = msg; 21 | } 22 | 23 | public TestEventThird(String msg){ 24 | this.msg=msg; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/fragment/FourFragment.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.fragment; 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 com.chinaztt.fda.ui.R; 10 | 11 | /** 12 | * 当前类注释:第四个Fragment 13 | * 项目名:FastDev4Android 14 | * 包名:com.chinaztt.fda.fragment 15 | * 作者:江清清 on 15/11/16 13:46 16 | * 邮箱:jiangqqlmj@163.com 17 | * QQ: 781931404 18 | * 公司:江苏中天科技软件技术有限公司 19 | */ 20 | public class FourFragment extends Fragment { 21 | private View mView; 22 | @Override 23 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 24 | if(mView==null){ 25 | mView=inflater.inflate(R.layout.four_frag_layout,container,false); 26 | } 27 | return mView; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/fragment/OneFragment.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | import com.chinaztt.fda.ui.R; 12 | 13 | /** 14 | * 当前类注释:第一个Fragment 15 | * 项目名:FastDev4Android 16 | * 包名:com.chinaztt.fda.fragment 17 | * 作者:江清清 on 15/11/16 13:45 18 | * 邮箱:jiangqqlmj@163.com 19 | * QQ: 781931404 20 | * 公司:江苏中天科技软件技术有限公司 21 | */ 22 | public class OneFragment extends Fragment{ 23 | private View mView; 24 | @Override 25 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 26 | if(mView==null){ 27 | mView=inflater.inflate(R.layout.one_frag_layout,container,false); 28 | TextView tv_content=(TextView)mView.findViewById(R.id.tv_content); 29 | Bundle bundle=getArguments(); 30 | if(bundle!=null){ 31 | tv_content.setText(bundle.getString("extra")); 32 | } 33 | 34 | } 35 | return mView; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/fragment/ThreeFragment.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.chinaztt.fda.ui.R; 11 | 12 | /** 13 | * 当前类注释:第三个Fragment 14 | * 项目名:FastDev4Android 15 | * 包名:com.chinaztt.fda.fragment 16 | * 作者:江清清 on 15/11/16 13:46 17 | * 邮箱:jiangqqlmj@163.com 18 | * QQ: 781931404 19 | * 公司:江苏中天科技软件技术有限公司 20 | */ 21 | public class ThreeFragment extends Fragment { 22 | private View mView; 23 | @Override 24 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 25 | if(mView==null){ 26 | mView=inflater.inflate(R.layout.three_frag_layout,container,false); 27 | } 28 | return mView; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/fragment/TwoFragment.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.chinaztt.fda.ui.R; 11 | 12 | /** 13 | * 当前类注释:第二个Fragment 14 | * 项目名:FastDev4Android 15 | * 包名:com.chinaztt.fda.fragment 16 | * 作者:江清清 on 15/11/16 13:45 17 | * 邮箱:jiangqqlmj@163.com 18 | * QQ: 781931404 19 | * 公司:江苏中天科技软件技术有限公司 20 | */ 21 | public class TwoFragment extends Fragment { 22 | private View mView; 23 | @Override 24 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 25 | if(mView==null){ 26 | mView=inflater.inflate(R.layout.two_frag_layout,container,false); 27 | } 28 | return mView; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/listlogic/RequestCallBack.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.listlogic; 2 | 3 | import java.io.InputStream; 4 | 5 | /** 6 | * 当前类注释:网络请求回调接口 7 | * 项目名:FastDev4Android 8 | * 包名:com.chinaztt.fda.listlogic 9 | * 作者:江清清 on 15/10/22 09:52 10 | * 邮箱:jiangqqlmj@163.com 11 | * QQ: 781931404 12 | * 公司:江苏中天科技软件技术有限公司 13 | */ 14 | public interface RequestCallBack { 15 | 16 | int HTTPSTATUSERROR=0; 17 | int HTTPRESPONSEERROR=1; 18 | int OUTOFMEMORYERROR=2; 19 | 20 | void onRequestStart(); 21 | void onRequestError(int errorCode, String errorMessage); 22 | void onRequestSuccess(String successMessage); 23 | void onRequestSuccess(InputStream successStream); 24 | void onRequestLoading(); 25 | void onCancel(); 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/presenter/LoginPresenter.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.presenter; 2 | 3 | import android.os.Handler; 4 | 5 | import com.chinaztt.fda.biz.IPersonBiz; 6 | import com.chinaztt.fda.biz.LoginRequestCallBack; 7 | import com.chinaztt.fda.biz.imp.PersonBizImp; 8 | import com.chinaztt.fda.entity.PersonBean; 9 | import com.chinaztt.fda.ui.view.ILoginView; 10 | import com.chinaztt.fda.utils.Log; 11 | 12 | /** 13 | * 当前类注释:负责完成登录界面View于Model(IPersonBiz)间的交互 14 | * 项目名:FastDev4Android 15 | * 包名:com.chinaztt.fda.presenter 16 | * 作者:江清清 on 15/10/27 16:36 17 | * 邮箱:jiangqqlmj@163.com 18 | * QQ: 781931404 19 | * 公司:江苏中天科技软件技术有限公司 20 | */ 21 | public class LoginPresenter { 22 | private static final String TAG="LoginPresenter"; 23 | private ILoginView mLoginView; 24 | private IPersonBiz mPersonBiz; 25 | 26 | private Handler mHandler=new Handler(); 27 | 28 | public LoginPresenter(ILoginView view) { 29 | mLoginView = view; 30 | mPersonBiz = new PersonBizImp(); 31 | } 32 | 33 | public void loginSystem(){ 34 | mPersonBiz.login(mLoginView.getUserName(), mLoginView.getPassword(), new LoginRequestCallBack() { 35 | /** 36 | * 登录成功 37 | * @param personBean 38 | */ 39 | @Override 40 | public void loginSuccess(final PersonBean personBean) { 41 | Log.d(TAG, "登录成功:" + personBean.toString()); 42 | mHandler.post(new Runnable() { 43 | @Override 44 | public void run() { 45 | mLoginView.showSuccessInfo(personBean); 46 | } 47 | }); 48 | } 49 | /** 50 | * 登录失败 51 | */ 52 | @Override 53 | public void loginFailed() { 54 | Log.d(TAG,"登录失败..."); 55 | mHandler.post(new Runnable() { 56 | @Override 57 | public void run() { 58 | mLoginView.showFailedInfo();; 59 | } 60 | }); 61 | } 62 | }); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/spreference/SharedPreferencesTag.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.spreference; 2 | 3 | /** 4 | * 当前类注释:当前类用户SharedPreferences进行save的时候 配置key常量 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.spreference 7 | * 作者:江清清 on 15/10/22 09:26 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class SharedPreferencesTag { 13 | public static final String DEMO_KEY="demo_key"; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/AVLoadingIndicatorActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.widget.Button; 6 | 7 | import com.chinaztt.fda.ui.R; 8 | import com.chinaztt.fda.ui.base.BaseActivity; 9 | import com.wang.avi.AVLoadingIndicatorView; 10 | 11 | import org.androidannotations.annotations.EActivity; 12 | 13 | /** 14 | * 当前类注释: 15 | * 项目名:FastDev4Android 16 | * 包名:com.chinaztt.fda.test 17 | * 作者:江清清 on 15/11/3 08:37 18 | * 邮箱:jiangqqlmj@163.com 19 | * QQ: 781931404 20 | * 公司:江苏中天科技软件技术有限公司 21 | */ 22 | @EActivity 23 | public class AVLoadingIndicatorActivity extends BaseActivity{ 24 | private Button progress_start,progress_stop; 25 | private AVLoadingIndicatorView avloadingIndicatorView_BallPulse; 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setContentView(R.layout.av_loading_indicator_layout); 30 | avloadingIndicatorView_BallPulse=(AVLoadingIndicatorView)this.findViewById(R.id.avloadingIndicatorView_BallPulse); 31 | progress_start=(Button)this.findViewById(R.id.progress_start); 32 | progress_stop=(Button)this.findViewById(R.id.progress_stop); 33 | 34 | //打开动画 35 | progress_start.setOnClickListener(new View.OnClickListener() { 36 | @Override 37 | public void onClick(View v) { 38 | avloadingIndicatorView_BallPulse.setVisibility(View.VISIBLE); 39 | } 40 | }); 41 | //关闭动画 42 | progress_stop.setOnClickListener(new View.OnClickListener() { 43 | @Override 44 | public void onClick(View v) { 45 | avloadingIndicatorView_BallPulse.setVisibility(View.GONE); 46 | } 47 | }); 48 | 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/AnnotationsTestActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.widget.Button; 6 | import android.widget.TextView; 7 | import com.chinaztt.fda.ui.R; 8 | import com.chinaztt.fda.ui.base.BaseActivity; 9 | 10 | import org.androidannotations.annotations.AfterInject; 11 | import org.androidannotations.annotations.AfterViews; 12 | import org.androidannotations.annotations.Click; 13 | import org.androidannotations.annotations.EActivity; 14 | import org.androidannotations.annotations.ViewById; 15 | 16 | 17 | /** 18 | * 当前类注释:依赖注入管理器AndroidAnnotations使用实例 19 | * 项目名:FastDev4Android 20 | * 包名:com.chinaztt.fda.test 21 | * 作者:江清清 on 15/10/28 08:36 22 | * 邮箱:jiangqqlmj@163.com 23 | * QQ: 781931404 24 | * 公司:江苏中天科技软件技术有限公司 25 | */ 26 | @EActivity(R.layout.dragger_inject_layout) 27 | public class AnnotationsTestActivity extends BaseActivity { 28 | @ViewById 29 | Button btn_show; 30 | @ViewById 31 | TextView tv_show; 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | } 36 | @Click(R.id.btn_show) 37 | public void btnShowClick(){ 38 | tv_show.setText("按钮被点击了..."); 39 | } 40 | @AfterViews 41 | public void setTv_show(){ 42 | tv_show.setText("我已经被注入啦..."); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/BaseAdapterTestActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test; 2 | 3 | import android.os.Bundle; 4 | import android.widget.ListView; 5 | 6 | import com.chinaztt.fda.adapter.base.BaseAdapterHelper; 7 | import com.chinaztt.fda.adapter.base.QuickAdapter; 8 | import com.chinaztt.fda.entity.ModuleBean; 9 | import com.chinaztt.fda.ui.R; 10 | import com.chinaztt.fda.ui.base.BaseActivity; 11 | import org.androidannotations.annotations.AfterViews; 12 | import org.androidannotations.annotations.EActivity; 13 | import org.androidannotations.annotations.ViewById; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * 当前类注释:baseAdapterhelper 使用实例 19 | * 项目名:FastDev4Android 20 | * 包名:com.chinaztt.fda.test 21 | * 作者:江清清 on 15/11/8 17:39 22 | * 邮箱:jiangqqlmj@163.com 23 | * QQ: 781931404 24 | * 公司:江苏中天科技软件技术有限公司 25 | */ 26 | @EActivity(R.layout.base_adapter_test_layout) 27 | public class BaseAdapterTestActivity extends BaseActivity { 28 | @ViewById 29 | ListView lv_base_adapter; 30 | private QuickAdapter mAdapter; 31 | private List moduleBeans; 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | } 36 | @AfterViews 37 | public void bindLvData(){ 38 | moduleBeans=DataUtils.getAdapterData(); 39 | if(mAdapter==null) { 40 | mAdapter = new QuickAdapter(this, R.layout.lv_item_base_layout,moduleBeans) { 41 | @Override 42 | protected void convert(BaseAdapterHelper helper, ModuleBean item) { 43 | //列表底下显示进度 44 | mAdapter.showIndeterminateProgress(true); 45 | helper.setText(R.id.text_lv_item_title, item.getModulename()) 46 | .setText(R.id.text_lv_item_description, item.getDescription()) 47 | .setImageUrl(R.id.img_lv_item, item.getImgurl()); 48 | } 49 | }; 50 | lv_base_adapter.setAdapter(mAdapter); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/CardView/CardViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.CardView; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.Button; 7 | import android.widget.LinearLayout; 8 | import android.widget.TextView; 9 | 10 | import com.chinaztt.fda.ui.R; 11 | import com.chinaztt.fda.ui.base.BaseActivity; 12 | 13 | /** 14 | * 当前类注释:Google Android新特性,CardView使用实例 15 | * 项目名:FastDev4Android 16 | * 包名:com.chinaztt.fda.test 17 | * 作者:江清清 on 15/11/23 13:43 18 | * 邮箱:jiangqqlmj@163.com 19 | * QQ: 781931404 20 | * 公司:江苏中天科技软件技术有限公司 21 | */ 22 | public class CardViewActivity extends BaseActivity { 23 | private LinearLayout top_bar_linear_back; 24 | private TextView top_bar_title; 25 | private Button btn_cardview_recyclerview; 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setContentView(R.layout.card_view_layout); 30 | top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back); 31 | top_bar_linear_back.setOnClickListener(new CustomOnClickListener()); 32 | top_bar_title=(TextView)this.findViewById(R.id.top_bar_title); 33 | top_bar_title.setText("CardView使用实例"); 34 | 35 | btn_cardview_recyclerview=(Button)this.findViewById(R.id.btn_cardview_recyclerview); 36 | btn_cardview_recyclerview.setOnClickListener(new View.OnClickListener() { 37 | @Override 38 | public void onClick(View v) { 39 | CardViewActivity.this.startActivity(new Intent(CardViewActivity.this,CardViewRecyclerActivity.class)); 40 | } 41 | }); 42 | } 43 | class CustomOnClickListener implements View.OnClickListener{ 44 | @Override 45 | public void onClick(View v) { 46 | CardViewActivity.this.finish(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/CardView/CardViewRecyclerActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.CardView; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.widget.LinearLayoutManager; 5 | import android.support.v7.widget.OrientationHelper; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.View; 8 | import android.widget.LinearLayout; 9 | import android.widget.TextView; 10 | 11 | import com.chinaztt.fda.ui.R; 12 | import com.chinaztt.fda.ui.base.BaseActivity; 13 | 14 | /** 15 | * 当前类注释:CardView结合RecyclerView使用实例 16 | * 项目名:FastDev4Android 17 | * 包名:com.chinaztt.fda.test.CardView 18 | * 作者:江清清 on 15/11/23 19:34 19 | * 邮箱:jiangqqlmj@163.com 20 | * QQ: 781931404 21 | * 公司:江苏中天科技软件技术有限公司 22 | */ 23 | public class CardViewRecyclerActivity extends BaseActivity { 24 | private LinearLayout top_bar_linear_back; 25 | private TextView top_bar_title; 26 | private RecyclerView recycler_cardview; 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.card_view_recycler_layout); 31 | top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back); 32 | top_bar_linear_back.setOnClickListener(new CustomOnClickListener()); 33 | top_bar_title=(TextView)this.findViewById(R.id.top_bar_title); 34 | top_bar_title.setText("CardView结合RecyclerView使用实例"); 35 | 36 | recycler_cardview=(RecyclerView)this.findViewById(R.id.recycler_cardview); 37 | LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this); 38 | linearLayoutManager.setOrientation(OrientationHelper.VERTICAL); 39 | recycler_cardview.setLayoutManager(linearLayoutManager); 40 | recycler_cardview.setAdapter(new CardViewAdapter(this)); 41 | 42 | 43 | } 44 | class CustomOnClickListener implements View.OnClickListener{ 45 | @Override 46 | public void onClick(View v) { 47 | CardViewRecyclerActivity.this.finish(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/ComInstance/AdvanceInstanceBean.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.ComInstance; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 当前类注释:SwipeRefreshLayout+RecyclerView+CardView升级版本 Item信息实体类 7 | * 项目名:FastDev4Android 8 | * 包名:com.chinaztt.fda.test.ComInstance 9 | * 作者:江清清 on 15/11/28 10:27 10 | * 邮箱:jiangqqlmj@163.com 11 | * QQ: 781931404 12 | * 公司:江苏中天科技软件技术有限公司 13 | */ 14 | public class AdvanceInstanceBean { 15 | private List instanceBeans; 16 | public AdvanceInstanceBean() { 17 | } 18 | public AdvanceInstanceBean(List instanceBeans) { 19 | this.instanceBeans = instanceBeans; 20 | } 21 | 22 | public List getInstanceBeans() { 23 | return instanceBeans; 24 | } 25 | 26 | public void setInstanceBeans(List instanceBeans) { 27 | this.instanceBeans = instanceBeans; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "AdvanceInstanceBean{" + 33 | "instanceBeans=" + instanceBeans + 34 | '}'; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/ComInstance/AdvanceIntanceDataUtils.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.ComInstance; 2 | 3 | import com.chinaztt.fda.ui.R; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * 当前类注释: 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.test.ComInstance 12 | * 作者:江清清 on 15/11/28 10:46 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | public class AdvanceIntanceDataUtils { 18 | public static List getAdvanceInstanceBeans(){ 19 | List advanceInstanceBeans=new ArrayList(); 20 | for (int i=0;i<10;i++){ 21 | AdvanceInstanceBean advanceInstanceBean=new AdvanceInstanceBean(); 22 | List instanceBeans=new ArrayList(); 23 | for(int j=0;j<2;j++){ 24 | InstanceBean bean=null; 25 | if(j==0){ 26 | bean=new InstanceBean("我是左边标题Item"+i, R.drawable.liuyan); 27 | }else { 28 | bean=new InstanceBean("我是右边标题Item"+i, R.drawable.liuyan); 29 | } 30 | instanceBeans.add(bean); 31 | } 32 | advanceInstanceBean.setInstanceBeans(instanceBeans); 33 | advanceInstanceBeans.add(advanceInstanceBean); 34 | } 35 | return advanceInstanceBeans; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/ComInstance/InstanceBean.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.ComInstance; 2 | 3 | /** 4 | * 当前类注释:实例模拟数据bean 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.test.ComInstance 7 | * 作者:江清清 on 15/11/27 21:56 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class InstanceBean { 13 | private int img; 14 | private String title; 15 | public InstanceBean() { 16 | } 17 | 18 | public InstanceBean(String title, int img) { 19 | this.title = title; 20 | this.img = img; 21 | } 22 | 23 | public int getImg() { 24 | return img; 25 | } 26 | 27 | public void setImg(int img) { 28 | this.img = img; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "InstanceBean{" + 42 | "img='" + img + '\'' + 43 | ", title='" + title + '\'' + 44 | '}'; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/ComInstance/InstanceDataUtils.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.ComInstance; 2 | 3 | import com.chinaztt.fda.ui.R; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * 当前类注释: 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.test.ComInstance 12 | * 作者:江清清 on 15/11/27 22:24 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | public class InstanceDataUtils { 18 | public static List getInstanceBeans(){ 19 | List instanceBeans=new ArrayList(); 20 | for (int i=0;i<10;i++){ 21 | InstanceBean bean=new InstanceBean("我是标题Item"+i,R.drawable.liuyan); 22 | instanceBeans.add(bean); 23 | } 24 | return instanceBeans; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/CrashTestActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.widget.Button; 6 | import android.widget.TextView; 7 | 8 | import com.chinaztt.fda.application.FDApplication; 9 | import com.chinaztt.fda.ui.R; 10 | import com.chinaztt.fda.ui.base.BaseActivity; 11 | import com.chinaztt.fda.utils.Log; 12 | 13 | import org.androidannotations.annotations.App; 14 | import org.androidannotations.annotations.EActivity; 15 | 16 | /** 17 | * 当前类注释: 18 | * 项目名:FastDev4Android 19 | * 包名:com.chinaztt.fda.test 20 | * 作者:江清清 on 15/10/26 13:38 21 | * 邮箱:jiangqqlmj@163.com 22 | * QQ: 781931404 23 | * 公司:江苏中天科技软件技术有限公司 24 | */ 25 | @EActivity 26 | public class CrashTestActivity extends BaseActivity { 27 | private Button crash_btn; 28 | private TextView crash_tv; 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.crash_test_layout); 33 | crash_btn=(Button)this.findViewById(R.id.crash_btn); 34 | crash_btn.setOnClickListener(new View.OnClickListener() { 35 | @Override 36 | public void onClick(View v) { 37 | crash_tv.setText("客户端崩溃了..."); 38 | } 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/MainFrameActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentActivity; 5 | 6 | import com.chinaztt.fda.ui.R; 7 | import com.chinaztt.fda.ui.base.BaseActivity; 8 | 9 | import org.androidannotations.annotations.EActivity; 10 | 11 | /** 12 | * 当前类注释: 13 | * 项目名:FastDev4Android 14 | * 包名:com.chinaztt.fda.test 15 | * 作者:江清清 on 15/11/16 13:49 16 | * 邮箱:jiangqqlmj@163.com 17 | * QQ: 781931404 18 | * 公司:江苏中天科技软件技术有限公司 19 | */ 20 | @EActivity(R.layout.main_frame_layout) 21 | public class MainFrameActivity extends FragmentActivity { 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/MainInfoActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test; 2 | import android.os.Bundle; 3 | import android.support.v4.app.FragmentActivity; 4 | import android.view.View; 5 | import android.widget.LinearLayout; 6 | import android.widget.TextView; 7 | 8 | import com.chinaztt.fda.ui.R; 9 | 10 | /** 11 | * 当前类注释:当前类注释:Fragment+ViewPager+FragmentStatePagerAapter仿照新闻顶部TAB 12 | * 项目名:FastDev4Android 13 | * 包名:com.chinaztt.fda.test 14 | * 作者:江清清 on 15/12/2 09:43 15 | * 邮箱:jiangqqlmj@163.com 16 | * QQ: 781931404 17 | * 公司:江苏中天科技软件技术有限公司 18 | */ 19 | public class MainInfoActivity extends FragmentActivity { 20 | private LinearLayout top_bar_linear_back; 21 | private TextView top_bar_title; 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.main_info_fragment_layout); 26 | top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back); 27 | top_bar_linear_back.setOnClickListener(new View.OnClickListener() { 28 | @Override 29 | public void onClick(View v) { 30 | MainInfoActivity.this.finish(); 31 | } 32 | }); 33 | top_bar_title=(TextView)this.findViewById(R.id.top_bar_title); 34 | top_bar_title.setText("Fragment+ViewPager+FragmentStatePagerAdapter实例"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/RecyclerViewAA/AAUserAdapter.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.RecyclerViewAA; 2 | 3 | import android.content.Context; 4 | import android.view.ViewGroup; 5 | import org.androidannotations.annotations.EBean; 6 | import org.androidannotations.annotations.RootContext; 7 | 8 | /** 9 | * 当前类注释: 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.test.RecyclerViewAA 12 | * 作者:江清清 on 15/11/21 09:35 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | @EBean 18 | public class AAUserAdapter extends RecyclerViewAdapterBase { 19 | @RootContext 20 | Context context; 21 | /** 22 | * 创建Item视图View 23 | * @param parent 24 | * @param viewType 25 | * @return 26 | */ 27 | @Override 28 | protected AAUserItemView onCreateItemView(ViewGroup parent, int viewType) { 29 | return AAUserItemView_.build(context); 30 | } 31 | /** 32 | * 进行绑定数据View 33 | * @param holder 34 | * @param position 35 | */ 36 | @Override 37 | public void onBindViewHolder(ViewWrapper holder, int position) { 38 | AAUserItemView view =holder.getView(); 39 | TestUserBean userBean = items.get(position); 40 | view.bind(userBean); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/RecyclerViewAA/AAUserFinder.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.RecyclerViewAA; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 当前类注释: 7 | * 项目名:FastDev4Android 8 | * 包名:com.chinaztt.fda.test.RecyclerViewAA 9 | * 作者:江清清 on 15/11/21 09:36 10 | * 邮箱:jiangqqlmj@163.com 11 | * QQ: 781931404 12 | * 公司:江苏中天科技软件技术有限公司 13 | */ 14 | public interface AAUserFinder { 15 | List findAll(); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/RecyclerViewAA/AAUserItemView.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.RecyclerViewAA; 2 | 3 | import android.content.Context; 4 | import android.widget.LinearLayout; 5 | import android.widget.TextView; 6 | 7 | import com.chinaztt.fda.ui.R; 8 | 9 | import org.androidannotations.annotations.EViewGroup; 10 | import org.androidannotations.annotations.ViewById; 11 | 12 | /** 13 | * 当前类注释: 14 | * 项目名:FastDev4Android 15 | * 包名:com.chinaztt.fda.test.RecyclerViewAA 16 | * 作者:江清清 on 15/11/21 09:36 17 | * 邮箱:jiangqqlmj@163.com 18 | * QQ: 781931404 19 | * 公司:江苏中天科技软件技术有限公司 20 | */ 21 | @EViewGroup(R.layout.item_user_item) 22 | public class AAUserItemView extends LinearLayout { 23 | @ViewById 24 | TextView tv_first; 25 | @ViewById 26 | TextView tv_last; 27 | public AAUserItemView(Context context) { 28 | super(context); 29 | } 30 | public void bind(TestUserBean userBean) { 31 | tv_first.setText(userBean.getFirstName()); 32 | tv_last.setText(userBean.getLastName()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/RecyclerViewAA/ImMemoryUserFinder.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.RecyclerViewAA; 2 | 3 | import org.androidannotations.annotations.EBean; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * 当前类注释: 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.test.RecyclerViewAA 12 | * 作者:江清清 on 15/11/21 09:36 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | @EBean 18 | public class ImMemoryUserFinder implements AAUserFinder{ 19 | @Override 20 | public List findAll() { 21 | List userModels=new ArrayList(); 22 | for(int i=1;i<=45;i++){ 23 | TestUserBean model=new TestUserBean(); 24 | model.setFirstName("First 张三:"+i); 25 | model.setLastName("Last 李四:" + i); 26 | userModels.add(model); 27 | } 28 | return userModels; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/RecyclerViewAA/RecyclerViewAdapterBase.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.RecyclerViewAA; 2 | 3 | /** 4 | * 当前类注释: 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.test.RecyclerViewAA 7 | * 作者:江清清 on 15/11/21 09:31 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | 13 | import android.support.v7.widget.RecyclerView; 14 | import android.view.View; 15 | import android.view.ViewGroup; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | public abstract class RecyclerViewAdapterBaseextends RecyclerView.Adapter>{ 21 | /** 22 | * 存储需要绑定的数据 23 | */ 24 | protected List items = new ArrayList(); 25 | public List getItems() { 26 | return items; 27 | } 28 | public void setItems(List items) { 29 | this.items = items; 30 | } 31 | 32 | @Override 33 | public int getItemCount() { 34 | return items.size(); 35 | } 36 | 37 | /** 38 | * 进行创建视图承载类 39 | * @param parent 40 | * @param viewType 41 | * @return 42 | */ 43 | @Override 44 | public final ViewWrapper onCreateViewHolder(ViewGroup parent, int viewType) { 45 | return new ViewWrapper(onCreateItemView(parent, viewType)); 46 | } 47 | /** 48 | * 创建视图Item,交给具体实现类完成 49 | * @param parent 50 | * @param viewType 51 | * @return 52 | */ 53 | protected abstract V onCreateItemView(ViewGroup parent, int viewType); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/RecyclerViewAA/TestUserBean.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.RecyclerViewAA; 2 | 3 | /** 4 | * 当前类注释:测试的AA的用户实体类 5 | * 项目名:FastDev4Android 6 | * 包名:com.chinaztt.fda.test.RecyclerViewAA 7 | * 作者:江清清 on 15/11/21 09:29 8 | * 邮箱:jiangqqlmj@163.com 9 | * QQ: 781931404 10 | * 公司:江苏中天科技软件技术有限公司 11 | */ 12 | public class TestUserBean { 13 | private String firstName; 14 | private String LastName; 15 | 16 | public TestUserBean() { 17 | } 18 | 19 | public String getFirstName() { 20 | return firstName; 21 | } 22 | 23 | public void setFirstName(String firstName) { 24 | this.firstName = firstName; 25 | } 26 | 27 | public String getLastName() { 28 | return LastName; 29 | } 30 | 31 | public void setLastName(String lastName) { 32 | LastName = lastName; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "UserModel{" + 38 | "firstName='" + firstName + '\'' + 39 | ", LastName='" + LastName + '\'' + 40 | '}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/RecyclerViewAA/ViewWrapper.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.RecyclerViewAA; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | 6 | import org.androidannotations.annotations.EViewGroup; 7 | 8 | /** 9 | * 当前类注释:创建一个泛型类来把所有类型的View包装成ViewHonlder 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.test.RecyclerViewAA 12 | * 作者:江清清 on 15/11/21 09:24 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | public class ViewWrapper extends RecyclerView.ViewHolder { 18 | public V view; 19 | public ViewWrapper(V itemView) { 20 | super(itemView); 21 | view = itemView; 22 | } 23 | public V getView() { 24 | return view; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/TabLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentActivity; 5 | import android.view.View; 6 | import android.widget.LinearLayout; 7 | import android.widget.TextView; 8 | 9 | import com.chinaztt.fda.ui.R; 10 | 11 | /** 12 | * 当前类注释:承载Fragment的Activity类,采用google支持库 TabLayout实现Tab标签 13 | * 项目名:FastDev4Android 14 | * 包名:com.chinaztt.fda.test 15 | * 作者:江清清 on 15/12/2 21:02 16 | * 邮箱:jiangqqlmj@163.com 17 | * QQ: 781931404 18 | * 公司:江苏中天科技软件技术有限公司 19 | */ 20 | public class TabLayoutActivity extends FragmentActivity{ 21 | private LinearLayout top_bar_linear_back; 22 | private TextView top_bar_title; 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.tab_layout_activity_layout); 27 | top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back); 28 | top_bar_linear_back.setOnClickListener(new View.OnClickListener() { 29 | @Override 30 | public void onClick(View v) { 31 | TabLayoutActivity.this.finish(); 32 | } 33 | }); 34 | top_bar_title=(TextView)this.findViewById(R.id.top_bar_title); 35 | top_bar_title.setText("TabLayout打造网易新闻Tab标签"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/test/ViewDragHelper/ViewGragHelperActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.test.ViewDragHelper; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.widget.LinearLayout; 6 | import android.widget.TextView; 7 | 8 | import com.chinaztt.fda.ui.R; 9 | import com.chinaztt.fda.ui.base.BaseActivity; 10 | 11 | /** 12 | * 当前类注释:ViewGragHelper使用实例 13 | * 项目名:FastDev4Android 14 | * 包名:com.chinaztt.fda.test 15 | * 作者:江清清 on 15/11/24 20:15 16 | * 邮箱:jiangqqlmj@163.com 17 | * QQ: 781931404 18 | * 公司:江苏中天科技软件技术有限公司 19 | */ 20 | public class ViewGragHelperActivity extends BaseActivity { 21 | private LinearLayout top_bar_linear_back; 22 | private TextView top_bar_title; 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.view_grag_helper_layout); 27 | top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back); 28 | top_bar_linear_back.setOnClickListener(new CustomOnClickListener()); 29 | top_bar_title=(TextView)findViewById(R.id.top_bar_title); 30 | top_bar_title.setText("ViewGragHelper使用详解"); 31 | } 32 | class CustomOnClickListener implements View.OnClickListener{ 33 | @Override 34 | public void onClick(View v) { 35 | ViewGragHelperActivity.this.finish(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/ui/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.ui.base; 2 | 3 | import android.content.Intent; 4 | import android.view.LayoutInflater; 5 | import android.widget.Toast; 6 | 7 | /** 8 | * 当前类注释:基类Actvity 主要封装一些工具类的使用,公共方法,配置 9 | * 项目名:FastDev4Android 10 | * 包名:com.chinaztt.fda.base 11 | * 作者:江清清 on 15/10/22 08:59 12 | * 邮箱:jiangqqlmj@163.com 13 | * QQ: 781931404 14 | * 公司:江苏中天科技软件技术有限公司 15 | */ 16 | public class BaseActivity extends BaseFrameActvity{ 17 | /** 18 | * 获取当前view的LayoutInflater实例 19 | * @return 20 | */ 21 | protected LayoutInflater getLayouInflater() { 22 | LayoutInflater _LayoutInflater = LayoutInflater.from(this); 23 | return _LayoutInflater; 24 | } 25 | 26 | /** 27 | * 弹出toast 显示时长short 28 | * @param pMsg 29 | */ 30 | protected void showToastMsgShort(String pMsg) { 31 | Toast.makeText(this, pMsg, Toast.LENGTH_SHORT).show(); 32 | } 33 | /** 34 | * 弹出toase 显示时长long 35 | * @param pMsg 36 | */ 37 | protected void showToastMsgLong(String pMsg) { 38 | Toast.makeText(this, pMsg, Toast.LENGTH_LONG).show(); 39 | } 40 | /** 41 | * 根据传入的类(class)打开指定的activity 42 | * @param pClass 43 | */ 44 | protected void openActivity(Class pClass) { 45 | Intent _Intent = new Intent(); 46 | _Intent.setClass(this, pClass); 47 | startActivity(_Intent); 48 | } 49 | 50 | protected void openActivityByIntent(Intent pIntent){ 51 | startActivity(pIntent); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/ui/view/ILoginView.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.ui.view; 2 | 3 | import com.chinaztt.fda.entity.PersonBean; 4 | 5 | /** 6 | * 当前类注释:登录页面 相关操作 功能接口 7 | * 项目名:FastDev4Android 8 | * 包名:com.chinaztt.fda.ui.view 9 | * 作者:江清清 on 15/10/27 16:35 10 | * 邮箱:jiangqqlmj@163.com 11 | * QQ: 781931404 12 | * 公司:江苏中天科技软件技术有限公司 13 | */ 14 | public interface ILoginView { 15 | //获取用户名 16 | String getUserName(); 17 | //获取密码 18 | String getPassword(); 19 | 20 | void showSuccessInfo(PersonBean personBean); 21 | void showFailedInfo(); 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/utils/GuideUtils.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.utils; 2 | 3 | import android.content.Context; 4 | 5 | import com.chinaztt.fda.application.FDApplication; 6 | import com.chinaztt.fda.spreference.SharedPreferencesHelper; 7 | import com.chinaztt.fda.spreference.SharedPreferencesTag; 8 | 9 | /** 10 | * 当前类注释:查询与设置引导界面标志值工具类 11 | * 主要用于引导界面,APP新版本第一次打开 才会进行使用引导界面 12 | * 项目名:FastDev4Android 13 | * 包名:com.chinaztt.fda.utils 14 | * 作者:江清清 on 15/10/22 09:47 15 | * 邮箱:jiangqqlmj@163.com 16 | * QQ: 781931404 17 | * 公司:江苏中天科技软件技术有限公司 18 | */ 19 | public class GuideUtils { 20 | private static final String KEY_GUIDE_ACTIVITY="key_guide_activity"; 21 | /** 22 | * 根据版本code值 判断是否已经引导过了 23 | * @param context 上下文 24 | * @param versionCode 版本值 25 | * @return 引导过返回true,否则返回false 26 | */ 27 | public static boolean activityIsGuided(Context context,int versionCode){ 28 | SharedPreferencesHelper mSharedPreferencesHelper=SharedPreferencesHelper.getInstance(FDApplication.getInstance()); 29 | if(mSharedPreferencesHelper.getIntValue(KEY_GUIDE_ACTIVITY)==versionCode){ 30 | return true; 31 | } 32 | return false; 33 | } 34 | /** 35 | * 设置code值,表明已经引导过 36 | * @param context 37 | * @param versionCode 38 | */ 39 | public static void setIsGuided(Context context,int versionCode){ 40 | SharedPreferencesHelper mSharedPreferencesHelper=SharedPreferencesHelper.getInstance(FDApplication.getInstance()); 41 | mSharedPreferencesHelper.putIntValue(KEY_GUIDE_ACTIVITY, versionCode); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/utils/JudgeNetWorker.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.utils; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * 当前类注释:判断网络状态 是连接还是断开状态 9 | * 项目名:FastDev4Android 10 | * 包名:com.chinaztt.fda.utils 11 | * 作者:江清清 on 15/10/22 09:46 12 | * 邮箱:jiangqqlmj@163.com 13 | * QQ: 781931404 14 | * 公司:江苏中天科技软件技术有限公司 15 | */ 16 | public class JudgeNetWorker { 17 | private static final int CMNET=3; 18 | private static final int CMWAP=2; 19 | private static final int WIFI=1; 20 | public static boolean checkConnectionOk(Context context) { 21 | final ConnectivityManager cm = (ConnectivityManager) context 22 | .getSystemService(Context.CONNECTIVITY_SERVICE); 23 | final NetworkInfo networkInfo = cm.getActiveNetworkInfo(); 24 | if (networkInfo == null || !networkInfo.isConnectedOrConnecting()) { 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | /** 31 | * @author jiangqq 32 | * 获取当前的网络状态 -1:没有网络 1:WIFI网络 2:wap网络 3:net网络 33 | * @param context 34 | * @return 35 | */ 36 | public static int getAPNType(Context context){ 37 | int netType = -1; 38 | ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 39 | NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); 40 | if(networkInfo==null){ 41 | return netType; 42 | } 43 | int nType = networkInfo.getType(); 44 | if(nType==ConnectivityManager.TYPE_MOBILE){ 45 | Log.e("networkInfo.getExtraInfo()", "networkInfo.getExtraInfo() is "+networkInfo.getExtraInfo()); 46 | if(networkInfo.getExtraInfo().toLowerCase().equals("cmnet")){ 47 | netType = CMNET; 48 | } 49 | else{ 50 | netType = CMWAP; 51 | } 52 | } 53 | else if(nType==ConnectivityManager.TYPE_WIFI){ 54 | netType = WIFI; 55 | } 56 | return netType; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/utils/ManagerActivity.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.utils; 2 | 3 | import android.app.Activity; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * 当前类注释: Activity 管理,可以支持完全退出,不过是否能够完全退出, 10 | * 肯定是不行,如果应用中有一些service,可能会重启 11 | * 项目名:FastDev4Android 12 | * 包名:com.chinaztt.fda.utils 13 | * 作者:江清清 on 15/10/22 09:01 14 | * 邮箱:jiangqqlmj@163.com 15 | * QQ: 781931404 16 | * 公司:江苏中天科技软件技术有限公司 17 | */ 18 | public class ManagerActivity { 19 | public static ManagerActivity instance = new ManagerActivity(); 20 | private List mLists = new ArrayList(); 21 | private ManagerActivity() { 22 | } 23 | public synchronized static ManagerActivity getInstance() { 24 | 25 | return instance; 26 | } 27 | 28 | /** 29 | * 往集合中添加一个Activity 30 | * @param pActivity 31 | */ 32 | public void addActivity(Activity pActivity) { 33 | if (pActivity != null) { 34 | mLists.add(pActivity); 35 | } 36 | } 37 | 38 | /** 39 | * 从集合中删除一个Activity 40 | * @param pActivity 需要删除的Activity 41 | */ 42 | public void removeActivity(Activity pActivity) { 43 | if (pActivity != null) { 44 | if (mLists.contains(pActivity)) { 45 | mLists.remove(pActivity); 46 | pActivity.finish(); 47 | pActivity = null; 48 | } 49 | } 50 | } 51 | 52 | //从栈中进行删除集合顶得Activity 53 | public void popActivity() { 54 | Activity activity = mLists.get(mLists.size() - 1); 55 | removeActivity(activity); 56 | } 57 | public int getNum() { 58 | return mLists.size(); 59 | } 60 | /** 61 | * 完全删除集合中 62 | */ 63 | public void finishActivity() { 64 | if (mLists != null && mLists.size() >= 0) { 65 | for (Activity pActivity : mLists) { 66 | pActivity.finish(); 67 | pActivity = null; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/widget/CustomLinearLayoutManager.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.LinearLayoutManager; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.View; 7 | 8 | /** 9 | * 当前类注释:重写LinearLayoutManger使得高度自适应 10 | * 项目名:FastDev4Android 11 | * 包名:com.chinaztt.fda.widget 12 | * 作者:江清清 on 15/11/20 13:50 13 | * 邮箱:jiangqqlmj@163.com 14 | * QQ: 781931404 15 | * 公司:江苏中天科技软件技术有限公司 16 | */ 17 | public class CustomLinearLayoutManager extends LinearLayoutManager { 18 | public CustomLinearLayoutManager(Context context) { 19 | super(context); 20 | } 21 | 22 | @Override 23 | public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) { 24 | View view=recycler.getViewForPosition(0); 25 | if(view!=null){ 26 | measureChild(view,widthSpec,heightSpec); 27 | int mWidth= View.MeasureSpec.getSize(widthSpec); 28 | int mHeight=view.getMeasuredHeight(); 29 | setMeasuredDimension(mWidth,mHeight); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/chinaztt/fda/widget/TestDecoration.java: -------------------------------------------------------------------------------- 1 | package com.chinaztt.fda.widget; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | import android.graphics.Rect; 7 | import android.graphics.drawable.Drawable; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.View; 10 | 11 | /** 12 | * 当前类注释:自定义实现一个Decoration 分隔线 13 | * 项目名:FastDev4Android 14 | * 包名:com.chinaztt.fda.widget 15 | * 作者:江清清 on 15/11/19 12:29 16 | * 邮箱:jiangqqlmj@163.com 17 | * QQ: 781931404 18 | * 公司:江苏中天科技软件技术有限公司 19 | */ 20 | public class TestDecoration extends RecyclerView.ItemDecoration { 21 | //采用系统内置的风格的分割线 22 | private static final int[] attrs=new int[]{android.R.attr.listDivider}; 23 | private Drawable mDivider; 24 | 25 | public TestDecoration(Context context) { 26 | TypedArray typedArray=context.obtainStyledAttributes(attrs); 27 | mDivider=typedArray.getDrawable(0); 28 | typedArray.recycle(); 29 | } 30 | 31 | /** 32 | * 进行自定义绘制 33 | * @param c 34 | * @param parent 35 | * @param state 36 | */ 37 | @Override 38 | public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { 39 | int top=parent.getPaddingTop(); 40 | int bottom=parent.getHeight()-parent.getPaddingBottom(); 41 | int childCount=parent.getChildCount(); 42 | for(int i=0;i= VERSION_CODES.JELLY_BEAN) { 13 | SDK16.postOnAnimation(view, runnable); 14 | } else { 15 | view.postDelayed(runnable, SIXTY_FPS_INTERVAL); 16 | } 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/uk/co/senab/photoview/SDK16.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package uk.co.senab.photoview; 17 | 18 | import android.annotation.TargetApi; 19 | import android.view.View; 20 | 21 | @TargetApi(16) 22 | public class SDK16 { 23 | 24 | public static void postOnAnimation(View view, Runnable r) { 25 | view.postOnAnimation(r); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/res/anim/move_pop_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/move_pop_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/baby.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/baby.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/bottom_line_blue.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/bottom_line_blue.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/bottom_line_gray.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/bottom_line_gray.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/four.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/four.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/header_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/header_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/hui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/hui.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_item_gallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/ic_item_gallery.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/ic_loading.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_loading_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/ic_loading_s.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_poi_meal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/ic_poi_meal.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_refresh_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/ic_refresh_down.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_right_arrow_meal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/ic_right_arrow_meal.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/lan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/lan.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/line_read_option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/line_read_option.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/liuyan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/liuyan.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/meinv.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/meinv.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/moren.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/moren.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/one.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/one.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/three.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/three.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/two.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangqqlmj/FastDev4Android/cf220e5265de08214e56a947d47e4871aeda8c14/app/src/main/res/drawable-hdpi/two.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_loading_refresh.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_small.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 13 | 19 | 20 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/base_adapter_test_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | 18 | 19 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/card_view_recycler_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/com_instance_item_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 18 | 25 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/com_instance_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/common_top_bar_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 14 | 15 | 21 | 22 | 28 | 29 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/crash_test_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 |