├── .gitignore ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── libs │ ├── alipaySDK-20150818.jar │ ├── armeabi │ │ └── libbspatch.so │ ├── baidumapapi_v3_5_0.jar │ ├── butterknife-6.1.0.jar │ ├── gson-2.2.4.jar │ ├── javax.inject.jar │ ├── libammsdk.jar │ ├── umeng-analytics-v5.6.1.jar │ ├── umeng-update-v2.6.0.1.jar │ ├── universal-image-loader-1.9.4.jar │ └── volley.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── randian │ │ └── win │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── protocal │ │ ├── agreement.html │ │ └── css │ │ ├── agreement.css │ │ └── common.css │ ├── java │ └── com │ │ └── randian │ │ └── win │ │ ├── RanDianApplication.java │ │ ├── model │ │ ├── Coach.java │ │ ├── Comment.java │ │ ├── CommentItem.java │ │ ├── Consumer.java │ │ ├── Coupon.java │ │ ├── ErrorCode.java │ │ ├── Order.java │ │ ├── PayResult.java │ │ ├── Sport.java │ │ ├── Time.java │ │ └── WxInfo.java │ │ ├── support │ │ ├── AccountController.java │ │ ├── SafeAsyncTask │ │ │ ├── Ln.java │ │ │ ├── SafeAsyncTask.java │ │ │ └── Strings.java │ │ ├── Session.java │ │ ├── dialogfragment │ │ │ ├── BaseDialogFragment.java │ │ │ ├── DialogResultListener.java │ │ │ ├── ProgressDialogFragment.java │ │ │ └── ProgressDialogTask.java │ │ └── network │ │ │ ├── ApiRequest.java │ │ │ ├── BaseArrayRequest.java │ │ │ ├── BaseRequest.java │ │ │ └── OkRequest.java │ │ ├── ui │ │ ├── HomeActivity.java │ │ ├── HomePagerAdapter.java │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragment.java │ │ │ ├── FooterView.java │ │ │ ├── ListBaseFragment.java │ │ │ └── SliderDescriptionAnimation.java │ │ ├── coach │ │ │ ├── CoachDetailActivity.java │ │ │ ├── CoachDetailBaseActivity.java │ │ │ ├── CoachListAdapter.java │ │ │ ├── CoachListFragment.java │ │ │ ├── CommentListActivity.java │ │ │ └── CommentListAdapter.java │ │ ├── coupon │ │ │ ├── CouponListActivity.java │ │ │ └── CouponListAdapter.java │ │ ├── order │ │ │ ├── CalendarAdapter.java │ │ │ ├── CalendarFragment.java │ │ │ ├── OrderCalendarAdapter.java │ │ │ ├── OrderChooseCoachActivity.java │ │ │ ├── OrderChooseCoachBaseActivity.java │ │ │ ├── OrderChooseTimeActivity.java │ │ │ ├── OrderCoachListAdapter.java │ │ │ ├── OrderCommentDialogFragment.java │ │ │ ├── OrderConfirmActivity.java │ │ │ ├── OrderCustomerInfoActivity.java │ │ │ ├── OrderDetailActivity.java │ │ │ ├── OrderListAdapter.java │ │ │ ├── OrderListFragment.java │ │ │ └── OrderPayActivity.java │ │ ├── personal │ │ │ ├── AboutUsActivity.java │ │ │ ├── FeedbackActivity.java │ │ │ ├── MyAgreementActivity.java │ │ │ ├── MyCouponActivity.java │ │ │ ├── MyCouponListAdapter.java │ │ │ └── PersonalFragment.java │ │ ├── sport │ │ │ ├── SportDetailActivity.java │ │ │ ├── SportListAdapter.java │ │ │ ├── SportListAdapter_bak.java │ │ │ └── SportListFragment.java │ │ └── welcome │ │ │ ├── LoginActivity.java │ │ │ ├── SplashActivity.java │ │ │ └── indicator │ │ │ ├── IndicatorActivity.java │ │ │ ├── IntroImageAdapter.java │ │ │ ├── IntroImagePageFragment.java │ │ │ └── StartPageFragment.java │ │ ├── utils │ │ ├── Consts.java │ │ ├── ErrorHandler.java │ │ ├── HttpClient.java │ │ ├── LogUtils.java │ │ ├── MockUtils.java │ │ ├── TimeUtils.java │ │ ├── Toaster.java │ │ ├── UIUtils.java │ │ └── Utils.java │ │ ├── view │ │ └── ScrollExposeListView.java │ │ └── wxapi │ │ └── WXPayEntryActivity.java │ ├── jniLibs │ ├── arm64-v8a │ │ └── libBaiduMapSDK_v3_5_0_31.so │ ├── armeabi-v7a │ │ └── libBaiduMapSDK_v3_5_0_31.so │ ├── armeabi │ │ └── libBaiduMapSDK_v3_5_0_31.so │ ├── libBaiduMapSDK_v3_5_0_31.so │ ├── x86 │ │ └── libBaiduMapSDK_v3_5_0_31.so │ └── x86_64 │ │ └── libBaiduMapSDK_v3_5_0_31.so │ └── res │ ├── drawable-hdpi │ ├── umeng_update_btn_check_off_focused_holo_light.png │ ├── umeng_update_btn_check_off_holo_light.png │ ├── umeng_update_btn_check_off_pressed_holo_light.png │ ├── umeng_update_btn_check_on_focused_holo_light.png │ ├── umeng_update_btn_check_on_holo_light.png │ ├── umeng_update_btn_check_on_pressed_holo_light.png │ ├── umeng_update_close_bg_normal.png │ └── umeng_update_close_bg_tap.png │ ├── drawable-xhdpi │ ├── aboutus.png │ ├── actionbar_arrow.png │ ├── actionbar_logo.png │ ├── address_search_item_click.xml │ ├── arrow_right_grey.png │ ├── avatar_placeholder.png │ ├── avatar_sample.jpg │ ├── banner1.jpg │ ├── banner2.png │ ├── banner3.jpg │ ├── banner4.jpg │ ├── bubble.png │ ├── bubble_grey.png │ ├── bubble_grey_high.png │ ├── choose_coach_grey.png │ ├── choose_coach_orange.png │ ├── coach_list_header.jpg │ ├── coupon_invalid.png │ ├── coupon_valid.png │ ├── edit_content_shape.xml │ ├── icon_aboutus.png │ ├── icon_address.png │ ├── icon_address_grey.png │ ├── icon_checked.png │ ├── icon_class.png │ ├── icon_clock.png │ ├── icon_clock_orange.jpg │ ├── icon_close.png │ ├── icon_coach.png │ ├── icon_coupon.png │ ├── icon_feedback.png │ ├── icon_grey_point.png │ ├── icon_invite_code.png │ ├── icon_login_phone.png │ ├── icon_myorder.png │ ├── icon_open.png │ ├── icon_orange_point.png │ ├── icon_order.png │ ├── icon_order_again.png │ ├── icon_order_grey.png │ ├── icon_order_num.png │ ├── icon_phone.png │ ├── icon_time_available.png │ ├── icon_time_unavailable.png │ ├── icon_unchecked.png │ ├── icon_vericode.png │ ├── js.png │ ├── listitem_shape.xml │ ├── login_btn_shape.xml │ ├── order_btn_shape.xml │ ├── order_btn_shape_comment.xml │ ├── order_list_header.jpg │ ├── pebble.png │ ├── personal_header.jpg │ ├── splash.jpg │ ├── sport_list_header.jpg │ ├── star_gray.png │ ├── star_half.png │ ├── star_yellow.png │ ├── sub_add_btn.xml │ ├── submit_btn_shape.xml │ ├── tab1_normal.png │ ├── tab1_selected.png │ ├── tab2_normal.png │ ├── tab2_selected.png │ ├── tab3_normal.png │ ├── tab3_selected.png │ ├── tab4_normal.png │ ├── tab4_selected.png │ ├── tb_munion_icon.xml │ ├── tb_munion_item_selector.xml │ └── yj.png │ ├── drawable │ ├── umeng_common_gradient_green.xml │ ├── umeng_common_gradient_orange.xml │ ├── umeng_common_gradient_red.xml │ ├── umeng_update_button_cancel_bg_focused.xml │ ├── umeng_update_button_cancel_bg_normal.xml │ ├── umeng_update_button_cancel_bg_selector.xml │ ├── umeng_update_button_cancel_bg_tap.xml │ ├── umeng_update_button_check_selector.xml │ ├── umeng_update_button_close_bg_selector.xml │ ├── umeng_update_button_ok_bg_focused.xml │ ├── umeng_update_button_ok_bg_normal.xml │ ├── umeng_update_button_ok_bg_selector.xml │ ├── umeng_update_button_ok_bg_tap.xml │ ├── umeng_update_dialog_bg.xml │ ├── umeng_update_title_bg.xml │ └── umeng_update_wifi_disable.png │ ├── layout-v9 │ └── umeng_common_download_notification.xml │ ├── layout │ ├── about_us.xml │ ├── actionbar.xml │ ├── activity_home.xml │ ├── address_list_item.xml │ ├── calendar_item.xml │ ├── coach_detail.xml │ ├── coach_detail_sport_list_item.xml │ ├── coach_list.xml │ ├── coach_list_item.xml │ ├── comment_list.xml │ ├── comment_list_item.xml │ ├── coupon_list.xml │ ├── coupon_list_item.xml │ ├── feedback.xml │ ├── indicator.xml │ ├── intro_image.xml │ ├── login.xml │ ├── my_coupon.xml │ ├── my_coupon_list_item.xml │ ├── order1.xml │ ├── order2.xml │ ├── order3.xml │ ├── order_calendar.xml │ ├── order_choose_coach.xml │ ├── order_coach_list_item.xml │ ├── order_comment_dialog.xml │ ├── order_detail.xml │ ├── order_list.xml │ ├── order_list_item.xml │ ├── order_pay.xml │ ├── personal.xml │ ├── splash.xml │ ├── sport_detail.xml │ ├── sport_list.xml │ ├── sport_list_item.xml │ ├── sport_list_item_new.xml │ ├── start_image.xml │ ├── tb_munion_aditem.xml │ ├── umeng_common_download_notification.xml │ ├── umeng_update_dialog.xml │ ├── view_coach_detail_header.xml │ ├── view_empty_footer.xml │ ├── view_image_header_pic.xml │ ├── view_image_header_slider.xml │ ├── view_list_footer.xml │ └── view_order_coach_list_header.xml │ ├── menu │ └── menu.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── raw │ ├── comment.json │ ├── my_coupon.json │ ├── order_coach_data │ ├── order_coupon_list.json │ ├── order_detail.json │ ├── order_list.json │ └── reorder.json │ ├── values-w820dp │ └── dimens.xml │ ├── values-zh │ ├── umeng_common_strings.xml │ └── umeng_update_string.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ ├── tb_munion_strings.xml │ ├── umeng_common_strings.xml │ └── umeng_update_string.xml ├── build.gradle ├── build └── intermediates │ ├── dex-cache │ └── cache.xml │ └── gradle_project_sync_data.bin ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties ├── readmepic ├── 0.jpg ├── 1.jpg ├── 2.2.jpg ├── 2.jpg ├── 3.1.jpg ├── 3.jpg ├── 4.jpg ├── 5.jpg ├── 6.jpg ├── 7.jpg └── 8.jpg ├── settings.gradle └── thirdparty └── com └── d └── pulltorefresh └── pulltorefresh └── 1.4.3 └── pulltorefresh-1.4.3.aar /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AppStarter 2 | 3 | This is an o2o app sample,which covers a lot features you may wanna to put into you app.It also supports alipay and weixin pay. It looks like: 4 | 5 | ![](readmepic/0.jpg) 6 | 7 | 8 | ![](readmepic/1.jpg) 9 | 10 | 11 | ![](readmepic/2.jpg) 12 | 13 | 14 | ![](readmepic/2.2.jpg) 15 | 16 | 17 | ![](readmepic/3.1.jpg) 18 | 19 | 20 | ![](readmepic/3.jpg) 21 | 22 | 23 | ![](readmepic/4.jpg) 24 | 25 | 26 | ![](readmepic/5.jpg) 27 | 28 | 29 | ![](readmepic/6.jpg) 30 | 31 | 32 | ![](readmepic/7.jpg) 33 | 34 | 35 | ![](readmepic/8.jpg) 36 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.randian.win" 9 | minSdkVersion 11 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.2.0' 25 | compile 'com.viewpagerindicator:library:2.4.1@aar' 26 | compile 'com.d.pulltorefresh:pulltorefresh:1.4.3@aar' 27 | compile files('libs/libammsdk.jar') 28 | compile files('libs/alipaySDK-20150818.jar') 29 | compile 'com.squareup.picasso:picasso:2.3.2'//slider 依赖 30 | compile 'com.nineoldandroids:library:2.4.0' //slider 依赖 31 | compile 'com.daimajia.slider:library:1.1.5@aar' //image slider 32 | compile 'com.facebook.fresco:fresco:0.7.0+' 33 | } 34 | -------------------------------------------------------------------------------- /app/libs/alipaySDK-20150818.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/alipaySDK-20150818.jar -------------------------------------------------------------------------------- /app/libs/armeabi/libbspatch.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/armeabi/libbspatch.so -------------------------------------------------------------------------------- /app/libs/baidumapapi_v3_5_0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/baidumapapi_v3_5_0.jar -------------------------------------------------------------------------------- /app/libs/butterknife-6.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/butterknife-6.1.0.jar -------------------------------------------------------------------------------- /app/libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /app/libs/javax.inject.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/javax.inject.jar -------------------------------------------------------------------------------- /app/libs/libammsdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/libammsdk.jar -------------------------------------------------------------------------------- /app/libs/umeng-analytics-v5.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/umeng-analytics-v5.6.1.jar -------------------------------------------------------------------------------- /app/libs/umeng-update-v2.6.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/umeng-update-v2.6.0.1.jar -------------------------------------------------------------------------------- /app/libs/universal-image-loader-1.9.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/universal-image-loader-1.9.4.jar -------------------------------------------------------------------------------- /app/libs/volley.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DoTalkLily/AppKit/6ac33e824cff6721cd2e5a64da4836cbd5d2ff9b/app/libs/volley.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 D:\Android SDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | -libraryjars libs/alipaySDK-20150602.jar 20 | -keep class com.alipay.android.app.IAlixPay{*;} 21 | -keep class com.alipay.android.app.IAlixPay$Stub{*;} 22 | -keep class com.alipay.android.app.IRemoteServiceCallback{*;} 23 | -keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;} 24 | -keep class com.alipay.sdk.app.PayTask{ public *;} 25 | -keep class com.alipay.sdk.app.AuthTask{ public *;} -------------------------------------------------------------------------------- /app/src/androidTest/java/com/randian/win/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.randian.win; 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/assets/protocal/css/agreement.css: -------------------------------------------------------------------------------- 1 | .agreement{font-size:13px;margin:10px;line-height:1.25em}.h2{font-size:14px;font-weight:400;margin:6px 0}.item,.sub-item,.text{margin:5px 0}.text{text-indent:26px}.sub-item{text-indent:7px} -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/RanDianApplication.java: -------------------------------------------------------------------------------- 1 | package com.randian.win; 2 | 3 | import android.app.Application; 4 | import android.os.Build; 5 | 6 | import com.android.volley.RequestQueue; 7 | import com.android.volley.toolbox.Volley; 8 | import com.facebook.drawee.backends.pipeline.Fresco; 9 | import com.google.gson.Gson; 10 | import com.google.gson.GsonBuilder; 11 | import com.randian.win.support.AccountController; 12 | import com.randian.win.utils.LogUtils; 13 | 14 | /** 15 | * Created by li.lli on 2015/6/9. 16 | */ 17 | public class RanDianApplication extends Application { 18 | private static final String TAG = RanDianApplication.class.getSimpleName(); 19 | private static RanDianApplication mApp; 20 | private RequestQueue mRequestQueue; 21 | private static Gson mGson; 22 | 23 | private AccountController mAccountController; 24 | 25 | @Override 26 | public void onCreate() { 27 | super.onCreate(); 28 | mApp = this; 29 | initLogUtils(); 30 | initImageLoader(); 31 | initNetwork(); 32 | initGson(); 33 | initController(); 34 | } 35 | 36 | public static RanDianApplication getApp() { 37 | return mApp; 38 | } 39 | 40 | private void initLogUtils() { 41 | if (BuildConfig.DEBUG) { 42 | LogUtils.e(TAG, "Device Info: model=" + Build.MODEL); 43 | LogUtils.e(TAG, "Device Info: brand=" + Build.BRAND); 44 | LogUtils.e(TAG, "Device Info: device=" + Build.DEVICE); 45 | LogUtils.e(TAG, "Device Info: board=" + Build.BOARD); 46 | LogUtils.e(TAG, "Device Info: product=" + Build.PRODUCT); 47 | LogUtils.e(TAG, "Device Info: manufacturer=" + Build.MANUFACTURER); 48 | LogUtils.e(TAG, "Device Info: fingerprint=" + Build.FINGERPRINT); 49 | LogUtils.enable(); 50 | } else { 51 | LogUtils.disable(); 52 | } 53 | } 54 | 55 | private void initImageLoader() { 56 | // ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this) 57 | // .threadPoolSize(5) 58 | // .memoryCacheSizePercentage(25) 59 | // .memoryCacheSize(2 * 1024 * 1024) 60 | // .tasksProcessingOrder(QueueProcessingType.FIFO) 61 | // .build(); 62 | // 63 | // ImageLoader.getInstance().init(configuration); 64 | 65 | Fresco.initialize(this); 66 | } 67 | 68 | private void initNetwork() { 69 | mRequestQueue = Volley.newRequestQueue(RanDianApplication.getApp()); 70 | } 71 | 72 | private void initGson() { 73 | mGson = new GsonBuilder() 74 | .serializeNulls() 75 | .disableHtmlEscaping() 76 | .create(); 77 | } 78 | 79 | public static Gson getGson() { 80 | if (mGson == null) { 81 | mGson = new GsonBuilder() 82 | .serializeNulls() 83 | .disableHtmlEscaping() 84 | .excludeFieldsWithoutExposeAnnotation() 85 | .create(); 86 | } 87 | return mGson; 88 | } 89 | 90 | public void initController(){ 91 | mAccountController = new AccountController(getApp()); 92 | } 93 | 94 | public RequestQueue getVolleyQueue() { 95 | if (mRequestQueue == null) { 96 | mRequestQueue = Volley.newRequestQueue(RanDianApplication.getApp()); 97 | } 98 | return mRequestQueue; 99 | } 100 | 101 | public AccountController getAccountController() { 102 | if (mAccountController == null) { 103 | mAccountController = new AccountController(getApp()); 104 | } 105 | return mAccountController; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/Comment.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by lily on 15-8-22. 7 | */ 8 | public class Comment { 9 | private int score; 10 | private int comment_num; 11 | private List comments; 12 | 13 | public int getComment_num() { 14 | return comment_num; 15 | } 16 | 17 | public void setComment_num(int comment_num) { 18 | this.comment_num = comment_num; 19 | } 20 | 21 | public List getComments() { 22 | return comments; 23 | } 24 | 25 | public void setComments(List comments) { 26 | this.comments = comments; 27 | } 28 | 29 | public int getScore() { 30 | return score; 31 | } 32 | 33 | public void setScore(int score) { 34 | this.score = score; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/CommentItem.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by lily on 15-8-22. 7 | */ 8 | public class CommentItem implements Serializable{ 9 | private int stars; 10 | private long id; 11 | private long user_id; 12 | private long coach_id; 13 | private String mobile; 14 | private String created_at; 15 | private String content; 16 | private String order_no; 17 | 18 | public String getContent() { 19 | return content; 20 | } 21 | 22 | public void setContent(String content) { 23 | this.content = content; 24 | } 25 | 26 | public String getCreated_at() { 27 | return created_at; 28 | } 29 | 30 | public void setCreated_at(String created_at) { 31 | this.created_at = created_at; 32 | } 33 | 34 | public String getMobile() { 35 | return mobile; 36 | } 37 | 38 | public void setMobile(String mobile) { 39 | this.mobile = mobile; 40 | } 41 | 42 | public int getStars() { 43 | return stars; 44 | } 45 | 46 | public void setStars(int stars) { 47 | this.stars = stars; 48 | } 49 | 50 | public long getCoach_id() { 51 | return coach_id; 52 | } 53 | 54 | public void setCoach_id(long coach_id) { 55 | this.coach_id = coach_id; 56 | } 57 | 58 | public String getOrder_no() { 59 | return order_no; 60 | } 61 | 62 | public void setOrder_no(String order_no) { 63 | this.order_no = order_no; 64 | } 65 | 66 | public long getUser_id() { 67 | return user_id; 68 | } 69 | 70 | public void setUser_id(long user_id) { 71 | this.user_id = user_id; 72 | } 73 | 74 | public long getId() { 75 | return id; 76 | } 77 | 78 | public void setId(long id) { 79 | this.id = id; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/Consumer.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | /** 4 | * Created by lily on 15-8-3. 5 | */ 6 | public class Consumer { 7 | String consignee_address; 8 | String consignee_street; 9 | String consignee_name; 10 | long consignee_mobile; 11 | long id; 12 | 13 | public String getConsignee_address() { 14 | return consignee_address; 15 | } 16 | 17 | public void setConsignee_address(String consignee_address) { 18 | this.consignee_address = consignee_address; 19 | } 20 | 21 | public long getConsignee_mobile() { 22 | return consignee_mobile; 23 | } 24 | 25 | public void setConsignee_mobile(long consignee_mobile) { 26 | this.consignee_mobile = consignee_mobile; 27 | } 28 | 29 | public String getConsignee_name() { 30 | return consignee_name; 31 | } 32 | 33 | public void setConsignee_name(String consignee_name) { 34 | this.consignee_name = consignee_name; 35 | } 36 | 37 | public String getConsignee_street() { 38 | return consignee_street; 39 | } 40 | 41 | public void setConsignee_street(String consignee_street) { 42 | this.consignee_street = consignee_street; 43 | } 44 | 45 | public long getId() { 46 | return id; 47 | } 48 | 49 | public void setId(long id) { 50 | this.id = id; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/Coupon.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by lily on 15-8-8. 7 | */ 8 | public class Coupon implements Serializable { 9 | private long id; 10 | private long receive_mobile; 11 | private float coupon_fee; 12 | private String created_at; 13 | private String coupon_expire_at; 14 | private String coupon_state_text; 15 | private String coupon_description; 16 | 17 | public String getCoupon_description() { 18 | return coupon_description; 19 | } 20 | 21 | public void setCoupon_description(String coupon_description) { 22 | this.coupon_description = coupon_description; 23 | } 24 | 25 | public String getCoupon_expire_at() { 26 | return coupon_expire_at; 27 | } 28 | 29 | public void setCoupon_expire_at(String coupon_expire_at) { 30 | this.coupon_expire_at = coupon_expire_at; 31 | } 32 | 33 | public float getCoupon_fee() { 34 | return coupon_fee; 35 | } 36 | 37 | public void setCoupon_fee(float coupon_fee) { 38 | this.coupon_fee = coupon_fee; 39 | } 40 | 41 | public String getCoupon_state_text() { 42 | return coupon_state_text; 43 | } 44 | 45 | public void setCoupon_state_text(String coupon_state_text) { 46 | this.coupon_state_text = coupon_state_text; 47 | } 48 | 49 | public String getCreated_at() { 50 | return created_at; 51 | } 52 | 53 | public void setCreated_at(String created_at) { 54 | this.created_at = created_at; 55 | } 56 | 57 | public long getId() { 58 | return id; 59 | } 60 | 61 | public void setId(long id) { 62 | this.id = id; 63 | } 64 | 65 | public long getReceive_mobile() { 66 | return receive_mobile; 67 | } 68 | 69 | public void setReceive_mobile(long receive_mobile) { 70 | this.receive_mobile = receive_mobile; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/ErrorCode.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | /** 4 | * Created by lily on 15-8-6. 5 | */ 6 | public class ErrorCode { 7 | private int error_code; 8 | private String error; 9 | 10 | public String getError() { 11 | return error; 12 | } 13 | 14 | public void setError(String error) { 15 | this.error = error; 16 | } 17 | 18 | public int getError_code() { 19 | return error_code; 20 | } 21 | 22 | public void setError_code(int error_code) { 23 | this.error_code = error_code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/PayResult.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; import android.text.TextUtils; public class PayResult { private String resultStatus; private String result; private String memo; public PayResult(String rawResult) { if (TextUtils.isEmpty(rawResult)) return; String[] resultParams = rawResult.split(";"); for (String resultParam : resultParams) { if (resultParam.startsWith("resultStatus")) { resultStatus = gatValue(resultParam, "resultStatus"); } if (resultParam.startsWith("result")) { result = gatValue(resultParam, "result"); } if (resultParam.startsWith("memo")) { memo = gatValue(resultParam, "memo"); } } } @Override public String toString() { return "resultStatus={" + resultStatus + "};memo={" + memo + "};result={" + result + "}"; } private String gatValue(String content, String key) { String prefix = key + "={"; return content.substring(content.indexOf(prefix) + prefix.length(), content.lastIndexOf("}")); } /** * @return the resultStatus */ public String getResultStatus() { return resultStatus; } /** * @return the memo */ public String getMemo() { return memo; } /** * @return the result */ public String getResult() { return result; } } -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/Sport.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by li.lli on 2015/6/8. 8 | */ 9 | public class Sport implements Serializable { 10 | private long id; 11 | private String name; 12 | private float price; 13 | private float coach_price; 14 | private int duration; 15 | private int max_user_num; 16 | private int min_user_num; 17 | private float original_price; 18 | private String suggest; 19 | private String created_at; 20 | private String updated_at; 21 | private String head_image_url; 22 | private String description; 23 | private List detail_image_urls; 24 | 25 | public String getDescription() { 26 | return description; 27 | } 28 | 29 | public void setDescription(String description) { 30 | this.description = description; 31 | } 32 | 33 | public long getId() { 34 | return id; 35 | } 36 | 37 | public void setId(long id) { 38 | this.id = id; 39 | } 40 | 41 | public String getName() { 42 | return name; 43 | } 44 | 45 | public void setName(String name) { 46 | this.name = name; 47 | } 48 | 49 | public float getPrice() { 50 | return price; 51 | } 52 | 53 | public void setPrice(float price) { 54 | this.price = price; 55 | } 56 | 57 | public int getDuration() { 58 | return duration; 59 | } 60 | 61 | public void setDuration(int duration) { 62 | this.duration = duration; 63 | } 64 | 65 | public int getMax_user_num() { 66 | return max_user_num; 67 | } 68 | 69 | public void setMax_user_num(int max_user_num) { 70 | this.max_user_num = max_user_num; 71 | } 72 | 73 | public int getMin_user_num() { 74 | return min_user_num; 75 | } 76 | 77 | public void setMin_user_num(int min_user_num) { 78 | this.min_user_num = min_user_num; 79 | } 80 | 81 | public float getOriginal_price() { 82 | return original_price; 83 | } 84 | 85 | public void setOriginal_price(float original_price) { 86 | this.original_price = original_price; 87 | } 88 | 89 | public String getHead_image_url() { 90 | return head_image_url; 91 | } 92 | 93 | public void setHead_image_url(String head_image_url) { 94 | this.head_image_url = head_image_url; 95 | } 96 | 97 | public String getCreated_at() { 98 | return created_at; 99 | } 100 | 101 | public void setCreated_at(String created_at) { 102 | this.created_at = created_at; 103 | } 104 | 105 | public String getUpdated_at() { 106 | return updated_at; 107 | } 108 | 109 | public void setUpdated_at(String updated_at) { 110 | this.updated_at = updated_at; 111 | } 112 | 113 | public List getDetail_image_urls() { 114 | return detail_image_urls; 115 | } 116 | 117 | public void setDetail_image_urls(List detail_image_urls) { 118 | this.detail_image_urls = detail_image_urls; 119 | } 120 | 121 | public String getSuggest() { 122 | return suggest; 123 | } 124 | 125 | public void setSuggest(String suggest) { 126 | this.suggest = suggest; 127 | } 128 | 129 | public float getCoach_price() { 130 | return coach_price; 131 | } 132 | 133 | public void setCoach_price(float coach_price) { 134 | this.coach_price = coach_price; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/Time.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | /** 4 | * Created by lily on 15-7-27. 5 | */ 6 | public class Time { 7 | private String time; 8 | private boolean available; 9 | 10 | public String getTime() { 11 | return time; 12 | } 13 | 14 | public void setTime(String time) { 15 | this.time = time; 16 | } 17 | 18 | public boolean isAvailable() { 19 | return available; 20 | } 21 | 22 | public void setAvailable(boolean available) { 23 | this.available = available; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/model/WxInfo.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.model; 2 | 3 | /** 4 | * Created by lily on 15-8-30. 5 | * 微信支付相关参数,参见:https://pay.weixin.qq.com/wiki/doc/api/app.php?chapter=9_12 6 | */ 7 | public class WxInfo { 8 | private String sign; 9 | private String appid; 10 | private String noncestr; 11 | private String prepayid; 12 | private String partnerid; 13 | private String timestamp; 14 | 15 | public String getAppid() { 16 | return appid; 17 | } 18 | 19 | public void setAppid(String appid) { 20 | this.appid = appid; 21 | } 22 | 23 | public String getNoncestr() { 24 | return noncestr; 25 | } 26 | 27 | public void setNoncestr(String noncestr) { 28 | this.noncestr = noncestr; 29 | } 30 | 31 | public String getPartnerid() { 32 | return partnerid; 33 | } 34 | 35 | public void setPartnerid(String partnerid) { 36 | this.partnerid = partnerid; 37 | } 38 | 39 | public String getPrepayid() { 40 | return prepayid; 41 | } 42 | 43 | public void setPrepayid(String prepayid) { 44 | this.prepayid = prepayid; 45 | } 46 | 47 | public String getSign() { 48 | return sign; 49 | } 50 | 51 | public void setSign(String sign) { 52 | this.sign = sign; 53 | } 54 | 55 | public String getTimestamp() { 56 | return timestamp; 57 | } 58 | 59 | public void setTimestamp(String timestamp) { 60 | this.timestamp = timestamp; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/AccountController.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support; 2 | 3 | import android.content.Context; 4 | 5 | import com.randian.win.utils.UIUtils; 6 | 7 | /** 8 | * Created by lily on 15-7-18. 9 | */ 10 | public class AccountController { 11 | 12 | private Context mContext; 13 | private Session mSession; 14 | 15 | private static String TAG = AccountController.class.getName(); 16 | 17 | public AccountController(Context context) { 18 | this.mContext = context; 19 | init(); 20 | } 21 | 22 | public void init() { 23 | mSession = Session.get(mContext); 24 | } 25 | 26 | public boolean isLogin() { 27 | return mSession!=null && !"0".equals(mSession.getUserId()); 28 | } 29 | 30 | public String getCurrentUserId() { 31 | return mSession.getUserId(); 32 | } 33 | 34 | public void logout() { 35 | mSession.delete(mContext); 36 | UIUtils.startSplashActivity(mContext); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/dialogfragment/BaseDialogFragment.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support.dialogfragment; 2 | 3 | import android.app.Activity; 4 | import android.content.DialogInterface; 5 | import android.os.Bundle; 6 | import android.support.v4.app.DialogFragment; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v4.app.FragmentActivity; 9 | import android.support.v4.app.FragmentManager; 10 | import android.support.v4.app.FragmentTransaction; 11 | 12 | /** 13 | * Created with IntelliJ IDEA. 14 | * User: zeyiwu 15 | * Date: 13-9-29 16 | * Time: 下午12:32 17 | */ 18 | public class BaseDialogFragment extends DialogFragment implements 19 | DialogInterface.OnClickListener { 20 | 21 | protected static final String ARG_TITLE = "title"; 22 | protected static final String ARG_MESSAGE = "message"; 23 | protected static final String ARG_REQUESTCODE = "request_code"; 24 | private DialogResultListener mListener; 25 | 26 | public static void show(FragmentActivity activity, 27 | BaseDialogFragment fragment, 28 | Bundle arguments, 29 | String tag) { 30 | FragmentManager manager = activity.getSupportFragmentManager(); 31 | FragmentTransaction transaction = manager.beginTransaction(); 32 | Fragment current = manager.findFragmentByTag(tag); 33 | if (current != null) { 34 | transaction.remove(current); 35 | } 36 | 37 | fragment.setArguments(arguments); 38 | fragment.show(manager, tag); 39 | } 40 | 41 | public static void dismiss(FragmentActivity activity, String tag) { 42 | FragmentManager manager = activity.getSupportFragmentManager(); 43 | FragmentTransaction transaction = manager.beginTransaction(); 44 | Fragment current = manager.findFragmentByTag(tag); 45 | if (current != null) { 46 | transaction.remove(current); 47 | } 48 | 49 | transaction.commitAllowingStateLoss(); 50 | } 51 | 52 | public void setDialogResultListener(DialogResultListener listener) { 53 | mListener = listener; 54 | } 55 | 56 | protected static Bundle createArguments(final String title, 57 | final String message, 58 | final int requestCode) { 59 | Bundle bundle = new Bundle(); 60 | bundle.putString(ARG_TITLE, title); 61 | bundle.putString(ARG_MESSAGE, message); 62 | bundle.putInt(ARG_REQUESTCODE, requestCode); 63 | return bundle; 64 | } 65 | 66 | protected void onResult(int resultCode) { 67 | if (mListener != null) { 68 | Bundle bundle = getArguments(); 69 | if (bundle != null) { 70 | mListener.onDialogResult(bundle.getInt(ARG_REQUESTCODE), resultCode, bundle); 71 | } 72 | } 73 | } 74 | 75 | protected String getMessage() { 76 | return getArguments().getString(ARG_MESSAGE); 77 | } 78 | 79 | protected String getTitle() { 80 | return getArguments().getString(ARG_TITLE); 81 | } 82 | 83 | @Override 84 | public void onCancel(DialogInterface dialog) { 85 | onResult(Activity.RESULT_CANCELED); 86 | } 87 | 88 | @Override 89 | public void onClick(DialogInterface dialog, int which) { 90 | dialog.dismiss(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/dialogfragment/DialogResultListener.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support.dialogfragment; 2 | 3 | import android.os.Bundle; 4 | 5 | /** 6 | * Created with IntelliJ IDEA. 7 | * User: zeyiwu 8 | * Date: 13-9-29 9 | * Time: 下午12:33 10 | */ 11 | public interface DialogResultListener { 12 | /** 13 | * Callback for a dialog finishing and delivering a result 14 | * 15 | */ 16 | void onDialogResult(int requestCode, int resultCode, Bundle arguments); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/dialogfragment/ProgressDialogFragment.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support.dialogfragment; 2 | 3 | import android.app.Dialog; 4 | import android.app.ProgressDialog; 5 | import android.content.Context; 6 | import android.os.Bundle; 7 | import android.support.v4.app.FragmentActivity; 8 | 9 | /** 10 | * Created with IntelliJ IDEA. 11 | * User: zeyiwu 12 | * Date: 13-9-4 13 | * Time: 下午1:56 14 | */ 15 | public class ProgressDialogFragment extends BaseDialogFragment { 16 | private static final String TAG = ProgressDialogFragment.class.getSimpleName(); 17 | private String mMessage; 18 | 19 | public ProgressDialogFragment() {} 20 | 21 | public static ProgressDialogFragment show(FragmentActivity activity, int messageID, int requestCode) { 22 | return show(activity, activity.getString(messageID), requestCode); 23 | } 24 | 25 | public static ProgressDialogFragment show(FragmentActivity activity, String message, int requestCode) { 26 | Bundle bundle = createArguments(null, message, requestCode); 27 | ProgressDialogFragment fragment = new ProgressDialogFragment(); 28 | show(activity, fragment, bundle, ProgressDialogFragment.class.getSimpleName()); 29 | return fragment; 30 | } 31 | 32 | public static void dismiss(FragmentActivity activity) { 33 | if (activity != null && !activity.isFinishing()) { 34 | dismiss(activity, ProgressDialogFragment.class.getSimpleName()); 35 | } 36 | } 37 | 38 | public ProgressDialogFragment(String message) { 39 | mMessage = message; 40 | } 41 | 42 | public ProgressDialogFragment(Context context, int resId) { 43 | new ProgressDialogFragment(context.getString(resId)); 44 | } 45 | 46 | @Override 47 | public Dialog onCreateDialog(Bundle savedInstanceState) { 48 | Bundle bundle = getArguments(); 49 | if (bundle != null) { 50 | mMessage = getMessage(); 51 | } 52 | ProgressDialog progressDialog = new ProgressDialog(getActivity()); 53 | progressDialog.setMessage(mMessage); 54 | progressDialog.setIndeterminate(true); 55 | progressDialog.setCancelable(true); 56 | progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 57 | return progressDialog; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/dialogfragment/ProgressDialogTask.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support.dialogfragment; 2 | 3 | import android.support.v4.app.FragmentActivity; 4 | 5 | import com.randian.win.support.SafeAsyncTask.SafeAsyncTask; 6 | import com.randian.win.utils.ErrorHandler; 7 | 8 | /** 9 | * Created with IntelliJ IDEA. 10 | * User: zeyiwu 11 | * Date: 13-9-24 12 | * Time: 下午2:16 13 | */ 14 | public abstract class ProgressDialogTask extends SafeAsyncTask { 15 | 16 | private FragmentActivity mActivity; 17 | private String mMessage; 18 | private DialogResultListener mListener; 19 | 20 | public ProgressDialogTask(FragmentActivity activity, int resID) { 21 | super(); 22 | mActivity = activity; 23 | mMessage = activity.getString(resID); 24 | } 25 | 26 | public ProgressDialogTask(FragmentActivity activity, String message) { 27 | super(); 28 | mActivity = activity; 29 | mMessage = message; 30 | } 31 | 32 | public void setDialogResultListener(DialogResultListener listener) { 33 | mListener = listener; 34 | } 35 | 36 | private void showIndeterminate(final String message, final int requestCode) { 37 | ProgressDialogFragment fragment = ProgressDialogFragment.show(mActivity, message, requestCode); 38 | fragment.setDialogResultListener(mListener); 39 | } 40 | 41 | private void showIndeterminate(final int messageID, final int requestCode) { 42 | ProgressDialogFragment fragment = ProgressDialogFragment.show(mActivity, messageID, requestCode); 43 | fragment.setDialogResultListener(mListener); 44 | } 45 | 46 | public void start(final int requestCode) { 47 | showIndeterminate(mMessage, requestCode); 48 | execute(); 49 | } 50 | 51 | public void start() { 52 | start(0); 53 | } 54 | 55 | @Override 56 | public T call() throws Exception { 57 | return run(); 58 | } 59 | 60 | @Override 61 | protected void onSuccess(T t) throws Exception { 62 | ProgressDialogFragment.dismiss(mActivity); 63 | } 64 | 65 | @Override 66 | protected void onException(Exception e) throws RuntimeException { 67 | ProgressDialogFragment.dismiss(mActivity); 68 | ErrorHandler.handleException(mActivity, e); 69 | } 70 | 71 | protected abstract T run() throws Exception; 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/network/ApiRequest.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support.network; 2 | 3 | import com.android.volley.NetworkResponse; 4 | import com.android.volley.Response; 5 | 6 | 7 | /** 8 | * Created by Lily on 15-06-12 9 | */ 10 | public abstract class ApiRequest extends OkRequest { 11 | 12 | /** 13 | * 构造函数 14 | * 15 | * @param method 请求方法 Method.GET 等 16 | * @param url 请求的URL 17 | * @param errorListener 出错回调 18 | */ 19 | public ApiRequest(int method, String url, Response.ErrorListener errorListener) { 20 | super(method, url, errorListener); 21 | } 22 | 23 | protected abstract Response parseNetworkResponse(NetworkResponse response); 24 | 25 | /** 26 | * 构造函数 27 | * 28 | * @param method 请求方法 Method.GET 等 29 | * @param url 请求的URL 30 | * @param listener 成功回调 31 | * @param errorListener 出错回调 32 | */ 33 | public ApiRequest(int method, String url, Response.Listener listener, Response.ErrorListener errorListener) { 34 | this(method, url, errorListener); 35 | setReseponseListener(listener); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/network/BaseArrayRequest.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support.network; 2 | 3 | import android.os.SystemClock; 4 | 5 | import com.android.volley.NetworkResponse; 6 | import com.android.volley.ParseError; 7 | import com.android.volley.Response; 8 | import com.android.volley.VolleyError; 9 | import com.android.volley.VolleyLog; 10 | import com.android.volley.toolbox.HttpHeaderParser; 11 | 12 | import org.json.JSONArray; 13 | import org.json.JSONException; 14 | 15 | import java.io.UnsupportedEncodingException; 16 | 17 | public class BaseArrayRequest extends ApiRequest { 18 | 19 | private long mRequestBeginTime = 0; 20 | 21 | public BaseArrayRequest(int method, String url, Response.Listener listener, 22 | Response.ErrorListener errorListener) { 23 | super(method, url, listener, errorListener); 24 | } 25 | 26 | @Override 27 | //解析返回的数据 28 | protected Response parseNetworkResponse(NetworkResponse response) { 29 | try { 30 | byte[] data = response.data; 31 | String json = new String(data, HttpHeaderParser.parseCharset(response.headers)); 32 | if (VolleyLog.DEBUG) { 33 | VolleyLog.d("response:%s", json); 34 | } 35 | return Response.success(new JSONArray(json), HttpHeaderParser.parseCacheHeaders(response)); 36 | } catch (UnsupportedEncodingException e) { 37 | return Response.error(new ParseError(e)); 38 | } catch (JSONException e) { 39 | return Response.error(new ParseError(e)); 40 | } 41 | } 42 | 43 | @Override 44 | public void addMarker(String tag) { 45 | super.addMarker(tag); 46 | if (mRequestBeginTime == 0) { 47 | mRequestBeginTime = SystemClock.elapsedRealtime(); 48 | } 49 | } 50 | 51 | @Override 52 | protected void deliverResponse(JSONArray jsonArray) { 53 | super.deliverResponse(jsonArray); 54 | //请求用掉的总时间 55 | long requestTime = SystemClock.elapsedRealtime() - mRequestBeginTime; 56 | } 57 | 58 | @Override 59 | //可以自己在这里完成错误的自定义处理 60 | public void deliverError(VolleyError error) { 61 | super.deliverError(error); 62 | //错误发生时候response的数据 byte[] 63 | //error.networkResponse.data; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/support/network/BaseRequest.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.support.network; 2 | 3 | import android.os.SystemClock; 4 | 5 | import com.android.volley.NetworkResponse; 6 | import com.android.volley.ParseError; 7 | import com.android.volley.Response; 8 | import com.android.volley.VolleyError; 9 | import com.android.volley.VolleyLog; 10 | import com.android.volley.toolbox.HttpHeaderParser; 11 | import com.randian.win.utils.LogUtils; 12 | 13 | import java.io.UnsupportedEncodingException; 14 | 15 | public class BaseRequest extends ApiRequest { 16 | 17 | private long mRequestBeginTime = 0; 18 | private final String TAG = BaseRequest.class.getSimpleName(); 19 | 20 | public BaseRequest(int method, String url, Response.Listener listener, 21 | Response.ErrorListener errorListener) { 22 | super(method, url, listener, errorListener); 23 | } 24 | 25 | @Override 26 | //解析返回的数据 27 | protected Response parseNetworkResponse(NetworkResponse response) { 28 | try { 29 | byte[] data = response.data; 30 | String json = new String(data, HttpHeaderParser.parseCharset(response.headers)); 31 | LogUtils.d(TAG, json); 32 | if (VolleyLog.DEBUG) { 33 | VolleyLog.d("response:%s", json); 34 | } 35 | return Response.success(json, HttpHeaderParser.parseCacheHeaders(response)); 36 | } catch (UnsupportedEncodingException e) { 37 | return Response.error(new ParseError(e)); 38 | } 39 | } 40 | 41 | @Override 42 | public void addMarker(String tag) { 43 | super.addMarker(tag); 44 | if (mRequestBeginTime == 0) { 45 | mRequestBeginTime = SystemClock.elapsedRealtime(); 46 | } 47 | } 48 | 49 | @Override 50 | protected void deliverResponse(String result) { 51 | super.deliverResponse(result); 52 | //请求用掉的总时间 53 | long requestTime = SystemClock.elapsedRealtime() - mRequestBeginTime; 54 | } 55 | 56 | @Override 57 | //可以自己在这里完成错误的自定义处理 58 | public void deliverError(VolleyError error) { 59 | super.deliverError(error); 60 | //错误发生时候response的数据 byte[] 61 | //error.networkResponse.data; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/HomePagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui; 2 | 3 | import android.content.Context; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentPagerAdapter; 7 | 8 | import com.randian.win.ui.base.BaseFragment; 9 | import com.randian.win.ui.coach.CoachListFragment; 10 | import com.randian.win.ui.personal.PersonalFragment; 11 | import com.randian.win.ui.order.OrderListFragment; 12 | import com.randian.win.ui.sport.SportListFragment; 13 | 14 | import java.util.HashMap; 15 | 16 | 17 | public class HomePagerAdapter extends FragmentPagerAdapter { 18 | 19 | private Context mContext; 20 | private HashMap mFragments; 21 | 22 | public HomePagerAdapter(Context context, FragmentManager fm) { 23 | super(fm); 24 | mContext = context; 25 | mFragments = new HashMap<>(); 26 | mFragments.put(0, new SportListFragment()); 27 | mFragments.put(1, new CoachListFragment()); 28 | mFragments.put(2, new OrderListFragment()); 29 | mFragments.put(3, new PersonalFragment()); 30 | } 31 | 32 | @Override 33 | public BaseFragment getItem(int i) { 34 | return mFragments.get(i); 35 | } 36 | 37 | @Override 38 | public int getItemPosition(Object object) { 39 | return FragmentPagerAdapter.POSITION_NONE; 40 | } 41 | 42 | 43 | @Override 44 | public int getCount() { 45 | return 4; 46 | } 47 | 48 | public Fragment getFragment(int index) { 49 | BaseFragment fragment = mFragments.get(index); 50 | if (fragment != null) { 51 | return fragment; 52 | } 53 | return null; 54 | } 55 | 56 | public void changeFragment(int position, BaseFragment fragment) { 57 | if (position >= getCount() && fragment == null) { 58 | return; 59 | } 60 | mFragments.put(position, fragment); 61 | notifyDataSetChanged(); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui.base; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.ActionBar; 5 | import android.support.v7.app.ActionBarActivity; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | 9 | import com.android.volley.Request; 10 | import com.android.volley.RequestQueue; 11 | import com.randian.win.R; 12 | import com.randian.win.RanDianApplication; 13 | import com.umeng.analytics.MobclickAgent; 14 | 15 | /** 16 | * Created by li.lli on 2015/6/7. 17 | */ 18 | public class BaseActivity extends AppCompatActivity { 19 | 20 | protected RequestQueue mQueue; 21 | protected ActionBar mActionbar; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | mQueue = RanDianApplication.getApp().getVolleyQueue(); 27 | initActionBar(); 28 | } 29 | 30 | @Override 31 | protected void onResume() { 32 | super.onResume(); 33 | MobclickAgent.onResume(this);//you meng 34 | } 35 | 36 | @Override 37 | protected void onPause() { 38 | super.onPause(); 39 | MobclickAgent.onPause(this); 40 | } 41 | 42 | protected void addRequest(Request request) { 43 | mQueue.add(request); 44 | } 45 | 46 | protected RequestQueue getRequestQueue() { 47 | return mQueue; 48 | } 49 | 50 | @Override 51 | public void onDestroy() { 52 | getRequestQueue().cancelAll(this); 53 | super.onDestroy(); 54 | } 55 | 56 | protected void initActionBar() { 57 | mActionbar = getSupportActionBar(); 58 | if (mActionbar == null) { 59 | return; 60 | } 61 | mActionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); 62 | mActionbar.setDisplayShowCustomEnabled(true); 63 | mActionbar.setCustomView(R.layout.actionbar); 64 | mActionbar.getCustomView().findViewById(R.id.iv_tab_back).setOnClickListener(new View.OnClickListener() { 65 | @Override 66 | public void onClick(View v) { 67 | finish(); 68 | } 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui.base; 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.android.volley.Request; 10 | import com.android.volley.RequestQueue; 11 | import com.randian.win.RanDianApplication; 12 | 13 | /** 14 | * Created by Lily 15 | */ 16 | public class BaseFragment extends Fragment { 17 | 18 | protected RequestQueue mQueue; 19 | 20 | @Override 21 | public void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | mQueue = RanDianApplication.getApp().getVolleyQueue(); 24 | } 25 | 26 | @Override 27 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 28 | return super.onCreateView(inflater, container, savedInstanceState); 29 | } 30 | 31 | protected void addRequest(Request request) { 32 | mQueue.add(request); 33 | } 34 | 35 | protected RequestQueue getRequestQueue() { 36 | return mQueue; 37 | } 38 | 39 | @Override 40 | public void onDestroy() { 41 | getRequestQueue().cancelAll(this); 42 | super.onDestroy(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/base/SliderDescriptionAnimation.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui.base; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.animation.ValueAnimator; 5 | import android.view.View; 6 | 7 | import com.daimajia.slider.library.Animations.BaseAnimationInterface; 8 | import com.nineoldandroids.view.ViewHelper; 9 | import com.randian.win.R; 10 | 11 | /** 12 | * Created by lily on 15-9-4. 13 | */ 14 | public class SliderDescriptionAnimation implements BaseAnimationInterface { 15 | /** 16 | * When current item is going to leave, let's make the description layout disappear. 17 | */ 18 | @Override 19 | public void onPrepareCurrentItemLeaveScreen(View current) { 20 | View descriptionLayout = current.findViewById(R.id.description_layout); 21 | if (descriptionLayout != null) { 22 | current.findViewById(R.id.description_layout).setVisibility(View.INVISIBLE); 23 | } 24 | } 25 | 26 | /** 27 | * When next item is coming to show, let's hide the description layout. 28 | */ 29 | @Override 30 | public void onPrepareNextItemShowInScreen(View next) { 31 | View descriptionLayout = next.findViewById(R.id.description_layout); 32 | if (descriptionLayout != null) { 33 | next.findViewById(R.id.description_layout).setVisibility(View.INVISIBLE); 34 | } 35 | } 36 | 37 | @Override 38 | public void onCurrentItemDisappear(View current) { 39 | 40 | } 41 | 42 | /** 43 | * When next item is shown, let's make an animation to show the 44 | * description layout. 45 | */ 46 | @Override 47 | public void onNextItemAppear(View next) { 48 | View descriptionLayout = next.findViewById(R.id.description_layout); 49 | if (descriptionLayout != null) { 50 | next.findViewById(R.id.description_layout).setVisibility(View.INVISIBLE); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/coach/CoachDetailBaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui.coach; 2 | 3 | import android.net.Uri; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.ImageView; 7 | import android.widget.LinearLayout; 8 | import android.widget.ListView; 9 | import android.widget.TextView; 10 | 11 | import com.facebook.drawee.view.SimpleDraweeView; 12 | import com.randian.win.R; 13 | import com.randian.win.model.Coach; 14 | import com.randian.win.ui.base.BaseActivity; 15 | 16 | 17 | /** 18 | * Created by lily on 15-7-5. 19 | */ 20 | public class CoachDetailBaseActivity extends BaseActivity { 21 | 22 | protected View mHeaderView; 23 | protected Coach mCoach; 24 | protected TextView mDescription; 25 | protected ImageView mDescBtn; 26 | protected ListView mListView; 27 | protected TextView mTips; 28 | protected TextView mAboutCoach; 29 | protected ViewGroup mCommentStars; 30 | protected TextView mCommentCount; 31 | protected TextView mCommentScore; 32 | protected View mCommentDivider; 33 | protected View mCommentContainer; 34 | protected ImageView mImageWrapper; 35 | 36 | protected void initHeader() { 37 | mHeaderView = getLayoutInflater().inflate(R.layout.view_coach_detail_header, null); 38 | mDescBtn = (ImageView)mHeaderView.findViewById(R.id.desc_btn); 39 | mImageWrapper = (ImageView)mHeaderView.findViewById(R.id.avatar_wrapper); 40 | mAboutCoach = (TextView)mHeaderView.findViewById(R.id.about_coach); 41 | mDescription = (TextView)mHeaderView.findViewById(R.id.desc_content); 42 | mTips = (TextView) mHeaderView.findViewById(R.id.tips); 43 | mCommentContainer = mHeaderView.findViewById(R.id.comment_container); 44 | mCommentDivider = mHeaderView.findViewById(R.id.comment_divider); 45 | mCommentCount = (TextView) mHeaderView.findViewById(R.id.comment_count); 46 | mCommentScore = (TextView) mHeaderView.findViewById(R.id.comment_score); 47 | mCommentStars = (LinearLayout) mHeaderView.findViewById(R.id.comment_star); 48 | ((TextView)mHeaderView.findViewById(R.id.coach_title)).setText(mCoach.getName()); 49 | ((TextView)mHeaderView.findViewById(R.id.coach_gender)).setText(mCoach.getSex()); 50 | ((TextView)mHeaderView.findViewById(R.id.category)).setText(mCoach.getCategories()); 51 | ((TextView)mHeaderView.findViewById(R.id.order_num)).setText(mCoach.getOrder_num() + " 单"); 52 | ((TextView)mHeaderView.findViewById(R.id.available_area)).setText(mCoach.getAvailable_areas()); 53 | mListView.addHeaderView(mHeaderView); 54 | ((SimpleDraweeView) mHeaderView.findViewById(R.id.avatar_image)).setImageURI(Uri.parse(mCoach.getProfile_image_url())); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/coach/CoachListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui.coach; 2 | 3 | import android.content.Context; 4 | import android.net.Uri; 5 | import android.text.Html; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | import com.facebook.drawee.view.SimpleDraweeView; 14 | import com.randian.win.R; 15 | import com.randian.win.model.Coach; 16 | import com.randian.win.utils.Consts; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import butterknife.ButterKnife; 22 | import butterknife.InjectView; 23 | 24 | /** 25 | * Created by li.lli on 2015/6/8. 26 | */ 27 | public class CoachListAdapter extends BaseAdapter{ 28 | Context mContext; 29 | List mData; 30 | 31 | public CoachListAdapter(Context context){ 32 | mContext = context; 33 | mData = new ArrayList<>(); 34 | } 35 | 36 | public void setData(List data) { 37 | if (data == null) { 38 | return; 39 | } 40 | mData.clear(); 41 | mData.addAll(data); 42 | notifyDataSetChanged(); 43 | } 44 | 45 | public void addData(List data) { 46 | if (data != null && !data.isEmpty()) { 47 | mData.addAll(data); 48 | notifyDataSetChanged(); 49 | } 50 | } 51 | 52 | @Override 53 | public int getCount() { 54 | return mData == null ? 0 : mData .size(); 55 | } 56 | 57 | @Override 58 | public Coach getItem(int i) { 59 | if(mData == null || mData.size() <= i){ 60 | return null; 61 | } 62 | return mData.get(i); 63 | } 64 | 65 | @Override 66 | public long getItemId(int i) { 67 | return 0; 68 | } 69 | 70 | @Override 71 | public View getView(int position, View convertView, ViewGroup parent) { 72 | ViewHolder holder; 73 | 74 | if (convertView == null) { 75 | convertView = LayoutInflater.from(mContext).inflate(R.layout.coach_list_item, parent,false); 76 | holder = new ViewHolder(convertView); 77 | convertView.setTag(holder); 78 | } else { 79 | holder = (ViewHolder) convertView.getTag(); 80 | } 81 | 82 | Coach coach = mData.get(position); 83 | holder.mName.setText(coach.getName()); 84 | holder.mGender.setText(coach.getSex()); 85 | holder.mCategories.setText(coach.getCategories()); 86 | holder.mAvilableAreas.setText(coach.getAvailable_areas()); 87 | holder.mImage.setImageURI(Uri.parse(coach.getProfile_image_url())); 88 | holder.mDescription.setText(Html.fromHtml(coach.getDescription())); 89 | holder.mOrderNum.setText(String.valueOf(coach.getOrder_num())+"单"); 90 | holder.mImageWrapper.setImageResource(Consts.COACH_LEVEL_IMG_WRAPPER.get(coach.getLevel())); 91 | 92 | return convertView; 93 | } 94 | 95 | class ViewHolder { 96 | @InjectView(R.id.avatar_bubble) 97 | ImageView mImageWrapper; 98 | @InjectView(R.id.coach_image) 99 | SimpleDraweeView mImage; 100 | @InjectView(R.id.name) 101 | TextView mName; 102 | @InjectView(R.id.gender) 103 | TextView mGender; 104 | @InjectView(R.id.description) 105 | TextView mDescription; 106 | @InjectView(R.id.categories) 107 | TextView mCategories; 108 | @InjectView(R.id.order_num) 109 | TextView mOrderNum; 110 | @InjectView(R.id.available_area) 111 | TextView mAvilableAreas; 112 | 113 | public ViewHolder(View view) { 114 | ButterKnife.inject(this, view); 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/coach/CommentListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui.coach; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.TextView; 9 | 10 | import com.randian.win.R; 11 | import com.randian.win.model.CommentItem; 12 | import com.randian.win.utils.Utils; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import butterknife.ButterKnife; 18 | import butterknife.InjectView; 19 | 20 | /** 21 | * Created by li.lli on 2015/6/8. 22 | */ 23 | public class CommentListAdapter extends BaseAdapter{ 24 | private Context mContext; 25 | private List mData; 26 | 27 | public CommentListAdapter(Context context){ 28 | mContext = context; 29 | mData = new ArrayList<>(); 30 | } 31 | 32 | public void setData(List data) { 33 | if (data == null) { 34 | return; 35 | } 36 | mData.clear(); 37 | mData.addAll(data); 38 | notifyDataSetChanged(); 39 | } 40 | 41 | public void addData(List data) { 42 | if (data != null && !data.isEmpty()) { 43 | mData.addAll(data); 44 | notifyDataSetChanged(); 45 | } 46 | } 47 | 48 | @Override 49 | public int getCount() { 50 | return mData == null ? 0 : mData .size(); 51 | } 52 | 53 | @Override 54 | public CommentItem getItem(int i) { 55 | if(mData == null || mData.size() <= i){ 56 | return null; 57 | } 58 | return mData.get(i); 59 | } 60 | 61 | @Override 62 | public long getItemId(int i) { 63 | return 0; 64 | } 65 | 66 | @Override 67 | public View getView(int position, View convertView, ViewGroup parent) { 68 | ViewHolder holder; 69 | 70 | if (convertView == null) { 71 | convertView = LayoutInflater.from(mContext).inflate(R.layout.comment_list_item, parent,false); 72 | holder = new ViewHolder(convertView); 73 | convertView.setTag(holder); 74 | } else { 75 | holder = (ViewHolder) convertView.getTag(); 76 | } 77 | 78 | CommentItem comment = mData.get(position); 79 | holder.mPhone.setText(comment.getMobile()); 80 | holder.mDate.setText(comment.getCreated_at()); 81 | holder.commentContent.setText(comment.getContent()); 82 | holder.viewGroup.removeAllViews(); 83 | Utils.commentStar(comment.getStars(), holder.viewGroup, mContext); 84 | 85 | return convertView; 86 | } 87 | 88 | class ViewHolder { 89 | @InjectView(R.id.date) 90 | TextView mDate; 91 | @InjectView(R.id.phone) 92 | TextView mPhone; 93 | @InjectView(R.id.comment_star) 94 | ViewGroup viewGroup; 95 | @InjectView(R.id.comment_content) 96 | TextView commentContent; 97 | 98 | public ViewHolder(View view) { 99 | ButterKnife.inject(this, view); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/com/randian/win/ui/order/CalendarAdapter.java: -------------------------------------------------------------------------------- 1 | package com.randian.win.ui.order; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.BaseAdapter; 9 | import android.widget.TextView; 10 | import com.randian.win.R; 11 | import com.randian.win.model.Time; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import butterknife.ButterKnife; 17 | import butterknife.InjectView; 18 | 19 | /** 20 | * Created by li.lli on 2015/6/8. 21 | */ 22 | public class CalendarAdapter extends BaseAdapter{ 23 | private Context mContext; 24 | private List