From 7b9a57bfc4434c1706c0de3c66ef5b4222c06a7a Mon Sep 17 00:00:00 2001 From: liudahong <1194312604@qq.com> Date: Tue, 21 Mar 2017 16:43:14 +0800 Subject: [PATCH] =?UTF-8?q?foodparty=20=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FoodParty/.gitignore | 8 + FoodParty/.idea/compiler.xml | 22 + .../.idea/copyright/profiles_settings.xml | 3 + FoodParty/.idea/encodings.xml | 6 + FoodParty/.idea/gradle.xml | 20 + FoodParty/.idea/misc.xml | 46 + FoodParty/.idea/modules.xml | 10 + FoodParty/.idea/runConfigurations.xml | 12 + FoodParty/app/.gitignore | 1 + FoodParty/app/build.gradle | 36 + FoodParty/app/proguard-rules.pro | 17 + .../liudaohong/foodparty/ApplicationTest.java | 13 + FoodParty/app/src/main/AndroidManifest.xml | 21 + .../foodparty/Adapter/Food_0_adapter.java | 208 ++ .../foodparty/Adapter/Food_1_adapter.java | 113 + .../foodparty/Adapter/Food_2_adapter.java | 159 ++ .../foodparty/Adapter/Home_grid_adapter.java | 72 + .../foodparty/Adapter/Home_lv_adapter.java | 93 + .../foodparty/Bean/FoodTabBean.java | 59 + .../foodparty/Bean/FoodVp0Bean.java | 149 ++ .../foodparty/Bean/FoodVp1Bean.java | 129 + .../foodparty/Bean/FoodVp2Bean.java | 129 + .../liudaohong/foodparty/Bean/HomeBean.java | 161 ++ .../foodparty/Bean/HomeListBean.java | 42 + .../liudaohong/foodparty/Iterface/IFood.java | 28 + .../foodparty/Iterface/IFood_0_Listener.java | 14 + .../liudaohong/foodparty/Iterface/Ihome.java | 15 + .../com/liudaohong/foodparty/MyGridView.java | 26 + .../foodparty/ui/Activity/MainActivity.java | 83 + .../ui/Activity/NoActionBarActivity.java | 18 + .../ui/Fragment/Food_0_fragment.java | 215 ++ .../ui/Fragment/Food_1_Fragment.java | 145 ++ .../ui/Fragment/Food_2_Fragment.java | 138 + .../ui/Fragment/Food_3_Fragment.java | 26 + .../foodparty/ui/Fragment/HomeFragment.java | 120 + .../foodparty/ui/Fragment/MineFragment.java | 24 + .../foodparty/ui/Fragment/foodFragment.java | 133 + .../res/drawable/ic_def_user_smallstroke.png | Bin 0 -> 2199 bytes .../src/main/res/drawable/ic_tab_homepage.png | Bin 0 -> 1517 bytes .../res/drawable/ic_tab_homepage_select.png | Bin 0 -> 1591 bytes .../src/main/res/drawable/ic_tab_library.png | Bin 0 -> 879 bytes .../res/drawable/ic_tab_library_select.png | Bin 0 -> 907 bytes .../app/src/main/res/drawable/ic_tab_my.png | Bin 0 -> 1358 bytes .../main/res/drawable/ic_tab_my_select.png | Bin 0 -> 1408 bytes FoodParty/app/src/main/res/drawable/tab_0.xml | 6 + FoodParty/app/src/main/res/drawable/tab_1.xml | 5 + FoodParty/app/src/main/res/drawable/tab_2.xml | 5 + .../app/src/main/res/layout/activity_main.xml | 28 + .../app/src/main/res/layout/food_0_1item.xml | 19 + .../app/src/main/res/layout/food_0_item.xml | 70 + .../app/src/main/res/layout/food_1_item.xml | 45 + .../app/src/main/res/layout/food_1_layout.xml | 14 + .../app/src/main/res/layout/food_2_2item.xml | 58 + .../app/src/main/res/layout/food_2_item.xml | 43 + .../app/src/main/res/layout/food_2_layout.xml | 11 + .../main/res/layout/food_fragment_layout.xml | 22 + .../app/src/main/res/layout/foodfooter.xml | 16 + .../main/res/layout/home_fragment_ayout.xml | 11 + .../src/main/res/layout/home_grid_item.xml | 23 + .../src/main/res/layout/home_item_layout.xml | 43 + .../src/main/res/layout/tab_item_layout.xml | 26 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes .../app/src/main/res/mipmap-hdpi/ic_watch.png | Bin 0 -> 1005 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes .../main/res/mipmap-xhdpi/ic_home_camera.png | Bin 0 -> 1598 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../app/src/main/res/mipmap-xhdpi/ic_read.png | Bin 0 -> 1223 bytes .../app/src/main/res/mipmap-xhdpi/icon.png | Bin 0 -> 2806 bytes .../main/res/mipmap-xxhdpi/ic_dest_mate.png | Bin 0 -> 915 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../main/res/mipmap-xxxhdpi/ic_home_agree.png | Bin 0 -> 1364 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes .../app/src/main/res/values-w820dp/dimens.xml | 6 + FoodParty/app/src/main/res/values/colors.xml | 6 + FoodParty/app/src/main/res/values/dimens.xml | 5 + FoodParty/app/src/main/res/values/strings.xml | 3 + FoodParty/app/src/main/res/values/styles.xml | 11 + .../liudaohong/foodparty/ExampleUnitTest.java | 15 + FoodParty/build.gradle | 23 + FoodParty/gradle.properties | 18 + FoodParty/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + FoodParty/gradlew | 160 ++ FoodParty/gradlew.bat | 90 + .../projectFilesBackup/.idea/workspace.xml | 2302 +++++++++++++++++ FoodParty/settings.gradle | 1 + .../\347\234\213\346\210\277/.gitignore" | 1 + .../\347\234\213\346\210\277/build.gradle" | 30 + .../proguard-rules.pro" | 17 + .../java/com/qf/kanfang/ApplicationTest.java" | 13 + .../src/main/AndroidManifest.xml" | 31 + .../src/main/java/com/qf/kanfang/App.java" | 22 + .../qf/kanfang/adapter/CityChoseAdapter.java" | 182 ++ .../java/com/qf/kanfang/bean/CityBean.java" | 203 ++ .../com/qf/kanfang/inter/ICityChose.java" | 18 + .../ui/activity/CityChoseActivity.java" | 196 ++ .../qf/kanfang/ui/activity/MainActivity.java" | 108 + .../ui/activity/NoActionBarActivity.java" | 18 + .../kanfang/ui/activity/SlpashActivity.java" | 160 ++ .../kanfang/ui/activity/WelcomeActivity.java" | 47 + .../ui/fragment/DiscoverFragment.java" | 22 + .../qf/kanfang/ui/fragment/HomeFragment.java" | 75 + .../kanfang/ui/fragment/MessageFragment.java" | 24 + .../qf/kanfang/ui/fragment/MineFragment.java" | 24 + .../kanfang/ui/fragment/SlpashFragment.java" | 64 + .../com/qf/kanfang/utils/APIManager.java" | 17 + .../java/com/qf/kanfang/utils/Constant.java" | 29 + .../java/com/qf/kanfang/utils/FileUtils.java" | 61 + .../java/com/qf/kanfang/utils/HttpUtils.java" | 51 + .../main/java/com/qf/kanfang/utils/L.java" | 29 + .../com/qf/kanfang/utils/SharedUtils.java" | 37 + .../res/color/tab_text_color_selector.xml" | 5 + .../bg_guide_activity_background.png" | Bin 0 -> 154960 bytes .../res/drawable-xhdpi/guide_content_0.png" | Bin 0 -> 2612 bytes .../res/drawable-xhdpi/guide_content_1.png" | Bin 0 -> 2980 bytes .../res/drawable-xhdpi/guide_content_2.png" | Bin 0 -> 2937 bytes .../res/drawable-xhdpi/guide_content_3.png" | Bin 0 -> 2865 bytes .../drawable-xhdpi/guide_content_new_0.png" | Bin 0 -> 3413 bytes .../drawable-xhdpi/guide_content_new_1.png" | Bin 0 -> 3195 bytes .../drawable-xhdpi/guide_content_new_2.png" | Bin 0 -> 3412 bytes .../drawable-xhdpi/guide_content_new_3.png" | Bin 0 -> 2004 bytes .../res/drawable-xhdpi/guide_title_0.png" | Bin 0 -> 2868 bytes .../res/drawable-xhdpi/guide_title_new_0.png" | Bin 0 -> 2212 bytes .../res/drawable-xhdpi/guide_title_new_1.png" | Bin 0 -> 2052 bytes .../res/drawable-xhdpi/guide_title_new_2.png" | Bin 0 -> 2253 bytes .../res/drawable-xhdpi/guide_title_new_3.png" | Bin 0 -> 1597 bytes .../ic_guide_picture_new_0.png" | Bin 0 -> 68819 bytes .../ic_guide_picture_new_1.png" | Bin 0 -> 24197 bytes .../ic_guide_picture_new_2.png" | Bin 0 -> 58482 bytes .../ic_guide_picture_new_3.png" | Bin 0 -> 41634 bytes .../main/res/drawable-xhdpi/icon_logo.png" | Bin 0 -> 19394 bytes .../main/res/drawable-xhdpi/icon_tencent.png" | Bin 0 -> 8053 bytes .../drawable-xhdpi/tab_discover_normal.png" | Bin 0 -> 1889 bytes .../drawable-xhdpi/tab_discover_pressed.png" | Bin 0 -> 1370 bytes .../drawable-xhdpi/tab_message_normal.png" | Bin 0 -> 1450 bytes .../drawable-xhdpi/tab_message_pressed.png" | Bin 0 -> 1003 bytes .../res/drawable-xhdpi/tab_mine_normal.png" | Bin 0 -> 1447 bytes .../res/drawable-xhdpi/tab_mine_pressed.png" | Bin 0 -> 981 bytes .../drawable-xhdpi/tab_new_house_normal.png" | Bin 0 -> 1105 bytes .../drawable-xhdpi/tab_new_house_pressed.png" | Bin 0 -> 795 bytes .../res/drawable/tab_discove_selector.xml" | 5 + .../main/res/drawable/tab_home_selector.xml" | 5 + .../res/drawable/tab_message_selector.xml" | 5 + .../main/res/drawable/tab_mine_selector.xml" | 5 + .../main/res/layout/activity_city_chose.xml" | 37 + .../src/main/res/layout/activity_main.xml" | 32 + .../main/res/layout/actyivity_welcome.xml" | 21 + .../res/layout/city_item_head_layout.xml" | 16 + .../res/layout/city_item_name_layout.xml" | 15 + .../src/main/res/layout/fragment_home.xml" | 36 + .../src/main/res/layout/slpash_activity.xml" | 11 + .../src/main/res/layout/slpash_fragment.xml" | 34 + .../src/main/res/layout/tab_item_layout.xml" | 22 + .../src/main/res/mipmap-hdpi/ic_launcher.png" | Bin 0 -> 3418 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png" | Bin 0 -> 2206 bytes .../main/res/mipmap-xhdpi/ic_launcher.png" | Bin 0 -> 4842 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png" | Bin 0 -> 7718 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png" | Bin 0 -> 10486 bytes .../src/main/res/values-w820dp/dimens.xml" | 6 + .../src/main/res/values/colors.xml" | 8 + .../src/main/res/values/dimens.xml" | 13 + .../src/main/res/values/strings.xml" | 3 + .../src/main/res/values/styles.xml" | 19 + .../java/com/qf/kanfang/ExampleUnitTest.java" | 15 + 164 files changed, 7397 insertions(+) create mode 100644 FoodParty/.gitignore create mode 100644 FoodParty/.idea/compiler.xml create mode 100644 FoodParty/.idea/copyright/profiles_settings.xml create mode 100644 FoodParty/.idea/encodings.xml create mode 100644 FoodParty/.idea/gradle.xml create mode 100644 FoodParty/.idea/misc.xml create mode 100644 FoodParty/.idea/modules.xml create mode 100644 FoodParty/.idea/runConfigurations.xml create mode 100644 FoodParty/app/.gitignore create mode 100644 FoodParty/app/build.gradle create mode 100644 FoodParty/app/proguard-rules.pro create mode 100644 FoodParty/app/src/androidTest/java/com/liudaohong/foodparty/ApplicationTest.java create mode 100644 FoodParty/app/src/main/AndroidManifest.xml create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_0_adapter.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_1_adapter.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_2_adapter.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_grid_adapter.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_lv_adapter.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodTabBean.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp0Bean.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp1Bean.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp2Bean.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeBean.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeListBean.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood_0_Listener.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/Ihome.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/MyGridView.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/MainActivity.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/NoActionBarActivity.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_0_fragment.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_1_Fragment.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_2_Fragment.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_3_Fragment.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/HomeFragment.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/MineFragment.java create mode 100644 FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/foodFragment.java create mode 100644 FoodParty/app/src/main/res/drawable/ic_def_user_smallstroke.png create mode 100644 FoodParty/app/src/main/res/drawable/ic_tab_homepage.png create mode 100644 FoodParty/app/src/main/res/drawable/ic_tab_homepage_select.png create mode 100644 FoodParty/app/src/main/res/drawable/ic_tab_library.png create mode 100644 FoodParty/app/src/main/res/drawable/ic_tab_library_select.png create mode 100644 FoodParty/app/src/main/res/drawable/ic_tab_my.png create mode 100644 FoodParty/app/src/main/res/drawable/ic_tab_my_select.png create mode 100644 FoodParty/app/src/main/res/drawable/tab_0.xml create mode 100644 FoodParty/app/src/main/res/drawable/tab_1.xml create mode 100644 FoodParty/app/src/main/res/drawable/tab_2.xml create mode 100644 FoodParty/app/src/main/res/layout/activity_main.xml create mode 100644 FoodParty/app/src/main/res/layout/food_0_1item.xml create mode 100644 FoodParty/app/src/main/res/layout/food_0_item.xml create mode 100644 FoodParty/app/src/main/res/layout/food_1_item.xml create mode 100644 FoodParty/app/src/main/res/layout/food_1_layout.xml create mode 100644 FoodParty/app/src/main/res/layout/food_2_2item.xml create mode 100644 FoodParty/app/src/main/res/layout/food_2_item.xml create mode 100644 FoodParty/app/src/main/res/layout/food_2_layout.xml create mode 100644 FoodParty/app/src/main/res/layout/food_fragment_layout.xml create mode 100644 FoodParty/app/src/main/res/layout/foodfooter.xml create mode 100644 FoodParty/app/src/main/res/layout/home_fragment_ayout.xml create mode 100644 FoodParty/app/src/main/res/layout/home_grid_item.xml create mode 100644 FoodParty/app/src/main/res/layout/home_item_layout.xml create mode 100644 FoodParty/app/src/main/res/layout/tab_item_layout.xml create mode 100644 FoodParty/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 FoodParty/app/src/main/res/mipmap-hdpi/ic_watch.png create mode 100644 FoodParty/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 FoodParty/app/src/main/res/mipmap-xhdpi/ic_home_camera.png create mode 100644 FoodParty/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 FoodParty/app/src/main/res/mipmap-xhdpi/ic_read.png create mode 100644 FoodParty/app/src/main/res/mipmap-xhdpi/icon.png create mode 100644 FoodParty/app/src/main/res/mipmap-xxhdpi/ic_dest_mate.png create mode 100644 FoodParty/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 FoodParty/app/src/main/res/mipmap-xxxhdpi/ic_home_agree.png create mode 100644 FoodParty/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 FoodParty/app/src/main/res/values-w820dp/dimens.xml create mode 100644 FoodParty/app/src/main/res/values/colors.xml create mode 100644 FoodParty/app/src/main/res/values/dimens.xml create mode 100644 FoodParty/app/src/main/res/values/strings.xml create mode 100644 FoodParty/app/src/main/res/values/styles.xml create mode 100644 FoodParty/app/src/test/java/com/liudaohong/foodparty/ExampleUnitTest.java create mode 100644 FoodParty/build.gradle create mode 100644 FoodParty/gradle.properties create mode 100644 FoodParty/gradle/wrapper/gradle-wrapper.jar create mode 100644 FoodParty/gradle/wrapper/gradle-wrapper.properties create mode 100644 FoodParty/gradlew create mode 100644 FoodParty/gradlew.bat create mode 100644 FoodParty/projectFilesBackup/.idea/workspace.xml create mode 100644 FoodParty/settings.gradle create mode 100644 "FoodParty/\347\234\213\346\210\277/.gitignore" create mode 100644 "FoodParty/\347\234\213\346\210\277/build.gradle" create mode 100644 "FoodParty/\347\234\213\346\210\277/proguard-rules.pro" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/androidTest/java/com/qf/kanfang/ApplicationTest.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/AndroidManifest.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/App.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/adapter/CityChoseAdapter.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/bean/CityBean.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/inter/ICityChose.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/activity/CityChoseActivity.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/activity/MainActivity.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/activity/NoActionBarActivity.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/activity/SlpashActivity.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/activity/WelcomeActivity.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/fragment/DiscoverFragment.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/fragment/HomeFragment.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/fragment/MessageFragment.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/fragment/MineFragment.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/ui/fragment/SlpashFragment.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/utils/APIManager.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/utils/Constant.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/utils/FileUtils.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/utils/HttpUtils.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/utils/L.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/java/com/qf/kanfang/utils/SharedUtils.java" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/color/tab_text_color_selector.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/bg_guide_activity_background.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_0.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_1.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_2.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_3.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_new_0.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_new_1.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_new_2.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_content_new_3.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_title_0.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_title_new_0.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_title_new_1.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_title_new_2.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/guide_title_new_3.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/ic_guide_picture_new_0.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/ic_guide_picture_new_1.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/ic_guide_picture_new_2.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/ic_guide_picture_new_3.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/icon_logo.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/icon_tencent.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_discover_normal.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_discover_pressed.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_message_normal.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_message_pressed.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_mine_normal.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_mine_pressed.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_new_house_normal.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable-xhdpi/tab_new_house_pressed.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable/tab_discove_selector.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable/tab_home_selector.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable/tab_message_selector.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/drawable/tab_mine_selector.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/activity_city_chose.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/activity_main.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/actyivity_welcome.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/city_item_head_layout.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/city_item_name_layout.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/fragment_home.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/slpash_activity.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/slpash_fragment.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/layout/tab_item_layout.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/mipmap-hdpi/ic_launcher.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/mipmap-mdpi/ic_launcher.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/mipmap-xhdpi/ic_launcher.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/mipmap-xxhdpi/ic_launcher.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/mipmap-xxxhdpi/ic_launcher.png" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/values-w820dp/dimens.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/values/colors.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/values/dimens.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/values/strings.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/main/res/values/styles.xml" create mode 100644 "FoodParty/\347\234\213\346\210\277/src/test/java/com/qf/kanfang/ExampleUnitTest.java" diff --git a/FoodParty/.gitignore b/FoodParty/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/FoodParty/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/FoodParty/.idea/compiler.xml b/FoodParty/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/FoodParty/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FoodParty/.idea/copyright/profiles_settings.xml b/FoodParty/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/FoodParty/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/FoodParty/.idea/encodings.xml b/FoodParty/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/FoodParty/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/FoodParty/.idea/gradle.xml b/FoodParty/.idea/gradle.xml new file mode 100644 index 0000000..c643e8a --- /dev/null +++ b/FoodParty/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/FoodParty/.idea/misc.xml b/FoodParty/.idea/misc.xml new file mode 100644 index 0000000..5d19981 --- /dev/null +++ b/FoodParty/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FoodParty/.idea/modules.xml b/FoodParty/.idea/modules.xml new file mode 100644 index 0000000..65c6770 --- /dev/null +++ b/FoodParty/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/FoodParty/.idea/runConfigurations.xml b/FoodParty/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/FoodParty/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/FoodParty/app/.gitignore b/FoodParty/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/FoodParty/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/FoodParty/app/build.gradle b/FoodParty/app/build.gradle new file mode 100644 index 0000000..bf79fb2 --- /dev/null +++ b/FoodParty/app/build.gradle @@ -0,0 +1,36 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.3" + + defaultConfig { + applicationId "com.liudaohong.foodparty" + minSdkVersion 16 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(include: ['*.jar'], dir: 'libs') + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.4.0' + compile 'com.android.support:design:23.4.0' + compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4' + //Retrofit2所需要的包 + compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4' + //ConverterFactory的Gson依赖包 + compile 'com.squareup.retrofit2:converter-scalars:2.0.0-beta4' + compile 'com.android.support:cardview-v7:23.4.0' + compile 'com.squareup.picasso:picasso:2.5.2' + compile 'de.hdodenhof:circleimageview:2.1.0' + compile 'in.srain.cube:ultra-ptr:1.0.11' +} diff --git a/FoodParty/app/proguard-rules.pro b/FoodParty/app/proguard-rules.pro new file mode 100644 index 0000000..412c0eb --- /dev/null +++ b/FoodParty/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\ANDROIDSTUDIO\SDK/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/FoodParty/app/src/androidTest/java/com/liudaohong/foodparty/ApplicationTest.java b/FoodParty/app/src/androidTest/java/com/liudaohong/foodparty/ApplicationTest.java new file mode 100644 index 0000000..3dbc4a8 --- /dev/null +++ b/FoodParty/app/src/androidTest/java/com/liudaohong/foodparty/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.liudaohong.foodparty; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/FoodParty/app/src/main/AndroidManifest.xml b/FoodParty/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..80e0ab9 --- /dev/null +++ b/FoodParty/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_0_adapter.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_0_adapter.java new file mode 100644 index 0000000..35b8e66 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_0_adapter.java @@ -0,0 +1,208 @@ +package com.liudaohong.foodparty.Adapter; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.StaggeredGridLayoutManager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.liudaohong.foodparty.Bean.FoodVp0Bean; +import com.liudaohong.foodparty.Iterface.IFood; +import com.liudaohong.foodparty.Iterface.IFood_0_Listener; +import com.liudaohong.foodparty.R; +import com.squareup.picasso.Picasso; + +import java.util.List; + +import de.hdodenhof.circleimageview.CircleImageView; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class Food_0_adapter extends RecyclerView.Adapter { + private Context context; + private LayoutInflater inflater; + private List list; + private IFood_0_Listener listener; + + + public Food_0_adapter(Context context, List list) { + this.context = context; + this.list = list; + inflater=LayoutInflater.from(context); + } + public void SetLister(IFood_0_Listener listener){ + this.listener=listener; + + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view=null; + if (viewType==0){ + view=inflater.inflate(R.layout.food_0_1item,parent,false); + return new VH(view); + }else if (viewType==1){ + view=inflater.inflate(R.layout.food_0_item,parent,false); + return new VH1(view); + }else { + view=inflater.inflate(R.layout.foodfooter,parent,false); + return new VHfooter(view); + } + + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { + + int itemViewType = getItemViewType(position); + + + switch (itemViewType){ + case 0:{ + FoodVp0Bean.FeedsBean feedsBean = list.get(position); + VH holder1 = (VH) holder; + Picasso.with(context).load(feedsBean.getCard_image()).into(holder1.iv); + } + break; + case 1:{ + FoodVp0Bean.FeedsBean feedsBean = list.get(position); + VH1 holder1 = (VH1) holder; + holder1.name.setText(feedsBean.getPublisher()); + holder1.title.setText(feedsBean.getTitle()); + Picasso.with(context).load(feedsBean.getPublisher_avatar()).into(holder1.tot); + Picasso.with(context).load(feedsBean.getCard_image()).into(holder1.iv); + holder1.good.setText(feedsBean.getLike_ct()+""); + } + break; + case 2:{ + + } + break; + } + + } + + @Override + public int getItemCount() { + + return list.size()+1; + } + + @Override + public int getItemViewType(int position) { + if (position==0&&list.size()!=0){ + return 0; + }else if (position==list.size()){ + return 2; + }else { + return 1; + } + } + + class VH extends RecyclerView.ViewHolder{ + private ImageView iv; + public VH(View itemView) { + super(itemView); + if (listener!=null){ + + iv= (ImageView) itemView.findViewById(R.id.iv); + itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.setOnClickListener(v,getLayoutPosition()); + } + }); + + itemView.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + return listener.setOnLongClickListener(v,getLayoutPosition()); + } + }); + } + } + } + class VH1 extends RecyclerView.ViewHolder{ + private ImageView iv; + private TextView name; + private Button good; + private CircleImageView tot; + private TextView title; + public VH1(View itemView) { + super(itemView); + title= (TextView) itemView.findViewById(R.id.tv); + iv= (ImageView) itemView.findViewById(R.id.iv); + name= (TextView) itemView.findViewById(R.id.name); + good= (Button) itemView.findViewById(R.id.good); + tot= (CircleImageView) itemView.findViewById(R.id.tot); + if (listener!=null){ + + iv= (ImageView) itemView.findViewById(R.id.iv); + itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listener.setOnClickListener(v,getLayoutPosition()); + } + }); + + itemView.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + return listener.setOnLongClickListener(v,getLayoutPosition()); + } + }); + } + } + } + + class VHfooter extends RecyclerView.ViewHolder{ + private ProgressBar pb; + private TextView tv; + public VHfooter(View itemView) { + super(itemView); + pb= (ProgressBar) itemView.findViewById(R.id.pb); + tv= (TextView) itemView.findViewById(R.id.tv); + } + } + + + // + + @Override + public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) { + super.onViewAttachedToWindow(holder); + if (isStaggeredGridLayout(holder)) { + handleLayoutIfStaggeredGridLayout(holder, holder.getLayoutPosition()); + } + } + + private boolean isStaggeredGridLayout(RecyclerView.ViewHolder holder) { + ViewGroup.LayoutParams layoutParams = holder.itemView.getLayoutParams(); + if (layoutParams != null && layoutParams instanceof StaggeredGridLayoutManager.LayoutParams) { + return true; + } + return false; + } + + protected void handleLayoutIfStaggeredGridLayout(RecyclerView.ViewHolder holder, int position) { + // if (isHeader(position) || isFooter(position)) { + if ( isFooter(position)) { + StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams(); + p.setFullSpan(true); + } + } + + private boolean isFooter(int position) { + if (position==list.size()){ + return true; + } + return false; + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_1_adapter.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_1_adapter.java new file mode 100644 index 0000000..bf70c12 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_1_adapter.java @@ -0,0 +1,113 @@ +package com.liudaohong.foodparty.Adapter; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.liudaohong.foodparty.Bean.FoodVp1Bean; +import com.liudaohong.foodparty.R; +import com.squareup.picasso.Picasso; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/20. + */ + +public class Food_1_adapter extends RecyclerView.Adapter { + private List list; + private Context context; + private LayoutInflater inflater; + + public Food_1_adapter(List list, Context context) { + this.list = list; + this.context = context; + inflater=LayoutInflater.from(context); + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view=null; + switch (viewType){ + case 0:{ + view=inflater.inflate(R.layout.food_1_item,parent,false); + return new VH1(view); + + } + case 1:{ + view=inflater.inflate(R.layout.foodfooter,parent,false); + return new VH2(view); + } + } + return null; + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { + int type=getItemViewType(position); + switch (type){ + case 0:{ + FoodVp1Bean.FeedsBean feedsBean = list.get(position); + VH1 holder1 = (VH1) holder; + holder1.title.setText(feedsBean.getTitle()); + holder1.source.setText(feedsBean.getSource()); + holder1.tail.setText(feedsBean.getTail()); + Picasso.with(context).load(feedsBean.getBackground()).into(holder1.iv); + + } + break; + case 1:{ + + } + break; + } + + } + + @Override + public int getItemCount() { + return list.size()+1; + } + + @Override + public int getItemViewType(int position) { + if (position==list.size()){ + return 1; + }else { + return 0; + } + + } + + private class VH1 extends RecyclerView.ViewHolder{ + private ImageView iv; + private TextView source,title,tail; + public VH1(View itemView) { + super(itemView); + iv= (ImageView) itemView.findViewById(R.id.iv); + source= (TextView) itemView.findViewById(R.id.source); + title= (TextView) itemView.findViewById(R.id.title); + tail= (TextView) itemView.findViewById(R.id.tail); + } + } + private class VH2 extends RecyclerView.ViewHolder{ + + private ProgressBar pb; + private TextView tv; + public VH2(View itemView) { + super(itemView); + pb= (ProgressBar) itemView.findViewById(R.id.pb); + tv= (TextView) itemView.findViewById(R.id.tv); + } + } + + + + +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_2_adapter.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_2_adapter.java new file mode 100644 index 0000000..c509525 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Food_2_adapter.java @@ -0,0 +1,159 @@ +package com.liudaohong.foodparty.Adapter; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.liudaohong.foodparty.Bean.FoodVp2Bean; +import com.liudaohong.foodparty.R; +import com.squareup.picasso.Picasso; + +import org.w3c.dom.Text; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/21. + */ + +public class Food_2_adapter extends RecyclerView.Adapter { + private Context context; + private LayoutInflater inflater; + private List list; + + public Food_2_adapter(Context context, List list) { + this.context = context; + this.list = list; + inflater=LayoutInflater.from(context); + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view=null; + RecyclerView.ViewHolder VH = null; + switch (viewType){ + case 0:{ + view=inflater.inflate(R.layout.food_2_item,parent,false); + VH=new VH1(view); + + }break; + case 1:{ + view=inflater.inflate(R.layout.food_2_2item,parent,false); + VH=new VH2(view); + }break; + case 2:{ + view=inflater.inflate(R.layout.foodfooter,parent,false); + VH=new VH3(view); + } + break; + } + + return VH; + } + + @Override + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { + int type=getItemViewType(position); + switch (type){ + case 0:{ + VH1 holder1 = (VH1) holder; + FoodVp2Bean.FeedsBean feedsBean = list.get(position); + holder1.title.setText(feedsBean.getTitle()); + holder1.name.setText(feedsBean.getSource()); + holder1.tail.setText(feedsBean.getTail()); + Picasso.with(context).load(feedsBean.getImages().get(0)).into(holder1.iv); + } + break; + case 1:{ + VH2 holder1 = (VH2) holder; + FoodVp2Bean.FeedsBean feedsBean = list.get(position); + holder1.title.setText(feedsBean.getTitle()); + holder1.name.setText(feedsBean.getSource()); + holder1.tail.setText(feedsBean.getTail()); + Picasso.with(context).load(feedsBean.getImages().get(0)).into(holder1.iv0); + Picasso.with(context).load(feedsBean.getImages().get(1)).into(holder1.iv1); + Picasso.with(context).load(feedsBean.getImages().get(2)).into(holder1.iv2); + } + break; + case 2:{ + VH3 holder1 = (VH3) holder; + }break; + } + + } + + @Override + public int getItemCount() { + return list.size()+1; + } + + + @Override + public int getItemViewType(int position) { + /* int size = list.get(position).getImages().size(); + if (size ==1){ + return 0; + }else if (size==3){ + return 1; + }else if (position==list.size()){ + return 2; + }*/ + if (position==list.size()){ + return 2; + } + int size = list.get(position).getImages().size(); + if (size ==1){ + return 0; + }else if (size==3){ + return 1; + } + return super.getItemViewType(position); + } + + private class VH1 extends RecyclerView.ViewHolder{ + private TextView title,name,tail; + private ImageView iv; + public VH1(View itemView) { + super(itemView); + title= (TextView) itemView.findViewById(R.id.title); + name= (TextView) itemView.findViewById(R.id.name); + tail= (TextView) itemView.findViewById(R.id.tail); + iv= (ImageView) itemView.findViewById(R.id.iv); + } + } + + + private class VH2 extends RecyclerView.ViewHolder{ + private ImageView iv0,iv1,iv2; + private TextView title,name,tail; + public VH2(View itemView) { + super(itemView); + iv0= (ImageView) itemView.findViewById(R.id.iv0); + iv1= (ImageView) itemView.findViewById(R.id.iv1); + iv2= (ImageView) itemView.findViewById(R.id.iv2); + title= (TextView) itemView.findViewById(R.id.title); + name= (TextView) itemView.findViewById(R.id.name); + tail= (TextView) itemView.findViewById(R.id.tail); + } + } + + + private class VH3 extends RecyclerView.ViewHolder{ + + private ProgressBar pb; + private TextView tv; + public VH3(View itemView) { + super(itemView); + pb= (ProgressBar) itemView.findViewById(R.id.pb); + tv= (TextView) itemView.findViewById(R.id.tv); + } + } + + + +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_grid_adapter.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_grid_adapter.java new file mode 100644 index 0000000..6ec0251 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_grid_adapter.java @@ -0,0 +1,72 @@ +package com.liudaohong.foodparty.Adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.TextView; + +import com.liudaohong.foodparty.Bean.HomeBean; +import com.liudaohong.foodparty.R; +import com.squareup.picasso.Picasso; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/17. + */ + +public class Home_grid_adapter extends BaseAdapter { + private List list; + private Context context; + private LayoutInflater inflater; + + public Home_grid_adapter(List list, Context context) { + this.list = list; + this.context = context; + inflater=LayoutInflater.from(context); + } + + @Override + public int getCount() { + return list.size(); + } + + @Override + public Object getItem(int position) { + return list.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder vh=null; + if (convertView==null){ + convertView=inflater.inflate(R.layout.home_grid_item,parent,false); + vh=new ViewHolder(convertView); + convertView.setTag(vh); + }else { + vh= (ViewHolder) convertView.getTag(); + } + vh.tv.setText(list.get(position).getName()); + Picasso.with(context).load(list.get(position).getImage_url()).into(vh.iv); + return convertView; + } + + + class ViewHolder{ + private ImageView iv; + private TextView tv; + public ViewHolder(View view) { + iv= (ImageView) view.findViewById(R.id.iv); + tv= (TextView) view.findViewById(R.id.name); + + } + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_lv_adapter.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_lv_adapter.java new file mode 100644 index 0000000..2ca8d58 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Adapter/Home_lv_adapter.java @@ -0,0 +1,93 @@ +package com.liudaohong.foodparty.Adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.GridView; +import android.widget.TextView; + +import com.liudaohong.foodparty.Bean.HomeBean; +import com.liudaohong.foodparty.Bean.HomeListBean; +import com.liudaohong.foodparty.MyGridView; +import com.liudaohong.foodparty.R; + +import java.security.acl.Group; +import java.util.ArrayList; +import java.util.List; + +import static java.util.Collections.addAll; + +/** + * Created by liuhong on 2017/3/17. + */ + +public class Home_lv_adapter extends BaseAdapter { + private List list; + private Context context; + private LayoutInflater inflater; + + + + public Home_lv_adapter(List list, Context context) { + this.list = list; + this.context = context; + inflater=LayoutInflater.from(context); + } + + @Override + public int getCount() { + return list.size(); + } + + @Override + public Object getItem(int position) { + return list.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolderr vh=null; + if (convertView==null){ + convertView=inflater.inflate(R.layout.home_item_layout,parent,false); + vh=new ViewHolderr(convertView); + convertView.setTag(vh); + }else { + vh= (ViewHolderr) convertView.getTag(); + } + + vh. gridlist.clear(); + //添加数据 + List categories = list.get(position).getGroupBean().getCategories(); + vh. gridlist.addAll(categories); + //添加适配器 + vh.tv.setText(list.get(position).getName()); + vh.adapter.notifyDataSetChanged(); + return convertView; + } + + + class ViewHolderr{ + private TextView tv; + private MyGridView gridView; + private List gridlist; + private Home_grid_adapter adapter; + public ViewHolderr(View view) { + tv= (TextView) view.findViewById(R.id.textname); + gridView= ((MyGridView) view.findViewById(R.id.grid)); + if (gridlist==null){ + gridlist = new ArrayList<>(); + } + if (adapter==null){ + adapter = new Home_grid_adapter(gridlist,context); + } + gridView.setAdapter(adapter); + } + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodTabBean.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodTabBean.java new file mode 100644 index 0000000..c304646 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodTabBean.java @@ -0,0 +1,59 @@ +package com.liudaohong.foodparty.Bean; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class FoodTabBean { + /** + * categories_count : 4 + * categories : [{"id":1,"name":"首页"},{"id":2,"name":"评测"},{"id":3,"name":"知识"},{"id":4,"name":"美食"}] + */ + + private int categories_count; + private List categories; + + public int getCategories_count() { + return categories_count; + } + + public void setCategories_count(int categories_count) { + this.categories_count = categories_count; + } + + public List getCategories() { + return categories; + } + + public void setCategories(List categories) { + this.categories = categories; + } + + public static class CategoriesBean { + /** + * id : 1 + * name : 首页 + */ + + private int id; + private String name; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp0Bean.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp0Bean.java new file mode 100644 index 0000000..de6ac75 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp0Bean.java @@ -0,0 +1,149 @@ +package com.liudaohong.foodparty.Bean; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class FoodVp0Bean { + /** + * page : 1 + * total_pages : 195 + * feeds : [{"card_image":"http://up.boohee.cn/house/u/bet/img/2017_spring/banner_shiwupai.jpg","content_type":6,"link":"http://one.boohee.com/store/pages/bet_data_show_fl"},{"item_id":7810,"title":"黑胡椒牛排&全麦面包","card_image":"http://one.boohee.cn/food/2016/10/30/58A628DA-D358-4096-9C3F-7AB25988D845.jpg?imageView2/2/w/640","publisher":"CHENG1228","publisher_avatar":"http://wx.qlogo.cn/mmopen/PiajxSqBRaELj1mEkGxiamCB8UjibfJibusEBsZO0hAGpHA4iacP9CNufO8WJda4BRtMic5rvMzGF7hJYLibhbYxJns0g/0","description":"","content_type":5,"type":"food_card","like_ct":1201},{"item_id":7593,"title":"休息日早餐","card_image":"http://one.boohee.cn/food/2016/10/24/9E6BF442-E85F-45BE-979A-EECF4FB3E51B.jpg?imageView2/2/w/640","publisher":"言言言言西早","publisher_avatar":"http://one.boohee.cn/t/2016/10/26/BFA9249B-9A55-4D05-96B8-F256758A4F70.jpg","description":"","content_type":5,"type":"food_card","like_ct":2685},{"item_id":7594,"title":"休息日早餐","card_image":"http://one.boohee.cn/food/2016/10/24/D776CA50-F7D1-4D65-B6E6-0A206A67E9FE.jpg?imageView2/2/w/640","publisher":"言言言言西早","publisher_avatar":"http://one.boohee.cn/t/2016/10/26/BFA9249B-9A55-4D05-96B8-F256758A4F70.jpg","description":"","content_type":5,"type":"food_card","like_ct":748},{"item_id":7375,"title":"秋葵包龙利鱼","card_image":"http://one.boohee.cn/food/2016/10/18/0C797C58-2999-4C39-A112-F34CD247734D.jpg?imageView2/2/w/640","publisher":"子倩_","publisher_avatar":"http://wx.qlogo.cn/mmopen/PiajxSqBRaEK4YOdZ5Kic8KT7Cq5cRibBneS0WmzV5LicMia3anVOsNc098cfSDD2uMfC5VtExJEUibvWuk8607htcLA/0","description":"玉米粥➕圣女果➕橘子➕紫薯➕鸡蛋➕秋葵➕龙利鱼","content_type":5,"type":"food_card","like_ct":519},{"item_id":7264,"title":"香煎鲳鱼","card_image":"http://one.boohee.cn/food/2016/10/15/85F2A209-8BA3-4184-8812-E182EC1F94F2.jpg?imageView2/2/w/640","publisher":"艾米82808","publisher_avatar":"http://wx.qlogo.cn/mmopen/brsKjTrsruV0XF0fEribr3ayR1I4H3wNbI400UORicyyVeU6wcNXJRWhkHibEqiaBZGBsmZSa2ZMiaLZI8WmRRDYVZ82iaFeTLbzH6/0","description":"作为减脂餐 还不错","content_type":5,"type":"food_card","like_ct":188},{"item_id":7271,"title":"意大利面","card_image":"http://one.boohee.cn/food/2016/10/15/D30D6602-BF8F-412B-83E4-120AE7A16F58.jpg?imageView2/2/w/640","publisher":"小情绪..","publisher_avatar":"http://wx.qlogo.cn/mmopen/PiajxSqBRaEIibwzVXXnTox28hFWNaoQnaia6CGrDhr7NwsoRiadBgGwDeicicODY6wThrcoKWicVaTTt4AlCJ6BxGsVQ/0","description":"自制意大利白汤面","content_type":5,"type":"food_card","like_ct":428},{"item_id":7274,"title":"珍珠肉丸&牛油果","card_image":"http://one.boohee.cn/food/2016/10/15/09AD676B-E929-4B7A-B1E9-6684E93AA8BC.jpg?imageView2/2/w/640","publisher":"凯瑟琳de厨房","publisher_avatar":"http://one.boohee.cn/t/2016/10/21/6668E33D-3CA3-4260-9898-FC15AA31F449.jpg","description":"","content_type":5,"type":"food_card","like_ct":267},{"item_id":7281,"title":"肉松三明治","card_image":"http://one.boohee.cn/food/2016/10/16/02BB68B3-C45A-4E1E-ADB8-AAA32A97CFC9.jpg?imageView2/2/w/640","publisher":"我是林春春","publisher_avatar":"http://one.boohee.cn/t/2016/9/26/B6EA0FE8-B494-4F88-BCB2-893152016A28.jpg","description":"#简易早餐# 肉松三明治 生活就像一杯白开水,你每天都在喝,不要羡慕别人喝的饮料有各种颜色,其实未必有你的白开水解渴。[太阳]","content_type":5,"type":"food_card","like_ct":364},{"item_id":7283,"title":"自制鸡蛋三明治","card_image":"http://one.boohee.cn/food/2016/10/16/6FA3040E-C9D4-4851-AB75-46160510AD0D.jpg?imageView2/2/w/640","publisher":"小情绪..","publisher_avatar":"http://wx.qlogo.cn/mmopen/PiajxSqBRaEIibwzVXXnTox28hFWNaoQnaia6CGrDhr7NwsoRiadBgGwDeicicODY6wThrcoKWicVaTTt4AlCJ6BxGsVQ/0","description":"","content_type":5,"type":"food_card","like_ct":294},{"item_id":7304,"title":"午餐","card_image":"http://one.boohee.cn/food/2016/10/16/3470D50E-7F59-44CD-A716-D1C2EC903141.jpg?imageView2/2/w/640","publisher":"小情绪..","publisher_avatar":"http://wx.qlogo.cn/mmopen/PiajxSqBRaEIibwzVXXnTox28hFWNaoQnaia6CGrDhr7NwsoRiadBgGwDeicicODY6wThrcoKWicVaTTt4AlCJ6BxGsVQ/0","description":"","content_type":5,"type":"food_card","like_ct":136}] + */ + + private String page; + private int total_pages; + private List feeds; + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public int getTotal_pages() { + return total_pages; + } + + public void setTotal_pages(int total_pages) { + this.total_pages = total_pages; + } + + public List getFeeds() { + return feeds; + } + + public void setFeeds(List feeds) { + this.feeds = feeds; + } + + public static class FeedsBean { + /** + * card_image : http://up.boohee.cn/house/u/bet/img/2017_spring/banner_shiwupai.jpg + * content_type : 6 + * link : http://one.boohee.com/store/pages/bet_data_show_fl + * item_id : 7810 + * title : 黑胡椒牛排&全麦面包 + * publisher : CHENG1228 + * publisher_avatar : http://wx.qlogo.cn/mmopen/PiajxSqBRaELj1mEkGxiamCB8UjibfJibusEBsZO0hAGpHA4iacP9CNufO8WJda4BRtMic5rvMzGF7hJYLibhbYxJns0g/0 + * description : + * type : food_card + * like_ct : 1201 + */ + + private String card_image; + private int content_type; + private String link; + private int item_id; + private String title; + private String publisher; + private String publisher_avatar; + private String description; + private String type; + private int like_ct; + + public String getCard_image() { + return card_image; + } + + public void setCard_image(String card_image) { + this.card_image = card_image; + } + + public int getContent_type() { + return content_type; + } + + public void setContent_type(int content_type) { + this.content_type = content_type; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public int getItem_id() { + return item_id; + } + + public void setItem_id(int item_id) { + this.item_id = item_id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getPublisher() { + return publisher; + } + + public void setPublisher(String publisher) { + this.publisher = publisher; + } + + public String getPublisher_avatar() { + return publisher_avatar; + } + + public void setPublisher_avatar(String publisher_avatar) { + this.publisher_avatar = publisher_avatar; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getLike_ct() { + return like_ct; + } + + public void setLike_ct(int like_ct) { + this.like_ct = like_ct; + } + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp1Bean.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp1Bean.java new file mode 100644 index 0000000..2c5fc27 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp1Bean.java @@ -0,0 +1,129 @@ +package com.liudaohong.foodparty.Bean; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/20. + */ + +public class FoodVp1Bean { + /** + * page : 1 + * total_pages : 7 + * feeds : [{"item_id":833,"source":"/NICE 健康/","title":"各类海鲜蛋白质含量排行","background":"http://one.boohee.cn/food/image/food_news/2016/10/5/80652b339a9ced1c318faa620dbfcac4","tail":"41301人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MzI4MzEwOTMzMw==&mid=2649417868&idx=1&sn=369d9bb73ced27fd7f7582c1a0272792&mpshare=1&scene=1&srcid=10056q1aIBUvNiyftYRL8Knb#rd","content_type":4},{"item_id":818,"source":"/没牌子/","title":"难吃?好吃?我们尝到了沙拉酱的地狱和天堂","background":"http://one.boohee.cn/food/image/food_news/2016/9/28/bced6e60ca3a2ccc42b0be25e92e108a","tail":"24221人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MzA3ODA0MDg3MA==&mid=2656200967&idx=2&sn=cc4da915308d861e23e44355af4e4373&mpshare=1&scene=1&srcid=0928OFmNXisxdDr0r7SnYuvn#rd","content_type":4},{"item_id":813,"source":"/网易LOFTER/","title":"牛油果vs无花果,谁才是美食届的水果Queen?","background":"http://one.boohee.cn/food/image/food_news/2016/9/27/e22cc428e21ec928a0bc5859d93d58e8","tail":"19183人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MjM5MTA4MTE2MA==&mid=2650272527&idx=1&sn=5486ff70c2ee705d4db8d3b17afc44f2&chksm=beb9a4a889ce2dbe2c01aa0b9a91e1709bf149f858d973cf1eab53d18f16c5a55ce41814aa11","content_type":4},{"item_id":812,"source":"/企鹅吃喝指南/","title":"那些年,我们喝过的罐装咖啡","background":"http://one.boohee.cn/food/image/food_news/2016/9/27/7265166e6808db8bc3fa321cd56757c9","tail":"14879人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MjM5Mzc5NTk1OQ==&mid=2652998659&idx=1&sn=90b369ab31bb2f58349e74061d0533b6&scene=0#wechat_redirect","content_type":4},{"item_id":809,"source":"/36Kr/","title":"硅谷公司食堂哪家强?","background":"http://one.boohee.cn/food/image/food_news/2016/9/26/a2af734425288b94f7061a1d439af6e3","tail":"8070人阅读","type":"food_news","link":"http://36kr.com/p/5053091.html","content_type":4},{"item_id":797,"source":"/就知道吃/","title":"20多家飞机餐大测评,你中过哪家的枪?","background":"http://one.boohee.cn/food/image/food_news/2016/9/24/444f65ec4f020dc6fd78386d2db74cee","tail":"12205人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MzA4OTk0ODUwNQ==&mid=401940710&idx=1&sn=c8a9e7a2f6048859dee7f4e5fbea42d3&scene=24&srcid=0805GwS6sbWaisOZvAfDyiJB#wechat_redirect","content_type":4},{"item_id":776,"source":"/陈柳妍 消费者报道/","title":"8品牌蜂蜜测评:百花牌和同仁堂涉嫌造假","background":"http://one.boohee.cn/food/image/food_news/2016/8/11/8d36d7919cf30d8d5ca226c4d75786df","tail":"25053人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MjM5MTY1NTI0MA==&mid=2651810996&idx=1&sn=1a9502e02a97b38479b7b9d36cc2725a&scene=24&srcid=0805ZWOZ04MYFP5nteicT3aP#wechat_redirect","content_type":4},{"item_id":783,"source":"/ 龙十兄 一期一会饮食指南/","title":"没想到维他是这样的\u201c不务正业\u201d","background":"http://one.boohee.cn/food/image/food_news/2016/8/12/6af4fadd6e426a1f372ca7553d477b95","tail":"16822人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MzAxMTgzNzk4MQ==&mid=2650497836&idx=1&sn=3263230a57085d3789502f11d85b1130&scene=0#wechat_redirect","content_type":4},{"item_id":768,"source":"/食品饮料生鲜消费指南/","title":"我们做了一份\u201c最难喝饮料\u201d的测评报告","background":"http://one.boohee.cn/food/image/food_news/2016/8/11/d7bfbe668a05e1841ab68b0abe80a542","tail":"22175人阅读","type":"food_news","link":"http://mp.weixin.qq.com/s?__biz=MjM5NTcyMTE3MQ==&mid=2652363417&idx=2&sn=e0e29c5706f6dc0ab8b91f001c8bf742&scene=0#wechat_redirect","content_type":4},{"item_id":760,"source":"/ 就知道吃/","title":"喝遍30国41种果汁,我们用胃酸写出了最全果汁指南!","background":"http://one.boohee.cn/food/image/food_news/2016/8/11/5d99bfad74284d3f3623711f122fd92c","tail":"19920人阅读","type":"food_news","link":"http://toutiao.com/i6240399601052942849/","content_type":4}] + */ + + private String page; + private int total_pages; + private List feeds; + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public int getTotal_pages() { + return total_pages; + } + + public void setTotal_pages(int total_pages) { + this.total_pages = total_pages; + } + + public List getFeeds() { + return feeds; + } + + public void setFeeds(List feeds) { + this.feeds = feeds; + } + + public static class FeedsBean { + /** + * item_id : 833 + * source : /NICE 健康/ + * title : 各类海鲜蛋白质含量排行 + * background : http://one.boohee.cn/food/image/food_news/2016/10/5/80652b339a9ced1c318faa620dbfcac4 + * tail : 41301人阅读 + * type : food_news + * link : http://mp.weixin.qq.com/s?__biz=MzI4MzEwOTMzMw==&mid=2649417868&idx=1&sn=369d9bb73ced27fd7f7582c1a0272792&mpshare=1&scene=1&srcid=10056q1aIBUvNiyftYRL8Knb#rd + * content_type : 4 + */ + + private int item_id; + private String source; + private String title; + private String background; + private String tail; + private String type; + private String link; + private int content_type; + + public int getItem_id() { + return item_id; + } + + public void setItem_id(int item_id) { + this.item_id = item_id; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBackground() { + return background; + } + + public void setBackground(String background) { + this.background = background; + } + + public String getTail() { + return tail; + } + + public void setTail(String tail) { + this.tail = tail; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public int getContent_type() { + return content_type; + } + + public void setContent_type(int content_type) { + this.content_type = content_type; + } + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp2Bean.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp2Bean.java new file mode 100644 index 0000000..2ef1d77 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/FoodVp2Bean.java @@ -0,0 +1,129 @@ +package com.liudaohong.foodparty.Bean; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/21. + */ + +public class FoodVp2Bean { + /** + * page : 1 + * total_pages : 30 + * feeds : [{"source":"大糖 营养师团 ","title":"心梗离你有多远?| 教你选对食物 降低风险","link":"http://jingxuan.guokr.com/pick/75627/","tail":"12296","images":["http://up.boohee.cn/house/u/food_library/home_news/news_454.png"],"item_id":849,"type":"food_news","content_type":1},{"source":"大糖 营养师团 ","title":"零运动基础?1000步运动替换法你也可以尝试!","link":"http://jingxuan.guokr.com/pick/75632/","tail":"30107","images":["http://up.boohee.cn/house/u/food_library/home_news/news_450.png"],"item_id":850,"type":"food_news","content_type":1},{"source":"企鹅吃喝指南","title":"我知道你为什么看不起喝茶包","link":"http://mp.weixin.qq.com/s?__biz=MjM5Mzc5NTk1OQ==&mid=2652999710&idx=1&sn=6023a0532ca312f8909d3c6f29560b05&chksm=bd44aa068a33231058823c917d5c156318597c28ed7849a87e3cdc3768effdcce8769ee8fdad&mpshare=1&scene=1&srcid=1010244UiU6G70YDrdbjPf9q#rd","tail":"14724","images":["http://up.boohee.cn/house/u/food_library/home_news/news_452.png"],"item_id":851,"type":"food_news","content_type":1},{"source":"康宝莱微刊","title":"饿怕了?减肥加餐未必会胖,这个你必须知道!","link":"http://mp.weixin.qq.com/s?__biz=MjM5NjU4OTg4NA==&mid=2652400770&idx=1&sn=ebc42cda426d011621b3c6593019c135&mpshare=1&scene=1&srcid=1009LtdXRB92TqkYRvZYvuff#rd","tail":"50865","images":["http://up.boohee.cn/house/u/food_library/home_news/news_441.png"],"item_id":847,"type":"food_news","content_type":1},{"source":"e患者说 ","title":"葡萄酒过期了还能喝吗?","link":"http://www.toutiao.com/a6335516178047729922/","tail":"5851","images":["http://up.boohee.cn/house/u/food_library/home_news/news_448.png"],"item_id":846,"type":"food_news","content_type":1},{"source":" 朱俊平 糖尿病之友","title":"适合糖友加餐的健康零食,你得会吃!","link":"http://mp.weixin.qq.com/s?__biz=MjM5NTAzMDI3Mg==&mid=2650988024&idx=1&sn=655d73548290f7d5f4307569cd915e39&mpshare=1&scene=1&srcid=1009lYfanUygRWPdPurH951J#rd","tail":"15148","images":["http://up.boohee.cn/house/u/food_library/home_news/news_446.png"],"item_id":845,"type":"food_news","content_type":1},{"source":"范志红","title":"长假之后,怎么调整状态?","link":"","tail":"4736","images":["http://up.boohee.cn/house/u/food_library/home_news/news_442.png"],"item_id":843,"type":"food_news","content_type":1},{"source":"物道","title":"寒露|秋风一夜凉,枫林尽染暖阳色","link":"http://mp.weixin.qq.com/s?__biz=MzA4MzI1Mzc2MA==&mid=2653783646&idx=1&sn=1549d8c9387ad67f82603006a3dc2834&chksm=84206931b357e027cc07a9032a962e54168159dbc8aa66aa52a018d4f3da6b5ac8659fe3e9b4&mpshare=1&scene=1&srcid=1008iKrYlYdznvTbNFXKwnjq#rd","tail":"2517","images":["http://up.boohee.cn/house/u/food_library/home_news/news_440.png"],"item_id":842,"type":"food_news","content_type":1},{"source":"健康时报","title":"补血还是补肾,不同豆豆营养有啥差别?","link":"http://toutiao.com/a6338919538662539522/?tt_from=mobile_qq&utm_campaign=client_share&app=news_article&utm_source=mobile_qq&iid=5681682629&utm_medium=toutiao_ios","tail":"9409","images":["http://up.boohee.cn/house/u/food_library/home_news/news_444.png"],"item_id":844,"type":"food_news","content_type":1},{"source":"初夏之菡 食商","title":"食品包装上的标签,你误解了吗?","link":"http://mp.weixin.qq.com/s?__biz=MzAwNzk2NDk1Mg==&mid=2247483883&idx=1&sn=69b0c19ac1f06c59e6d62c3a2972e4cb&mpshare=1&scene=1&srcid=1007gu1WBlEays16hINL994Z#rd","tail":"13471","images":["http://up.boohee.cn/house/u/food_library/home_news/news_434.png"],"item_id":838,"type":"food_news","content_type":1}] + */ + + private String page; + private int total_pages; + private List feeds; + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public int getTotal_pages() { + return total_pages; + } + + public void setTotal_pages(int total_pages) { + this.total_pages = total_pages; + } + + public List getFeeds() { + return feeds; + } + + public void setFeeds(List feeds) { + this.feeds = feeds; + } + + public static class FeedsBean { + /** + * source : 大糖 营养师团 + * title : 心梗离你有多远?| 教你选对食物 降低风险 + * link : http://jingxuan.guokr.com/pick/75627/ + * tail : 12296 + * images : ["http://up.boohee.cn/house/u/food_library/home_news/news_454.png"] + * item_id : 849 + * type : food_news + * content_type : 1 + */ + + private String source; + private String title; + private String link; + private String tail; + private int item_id; + private String type; + private int content_type; + private List images; + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public String getTail() { + return tail; + } + + public void setTail(String tail) { + this.tail = tail; + } + + public int getItem_id() { + return item_id; + } + + public void setItem_id(int item_id) { + this.item_id = item_id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getContent_type() { + return content_type; + } + + public void setContent_type(int content_type) { + this.content_type = content_type; + } + + public List getImages() { + return images; + } + + public void setImages(List images) { + this.images = images; + } + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeBean.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeBean.java new file mode 100644 index 0000000..3e3e120 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeBean.java @@ -0,0 +1,161 @@ +package com.liudaohong.foodparty.Bean; + +import java.util.List; + +/** + * Created by liuhong on 2017/3/17. + */ + +public class HomeBean { + /** + * group_count : 3 + * group : [{"kind":"group","categories":[{"id":1,"name":"主食类","image_url":"http://up.boohee.cn/house/u/food_library/category/1_v1.png","sub_category_count":3,"sub_categories":[{"id":13,"name":"包装谷薯","image_url":null},{"id":11,"name":"天然谷薯","image_url":null},{"id":12,"name":"谷薯制品","image_url":null}],"description":null},{"id":2,"name":"肉蛋类","image_url":"http://up.boohee.cn/house/u/food_library/category/2_v1.png","sub_category_count":3,"sub_categories":[{"id":22,"name":"白肉","image_url":null},{"id":21,"name":"红肉","image_url":null},{"id":23,"name":"蛋类","image_url":null}],"description":null},{"id":3,"name":"大豆及制品","image_url":"http://up.boohee.cn/house/u/food_library/category/3_v1.png","sub_category_count":1,"sub_categories":[{"id":31,"name":"大豆及制品","image_url":null}],"description":null},{"id":4,"name":"蔬菜菌藻类","image_url":"http://up.boohee.cn/house/u/food_library/category/4_v1.png","sub_category_count":2,"sub_categories":[{"id":42,"name":"菌藻","image_url":null},{"id":41,"name":"蔬菜","image_url":null}],"description":null},{"id":5,"name":"水果类","image_url":"http://up.boohee.cn/house/u/food_library/category/5_v1.png","sub_category_count":1,"sub_categories":[{"id":51,"name":"水果","image_url":null}],"description":null},{"id":6,"name":"奶类","image_url":"http://up.boohee.cn/house/u/food_library/category/6_v1.png","sub_category_count":5,"sub_categories":[{"id":65,"name":"其它","image_url":null},{"id":64,"name":"奶粉","image_url":null},{"id":63,"name":"奶酪","image_url":null},{"id":62,"name":"酸奶","image_url":null},{"id":61,"name":"鲜奶","image_url":null}],"description":null},{"id":7,"name":"油脂类","image_url":"http://up.boohee.cn/house/u/food_library/category/7_v1.png","sub_category_count":2,"sub_categories":[{"id":72,"name":"动物油","image_url":null},{"id":71,"name":"植物油","image_url":null}],"description":null},{"id":8,"name":"坚果类","image_url":"http://up.boohee.cn/house/u/food_library/category/8_v1.png","sub_category_count":1,"sub_categories":[{"id":81,"name":"坚果种子","image_url":null}],"description":null},{"id":9,"name":"调味品","image_url":"http://up.boohee.cn/house/u/food_library/category/9_v1.png","sub_category_count":4,"sub_categories":[{"id":94,"name":"糖和蜂蜜","image_url":null},{"id":91,"name":"调味料","image_url":null},{"id":92,"name":"调味酱","image_url":null},{"id":93,"name":"酱菜","image_url":null}],"description":null},{"id":10,"name":"饮料类","image_url":"http://up.boohee.cn/house/u/food_library/category/10_v1.png","sub_category_count":8,"sub_categories":[{"id":108,"name":"乳饮料","image_url":null},{"id":104,"name":"含糖饮料","image_url":null},{"id":107,"name":"固体饮料","image_url":null},{"id":106,"name":"无糖咖啡","image_url":null},{"id":105,"name":"无糖茶饮","image_url":null},{"id":102,"name":"碳酸饮料","image_url":null},{"id":103,"name":"纯果蔬汁饮料","image_url":null},{"id":101,"name":"酒精饮料","image_url":null}],"description":null},{"id":11,"name":"零食,点心及冷饮","image_url":"http://up.boohee.cn/house/u/food_library/category/11_v1.png","sub_category_count":3,"sub_categories":[{"id":113,"name":"冷饮","image_url":null},{"id":112,"name":"点心","image_url":null},{"id":111,"name":"零食","image_url":null}],"description":null},{"id":12,"name":"其它","image_url":"http://up.boohee.cn/house/u/food_library/category/12_v1.png","sub_category_count":2,"sub_categories":[{"id":121,"name":"药食","image_url":null},{"id":122,"name":"营养保健","image_url":null}],"description":null}]},{"kind":"brand","categories":[{"id":20,"name":"薄荷","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand1.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":1,"name":"鲜得味","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand2.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":2,"name":"雀巢","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand3.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":3,"name":"光明","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand4.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":4,"name":"伊利","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand5.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":5,"name":"蒙牛","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand6.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":6,"name":"三全","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand7.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":7,"name":"永和","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand8.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":8,"name":"南方","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand9.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":9,"name":"康师傅","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand10.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":10,"name":"思念","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand11.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":21,"name":"新农哥","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand12.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":23,"name":"旺旺","image_url":"http://up.boohee.cn/house/u/food_library/brand/brand13.png","sub_category_count":0,"sub_categories":[],"description":null}]},{"kind":"restaurant","categories":[{"id":1,"name":"肯德基","image_url":"http://up.boohee.cn/house/u/food_library/chain_restaurant/linkage1.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":2,"name":"麦当劳","image_url":"http://up.boohee.cn/house/u/food_library/chain_restaurant/linkage2.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":3,"name":"星巴克","image_url":"http://up.boohee.cn/house/u/food_library/chain_restaurant/linkage3.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":4,"name":"吉野家","image_url":"http://up.boohee.cn/house/u/food_library/chain_restaurant/linkage4.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":5,"name":"德克士","image_url":"http://up.boohee.cn/house/u/food_library/chain_restaurant/linkage5.png","sub_category_count":0,"sub_categories":[],"description":null},{"id":6,"name":"大娘水饺","image_url":"http://up.boohee.cn/house/u/food_library/chain_restaurant/linkage6.png","sub_category_count":0,"sub_categories":[],"description":null}]}] + */ + + private int group_count; + private List group; + + public int getGroup_count() { + return group_count; + } + + public void setGroup_count(int group_count) { + this.group_count = group_count; + } + + public List getGroup() { + return group; + } + + public void setGroup(List group) { + this.group = group; + } + + public static class GroupBean { + /** + * kind : group + * categories : [{"id":1,"name":"主食类","image_url":"http://up.boohee.cn/house/u/food_library/category/1_v1.png","sub_category_count":3,"sub_categories":[{"id":13,"name":"包装谷薯","image_url":null},{"id":11,"name":"天然谷薯","image_url":null},{"id":12,"name":"谷薯制品","image_url":null}],"description":null},{"id":2,"name":"肉蛋类","image_url":"http://up.boohee.cn/house/u/food_library/category/2_v1.png","sub_category_count":3,"sub_categories":[{"id":22,"name":"白肉","image_url":null},{"id":21,"name":"红肉","image_url":null},{"id":23,"name":"蛋类","image_url":null}],"description":null},{"id":3,"name":"大豆及制品","image_url":"http://up.boohee.cn/house/u/food_library/category/3_v1.png","sub_category_count":1,"sub_categories":[{"id":31,"name":"大豆及制品","image_url":null}],"description":null},{"id":4,"name":"蔬菜菌藻类","image_url":"http://up.boohee.cn/house/u/food_library/category/4_v1.png","sub_category_count":2,"sub_categories":[{"id":42,"name":"菌藻","image_url":null},{"id":41,"name":"蔬菜","image_url":null}],"description":null},{"id":5,"name":"水果类","image_url":"http://up.boohee.cn/house/u/food_library/category/5_v1.png","sub_category_count":1,"sub_categories":[{"id":51,"name":"水果","image_url":null}],"description":null},{"id":6,"name":"奶类","image_url":"http://up.boohee.cn/house/u/food_library/category/6_v1.png","sub_category_count":5,"sub_categories":[{"id":65,"name":"其它","image_url":null},{"id":64,"name":"奶粉","image_url":null},{"id":63,"name":"奶酪","image_url":null},{"id":62,"name":"酸奶","image_url":null},{"id":61,"name":"鲜奶","image_url":null}],"description":null},{"id":7,"name":"油脂类","image_url":"http://up.boohee.cn/house/u/food_library/category/7_v1.png","sub_category_count":2,"sub_categories":[{"id":72,"name":"动物油","image_url":null},{"id":71,"name":"植物油","image_url":null}],"description":null},{"id":8,"name":"坚果类","image_url":"http://up.boohee.cn/house/u/food_library/category/8_v1.png","sub_category_count":1,"sub_categories":[{"id":81,"name":"坚果种子","image_url":null}],"description":null},{"id":9,"name":"调味品","image_url":"http://up.boohee.cn/house/u/food_library/category/9_v1.png","sub_category_count":4,"sub_categories":[{"id":94,"name":"糖和蜂蜜","image_url":null},{"id":91,"name":"调味料","image_url":null},{"id":92,"name":"调味酱","image_url":null},{"id":93,"name":"酱菜","image_url":null}],"description":null},{"id":10,"name":"饮料类","image_url":"http://up.boohee.cn/house/u/food_library/category/10_v1.png","sub_category_count":8,"sub_categories":[{"id":108,"name":"乳饮料","image_url":null},{"id":104,"name":"含糖饮料","image_url":null},{"id":107,"name":"固体饮料","image_url":null},{"id":106,"name":"无糖咖啡","image_url":null},{"id":105,"name":"无糖茶饮","image_url":null},{"id":102,"name":"碳酸饮料","image_url":null},{"id":103,"name":"纯果蔬汁饮料","image_url":null},{"id":101,"name":"酒精饮料","image_url":null}],"description":null},{"id":11,"name":"零食,点心及冷饮","image_url":"http://up.boohee.cn/house/u/food_library/category/11_v1.png","sub_category_count":3,"sub_categories":[{"id":113,"name":"冷饮","image_url":null},{"id":112,"name":"点心","image_url":null},{"id":111,"name":"零食","image_url":null}],"description":null},{"id":12,"name":"其它","image_url":"http://up.boohee.cn/house/u/food_library/category/12_v1.png","sub_category_count":2,"sub_categories":[{"id":121,"name":"药食","image_url":null},{"id":122,"name":"营养保健","image_url":null}],"description":null}] + */ + + private String kind; + private List categories; + + public String getKind() { + return kind; + } + + public void setKind(String kind) { + this.kind = kind; + } + + public List getCategories() { + return categories; + } + + public void setCategories(List categories) { + this.categories = categories; + } + + public static class CategoriesBean { + /** + * id : 1 + * name : 主食类 + * image_url : http://up.boohee.cn/house/u/food_library/category/1_v1.png + * sub_category_count : 3 + * sub_categories : [{"id":13,"name":"包装谷薯","image_url":null},{"id":11,"name":"天然谷薯","image_url":null},{"id":12,"name":"谷薯制品","image_url":null}] + * description : null + */ + + private int id; + private String name; + private String image_url; + private int sub_category_count; + private Object description; + private List sub_categories; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getImage_url() { + return image_url; + } + + public void setImage_url(String image_url) { + this.image_url = image_url; + } + + public int getSub_category_count() { + return sub_category_count; + } + + public void setSub_category_count(int sub_category_count) { + this.sub_category_count = sub_category_count; + } + + public Object getDescription() { + return description; + } + + public void setDescription(Object description) { + this.description = description; + } + + public List getSub_categories() { + return sub_categories; + } + + public void setSub_categories(List sub_categories) { + this.sub_categories = sub_categories; + } + + public static class SubCategoriesBean { + /** + * id : 13 + * name : 包装谷薯 + * image_url : null + */ + + private int id; + private String name; + private Object image_url; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Object getImage_url() { + return image_url; + } + + public void setImage_url(Object image_url) { + this.image_url = image_url; + } + } + } + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeListBean.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeListBean.java new file mode 100644 index 0000000..9707022 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Bean/HomeListBean.java @@ -0,0 +1,42 @@ +package com.liudaohong.foodparty.Bean; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class HomeListBean { + private String name; + private HomeBean.GroupBean groupBean; + + public HomeListBean() { + } + + public HomeListBean(String name, HomeBean.GroupBean groupBean) { + this.name = name; + this.groupBean = groupBean; + } + + @Override + public String toString() { + return "HomeListBean{" + + "name='" + name + '\'' + + ", groupBean=" + groupBean + + '}'; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public HomeBean.GroupBean getGroupBean() { + return groupBean; + } + + public void setGroupBean(HomeBean.GroupBean groupBean) { + this.groupBean = groupBean; + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood.java new file mode 100644 index 0000000..9cc379a --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood.java @@ -0,0 +1,28 @@ +package com.liudaohong.foodparty.Iterface; + +import com.liudaohong.foodparty.Bean.FoodTabBean; +import com.liudaohong.foodparty.Bean.FoodVp0Bean; +import com.liudaohong.foodparty.Bean.FoodVp1Bean; +import com.liudaohong.foodparty.Bean.FoodVp2Bean; + +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Query; + +/** + * Created by liuhong on 2017/3/18. + */ + +public interface IFood { + @GET("fb/v1/feed_categories?token=&user_key=&app_version=2.6") + Call callback(); + + @GET("fb/v1/feeds/category_feed?category=1&per=10&token=&user_key=&app_version=2.6&") + Call callbackvp0(@Query("page") int page); + + @GET("fb/v1/feeds/category_feed?category=2&per=10&token=&user_key=&app_version=2.6&") + Call callbackvp1(@Query("page") int page); + + @GET("fb/v1/feeds/category_feed?category=3&per=10&token=&user_key=&app_version=2.6&") + Call callbackvp2(@Query("page") int page); +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood_0_Listener.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood_0_Listener.java new file mode 100644 index 0000000..2a441b0 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/IFood_0_Listener.java @@ -0,0 +1,14 @@ +package com.liudaohong.foodparty.Iterface; + +import android.content.DialogInterface; +import android.view.View; + +/** + * Created by liuhong on 2017/3/20. + */ + +public interface IFood_0_Listener { + public void setOnClickListener(View item,int Positon); + public boolean setOnLongClickListener(View view,int postion); + +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/Ihome.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/Ihome.java new file mode 100644 index 0000000..70e6136 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/Iterface/Ihome.java @@ -0,0 +1,15 @@ +package com.liudaohong.foodparty.Iterface; + +import com.liudaohong.foodparty.Bean.HomeBean; + +import retrofit2.Call; +import retrofit2.http.GET; + +/** + * Created by liuhong on 2017/3/17. + */ + +public interface Ihome { + @GET("fb/v1/categories/list?token=&user_key=&app_version=2.6") + Call callback(); +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/MyGridView.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/MyGridView.java new file mode 100644 index 0000000..cf283ef --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/MyGridView.java @@ -0,0 +1,26 @@ +package com.liudaohong.foodparty; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.GridView; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class MyGridView extends GridView { + public MyGridView(Context context) { + super(context); + } + + public MyGridView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, + MeasureSpec.AT_MOST); + super.onMeasure(widthMeasureSpec, expandSpec); + } +} \ No newline at end of file diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/MainActivity.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/MainActivity.java new file mode 100644 index 0000000..31cfc72 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/MainActivity.java @@ -0,0 +1,83 @@ +package com.liudaohong.foodparty.ui.Activity; + +import android.graphics.drawable.ColorDrawable; +import android.support.v4.app.FragmentTabHost; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.TabHost; +import android.widget.TextView; +import com.liudaohong.foodparty.R; +import com.liudaohong.foodparty.ui.Fragment.HomeFragment; +import com.liudaohong.foodparty.ui.Fragment.MineFragment; +import com.liudaohong.foodparty.ui.Fragment.foodFragment; + +public class MainActivity extends NoActionBarActivity { + + private FragmentTabHost tabHost; + private String[] tabtitles={"食物百科","逛吃","我的"}; + int[] tabImgIds = { + R.drawable.tab_0, + R.drawable.tab_1, + R.drawable.tab_2 + }; + //标签对应的Fragment的Class + Class[] fragments = { + HomeFragment.class, + foodFragment.class, + MineFragment.class + }; + private LayoutInflater inflater; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + intiview(); + initTabs(); + } + + private void intiview() { + tabHost = ((FragmentTabHost) findViewById(R.id.tabHost)); + tabHost.setup(this,getSupportFragmentManager(),R.id.fragment_layout); + + } + + private void initTabs() { + //添加四个标签 + for (int i = 0; i < tabtitles.length; i++) { + //创建一个新的标签,指定Tag,这个tab就是Fragment的tag + TabHost.TabSpec tab = tabHost.newTabSpec("tab"+i); + //设置标签的视图 + tab.setIndicator(getTabView(i)); + //添加到TabHost中 + //参数一:标签TabSpec + //参数二:tab标签对应的Fragment的Class + //参数三:Bundle 可传参数到指定的Fragment中 + + tabHost.addTab(tab, fragments[i], null); + //把tab左右的分隔线设置为透明图片 + tabHost.getTabWidget().setDividerDrawable(new ColorDrawable(0x00000000)); + } + + } + + private View getTabView(int i) { + //动态得到View-->tab_item的布局 + if (inflater == null) { + inflater = LayoutInflater.from(this); + } + + View view = inflater.inflate(R.layout.tab_item_layout, null); + //设置view中的控件(ImageView,Text)相关属性 + ImageView iv = (ImageView) view.findViewById(R.id.tab_iv); + TextView tv = (TextView) view.findViewById(R.id.tab_tv); + iv.setImageResource(tabImgIds[i]); + tv.setText(tabtitles[i]); + return view; + + } + +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/NoActionBarActivity.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/NoActionBarActivity.java new file mode 100644 index 0000000..364ad5f --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Activity/NoActionBarActivity.java @@ -0,0 +1,18 @@ +package com.liudaohong.foodparty.ui.Activity; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class NoActionBarActivity extends AppCompatActivity { + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + //隐藏ActionBar + getSupportActionBar().hide(); + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_0_fragment.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_0_fragment.java new file mode 100644 index 0000000..e7b5f06 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_0_fragment.java @@ -0,0 +1,215 @@ +package com.liudaohong.foodparty.ui.Fragment; + +import android.graphics.Rect; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.StaggeredGridLayoutManager; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Toast; + +import com.liudaohong.foodparty.Adapter.Food_0_adapter; +import com.liudaohong.foodparty.Bean.FoodVp0Bean; +import com.liudaohong.foodparty.BuildConfig; +import com.liudaohong.foodparty.Iterface.IFood; +import com.liudaohong.foodparty.Iterface.IFood_0_Listener; +import com.liudaohong.foodparty.R; +import java.util.ArrayList; +import java.util.List; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +import static android.R.attr.max; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class Food_0_fragment extends Fragment { + + private View view; + private RecyclerView recycler; + private int page=1; + List list=new ArrayList<>(); + private Food_0_adapter adapter; + private int total_pages; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + if (view==null){ + view = inflater.inflate(R.layout.food_1_layout,container,false); + } + ViewGroup parent = (ViewGroup) view.getParent(); + if (parent!=null){ + parent.removeView(view); + } + return view; + } + + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + if (adapter==null){ + intiview(view); + intiadapter(); + intidata(); + intilisterner(); + initListener(); + } + } + + private void initListener() { + adapter.SetLister(new IFood_0_Listener() { + @Override + public void setOnClickListener(View item, int Positon) { + if(Positon==0){ + + }else { + + } + } + + @Override + public boolean setOnLongClickListener(View view, int postion) { + return false; + } + }); + } + + private void intilisterner() { + recycler.addOnScrollListener(new RecyclerView.OnScrollListener(){ + //用来标记是否正在向最后一个滑动,既是否向下滑动 + boolean isSlidingToLast = false; + + @Override + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { + StaggeredGridLayoutManager manager = (StaggeredGridLayoutManager) recyclerView.getLayoutManager(); + // 当不滚动时 + if (newState == RecyclerView.SCROLL_STATE_IDLE) { + //获取最后一个完全显示的ItemPosition + int[] lastVisiblePositions = manager.findLastVisibleItemPositions(new int[manager.getSpanCount()]); + int lastVisiblePos = getMaxElem(lastVisiblePositions); + int totalItemCount = manager.getItemCount(); + + // 判断是否滚动到底部 + if (lastVisiblePos == (totalItemCount -1) && isSlidingToLast) { + //加载更多功能的代码 + /* Ln.e("howes right="+manager.findLastCompletelyVisibleItemPosition()); + Toast.makeText(getActivityContext(),"加载更多",0).show();*/ + // Toast.makeText(getContext(), "可以加载更多了", Toast.LENGTH_SHORT).show(); + if (list.size()>0&&total_pages!=0&&page<=total_pages){ + intidata(); + } + } + } + } + + private int getMaxElem(int[] lastVisiblePositions) { + int max=0; + for (int i = 0; i < lastVisiblePositions.length; i++) { + max=max>lastVisiblePositions[i]?max:lastVisiblePositions[i]; + } + return max; + } + + @Override + public void onScrolled(RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + //dx用来判断横向滑动方向,dy用来判断纵向滑动方向 + if(dy > 0){ + //大于0表示,正在向下滚动 + isSlidingToLast = true; + }else{ + //小于等于0 表示停止或向上滚动 + isSlidingToLast = false; + } + + } + }); + + + } + + private void intidata() { + //增加返回值为Gson的支持(以实体类返回) + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://food.boohee.com/") + //增加返回值为Gson的支持(以实体类返回) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + IFood iFood = retrofit.create(IFood.class); + Call foodVp0BeanCall = iFood.callbackvp0(page++); + foodVp0BeanCall.enqueue(new Callback() { + + + + @Override + public void onResponse(Call call, Response response) { + Log.d("Food_0_fragment", "下载成功........"); + if (response.isSuccess()){ + FoodVp0Bean body = response.body(); + total_pages = body.getTotal_pages(); + + + List feeds = body.getFeeds(); + list.addAll(feeds); + adapter.notifyItemInserted(list.size()-feeds.size()); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + } + + private void intiadapter() { + adapter = new Food_0_adapter(getContext(),list); + recycler.setAdapter(adapter); + + + } + + private void intiview(View view) { + + recycler = ((RecyclerView) view.findViewById(R.id.recycler)); + StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); + recycler.setLayoutManager(staggeredGridLayoutManager); + //设置item之间的间隔 + SpacesItemDecoration decoration=new SpacesItemDecoration(16); + recycler.addItemDecoration(decoration); + + } + + + public class SpacesItemDecoration extends RecyclerView.ItemDecoration { + + private int space; + + public SpacesItemDecoration(int space) { + this.space=space; + } + + @Override + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { + outRect.left=space; + outRect.right=space; + outRect.bottom=space; + if(parent.getChildAdapterPosition(view)==0){ + outRect.top=space; + } + } + } + + +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_1_Fragment.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_1_Fragment.java new file mode 100644 index 0000000..82d9d4f --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_1_Fragment.java @@ -0,0 +1,145 @@ +package com.liudaohong.foodparty.ui.Fragment; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.StaggeredGridLayoutManager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.liudaohong.foodparty.Adapter.Food_1_adapter; +import com.liudaohong.foodparty.Bean.FoodVp1Bean; +import com.liudaohong.foodparty.Iterface.IFood; +import com.liudaohong.foodparty.R; + +import java.util.ArrayList; +import java.util.List; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + + +/** + * Created by liuhong on 2017/3/18. + */ + +public class Food_1_Fragment extends Fragment { + private View view; + private RecyclerView recycler; + private int page=1; + List list=new ArrayList<>(); + private Food_1_adapter adapter; + private int total_pages=0; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + + if (view==null){ + view = inflater.inflate(R.layout.food_1_layout,container,false); + } + ViewGroup parent = (ViewGroup) view.getParent(); + if (parent!=null){ + parent.removeView(view); + } + return view; + } + + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + if (adapter==null){ + intiview(view); + intiadapter(); + intidata(); + intilistener(); + } + } + + private void intilistener() { + recycler.addOnScrollListener(new RecyclerView.OnScrollListener() { + public boolean isSlidingToLast=false; + + @Override + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); + int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition(); + if (isSlidingToLast&&total_pages!=0&&page 0){ + //大于0表示,正在向下滚动 + isSlidingToLast = true; + }else{ + //小于等于0 表示停止或向上滚动 + isSlidingToLast = false; + } + + } + }); + } + + private void intiadapter() { + adapter = new Food_1_adapter(list,getContext()); + recycler.setAdapter(adapter); + + } + + private void intidata() { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://food.boohee.com/") + //增加返回值为Gson的支持(以实体类返回) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + IFood iFood = retrofit.create(IFood.class); + + Call foodVp1BeanCall = iFood.callbackvp1(page++); + foodVp1BeanCall.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccess()){ + + FoodVp1Bean body = response.body(); + total_pages = body.getTotal_pages(); + List feeds = body.getFeeds(); + list.addAll(feeds); + adapter.notifyItemInserted(list.size()-feeds.size()); + + } + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + + } + + private void intiview(View view) { + recycler = (RecyclerView) view.findViewById(R.id.recycler); + recycler.setLayoutManager(new LinearLayoutManager(getContext())); + + + } + + + + + + +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_2_Fragment.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_2_Fragment.java new file mode 100644 index 0000000..6efc2dc --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_2_Fragment.java @@ -0,0 +1,138 @@ +package com.liudaohong.foodparty.ui.Fragment; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewParent; + +import com.liudaohong.foodparty.Adapter.Food_2_adapter; +import com.liudaohong.foodparty.Bean.FoodVp1Bean; +import com.liudaohong.foodparty.Bean.FoodVp2Bean; +import com.liudaohong.foodparty.Iterface.IFood; +import com.liudaohong.foodparty.R; + +import java.util.ArrayList; +import java.util.List; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class Food_2_Fragment extends Fragment { + private View view; + private RecyclerView recycler; + private List list=new ArrayList<>(); + private Food_2_adapter adapter; + private int page=1; + private int total_pages=0; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + if (view==null){ + view=inflater.inflate(R.layout.food_2_layout,container,false); + } + + ViewGroup parent = (ViewGroup) view.getParent(); + if (parent!=null){ + parent.removeView(view); + } + + return view; + } + + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + if (adapter==null){ + + intiview(view); + intiadapter(); + intiData(); + initlistener(); + } + + } + + private void initlistener() { + recycler.addOnScrollListener(new RecyclerView.OnScrollListener() { + public boolean isSlidingToLast=false; + + @Override + public void onScrollStateChanged(RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); + int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition(); + if (isSlidingToLast&&total_pages!=0&&page0){ + //大于0表示,正在向下滚动 + isSlidingToLast = true; + }else{ + //小于等于0 表示停止或向上滚动 + isSlidingToLast = false; + } + + } + }); + } + + private void intiData() { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://food.boohee.com/") + //增加返回值为Gson的支持(以实体类返回) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + IFood iFood = retrofit.create(IFood.class); + Call foodVp2BeanCall = iFood.callbackvp2(page++); + foodVp2BeanCall.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccess()){ + FoodVp2Bean body = response.body(); + total_pages=body.getTotal_pages(); + List feeds = body.getFeeds(); + list.addAll(feeds); + adapter.notifyItemInserted(list.size()-feeds.size()); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + } + + private void intiadapter() { + adapter = new Food_2_adapter(getContext(),list); + recycler.setAdapter(adapter); + + } + + private void intiview(View view) { + recycler = (RecyclerView) view.findViewById(R.id.recycler); + LinearLayoutManager layout = new LinearLayoutManager(getContext()); + recycler.setLayoutManager(layout); + + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_3_Fragment.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_3_Fragment.java new file mode 100644 index 0000000..5c28801 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/Food_3_Fragment.java @@ -0,0 +1,26 @@ +package com.liudaohong.foodparty.ui.Fragment; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * Created by liuhong on 2017/3/18. + */ + +public class Food_3_Fragment extends Fragment { + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return super.onCreateView(inflater, container, savedInstanceState); + } + + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/HomeFragment.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/HomeFragment.java new file mode 100644 index 0000000..127fa90 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/HomeFragment.java @@ -0,0 +1,120 @@ +package com.liudaohong.foodparty.ui.Fragment; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ExpandableListView; +import android.widget.ListView; +import android.widget.TextView; + +import com.liudaohong.foodparty.Adapter.Home_lv_adapter; +import com.liudaohong.foodparty.Bean.HomeBean; +import com.liudaohong.foodparty.Bean.HomeListBean; +import com.liudaohong.foodparty.BuildConfig; +import com.liudaohong.foodparty.Iterface.Ihome; +import com.liudaohong.foodparty.R; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; +import java.util.List; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; +import retrofit2.converter.scalars.ScalarsConverterFactory; + +/** + * Created by liuhong on 2017/3/17. + */ + +public class HomeFragment extends Fragment { + + private ListView lv; + private static String uri= "http://food.boohee.com/fb/v1/categories/list?token=&user_key=&app_version=2.6"; + private List list =new ArrayList<>(); + private Home_lv_adapter adapter; + private View rootView; + + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + if (rootView == null) { + rootView = inflater.inflate(R.layout.home_fragment_ayout, container, false); + } + // 缓存的rootView需要判断是否已经被加过parent,如果有parent需要从parent删除,要不然会发生这个rootview已经有parent的错误。 + ViewGroup parent = (ViewGroup) rootView.getParent(); + if (parent != null) { + parent.removeView(rootView); + } + return rootView; + } + + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + lv = ((ListView) view.findViewById(R.id.lv)); + if (adapter==null){ + intiadapter(); + intiData(); + }else { + + } + + } + + private void intiadapter() { + adapter = new Home_lv_adapter(list,getContext()); + lv.setAdapter(adapter); + } + + private void intiData() { + + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://food.boohee.com/") + //增加返回值为Gson的支持(以实体类返回) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + Ihome ihome = retrofit.create(Ihome.class); + Call callback = ihome.callback(); + callback.enqueue(new Callback() { + + private HomeListBean homeListBean; + private String name; + + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccess()){ + List group = response.body().getGroup(); + for (int i = 0; i < group.size(); i++) { + HomeBean.GroupBean groupBean = group.get(i); + if (i==0){ + name = "食物分类"; + }else if (i==1){ + name="热门品牌"; + }else { + name="连锁餐饮"; + } + homeListBean=new HomeListBean(name,groupBean); + list.add(homeListBean); + } + adapter.notifyDataSetChanged(); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + + + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/MineFragment.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/MineFragment.java new file mode 100644 index 0000000..1b460a8 --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/MineFragment.java @@ -0,0 +1,24 @@ +package com.liudaohong.foodparty.ui.Fragment; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +/** + * Created by liuhong on 2017/3/17. + */ + +public class MineFragment extends Fragment { + + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + TextView text=new TextView(getContext()); + return text; + } +} diff --git a/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/foodFragment.java b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/foodFragment.java new file mode 100644 index 0000000..931d8ce --- /dev/null +++ b/FoodParty/app/src/main/java/com/liudaohong/foodparty/ui/Fragment/foodFragment.java @@ -0,0 +1,133 @@ +package com.liudaohong.foodparty.ui.Fragment; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.design.widget.TabLayout; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentPagerAdapter; +import android.support.v4.view.ViewPager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.liudaohong.foodparty.Bean.FoodTabBean; +import com.liudaohong.foodparty.Iterface.IFood; +import com.liudaohong.foodparty.R; + +import java.util.ArrayList; +import java.util.List; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +/** + * Created by liuhong on 2017/3/17. + */ + +public class foodFragment extends Fragment { + + private View rootView; + private TabLayout tab; + private ViewPager vp; + private List listFragment; + private Retrofit retrofit; + List listTab=new ArrayList<>(); + private FragmentPagerAdapter adapter; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + if (rootView == null) { + rootView = inflater.inflate(R.layout.food_fragment_layout, container, false); + } + // 缓存的rootView需要判断是否已经被加过parent,如果有parent需要从parent删除,要不然会发生这个rootview已经有parent的错误。 + ViewGroup parent = (ViewGroup) rootView.getParent(); + if (parent != null) { + parent.removeView(rootView); + } + return rootView; + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + if (adapter==null){ + intiview(view); + initfragments(); + intiadapter(); + intitabtitle(); + } + } + + private void initfragments() { + listFragment=new ArrayList<>(); + listFragment.add(new Food_0_fragment()); + listFragment.add(new Food_1_Fragment()); + listFragment.add(new Food_2_Fragment()); + listFragment.add(new Food_3_Fragment()); + } + + private void intiadapter() { + adapter = new FragmentPagerAdapter(getFragmentManager()) { + @Override + public Fragment getItem(int position) { + return listFragment.get(position); + } + + @Override + public int getCount() { + return listFragment.size(); + } + + @Override + public CharSequence getPageTitle(int position) { + if (listTab.size()==0){ + return ""; + }else { + + return listTab.get(position).getName(); + } + } + }; + vp.setAdapter(adapter); + tab.setupWithViewPager(vp); + } + + private void intitabtitle() { + //增加返回值为Gson的支持(以实体类返回) + retrofit = new Retrofit.Builder() + .baseUrl("http://food.boohee.com/") + //增加返回值为Gson的支持(以实体类返回) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + IFood iFood = retrofit.create(IFood.class); + Call callback = iFood.callback(); + callback.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccess()){ + List categories = response.body().getCategories(); + listTab.addAll(categories); + adapter.notifyDataSetChanged(); + + } + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + + } + + private void intiview(View view) { + tab = ((TabLayout) view.findViewById(R.id.tablayout)); + vp = ((ViewPager) view.findViewById(R.id.vp)); + + } +} diff --git a/FoodParty/app/src/main/res/drawable/ic_def_user_smallstroke.png b/FoodParty/app/src/main/res/drawable/ic_def_user_smallstroke.png new file mode 100644 index 0000000000000000000000000000000000000000..09bcebb1ba391af717ba39e2c8f4e337058c2072 GIT binary patch literal 2199 zcmeHI_ct2~1C2z8n4$J6YPJLk@q$t-iJFnBJxYm{R*h0>w5qhPsF65|K7F>98nr!n zX6@RqPlU!QtxCv_~554Mm{3_Sjl6fS}TR<0*dTyzhSAI*Y^(z)fE@# z4t&U32vhTa5Kji$mPCXp`RaRR_7571n~67-TbRG2%gJ^37J6gJ{#=#02Q7D828XV| zx*f9%cG7MHe0cJPRPPu)J$B=!S+c9c(9??gcvx#{w?}_SV32%*q37^ZY*mvgqJA26 zw=HX}yQ9VCuh=yA=5pFD0}MLrpLtJ;SW>JD2^{6$@@zt)Ub0FoR><#STmRktvY`A> zlK0aho_L$2Tm^??mf0gH`oxULdcjx6KMPVXT@=yZ{^h1{p$Yjj(<71SZ8~h8M zWRECrq$w>c)U>3pw$ypfd(k~{_4A@`Yp&4t`-DElW&I1KoR6v(u6e1vuF&W0~u}iGP`)m)k{@Ll-hrOQK!JSgJT`c_uAe6#sTx zQc=BUy)UK#^g~=(jNKZZhMKx!}F-8WnBYWF%*JI-|Eod4aBMQ#mQ(gt20s z_Ir9L$LS0p$vB4hxa`kJ##pFTm=hNw=YCm5PzkyZEhH2=aNxe}o`$wc9j*~J4 za-kvQ6Z}8o4E2~SIf0=h>=kBr;t8CU=B!1nUpC)A7$Yshgf68gbafbj#?#pBsUS0p ztG<_4Rj>%}ZL!>)ju)KyjD&)O@uu`q6SB3G=HDmH+!U@JMB=s(v*$=jI!aA27Z{I@ zFR%q!m;=wOyrT=ZXo+AYf(W26z={3)t;AGw_{4Q6^SRSv$^5H)h=CCIF%P!b80<@V z2G$ti@N+_DbhBUQEAy}gWD&iD?$3@TdYXgapfP8}q9E^gVBAtsfH{&0P3Pk>E+cx$ zgR0(gi;3{kfXAaV2|VLeajJv@>FgRFL=Y;#_Seq*9O+mWfS9 z)ZZJ4Zd~5AgMLLTWb3_jl@6rA46CX0Q~Wv#jjTR8mI&FPFI6zW!IW$KE&Qi+dRTw3T# zH(LA8a&sRF_4epT0=phn2t z@a=I@e);l6+=tL3RSv~1_StCbgEt#5TAS}we*GN%Fq@3on`m+NK(GDgQj?P*`e3?y zv*aCqX2cF@h@3M=O?B;&F%L{8Hz7S&v;MA=oWDtG>Sr4z=~pnV$1H1))nL?RWLPwJn}U~VmbY-^j>^ECLLQ@w<~^Jj zr5Y3Mqt_^MxrU0edSc&hgjmt}kUUqW^^@ErjZFGn&D>vr$Ow2owrG1K{DpX+OC(I2 zHOi|QNYZ7pT>P<=f{oo%hu|nR`AFcAwceBXODRbuNeF_ZkXGjQfUmD# z5}N=@`!NnfkVt~<#VZz|q*AFQES3nvL^K*C2_(=k3_)}oOFw+*@9kY&Toek0>yN;2PFh-LTif#T z^3u{0ol2$Q@oY95`0vuv2KxFc*z7bCX=-vZl}MyeD8PS9AhdHhYinyW)6;$3-L1{d zwG|ZwIXPr3mX?yj%*&hm@#Fj07#V~4#AH%27|<1`p`o{{tGJ+G0mS@#e_!9~>gqqm z#e(VSm6a6|2sHXlO3K*CNLPD%Nm0?_!UAwc`20*74Tx_81J&i_d>)Si!xStQEYE)X zc5QW)+tc$QKOYQder}G_*vMoszEoAs&CR9aa6}9yHzOm1LTRX}DJd)*6W3?VFh zai2Q*Gb;!Gu3i>OJ!n>ZJ_RPZ9^!t24L0uDAff2$PnIkH$pAGrl+M`yhHz*9hAtBd zUjbnzlvpprH$3_14Z6LKl`5`j!U5sdV-9XXn(V?5lLiRd6oE81yW&_rjzu{unaM;k z!emwK3ilnWOB*p?sX{pS;WTJC3O^6P7)|qp@YnD#lCJ~Bs;m7P*vh~|M4A- z?RHf2=yr@yHPLHUx8OQ(=xQKon?Ub>u^4{vKxTM^2cg&0c2vej<>Rs8N3CWwdS199E7f55 zChFMh_|bYu3L09<{p)C(m|AD^iD3;HkJ6AT|{JocsD zxKjg|W#!#5m7fpe%k46~ zWG+=fw~)&x<3nOyuADgQWxN#Tp{8v4&^2pyu+n{)B}a3M2#%kxJFKf!ju^#Dy83eT zn>C5JHZiYDtg<1E%9z;kk0?Ggq)1J-h($PFf7w}g!QD{j+<4@ZP}c8$3`RKdzQ9IF zA40*D`5={$(c?RKhkPF;__GQ{ zwA9<>pst(4uDNlM7H|Cy}Cwo1rL6 zPfGmVQ%0gEtafwDy-=jEpcI6Q22x8wyY{Z^KGO*wk6FD?xfr!AHVa?bToWl9f)P*D z6c@m+LXQ1>|XSY{?;f@X}4I_G=kus1hkUc@Z8Di)=BEK!BK&F&CYJ| zO&Lw?kU^P^LFkw~PdTXFhdAuxRG=I%dngn$1uJsVs==GR8o90!>Hd-TSER=Fy>I4%lK-}{j9|^QBUJ8i7^qJ=xavre<>x3cWxt- z&$2}pIHt=Yy`Nm#!rr$VO^L~>yEq{hj!QD5Bv>eT0Rz1=2`H?_s%_6o!osV#%pKiEqfb$Tn;O(*mV{fjCBz9aCtMS;S#mII`SJ;`@ zam^+A(Z0kJU*opdkgy&YyA*m4Q;9IG$aA1o`R%ZO5s2DbsFpBVJ;0Ghwp37JP>NBV zf#+?NO0+$ybk2?Vec2y;npEQ|2(~8KG)=rA8@F0rhjH+#>WC;i#8uldX}=xSepqiF W(c9=6+sOfc2ncCmZJu++CHz0D096eD literal 0 HcmV?d00001 diff --git a/FoodParty/app/src/main/res/drawable/ic_tab_homepage_select.png b/FoodParty/app/src/main/res/drawable/ic_tab_homepage_select.png new file mode 100644 index 0000000000000000000000000000000000000000..a19246566d511705502a000b773afe4996fff29b GIT binary patch literal 1591 zcmX|B3pmtS6#tLuYhz4>vLVWT9+lFDY;8$iHF+g$`o=Kk!RS4qQpO{uF*DwiwO&mm zw3)mgqZrRhQphVpl2prNOS9FioSi@Wb-wTZe&^hK&OPVc``ycPbKQ?u(N;ka1b={F z@2+4XI+kG-xZ+&d&j^BPaC7!_P?+Eo0wg~mQh-PXZ!!@5z*}J|6f%(g(V6cimAc?b z209&eTl5S*56M^HMgi1_p{)%#Jc#8%RMh{0WIAy8P*DlJJuv(n4OeV15~c=s2`<>0qa z4l%tV8^1X2}$T3Wn`hLtE!;CPcdm$d)!uWg};ZmyLuovhmZ`( z(3{yglbE)D0Uy-;BlmCgd{9|>?&AVmJzpSL@@NaO2NoCtG%SCy-V;Hvf&=z8o<~}w=?t>A&C1xa zTs2*sC1ILzkHf2{#M#qY)x&1CZ@SN^|Ew;VS6vxtczCa!^}rW_MC3T_p{m2cWvz~ngq3!muh1^YA-47jVVJL zR5WxobP9VSTZ;}}^dX&awmAEXqs~Unwbzmf>H>j>yK-vc_`9}8y{Quho zT!{>NfLdxf9@&X-rUwEJ2P_@DDl}S~UG&iI(VSAVDNUbh9f{ds@$0G86R)_tU5fVx z9om-pI(26pYHVuzkZHb-QnGd7P+YeKW%RqLW6XaS7hOAu!Cx z&1o0!-P>uioxOd7HlxRC>XrxEk(DQQ&0HHntm+f3^zH$+Zl(OH6jTqotR+p zRz_`?lh`BT0?`y}P$F_St+^vmEuG%k$PZ)iV(K)PBp(RPNX-f?aiA+Lxm}hQi52xs zbMY#H&!$H#+`M!?=}#fVf3B=EzG`b;F@||6u5uAN-Is0|{@SNGl)ft4a;m0@v)uWb zT3N;2nwb;RGt&2=S}_lD67b;&lfdoKZ^YofE_)$6Vjy4RCFN>`D={6peH$B<&E=|N zBn$c4v3RX;40EG)xH7YeAZgCG6>o9twlzz*H$4`d+up*_q#D6%!OsF3uWSI#E%p&~h zbC!ZEBXZr;Ap3znt5qxZW~FbQvEF#Ra1C|OsSn(*Hwk^4(mRaZWqRabz86cn-DFI? zLDcAN+F~fFRkgytQU}!z^V1W8sJcV>@>c?BkfU4mR9ar}d`xpt$UwW&UAC7dX-faZ zwawdPD;cZb@Gj386!Yy$tS%62r99tl!706bt=mr+;g);6UlcqsK7Q7{Kl7HA=%Z{l mvdk-*JX)$QLZ8uQId1ac*OgHpEVd}V59EM@t9`MpU-W+s6nsJe literal 0 HcmV?d00001 diff --git a/FoodParty/app/src/main/res/drawable/ic_tab_library.png b/FoodParty/app/src/main/res/drawable/ic_tab_library.png new file mode 100644 index 0000000000000000000000000000000000000000..4b3f4c422e8d6742ab7a24b00cc316bc6e073f02 GIT binary patch literal 879 zcmeAS@N?(olHy`uVBq!ia0vp^Q6S903?%u>HX1N6FzN*Ogt!8^3ueulKW*CFsZ)U@ z5X}QKfaHQ{(-zN|F%K*V6kjlN=ECXI=TDsq6j=xqoH}*&;>BlAoOt{C_20jL|NsBL zW8=nWPoDhy_wU=+uaEBEKd@^T$TXnF>C^Asx%1}rYoM0JbLK3VI`!lG_dmXWU%g}r z(3VBhrvudh8Rt)(0;>Q1?c4Rsmlw~PwQc?Sj~_mK`uK6%h7F5m&b)Hr!tO0w7R{Qq zW$oH^%a^}+_Uzorlc$az-MDJi?_a;(zk9c2_UsKSS6(=CX5ow(Z(hARcHqFCZQE{M zz54I(-{Xf4T{wOE@q-7e7A`!vd-pt`dv4u&`{vF3S+hW%oj!fdk|jX5Et)<1&aGP@ z|IU~JM z4ZtvfgMUEQN0nzla$UsX&;L)tC2%oX{{J_4`v3n1r~jW+YybcCc3dC&u`*N#7*Bnk zE{-7)hu_`^_h)hxVSNz#P$9{2Y0stZCa$nId%Gh74sc!j|6hJjx4w!;TH0n6yE~ta zCZ~R{-Z68+8ABev_QMZLEN%DJ@~KaGRPc2-`;^4<3MR%TYt;HH7S6qBC|Y@EPRn_D z4z4KIXtjou*J?FnI*(=OacxuQQ<-#De`-dt@6U!WQ>M&QvsC_)F>x+qTIwg6O3#Jf z-6CgQ%KVB<(ii%7Ydn~Cp)%nfmn@^0$`)phh=qq6yq&D0Eo7}+p8Go;R?6M?=l{#2 z>n?hq)^1&QVRiPG%fH(0eo+&+`|I!S+xHmDa+iFcm6h~=!OmlRxl8){UVij+Xz@Fr zAuMWk>CvA>6_G~ft*alEo($XNJR@yZ=CYYk;^qFl-HzH@4&{bdxxW`^wXTx;5WO(} z$yq199b28IH(Ey?cE7jRF1C{~G}1YQSFVdQ&MBb@0Bf!NEdT%j literal 0 HcmV?d00001 diff --git a/FoodParty/app/src/main/res/drawable/ic_tab_library_select.png b/FoodParty/app/src/main/res/drawable/ic_tab_library_select.png new file mode 100644 index 0000000000000000000000000000000000000000..13c0e3d656938c8a6f381d02bcc59fdf25d1f197 GIT binary patch literal 907 zcmZWneNf9`9N&0*Zf90AyWktBaOM`+i%V(|H3lUxWvEVv~9!T6Fi| zz6Qdb*qMM|zmRqTF>%n8qpuGwtr!`B$&A54^uB|^hyg3~tvHts`BiX4_U_1ByAok& zh0TWjWHCbUVz6r;8nkvUBm>5pa~D%e(FeY;N6Jrhds!o)XOYp;I=63 z=Z@`R;{vCjHAk2a5KE$b8EG;{F;Uu)LX^MClv=f=@UHpQlU~9G3G@kBbut+gY^bg6eg7WP3wb;~pKmlzr$d|#&HwLTz~w%v zsAzfpTG7*^8yGMc4AAP-u)^%@mvT9zL+6m2mzmi!sb&rHvR2Q)>Llz^!%Tz(fwfO8|U$7Q+BAz#A|DNZ=1}uD$pg^%4qYQcLjK zLfTvXk+y3OcFQ8lOV4*EII(O7At^Xzs}DPR`)SNPR%WT?+bd<`O8-)&U}K3jbM8KLIO*Vo zzRm9H4jU3>+_oX%;hsY*6nYVO@?ZuQqB`Lqutpc@TmF-1Gr)lPce>KZI362=gPz-U^iPffc zIQykYB+Hlh8=5rF$|=!&4S7B>{8r#yeqsT~`w`_?fL&~97+N5CW8QRyu2ROf_BQ|Y z$o7m$|0z%RoviPVe@l!vvrcWg?s+@mk=5~?0VSyCCjGlveuR!0#pMMB5w9YI*y4@L zteIhy_SV(WSW(wVnumMYekB*uQqdodnjXM%%M4B3xOY`2*Z^n zrOY{htRJ{G-h$YRzUH_8v8t!rG@zW^JKC<9+puV4Eo z#=hatr|l0uEIJok^K_ecvPVpnoy!-Y+3v>l%H%HUjtNdY^Mr+d)5C0~UQ3v()6a6* z=n%L#ocus4cddwFYThMnFHd;5KpD}XOAB0(m~}L(uuw8>Rb*#<>aL*aa<92-g=T`4 zn-romA=Q41PM<=l!fg8eg5lk8|o}}$4cpvqQ}c!+iVu=a&O#7@bK-oq@0!JxUE09CWDFo5Z6!cQr`); zbe`$3@FX?{vwwhJkg$Em(7Myrf^u}e6{ixXu|FV+q6YtG@H~%pcu)Da&Iv!{{z+PJ z5v7^md_!tk@dXooq%T88)Z}L1n;Yx=YOc~p@OT}Y%jNde|E`$!GbWyF?Fauh6anw= JmA^G4=_>;i_#XfO literal 0 HcmV?d00001 diff --git a/FoodParty/app/src/main/res/drawable/ic_tab_my_select.png b/FoodParty/app/src/main/res/drawable/ic_tab_my_select.png new file mode 100644 index 0000000000000000000000000000000000000000..c958a3d78580573541534677010314691e77dabd GIT binary patch literal 1408 zcmXX_3s{V46#kn`i0aX0UE(R~*^6DN@GMiLl8jAKljt%tO;gd0?wZC^xhyG+(nV&; zJ}agvD!W2r13Gf^zZty^enL`OSeas`?c9%2(wR)+RAbUuMU55nz`myq;bVmwqrsU+q09R!a) zlaG|Wc-%oiWHcVN!cRbO&26HOWy4YVmokervcA>1| ze=}`Anwm)=Ix#vP4NYihBph-%JQT?=HiiH`Lc@s}6$904_y=jKCt_d_k&(n7z60uB z;^Ya@)lC4suHQgvDv4$u1wR#Rs4g zU;}rt7*=S3u>)2GK@bZuO}K-pK9!$LCGYdT=0hvEpGJQIOM2-2h074I0V9CrATU`8 zWC6=2z^JE#jlen?3`T(yc#JO`gdp+Bto+{+D2nlry~dHV<#vCbkC&;9@mkrhVlBh4 zZQKIq!EO)6nIgW(rYPOe=}qH!kTcj!qyCstDLIsu5J7{p` zp9g`@ImR<&d0&1%npx=lJaGMkO)ZA=EUL}FEzo!UVM(p0i_}qcw{|&ehWyUljm)W{ zzjekYu}l_6xw|p4yev=tVX4hduTgW%7X?%}i{?lchAAoAOO{o_V8-k{>Iie!nAQ4{ zMIlONrjBda-Wi`PMQ4XB54=q04u}gC<=3dXnKm<0HgS)A7Twy*@Im3NW4;I*nC%qz#} z&R_8#%N%zHlr}w+JB|v&BEq6U<8vqST%SfxGl z`Xg(88Mv$~5~b^jl1pNr?wL0DFB_f6Xb&tr?T!H>8w35u0+zi~pRKK%T-{)PGwJxL zu68QAPBClcgH7DnH_NSU*us1%b#KMZ`?Br)klZ?3J8id(@AF@)()PR5C|)qE9cs^T z8M!`FjDEbYFsw?7*W2=4W{GyVyhL?)13$z15;G#ox_E`A7i&=+3gq zeHGqD1rg(;NiF{lKV8B1G-J5#%dqH{+!c!%(hstYY1u)So$W28((-vPSM0nczdCNm|IP5*ur+r@p&1t + + + + + \ No newline at end of file diff --git a/FoodParty/app/src/main/res/drawable/tab_1.xml b/FoodParty/app/src/main/res/drawable/tab_1.xml new file mode 100644 index 0000000..aeecd80 --- /dev/null +++ b/FoodParty/app/src/main/res/drawable/tab_1.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/FoodParty/app/src/main/res/drawable/tab_2.xml b/FoodParty/app/src/main/res/drawable/tab_2.xml new file mode 100644 index 0000000..2729486 --- /dev/null +++ b/FoodParty/app/src/main/res/drawable/tab_2.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/FoodParty/app/src/main/res/layout/activity_main.xml b/FoodParty/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..1a708fc --- /dev/null +++ b/FoodParty/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/FoodParty/app/src/main/res/layout/food_0_1item.xml b/FoodParty/app/src/main/res/layout/food_0_1item.xml new file mode 100644 index 0000000..4a52818 --- /dev/null +++ b/FoodParty/app/src/main/res/layout/food_0_1item.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/FoodParty/app/src/main/res/layout/food_0_item.xml b/FoodParty/app/src/main/res/layout/food_0_item.xml new file mode 100644 index 0000000..6a589da --- /dev/null +++ b/FoodParty/app/src/main/res/layout/food_0_item.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + +