├── .gitattributes ├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml └── runConfigurations.xml ├── FoodFans APP设计文档.docx ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── star │ │ └── foodfans │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── com │ │ │ └── star │ │ │ └── foodfans │ │ │ ├── Application.java │ │ │ ├── api │ │ │ ├── ApiClient.java │ │ │ ├── ApiInterface.java │ │ │ └── NetCacheInterceptor.java │ │ │ ├── dao │ │ │ ├── AchievemenkindtinfoDao.java │ │ │ ├── ArticleinfoDao.java │ │ │ ├── CommentinfoDao.java │ │ │ ├── FriendrangeDao.java │ │ │ ├── GoodsDao.java │ │ │ ├── HistoryDao.java │ │ │ ├── MessageDao.java │ │ │ ├── RecordDao.java │ │ │ ├── RewardDao.java │ │ │ ├── TokenDao.java │ │ │ ├── UserinfoDao.java │ │ │ └── VideoinfoDao.java │ │ │ ├── db │ │ │ └── AppDatabase.java │ │ │ ├── entity │ │ │ ├── Achievemenkindtinfo.java │ │ │ ├── Articleinfo.java │ │ │ ├── Commentinfo.java │ │ │ ├── Friendrange.java │ │ │ ├── Goods.java │ │ │ ├── History.java │ │ │ ├── Message.java │ │ │ ├── Model.java │ │ │ ├── Record.java │ │ │ ├── Result.java │ │ │ ├── Reward.java │ │ │ ├── SearchResultBean.java │ │ │ ├── Token.java │ │ │ ├── Userinfo.java │ │ │ └── Videoinfo.java │ │ │ ├── repository │ │ │ └── AppRepository.java │ │ │ ├── ui │ │ │ ├── activity │ │ │ │ ├── CommentActivity.java │ │ │ │ ├── DishInfoActivity.java │ │ │ │ ├── EditUserInfoActivity.java │ │ │ │ ├── ForgetPwdActivity.java │ │ │ │ ├── HistoryActivity.java │ │ │ │ ├── HomeActivity.java │ │ │ │ ├── LoginActivity.java │ │ │ │ ├── LoveActivity.java │ │ │ │ ├── RegisterActivity.java │ │ │ │ ├── SplashActivity.java │ │ │ │ └── WebViewActivity.java │ │ │ ├── adapter │ │ │ │ ├── BannerAdapter.java │ │ │ │ ├── CommentAdapter.java │ │ │ │ ├── DishItemAdapter.java │ │ │ │ ├── FoodCategoryListViewAdapter.java │ │ │ │ ├── GridViewAdapter.java │ │ │ │ ├── LoveAdapter.java │ │ │ │ └── MyPagerAdapter.java │ │ │ ├── fragment │ │ │ │ ├── BaseFragment.java │ │ │ │ ├── DiscoverFragment.java │ │ │ │ ├── DishCoverFragment.java │ │ │ │ ├── DishInfoCommentFragment.java │ │ │ │ ├── DishInfoItemFragment.java │ │ │ │ ├── HomeFragment.java │ │ │ │ ├── MeFragment.java │ │ │ │ └── RecommentFragment.java │ │ │ └── view │ │ │ │ ├── NonScrollGridView.java │ │ │ │ └── ViewPagerIndicator.java │ │ │ └── util │ │ │ ├── AppConfig.java │ │ │ ├── Session.java │ │ │ ├── SystemBarTintManager.java │ │ │ └── Utils.java │ └── res │ │ ├── anim │ │ ├── book_cover_anim.xml │ │ ├── book_cover_rate_anim.xml │ │ ├── fade_in.xml │ │ ├── fade_out.xml │ │ ├── push_left_in.xml │ │ ├── push_left_out.xml │ │ ├── push_right_in.xml │ │ ├── push_right_out.xml │ │ ├── push_up_in.xml │ │ └── push_up_out.xml │ │ ├── color │ │ ├── selector_food_namecolor.xml │ │ ├── selector_search_textcolor.xml │ │ ├── selector_searchresult_textcolor.xml │ │ └── selector_tab_textcolor.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── bg_login_input_ok.xml │ │ ├── bg_login_submit.xml │ │ ├── book_rate_background.xml │ │ ├── ic_add.png │ │ ├── ic_favorite_border_white.png │ │ ├── ic_favorite_white.png │ │ ├── ic_launcher_background.xml │ │ ├── ic_more_vert_white.png │ │ ├── icon_faviroute.png │ │ ├── icon_unfavourite.png │ │ ├── rating_yellow_middle.xml │ │ ├── recipe.jpg │ │ ├── save_profile_lock.xml │ │ ├── selector_common_click.xml │ │ ├── setting_item_selector.xml │ │ ├── star_empty_middle.png │ │ ├── star_empty_small.png │ │ ├── star_full_middle.png │ │ ├── star_full_small.png │ │ ├── star_half_middle.png │ │ ├── star_half_small.png │ │ └── textview_tag_bg.xml │ │ ├── layout │ │ ├── activity_comment.xml │ │ ├── activity_dish_info.xml │ │ ├── activity_edit_user_info.xml │ │ ├── activity_forget_pwd.xml │ │ ├── activity_history.xml │ │ ├── activity_home.xml │ │ ├── activity_login.xml │ │ ├── activity_love.xml │ │ ├── activity_register.xml │ │ ├── activity_splash.xml │ │ ├── activity_web_view.xml │ │ ├── dish_info.xml │ │ ├── error.xml │ │ ├── feed_header.xml │ │ ├── fragment_discover.xml │ │ ├── fragment_dish_comment.xml │ │ ├── fragment_dish_cover.xml │ │ ├── fragment_dish_info_item_list.xml │ │ ├── fragment_home.xml │ │ ├── fragment_me.xml │ │ ├── fragment_recommend.xml │ │ ├── item_gridview.xml │ │ ├── item_listview.xml │ │ ├── kanner_content_layout.xml │ │ ├── layout_text_feed.xml │ │ ├── layout_title.xml │ │ ├── list_item_dish.xml │ │ ├── user_edit_title.xml │ │ ├── welcome_slide1.xml │ │ ├── welcome_slide2.xml │ │ ├── welcome_slide3.xml │ │ └── welcome_slide4.xml │ │ ├── menu │ │ ├── bottombar_menu.xml │ │ └── dish_info.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ ├── ic_launcher_round.png │ │ └── ic_slide1.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ ├── ic_launcher_round.png │ │ └── ic_slide1.png │ │ ├── mipmap-xhdpi │ │ ├── back.png │ │ ├── default_head.jpg │ │ ├── dot_blur.png │ │ ├── dot_focus.png │ │ ├── ic_account.png │ │ ├── ic_btn_rank_all.png │ │ ├── ic_btn_rank_original.png │ │ ├── ic_clear.png │ │ ├── ic_home.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ ├── ic_launcher_round.png │ │ ├── ic_login_password.png │ │ ├── ic_login_username.png │ │ ├── ic_message.png │ │ ├── ic_quanzi.png │ │ ├── ic_search_white_24dp.png │ │ ├── ic_signup_sms.png │ │ ├── ic_slide1.png │ │ ├── ic_slide2.jpg │ │ ├── ic_slide3.png │ │ ├── ic_slide4.jpg │ │ ├── icon_back.png │ │ ├── no_result.png │ │ ├── qq.png │ │ ├── right.png │ │ └── table_search_normal.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ ├── ic_launcher_round.png │ │ └── ic_slide1.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_home.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ ├── ic_launcher_round.png │ │ └── ic_slide1.png │ │ ├── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── network_security_config.xml │ └── test │ └── java │ └── com │ └── star │ └── foodfans │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── proposal.docx ├── screenshots ├── Screenshot_2020-01-04-16-27-57-248_com.star.foodf.jpg ├── Screenshot_2020-01-04-16-28-01-076_com.star.foodf.jpg ├── Screenshot_2020-01-04-16-28-04-687_com.star.foodf.jpg ├── Screenshot_2020-01-04-16-28-09-272_com.star.foodf.jpg ├── Screenshot_2020-01-04-16-28-18-542_com.lbe.securi.jpg ├── Screenshot_2020-01-04-16-28-21-858_com.star.foodf.jpg ├── Screenshot_2020-01-04-16-38-43-773_com.star.foodf.jpg ├── Screenshot_2020-01-04-18-29-52-157_com.star.foodf.jpg ├── Screenshot_2020-01-04-21-05-46-380_com.star.foodf.jpg ├── Screenshot_2020-01-04-21-25-14-334_com.star.e_lea.jpg ├── Screenshot_2020-01-04-21-25-24-774_com.star.e_lea.jpg ├── Screenshot_2020-01-05-00-05-42-852_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-05-49-115_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-05-53-684_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-05-57-726_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-06-02-354_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-06-05-763_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-19-40-466_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-20-27-288_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-28-33-875_com.star.foodf.jpg ├── Screenshot_2020-01-05-00-48-41-989_com.star.foodf.jpg ├── Screenshot_2020-01-05-01-42-56-934_com.star.foodf.jpg ├── Screenshot_2020-01-05-01-48-58-427_com.star.foodf.jpg ├── Screenshot_2020-01-05-01-53-31-441_com.star.foodf.jpg ├── Screenshot_2020-01-05-01-54-47-077_com.star.foodf.jpg └── Screenshot_2020-01-05-01-54-53-743_com.star.foodf.jpg ├── settings.gradle └── videos ├── main_functions.mp4 └── register.mp4 /.gitattributes: -------------------------------------------------------------------------------- 1 | *.mp4 filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /FoodFans APP设计文档.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/FoodFans APP设计文档.docx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # food_fans 2 | I love food. 3 | 视频和截图分别在 screenshots和videos文件夹下 4 | ## [后端地址](https://github.com/kelekle/food_fans_service "food-fans-service") 5 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.mob.sdk' 3 | 4 | android { 5 | compileSdkVersion 29 6 | buildToolsVersion "29.0.2" 7 | defaultConfig { 8 | applicationId "com.star.foodfans" 9 | minSdkVersion 23 10 | targetSdkVersion 29 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | compileOptions { 22 | sourceCompatibility JavaVersion.VERSION_1_8 23 | targetCompatibility JavaVersion.VERSION_1_8 24 | } 25 | } 26 | 27 | MobSDK { 28 | appKey "2da5fb30c85f0" 29 | appSecret "c809ad6648dfbe63c975747df871bd29" 30 | 31 | ShareSDK { 32 | //平台配置信息 33 | devInfo { 34 | QQ { 35 | appId "1109746099" 36 | appKey "OW7D6lfVici0iI58" 37 | shareByAppClient true 38 | } 39 | } 40 | } 41 | } 42 | 43 | dependencies { 44 | implementation fileTree(dir: 'libs', include: ['*.jar']) 45 | implementation 'androidx.appcompat:appcompat:1.1.0' 46 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 47 | implementation 'com.google.android.material:material:1.0.0' 48 | 49 | implementation 'io.reactivex.rxjava2:rxjava:2.1.14' 50 | implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' 51 | // RxJava support for Room 52 | implementation 'android.arch.persistence.room:rxjava2:1.1.1' 53 | 54 | implementation "com.rengwuxian.materialedittext:library:2.1.4" 55 | implementation 'com.contrarywind:Android-PickerView:4.1.9' 56 | 57 | //Image 58 | implementation 'com.github.bumptech.glide:glide:4.10.0' 59 | annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' 60 | implementation 'de.hdodenhof:circleimageview:3.0.1' 61 | 62 | //validate 63 | implementation 'com.basgeekball:awesome-validation:2.0' 64 | 65 | //navigation 66 | implementation 'com.aurelhubert:ahbottomnavigation:2.3.4' 67 | 68 | //Network 69 | implementation 'com.squareup.retrofit2:retrofit:2.7.0' 70 | //gson 71 | implementation 'com.squareup.retrofit2:converter-gson:2.7.0' 72 | 73 | // Room依赖 74 | implementation 'android.arch.persistence.room:runtime:1.1.1' 75 | annotationProcessor "android.arch.persistence.room:compiler:1.1.1" 76 | 77 | //test 78 | testImplementation 'junit:junit:4.12' 79 | testImplementation 'org.mockito:mockito-core:1.10.19' 80 | androidTestImplementation 'androidx.test:runner:1.2.0' 81 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 82 | androidTestImplementation 'androidx.test:rules:1.2.0' 83 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 84 | 85 | } 86 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/star/foodfans/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.star.foodfans", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 14 | 16 | 18 | 20 | 22 | 23 | 24 | 27 | 30 | 33 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/Application.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans; 2 | 3 | import android.content.Context; 4 | 5 | public class Application extends android.app.Application { 6 | 7 | private static Context mContext; 8 | 9 | public void onCreate() { 10 | super.onCreate(); 11 | mContext = getApplicationContext(); 12 | } 13 | public static Context getContext(){ 14 | 15 | return mContext; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/api/ApiClient.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.api; 2 | 3 | import android.os.Environment; 4 | 5 | import java.io.File; 6 | import java.security.cert.CertificateException; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | import javax.net.ssl.HostnameVerifier; 10 | import javax.net.ssl.SSLContext; 11 | import javax.net.ssl.SSLSession; 12 | import javax.net.ssl.SSLSocketFactory; 13 | import javax.net.ssl.TrustManager; 14 | import javax.net.ssl.X509TrustManager; 15 | 16 | import okhttp3.Cache; 17 | import okhttp3.OkHttpClient; 18 | import retrofit2.Retrofit; 19 | import retrofit2.converter.gson.GsonConverterFactory; 20 | 21 | import static com.star.foodfans.util.AppConfig.BASE_URL; 22 | 23 | 24 | public class ApiClient { 25 | 26 | public static Retrofit retrofit; 27 | 28 | public static Retrofit getApiClient(){ 29 | if (retrofit == null){ 30 | retrofit = new Retrofit.Builder().baseUrl(BASE_URL) 31 | .client(getUnsafeOkHttpClient().build()) 32 | .addConverterFactory(GsonConverterFactory.create()) 33 | .build(); 34 | } 35 | return retrofit; 36 | } 37 | 38 | public static OkHttpClient.Builder getUnsafeOkHttpClient(){ 39 | try { 40 | // Create a trust manager that does not validate certificate chains 41 | final TrustManager[] trustAllCerts = new TrustManager[]{ 42 | new X509TrustManager() { 43 | @Override 44 | public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { 45 | } 46 | 47 | @Override 48 | public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { 49 | } 50 | 51 | @Override 52 | public java.security.cert.X509Certificate[] getAcceptedIssuers() { 53 | return new java.security.cert.X509Certificate[]{}; 54 | } 55 | } 56 | }; 57 | 58 | // Install the all-trusting trust manager 59 | final SSLContext sslContext = SSLContext.getInstance("SSL"); 60 | sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); 61 | 62 | // Create an ssl socket factory with our all-trusting manager 63 | final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); 64 | 65 | //cache 66 | int cacheSize = 10 * 1024 * 1024; // 10 MB 67 | Cache cache = new Cache(new File(Environment.getDownloadCacheDirectory(), "retrofit_cache"), cacheSize); 68 | 69 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 70 | builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]) 71 | .hostnameVerifier(new HostnameVerifier() { 72 | @Override 73 | public boolean verify(String hostname, SSLSession session) { 74 | return true; 75 | } 76 | }) 77 | .cache(cache) 78 | .addNetworkInterceptor(new NetCacheInterceptor()) 79 | .connectTimeout(60, TimeUnit.SECONDS) 80 | .readTimeout(20, TimeUnit.SECONDS) 81 | .writeTimeout(20, TimeUnit.SECONDS); 82 | return builder; 83 | } catch (Exception e) { 84 | throw new RuntimeException(e); 85 | } 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/api/ApiInterface.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.api; 2 | 3 | import com.google.gson.JsonArray; 4 | import com.google.gson.JsonObject; 5 | import com.star.foodfans.entity.Result; 6 | import com.star.foodfans.entity.SearchResultBean; 7 | import com.star.foodfans.entity.Userinfo; 8 | 9 | import java.util.List; 10 | 11 | import okhttp3.MultipartBody; 12 | import okhttp3.RequestBody; 13 | import okhttp3.ResponseBody; 14 | import retrofit2.Call; 15 | import retrofit2.http.Field; 16 | import retrofit2.http.FormUrlEncoded; 17 | import retrofit2.http.GET; 18 | import retrofit2.http.Multipart; 19 | import retrofit2.http.POST; 20 | import retrofit2.http.Part; 21 | import retrofit2.http.Query; 22 | import retrofit2.http.Streaming; 23 | 24 | public interface ApiInterface { 25 | 26 | @FormUrlEncoded 27 | @POST("login") 28 | Call login( 29 | @Field("email") String email, 30 | @Field("password") String password 31 | ); 32 | 33 | @FormUrlEncoded 34 | @POST("user/register") 35 | Call register( 36 | @Field("email") String email, 37 | @Field("password") String password, 38 | @Field("code") String code 39 | ); 40 | 41 | @FormUrlEncoded 42 | @POST("user/find_pwd") 43 | Call findPassword( 44 | @Field("email") String email, 45 | @Field("password") String password, 46 | @Field("code") String code 47 | ); 48 | 49 | @FormUrlEncoded 50 | @POST("user/get_code") 51 | Call getCode( 52 | @Field("email") String email 53 | ); 54 | 55 | @FormUrlEncoded 56 | @POST("user/change_username") 57 | Call changeUsername( 58 | @Field("email") String email, 59 | @Field("username") String username 60 | ); 61 | 62 | @FormUrlEncoded 63 | @POST("user/change_description") 64 | Call changeDescription( 65 | @Field("email") String email, 66 | @Field("description") String description 67 | ); 68 | 69 | @Multipart 70 | @POST("user/change_photo") 71 | Call changePhoto( 72 | @Part("email") RequestBody email, @Part MultipartBody.Part photo 73 | ); 74 | 75 | @Streaming 76 | @GET("user/get_user_photo") 77 | Call getUserPhoto( 78 | @Query("name") String name 79 | ); 80 | 81 | @GET("user/get_user") 82 | Call getUser( 83 | @Query("email") String email 84 | ); 85 | 86 | 87 | 88 | @GET("/allArticle") 89 | Call getAllArticle(); 90 | 91 | @FormUrlEncoded 92 | @POST("/search_articles") 93 | Call searchArticle( 94 | @Field("dish") String dish, 95 | @Field("cuisine") String cuisine 96 | ); 97 | 98 | @FormUrlEncoded 99 | @POST("/add_collection_article") 100 | Call collectArticle( 101 | @Field("contentId") String contentId 102 | ); 103 | 104 | @FormUrlEncoded 105 | @POST("/isCollectArticle") 106 | Call isCollectArticle( 107 | @Field("articleid") int articleid 108 | ); 109 | 110 | @FormUrlEncoded 111 | @POST("/cancelCollectArticle") 112 | Call cancelCollectArticle( 113 | @Field("articleid") int articleid 114 | ); 115 | 116 | @FormUrlEncoded 117 | @POST("/queryArticle") 118 | Call queryArticle( 119 | @Field("articleid") int articleid 120 | ); 121 | 122 | @GET("/get_personal_collection") 123 | Call getCollection( 124 | ); 125 | 126 | @GET("/get_personal_history") 127 | Call getHistory( 128 | ); 129 | 130 | @FormUrlEncoded 131 | @POST("/commentArticle") 132 | Call comment( 133 | @Field("score") int score, 134 | @Field("url") String url, 135 | @Field("content") String content, 136 | @Field("articleid") int articleid 137 | ); 138 | 139 | } 140 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/api/NetCacheInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.api; 2 | 3 | import com.star.foodfans.Application; 4 | import com.star.foodfans.util.AppConfig; 5 | import com.star.foodfans.util.Utils; 6 | 7 | import java.io.IOException; 8 | 9 | import okhttp3.Interceptor; 10 | import okhttp3.Request; 11 | import okhttp3.Response; 12 | 13 | public class NetCacheInterceptor implements Interceptor { 14 | @Override 15 | public Response intercept(Chain chain) throws IOException { 16 | Request origin = chain.request(); 17 | Request request = origin.newBuilder() 18 | .addHeader("token", Utils.getValue(Application.getContext(), AppConfig.CURRENT_TOKEN)) 19 | .method(origin.method(), origin.body()) 20 | .build(); 21 | Response originResponse = chain.proceed(request); 22 | 23 | //设置响应的缓存时间为60秒,即设置Cache-Control头,并移除pragma消息头,因为pragma也是控制缓存的一个消息头属性 24 | originResponse = originResponse.newBuilder() 25 | .removeHeader("pragma") 26 | .header("Cache-Control", "max-age=30") 27 | .build(); 28 | return originResponse; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/AchievemenkindtinfoDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Insert; 6 | import androidx.room.OnConflictStrategy; 7 | import androidx.room.Query; 8 | import androidx.room.Update; 9 | 10 | import com.star.foodfans.entity.Achievemenkindtinfo; 11 | 12 | import java.util.List; 13 | 14 | @Dao 15 | public interface AchievemenkindtinfoDao { 16 | /** 17 | * This method was generated by MyBatis Generator. 18 | * This method corresponds to the database table achievemenkindtinfo 19 | * 20 | * @mbggenerated 21 | */ 22 | @Query("DELETE FROM Achievemenkindtinfo WHERE typeid = :typeid") 23 | int deleteAchievementkindinfo(Integer typeid); 24 | 25 | @Query("DELETE FROM Achievemenkindtinfo") 26 | int deleteAllAchievemenkindtinfo(); 27 | 28 | /** 29 | * This method was generated by MyBatis Generator. 30 | * This method corresponds to the database table achievemenkindtinfo 31 | * 32 | * @mbggenerated 33 | */ 34 | @Insert(onConflict = OnConflictStrategy.REPLACE) 35 | void insertAchievemenkindtinfo(Achievemenkindtinfo record); 36 | 37 | /** 38 | * This method was generated by MyBatis Generator. 39 | * This method corresponds to the database table achievemenkindtinfo 40 | * 41 | * @mbggenerated 42 | */ 43 | @Query("SELECT * FROM Achievemenkindtinfo WHERE typeid = :typeid") 44 | LiveData selectAchievemenkindtinfo(Integer typeid); 45 | 46 | /** 47 | * This method was generated by MyBatis Generator. 48 | * This method corresponds to the database table achievemenkindtinfo 49 | * 50 | * @mbggenerated 51 | */ 52 | @Query("SELECT * FROM Achievemenkindtinfo") 53 | LiveData> selectAllAchievemenkindtinfo(); 54 | 55 | /** 56 | * This method was generated by MyBatis Generator. 57 | * This method corresponds to the database table achievemenkindtinfo 58 | * 59 | * @mbggenerated 60 | */ 61 | @Update 62 | int updateAchievemenkindtinfo(Achievemenkindtinfo record); 63 | 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/ArticleinfoDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Insert; 6 | import androidx.room.Query; 7 | import androidx.room.Update; 8 | 9 | import com.star.foodfans.entity.Articleinfo; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | @Dao 15 | public interface ArticleinfoDao { 16 | 17 | @Query("DELETE FROM Articleinfo WHERE articleid = :articleid") 18 | int deleteArticleinfo(Integer articleid); 19 | 20 | @Query("DELETE FROM Articleinfo") 21 | int deleteAllArticleinfo(); 22 | 23 | @Insert 24 | void insertArticleinfo(Articleinfo record); 25 | 26 | @Query("SELECT * FROM Articleinfo WHERE articleid = :articleid") 27 | LiveData selectArticleinfo(Integer articleid); 28 | 29 | @Query("SELECT * FROM Articleinfo") 30 | LiveData> selectAllArticleinfo(); 31 | 32 | // @Update 33 | // int updateArticleinfo(Articleinfo record); 34 | // 35 | // @Query("select articleId, articleinfo.userId, title, urls, praiseNum, readNum, commentNum, avgscore," + 36 | // " creatStamp, isTop, visitNum, tag, content" + 37 | // " from history, articleinfo" + 38 | // " where history.userId = :userid and history.contentId = concat('A', articleinfo.articleId) and history.isCollected = 1") 39 | // LiveData> selectArticleCollectionByUserid(int userid); 40 | // 41 | // @Query("select articleId, userId, title, urls, praiseNum, readNum, commentNum, avgscore,\n" + 42 | // " creatStamp, isTop, visitNum, tag, content" + 43 | // " from articleinfo\n" + 44 | // " where articleinfo.userId = :userid") 45 | // LiveData> selectArticlePublishByUserid(int userid); 46 | // 47 | // 48 | // @Query("select articleId, articleinfo.userId, title, urls, praiseNum, readNum, commentNum, avgscore," + 49 | // " creatStamp, isTop, visitNum, tag, content" + 50 | // " from articleinfo, history" + 51 | // " where history.userId = :userid and history.userId = articleinfo.userid and history.contentId = articleinfo.articleId") 52 | // LiveData> selectArticleHistoryByUserid(int userid); 53 | // 54 | // @Query("select articleId, userId, title, urls, praiseNum, readNum, commentNum, avgscore," + 55 | // " creatStamp, isTop, visitNum, tag, content" + 56 | // " from articleinfo\n" + 57 | // " limit 4\n") 58 | // LiveData> getHotArticles(); 59 | // 60 | // @Query("select articleId, articleinfo.userId, title, urls, praiseNum, readNum, commentNum, " + 61 | // "avgscore, creatStamp, isTop, visitNum, tag, content, username, " + 62 | // "((visitNum + 0.2 * commentNum) * avgscore) as hot " + 63 | // "FROM articleinfo, userinfo " + 64 | // "where articleinfo.userId = userinfo.userId " + 65 | // "and (articleinfo.tag LIKE :cuisine or articleinfo.title LIKE :dish) " + 66 | // "limit 10") 67 | // LiveData> searchArticles(String dish, String cuisine); 68 | 69 | // List selectTen(); 70 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/CommentinfoDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Insert; 6 | import androidx.room.Query; 7 | import androidx.room.Update; 8 | 9 | import com.star.foodfans.entity.Commentinfo; 10 | 11 | import java.util.List; 12 | 13 | @Dao 14 | public interface CommentinfoDao { 15 | 16 | @Query("DELETE FROM Commentinfo WHERE contentid = :commentid") 17 | int deleteCommentinfo(Integer commentid); 18 | 19 | @Query("DELETE FROM Commentinfo") 20 | int deleteAllCommentinfo(); 21 | 22 | @Insert 23 | void insertCommentinfo(Commentinfo record); 24 | 25 | @Query("SELECT * FROM Commentinfo WHERE commentid = :commentid") 26 | LiveData selectCommentinfo(Integer commentid); 27 | 28 | @Query("SELECT * FROM Commentinfo") 29 | LiveData> selectAllCommentinfo(); 30 | 31 | @Update 32 | int updateCommentinfo(Commentinfo record); 33 | 34 | @Query("SELECT * FROM Commentinfo WHERE contentid = :contentid") 35 | LiveData> selectCommentinfoByContentid(String contentid); 36 | 37 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/FriendrangeDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Insert; 6 | import androidx.room.Query; 7 | import androidx.room.Update; 8 | 9 | import com.star.foodfans.entity.Friendrange; 10 | import java.util.List; 11 | 12 | @Dao 13 | public interface FriendrangeDao { 14 | 15 | @Query("DELETE FROM Friendrange") 16 | int deleteAllFriendrange(); 17 | /** 18 | * This method was generated by MyBatis Generator. 19 | * This method corresponds to the database table friendrange 20 | * 21 | * @mbggenerated 22 | */ 23 | @Query("DELETE FROM Friendrange WHERE userid = :userid and friendid = :friendid") 24 | int deleteFriendrange(Integer userid, Integer friendid); 25 | 26 | /** 27 | * This method was generated by MyBatis Generator. 28 | * This method corresponds to the database table friendrange 29 | * 30 | * @mbggenerated 31 | */ 32 | @Insert 33 | void insert(Friendrange record); 34 | 35 | /** 36 | * This method was generated by MyBatis Generator. 37 | * This method corresponds to the database table friendrange 38 | * 39 | * @mbggenerated 40 | */ 41 | @Query("SELECT * FROM Friendrange WHERE userid = :userid and friendid = :friendid") 42 | LiveData selectFriendrange(Integer userid, Integer friendid); 43 | 44 | /** 45 | * This method was generated by MyBatis Generator. 46 | * This method corresponds to the database table friendrange 47 | * 48 | * @mbggenerated 49 | */ 50 | @Query("SELECT * FROM Friendrange") 51 | LiveData> selectAllFriendrange(); 52 | 53 | /** 54 | * This method was generated by MyBatis Generator. 55 | * This method corresponds to the database table friendrange 56 | * 57 | * @mbggenerated 58 | */@Update 59 | int updateFriendrange(Friendrange record); 60 | 61 | @Query("SELECT * FROM Friendrange WHERE userid = :userid") 62 | LiveData> selectPersonalFriends(Integer userid); 63 | 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/GoodsDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Delete; 6 | import androidx.room.Insert; 7 | import androidx.room.Query; 8 | import androidx.room.Update; 9 | 10 | import com.star.foodfans.entity.Goods; 11 | 12 | import java.util.List; 13 | 14 | @Dao 15 | public interface GoodsDao { 16 | /** 17 | * This method was generated by MyBatis Generator. 18 | * This method corresponds to the database table goods 19 | * 20 | * @mbggenerated 21 | */ 22 | @Query("DELETE FROM Goods WHERE id = :id") 23 | int deleteGoods(Integer id); 24 | 25 | @Query("DELETE FROM Goods") 26 | int deleteAllGoods(); 27 | /** 28 | * This method was generated by MyBatis Generator. 29 | * This method corresponds to the database table goods 30 | * 31 | * @mbggenerated 32 | */ 33 | @Insert 34 | void insertGoods(Goods record); 35 | 36 | /** 37 | * This method was generated by MyBatis Generator. 38 | * This method corresponds to the database table goods 39 | * 40 | * @mbggenerated 41 | */ 42 | @Query("SELECT * FROM Goods WHERE id = :id") 43 | LiveData selectGoods(Integer id); 44 | 45 | /** 46 | * This method was generated by MyBatis Generator. 47 | * This method corresponds to the database table goods 48 | * 49 | * @mbggenerated 50 | */ 51 | @Query("SELECT * FROM Goods") 52 | LiveData> selectAllGoods(); 53 | 54 | /** 55 | * This method was generated by MyBatis Generator. 56 | * This method corresponds to the database table goods 57 | * 58 | * @mbggenerated 59 | */ 60 | @Update 61 | int updateGoods(Goods record); 62 | 63 | 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/HistoryDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Delete; 6 | import androidx.room.Insert; 7 | import androidx.room.Query; 8 | import androidx.room.Update; 9 | 10 | import com.star.foodfans.entity.History; 11 | import java.util.List; 12 | 13 | @Dao 14 | public interface HistoryDao { 15 | /** 16 | * This method was generated by MyBatis Generator. 17 | * This method corresponds to the database table history 18 | * 19 | * @mbggenerated 20 | */ 21 | @Query("DELETE FROM History WHERE userid = :userid and contentid = :contentid") 22 | int deleteHistory(Integer userid, String contentid); 23 | 24 | @Query("DELETE FROM History") 25 | int deleteAllHistory(); 26 | /** 27 | * This method was generated by MyBatis Generator. 28 | * This method corresponds to the database table history 29 | * 30 | * @mbggenerated 31 | */ 32 | @Insert 33 | void insertHistory(History record); 34 | 35 | /** 36 | * This method was generated by MyBatis Generator. 37 | * This method corresponds to the database table history 38 | * 39 | * @mbggenerated 40 | */ 41 | @Query("SELECT * FROM History WHERE userid = :userid and contentid = :contentid") 42 | LiveData selectHistory(Integer userid, String contentid); 43 | 44 | /** 45 | * This method was generated by MyBatis Generator. 46 | * This method corresponds to the database table history 47 | * 48 | * @mbggenerated 49 | */ 50 | @Query("SELECT * FROM History") 51 | LiveData> selectAllHistory(); 52 | 53 | /** 54 | * This method was generated by MyBatis Generator. 55 | * This method corresponds to the database table history 56 | * 57 | * @mbggenerated 58 | */ 59 | @Update 60 | int updateHistory(History record); 61 | 62 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/MessageDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Delete; 6 | import androidx.room.Insert; 7 | import androidx.room.Query; 8 | import androidx.room.Update; 9 | 10 | import com.star.foodfans.entity.Message; 11 | 12 | import java.util.List; 13 | 14 | @Dao 15 | public interface MessageDao { 16 | /** 17 | * This method was generated by MyBatis Generator. 18 | * This method corresponds to the database table message 19 | * 20 | * @mbggenerated 21 | */ 22 | @Query("DELETE FROM Message WHERE msgid = :msgid") 23 | int deleteMessage(Integer msgid); 24 | 25 | @Query("DELETE FROM Message") 26 | int deleteAllMessage(); 27 | 28 | /** 29 | * This method was generated by MyBatis Generator. 30 | * This method corresponds to the database table message 31 | * 32 | * @mbggenerated 33 | */ 34 | @Insert 35 | void insertMessage(Message record); 36 | 37 | /** 38 | * This method was generated by MyBatis Generator. 39 | * This method corresponds to the database table message 40 | * 41 | * @mbggenerated 42 | */ 43 | @Query("SELECT * FROM Message WHERE msgid = :msgid") 44 | LiveData selectMessage(Integer msgid); 45 | 46 | /** 47 | * This method was generated by MyBatis Generator. 48 | * This method corresponds to the database table message 49 | * 50 | * @mbggenerated 51 | */ 52 | @Query("SELECT * FROM Message") 53 | LiveData> selectAllMessage(); 54 | 55 | /** 56 | * This method was generated by MyBatis Generator. 57 | * This method corresponds to the database table message 58 | * 59 | * @mbggenerated 60 | */ 61 | @Update 62 | int updateMessage(Message record); 63 | 64 | /** 65 | * This method was generated by MyBatis Generator. 66 | * This method corresponds to the database table message 67 | * 68 | * @mbggenerated 69 | */ 70 | @Query("SELECT * FROM Message WHERE receive = :uid") 71 | LiveData> selectOnesMessage(Integer uid); 72 | 73 | /** 74 | * This method was generated by MyBatis Generator. 75 | * This method corresponds to the database table message 76 | * 77 | * @mbggenerated 78 | */ 79 | @Query("UPDATE Message SET isread = 1 WHERE receive = :uid") 80 | void readMessage(Integer uid); 81 | 82 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/RecordDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Delete; 6 | import androidx.room.Insert; 7 | import androidx.room.Query; 8 | import androidx.room.Update; 9 | 10 | import com.star.foodfans.entity.Record; 11 | 12 | import java.util.List; 13 | 14 | @Dao 15 | public interface RecordDao { 16 | /** 17 | * This method was generated by MyBatis Generator. 18 | * This method corresponds to the database table record 19 | * 20 | * @mbggenerated 21 | */ 22 | @Query("DELETE FROM Record WHERE id = :id") 23 | int deleteRecord(Integer id); 24 | 25 | @Query("DELETE FROM Record") 26 | int deleteAllRecord(); 27 | /** 28 | * This method was generated by MyBatis Generator. 29 | * This method corresponds to the database table record 30 | * 31 | * @mbggenerated 32 | */ 33 | @Insert 34 | void insertRecord(Record record); 35 | 36 | /** 37 | * This method was generated by MyBatis Generator. 38 | * This method corresponds to the database table record 39 | * 40 | * @mbggenerated 41 | */ 42 | @Query("SELECT * FROM Record WHERE id = :id") 43 | LiveData selectRecord(Integer id); 44 | 45 | /** 46 | * This method was generated by MyBatis Generator. 47 | * This method corresponds to the database table record 48 | * 49 | * @mbggenerated 50 | */ 51 | @Query("SELECT * FROM Record") 52 | LiveData> selectAllRecord(); 53 | 54 | /** 55 | * This method was generated by MyBatis Generator. 56 | * This method corresponds to the database table record 57 | * 58 | * @mbggenerated 59 | */ 60 | @Update 61 | int updateRecord(Record record); 62 | 63 | @Query("SELECT * FROM Record WHERE userid = :id") 64 | LiveData> selectRecordByUserId(int id); 65 | 66 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/RewardDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Delete; 6 | import androidx.room.Insert; 7 | import androidx.room.Query; 8 | import androidx.room.Update; 9 | 10 | import com.star.foodfans.entity.Reward; 11 | 12 | import java.util.List; 13 | 14 | @Dao 15 | public interface RewardDao { 16 | /** 17 | * This method was generated by MyBatis Generator. 18 | * This method corresponds to the database table reward 19 | * 20 | * @mbggenerated 21 | */ 22 | @Query("DELETE FROM Reward WHERE rewardid = :rewardid") 23 | int deleteReward(Integer rewardid); 24 | 25 | @Query("DELETE FROM Reward") 26 | int deleteAllReward(); 27 | 28 | /** 29 | * This method was generated by MyBatis Generator. 30 | * This method corresponds to the database table reward 31 | * 32 | * @mbggenerated 33 | */ 34 | @Insert 35 | void insertReward(Reward record); 36 | 37 | /** 38 | * This method was generated by MyBatis Generator. 39 | * This method corresponds to the database table reward 40 | * 41 | * @mbggenerated 42 | */ 43 | @Query("SELECT * FROM Reward WHERE rewardid = :rewardid") 44 | LiveData selectReward(Integer rewardid); 45 | 46 | /** 47 | * This method was generated by MyBatis Generator. 48 | * This method corresponds to the database table reward 49 | * 50 | * @mbggenerated 51 | */ 52 | @Query("SELECT * FROM Reward") 53 | LiveData> selectAllReward(); 54 | 55 | /** 56 | * This method was generated by MyBatis Generator. 57 | * This method corresponds to the database table reward 58 | * 59 | * @mbggenerated 60 | */ 61 | @Update 62 | int updateReward(Reward record); 63 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/TokenDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.room.Dao; 4 | import androidx.room.Insert; 5 | import androidx.room.Query; 6 | 7 | import com.star.foodfans.entity.Token; 8 | 9 | @Dao 10 | public interface TokenDao { 11 | 12 | @Query("DELETE FROM Token") 13 | void deleteAll(); 14 | 15 | @Insert 16 | void insertToken(Token token); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/UserinfoDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Delete; 6 | import androidx.room.Insert; 7 | import androidx.room.OnConflictStrategy; 8 | import androidx.room.Query; 9 | import androidx.room.Update; 10 | 11 | import com.star.foodfans.entity.Userinfo; 12 | 13 | import java.util.List; 14 | 15 | @Dao 16 | public interface UserinfoDao { 17 | 18 | @Query("DELETE FROM Userinfo WHERE userid = :userid") 19 | int deleteUserinfo(Integer userid); 20 | 21 | @Query("DELETE FROM Userinfo") 22 | int deleteAllUserinfo(); 23 | 24 | @Insert(onConflict = OnConflictStrategy.REPLACE) 25 | void insertUserinfo(Userinfo record); 26 | 27 | @Query("SELECT * FROM Userinfo WHERE userid = :userid") 28 | LiveData selectUserinfo(Integer userid); 29 | 30 | @Query("SELECT * FROM Userinfo") 31 | LiveData> selectAllUserinfo(); 32 | 33 | @Query("SELECT * FROM Userinfo WHERE email = :email") 34 | LiveData selectUserinfoByEmail(String email); 35 | 36 | @Update 37 | int updateUserinfo(Userinfo record); 38 | 39 | // int insertByEmail(String username, String email, String password); 40 | // 41 | // int updateUserInfo(Integer userid, String username, String headpicture, String phone); 42 | // 43 | // Userinfo selectByEmail(String email); 44 | // 45 | // String selectPasswordByUserid(Integer userid); 46 | // 47 | // int changePassword(Integer userid, String newPassword); 48 | // 49 | // int changePasswordByEmail(String email, String newPassword); 50 | // 51 | // List selectNameByArticle(Integer articleid); 52 | // 53 | // List selectNameByVideo(Integer articleid); 54 | 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/dao/VideoinfoDao.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.dao; 2 | 3 | import androidx.lifecycle.LiveData; 4 | import androidx.room.Dao; 5 | import androidx.room.Insert; 6 | import androidx.room.Query; 7 | import androidx.room.Update; 8 | 9 | import com.star.foodfans.entity.Videoinfo; 10 | 11 | import java.util.List; 12 | 13 | @Dao 14 | public interface VideoinfoDao { 15 | /** 16 | * This method was generated by MyBatis Generator. 17 | * This method corresponds to the database table videoinfo 18 | * 19 | * @mbggenerated 20 | */ 21 | @Query("DELETE FROM Videoinfo WHERE videoid = :videoid") 22 | int deleteVideoinfo(Integer videoid); 23 | 24 | @Query("DELETE FROM Videoinfo") 25 | int deleteAllVideoinfo(); 26 | 27 | /** 28 | * This method was generated by MyBatis Generator. 29 | * This method corresponds to the database table videoinfo 30 | * 31 | * @mbggenerated 32 | */ 33 | @Insert 34 | void insertVideoinfo(Videoinfo record); 35 | 36 | /** 37 | * This method was generated by MyBatis Generator. 38 | * This method corresponds to the database table videoinfo 39 | * 40 | * @mbggenerated 41 | */ 42 | @Query("SELECT * FROM Videoinfo WHERE videoid = :videoid") 43 | LiveData selectVideoinfo(Integer videoid); 44 | 45 | /** 46 | * This method was generated by MyBatis Generator. 47 | * This method corresponds to the database table videoinfo 48 | * 49 | * @mbggenerated 50 | */ 51 | @Query("SELECT * FROM Videoinfo") 52 | List selectAllVideoinfo(); 53 | 54 | /** 55 | * This method was generated by MyBatis Generator. 56 | * This method corresponds to the database table videoinfo 57 | * 58 | * @mbggenerated 59 | */ 60 | @Update 61 | int updateVideoinfo(Videoinfo record); 62 | 63 | @Query("SELECT * FROM Videoinfo WHERE userid = :userid ") 64 | LiveData> selectVideoCollectionByUserid(int userid); 65 | 66 | // LiveData> selectVideoPublishByUserid(int userid); 67 | // 68 | // LiveData> selectVideoHistoryByUserid(int userid); 69 | // 70 | // List selectByHot(); 71 | 72 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/db/AppDatabase.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.db; 2 | 3 | import androidx.room.Database; 4 | import androidx.room.RoomDatabase; 5 | 6 | import com.star.foodfans.dao.AchievemenkindtinfoDao; 7 | import com.star.foodfans.dao.ArticleinfoDao; 8 | import com.star.foodfans.dao.CommentinfoDao; 9 | import com.star.foodfans.dao.FriendrangeDao; 10 | import com.star.foodfans.dao.GoodsDao; 11 | import com.star.foodfans.dao.HistoryDao; 12 | import com.star.foodfans.dao.MessageDao; 13 | import com.star.foodfans.dao.RecordDao; 14 | import com.star.foodfans.dao.RewardDao; 15 | import com.star.foodfans.dao.TokenDao; 16 | import com.star.foodfans.dao.UserinfoDao; 17 | import com.star.foodfans.dao.VideoinfoDao; 18 | import com.star.foodfans.entity.Achievemenkindtinfo; 19 | import com.star.foodfans.entity.Articleinfo; 20 | import com.star.foodfans.entity.Commentinfo; 21 | import com.star.foodfans.entity.Friendrange; 22 | import com.star.foodfans.entity.Goods; 23 | import com.star.foodfans.entity.History; 24 | import com.star.foodfans.entity.Message; 25 | import com.star.foodfans.entity.Record; 26 | import com.star.foodfans.entity.Reward; 27 | import com.star.foodfans.entity.Token; 28 | import com.star.foodfans.entity.Userinfo; 29 | import com.star.foodfans.entity.Videoinfo; 30 | 31 | 32 | @Database(entities = {Achievemenkindtinfo.class, Articleinfo.class, Commentinfo.class, 33 | Friendrange.class, Goods.class, History.class, Message.class, Record.class, 34 | Reward.class, Userinfo.class, Videoinfo.class, Token.class}, version = 1, exportSchema = false) 35 | public abstract class AppDatabase extends RoomDatabase { 36 | 37 | public abstract AchievemenkindtinfoDao achievemenkindtinfoDao(); 38 | public abstract ArticleinfoDao articleinfoDao(); 39 | public abstract CommentinfoDao commentinfoDao(); 40 | public abstract FriendrangeDao friendrangeDao(); 41 | public abstract GoodsDao goodsDao(); 42 | public abstract HistoryDao historyDao(); 43 | public abstract MessageDao messageDao(); 44 | public abstract RecordDao recordDao(); 45 | public abstract RewardDao rewardDao(); 46 | public abstract UserinfoDao userinfoDao(); 47 | public abstract VideoinfoDao videoinfoDao(); 48 | public abstract TokenDao tokenDao(); 49 | 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/entity/Achievemenkindtinfo.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.entity; 2 | 3 | import androidx.room.Entity; 4 | import androidx.room.PrimaryKey; 5 | 6 | import java.io.Serializable; 7 | 8 | @Entity 9 | public class Achievemenkindtinfo implements Serializable { 10 | /** 11 | * This field was generated by MyBatis Generator. 12 | * This field corresponds to the database column achievemenkindtinfo.typeid 13 | * 14 | * @mbggenerated 15 | */ 16 | @PrimaryKey 17 | private Integer typeid; 18 | 19 | /** 20 | * This field was generated by MyBatis Generator. 21 | * This field corresponds to the database column achievemenkindtinfo.meaning 22 | * 23 | * @mbggenerated 24 | */ 25 | private String meaning; 26 | 27 | /** 28 | * This field was generated by MyBatis Generator. 29 | * This field corresponds to the database column achievemenkindtinfo.privileges 30 | * 31 | * @mbggenerated 32 | */ 33 | private String privileges; 34 | 35 | /** 36 | * This field was generated by MyBatis Generator. 37 | * This field corresponds to the database table achievemenkindtinfo 38 | * 39 | * @mbggenerated 40 | */ 41 | private static final long serialVersionUID = 1L; 42 | 43 | /** 44 | * This method was generated by MyBatis Generator. 45 | * This method returns the value of the database column achievemenkindtinfo.typeid 46 | * 47 | * @return the value of achievemenkindtinfo.typeid 48 | * 49 | * @mbggenerated 50 | */ 51 | public Integer getTypeid() { 52 | return typeid; 53 | } 54 | 55 | /** 56 | * This method was generated by MyBatis Generator. 57 | * This method sets the value of the database column achievemenkindtinfo.typeid 58 | * 59 | * @param typeid the value for achievemenkindtinfo.typeid 60 | * 61 | * @mbggenerated 62 | */ 63 | public void setTypeid(Integer typeid) { 64 | this.typeid = typeid; 65 | } 66 | 67 | /** 68 | * This method was generated by MyBatis Generator. 69 | * This method returns the value of the database column achievemenkindtinfo.meaning 70 | * 71 | * @return the value of achievemenkindtinfo.meaning 72 | * 73 | * @mbggenerated 74 | */ 75 | public String getMeaning() { 76 | return meaning; 77 | } 78 | 79 | /** 80 | * This method was generated by MyBatis Generator. 81 | * This method sets the value of the database column achievemenkindtinfo.meaning 82 | * 83 | * @param meaning the value for achievemenkindtinfo.meaning 84 | * 85 | * @mbggenerated 86 | */ 87 | public void setMeaning(String meaning) { 88 | this.meaning = meaning == null ? null : meaning.trim(); 89 | } 90 | 91 | /** 92 | * This method was generated by MyBatis Generator. 93 | * This method returns the value of the database column achievemenkindtinfo.privileges 94 | * 95 | * @return the value of achievemenkindtinfo.privileges 96 | * 97 | * @mbggenerated 98 | */ 99 | public String getPrivileges() { 100 | return privileges; 101 | } 102 | 103 | /** 104 | * This method was generated by MyBatis Generator. 105 | * This method sets the value of the database column achievemenkindtinfo.privileges 106 | * 107 | * @param privileges the value for achievemenkindtinfo.privileges 108 | * 109 | * @mbggenerated 110 | */ 111 | public void setPrivileges(String privileges) { 112 | this.privileges = privileges == null ? null : privileges.trim(); 113 | } 114 | 115 | /** 116 | * This method was generated by MyBatis Generator. 117 | * This method corresponds to the database table achievemenkindtinfo 118 | * 119 | * @mbggenerated 120 | */ 121 | @Override 122 | public String toString() { 123 | StringBuilder sb = new StringBuilder(); 124 | sb.append(getClass().getSimpleName()); 125 | sb.append(" ["); 126 | sb.append("Hash = ").append(hashCode()); 127 | sb.append(", typeid=").append(typeid); 128 | sb.append(", meaning=").append(meaning); 129 | sb.append(", privileges=").append(privileges); 130 | sb.append(", serialVersionUID=").append(serialVersionUID); 131 | sb.append("]"); 132 | return sb.toString(); 133 | } 134 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/entity/Model.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.entity; 2 | 3 | public class Model { 4 | 5 | private String type; 6 | private Object data; 7 | 8 | public Model(String type, Object data) { 9 | this.type = type; 10 | this.data = data; 11 | } 12 | 13 | public String getType() { 14 | return type; 15 | } 16 | 17 | public void setType(String type) { 18 | this.type = type; 19 | } 20 | 21 | public Object getData() { 22 | return data; 23 | } 24 | 25 | public void setData(Object data) { 26 | this.data = data; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/entity/Result.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Result implements Serializable { 6 | 7 | private Articleinfo name; 8 | 9 | private float hot; 10 | 11 | private String username; 12 | 13 | private String[] tags; 14 | 15 | public Articleinfo getName() { 16 | return name; 17 | } 18 | 19 | public void setName(Articleinfo name) { 20 | this.name = name; 21 | } 22 | 23 | public float getHot() { 24 | return hot; 25 | } 26 | 27 | public void setHot(float hot) { 28 | this.hot = hot; 29 | } 30 | 31 | public String getUsername() { 32 | return username; 33 | } 34 | 35 | public void setUsername(String username) { 36 | this.username = username; 37 | } 38 | 39 | public String[] getTags() { 40 | return tags; 41 | } 42 | 43 | public void setTags(String[] tags) { 44 | this.tags = tags; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/entity/SearchResultBean.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | public class SearchResultBean implements Serializable { 6 | public String getArticleId() { 7 | return articleId; 8 | } 9 | 10 | public void setArticleId(String articleId) { 11 | this.articleId = articleId; 12 | } 13 | 14 | public String getVisitNum() { 15 | return visitNum; 16 | } 17 | 18 | public void setVisitNum(String visitNum) { 19 | this.visitNum = visitNum; 20 | } 21 | 22 | public String getPraiseNum() { 23 | return praiseNum; 24 | } 25 | 26 | public void setPraiseNum(String praiseNum) { 27 | this.praiseNum = praiseNum; 28 | } 29 | 30 | public String getTitle() { 31 | return title; 32 | } 33 | 34 | public void setTitle(String title) { 35 | this.title = title; 36 | } 37 | 38 | public String getHot() { 39 | return hot; 40 | } 41 | 42 | public void setHot(String hot) { 43 | this.hot = hot; 44 | } 45 | 46 | public String getUserId() { 47 | return userId; 48 | } 49 | 50 | public void setUserId(String userId) { 51 | this.userId = userId; 52 | } 53 | 54 | public String getContent() { 55 | return content; 56 | } 57 | 58 | public void setContent(String content) { 59 | this.content = content; 60 | } 61 | 62 | public String getCommentNum() { 63 | return commentNum; 64 | } 65 | 66 | public void setCommentNum(String commentNum) { 67 | this.commentNum = commentNum; 68 | } 69 | 70 | public String getUrls() { 71 | return urls; 72 | } 73 | 74 | public void setUrls(String urls) { 75 | this.urls = urls; 76 | } 77 | 78 | public String getReadNum() { 79 | return readNum; 80 | } 81 | 82 | public void setReadNum(String readNum) { 83 | this.readNum = readNum; 84 | } 85 | 86 | public String getIsTop() { 87 | return isTop; 88 | } 89 | 90 | public void setIsTop(String isTop) { 91 | this.isTop = isTop; 92 | } 93 | 94 | public float getAvgScore() { 95 | return avgScore; 96 | } 97 | 98 | public void setAvgScore(float avgScore) { 99 | this.avgScore = avgScore; 100 | } 101 | 102 | public String getCreateStamp() { 103 | return createStamp; 104 | } 105 | 106 | public void setCreateStamp(String createStamp) { 107 | this.createStamp = createStamp; 108 | } 109 | 110 | public String getTag() { 111 | return tag; 112 | } 113 | 114 | public void setTag(String tag) { 115 | this.tag = tag; 116 | } 117 | 118 | public String getUsername() { 119 | return username; 120 | } 121 | 122 | public void setUsername(String username) { 123 | this.username = username; 124 | } 125 | 126 | String articleId; 127 | 128 | String visitNum; 129 | 130 | String praiseNum; 131 | 132 | String title; 133 | 134 | String hot; 135 | 136 | String userId; 137 | 138 | String content; 139 | 140 | String commentNum; 141 | 142 | String urls; 143 | 144 | String readNum; 145 | 146 | String isTop; 147 | 148 | float avgScore; 149 | 150 | String createStamp; 151 | 152 | String tag; 153 | 154 | String username; 155 | 156 | } 157 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/entity/Token.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.entity; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.room.Entity; 5 | import androidx.room.PrimaryKey; 6 | 7 | @Entity 8 | public class Token { 9 | 10 | @PrimaryKey 11 | @NonNull 12 | private String token; 13 | 14 | public String getToken() { 15 | return token; 16 | } 17 | 18 | public void setToken(String token) { 19 | this.token = token; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/activity/CommentActivity.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.activity; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.os.Build; 6 | import android.os.Bundle; 7 | import android.text.Editable; 8 | import android.text.TextWatcher; 9 | import android.view.View; 10 | import android.view.Window; 11 | import android.widget.EditText; 12 | import android.widget.TextView; 13 | 14 | import com.google.gson.JsonObject; 15 | import com.star.foodfans.R; 16 | import com.star.foodfans.api.ApiClient; 17 | import com.star.foodfans.api.ApiInterface; 18 | import com.star.foodfans.repository.AppRepository; 19 | import com.star.foodfans.ui.adapter.CommentAdapter; 20 | import com.star.foodfans.util.Utils; 21 | 22 | import retrofit2.Call; 23 | import retrofit2.Callback; 24 | import retrofit2.Response; 25 | 26 | public class CommentActivity extends AppCompatActivity implements TextWatcher, View.OnClickListener 27 | { 28 | 29 | private TextView textNumber; 30 | private EditText content; 31 | private TextView save; 32 | ApiInterface apiInterface = ApiClient.getApiClient().create(ApiInterface.class); 33 | // private AppRepository appRepository; 34 | private int id; 35 | 36 | @Override 37 | protected void onCreate(Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | // Making notification bar transparent 40 | if (Build.VERSION.SDK_INT >= 21) { 41 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); 42 | } 43 | setContentView(R.layout.activity_comment); 44 | id = getIntent().getExtras().getInt("id"); 45 | textNumber = findViewById(R.id.text_num); 46 | content = findViewById(R.id.edit_text_input_content); 47 | save = findViewById(R.id.save); 48 | save.setOnClickListener(this); 49 | save.setEnabled(false); 50 | // appRepository = AppRepository.getAppRepository(this); 51 | content.addTextChangedListener(new TextWatcher() { 52 | @Override 53 | public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { 54 | 55 | } 56 | 57 | @Override 58 | public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { 59 | 60 | } 61 | 62 | @Override 63 | public void afterTextChanged(Editable editable) { 64 | save.setBackgroundColor(getResources().getColor(R.color.login_input_active)); 65 | save.setEnabled(true); 66 | } 67 | }); 68 | } 69 | 70 | @Override 71 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 72 | 73 | } 74 | 75 | @Override 76 | public void onTextChanged(CharSequence s, int start, int before, int count) { 77 | 78 | } 79 | 80 | @Override 81 | public void afterTextChanged(Editable s) { 82 | textNumber.setText(content.length() + "/200"); 83 | } 84 | 85 | @Override 86 | public void onClick(View view) { 87 | switch (view.getId()) { 88 | case R.id.img_back: 89 | finish(); 90 | break; 91 | case R.id.save: 92 | if(content.length()>200){ 93 | Utils.showLongToast(this, "个人描述不得超过200字"); 94 | return; 95 | } 96 | final String tx = content.getText().toString(); 97 | Call call = apiInterface.comment(3, "url", tx, id); 98 | call.enqueue(new Callback() { 99 | @Override 100 | public void onResponse(Call call, Response response) { 101 | if (response.isSuccessful() && response.body() != null) { 102 | // 103 | Utils.showLongToast(CommentActivity.this, "评论成功!"); 104 | finish(); 105 | } else { 106 | Utils.showLongToast(CommentActivity.this, "未知错误,更改失败!"); 107 | } 108 | } 109 | 110 | @Override 111 | public void onFailure(Call call, Throwable t) { 112 | Utils.showLongToast(CommentActivity.this, "未知错误,更改失败!"); 113 | } 114 | }); 115 | break; 116 | } 117 | } 118 | } 119 | 120 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/activity/EditUserInfoActivity.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.activity; 2 | 3 | import android.content.ContentValues; 4 | import android.content.Intent; 5 | import android.database.Cursor; 6 | import android.graphics.Bitmap; 7 | import android.graphics.BitmapFactory; 8 | import android.graphics.Matrix; 9 | import android.net.Uri; 10 | import android.os.AsyncTask; 11 | import android.os.Build; 12 | import android.os.Bundle; 13 | import android.os.Environment; 14 | import android.provider.MediaStore; 15 | import android.view.View; 16 | import android.widget.RelativeLayout; 17 | import android.widget.TextView; 18 | import androidx.appcompat.app.AppCompatActivity; 19 | 20 | import com.bumptech.glide.Glide; 21 | import com.star.foodfans.R; 22 | import com.star.foodfans.api.ApiClient; 23 | import com.star.foodfans.api.ApiInterface; 24 | import com.star.foodfans.entity.Userinfo; 25 | import com.star.foodfans.util.AppConfig; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | import de.hdodenhof.circleimageview.CircleImageView; 31 | 32 | public class EditUserInfoActivity extends AppCompatActivity implements View.OnClickListener { 33 | 34 | private RelativeLayout headRelativeLayout; 35 | private RelativeLayout nameRelativeLayout; 36 | // private RelativeLayout descriptionRelativeLayout; 37 | 38 | private CircleImageView head; 39 | private TextView name; 40 | // private TextView description; 41 | ApiInterface apiInterface = ApiClient.getApiClient().create(ApiInterface.class); 42 | 43 | private Bitmap headBitmap;// 头像Bitmap 44 | 45 | 46 | /* 头像文件 */ 47 | private static final String IMAGE_FILE_NAME = "temp_head_image.jpg"; 48 | private static final String CROP_IMAGE_FILE_NAME = "bala_crop.jpg"; 49 | /* 请求识别码 */ 50 | private static final int CODE_GALLERY_REQUEST = 0xa0; 51 | private static final int CODE_CAMERA_REQUEST = 0xa1; 52 | private static final int CODE_RESULT_REQUEST = 0xa2; 53 | 54 | // 裁剪后图片的宽(X)和高(Y),480 X 480的正方形。 55 | private static int output_X = 50; 56 | private static int output_Y = 50; 57 | //改变头像的标记位 58 | private int new_icon=0xa3; 59 | private String mExtStorDir; 60 | private Uri imageUri; 61 | 62 | private static List optionsSexItems = new ArrayList<>(); 63 | private static List optionsAgeItems = new ArrayList<>(); 64 | 65 | @Override 66 | protected void onCreate(Bundle savedInstanceState) { 67 | super.onCreate(savedInstanceState); 68 | // Making notification bar transparent 69 | if (Build.VERSION.SDK_INT >= 21) { 70 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); 71 | } 72 | initView(); 73 | initData(); 74 | setListener(); 75 | } 76 | 77 | @Override 78 | protected void onResume(){ 79 | super.onResume(); 80 | initData(); 81 | setListener(); 82 | } 83 | 84 | static { 85 | optionsSexItems.add("男"); 86 | optionsSexItems.add("女"); 87 | for(int i = 1;i < 121;i++){ 88 | optionsAgeItems.add(String.valueOf(i)); 89 | } 90 | } 91 | 92 | protected void initData(){ 93 | Userinfo user = AppConfig.CURRENT_USER; 94 | if(user != null) { 95 | name.setText(user.getUsername()); 96 | Glide.with(this).load(user.getHeadpicture()).into(head); 97 | } 98 | } 99 | 100 | protected void initView() { 101 | setContentView(R.layout.activity_edit_user_info); 102 | headRelativeLayout = findViewById(R.id.profile_head_line); 103 | nameRelativeLayout = findViewById(R.id.profile_name_line); 104 | head = findViewById(R.id.profile_head); 105 | name = findViewById(R.id.profile_name); 106 | } 107 | 108 | protected void setListener() { 109 | headRelativeLayout.setOnClickListener(this); 110 | nameRelativeLayout.setOnClickListener(this); 111 | } 112 | 113 | @Override 114 | public void onClick(View v) { 115 | switch (v.getId()){ 116 | case R.id.profile_head_line: 117 | //todo change head icon 118 | break; 119 | case R.id.profile_name_line: 120 | // Utils.start_Activity(EditUserInfoActivity.this, EditUsernameActivity.class); 121 | break; 122 | } 123 | } 124 | 125 | 126 | 127 | } 128 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/activity/WebViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.activity; 2 | 3 | import android.os.Build; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.KeyEvent; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.webkit.WebSettings; 10 | import android.webkit.WebView; 11 | import android.webkit.WebViewClient; 12 | 13 | import androidx.appcompat.app.AppCompatActivity; 14 | 15 | import com.star.foodfans.R; 16 | import com.star.foodfans.util.AppConfig; 17 | 18 | 19 | public class WebViewActivity extends AppCompatActivity { 20 | 21 | private WebView webView; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | // Making notification bar transparent 27 | if (Build.VERSION.SDK_INT >= 21) { 28 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); 29 | } 30 | setContentView(R.layout.activity_web_view); 31 | webView = findViewById(R.id.view_web); 32 | WebSettings settings = webView.getSettings(); 33 | settings.setDomStorageEnabled(true); 34 | //解决一些图片加载问题 35 | settings.setJavaScriptEnabled(true); 36 | settings.setBlockNetworkImage(false); 37 | webView.setWebViewClient(new WebViewClient(){ 38 | @Override 39 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 40 | Log.d("webview","url: "+url); 41 | view.loadUrl(url); 42 | return true; 43 | } 44 | }); 45 | webView.loadUrl(AppConfig.PROJECT_URL); 46 | } 47 | 48 | @Override 49 | public boolean onKeyDown(int keyCode, KeyEvent event) { 50 | if(keyCode == KeyEvent.KEYCODE_BACK) { 51 | if(webView.canGoBack()) { 52 | webView.goBack(); 53 | return true; 54 | } 55 | } 56 | return super.onKeyDown(keyCode, event); 57 | } 58 | 59 | @Override 60 | protected void onDestroy() { 61 | if (webView != null) { 62 | webView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); 63 | webView.setTag(null); 64 | webView.clearHistory(); 65 | 66 | ((ViewGroup) webView.getParent()).removeView(webView); 67 | webView.destroy(); 68 | webView = null; 69 | } 70 | super.onDestroy(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/adapter/BannerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.net.Uri; 5 | import android.os.AsyncTask; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | import androidx.annotation.NonNull; 13 | import androidx.recyclerview.widget.RecyclerView; 14 | 15 | import com.bumptech.glide.Glide; 16 | import com.star.foodfans.R; 17 | import com.star.foodfans.entity.Articleinfo; 18 | import com.star.foodfans.entity.Result; 19 | 20 | import java.io.File; 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import okhttp3.ResponseBody; 25 | import retrofit2.Call; 26 | import retrofit2.Callback; 27 | import retrofit2.Response; 28 | 29 | public class BannerAdapter extends RecyclerView.Adapter { 30 | 31 | private List topCoursesEntities; 32 | private Context context; 33 | private OnItemClickListener onItemClickListener; 34 | 35 | /** 36 | * 设置RecyclerView某个的监听 37 | * @param onItemClickListener 38 | */ 39 | public void setOnItemClickListener(OnItemClickListener onItemClickListener){ 40 | this.onItemClickListener = onItemClickListener; 41 | } 42 | 43 | public interface OnItemClickListener { 44 | void onItemClick(int position); 45 | } 46 | 47 | public BannerAdapter(Context context){ 48 | this.context = context; 49 | topCoursesEntities = new ArrayList<>(); 50 | } 51 | 52 | public void resetList(List items){ 53 | topCoursesEntities.clear(); 54 | topCoursesEntities.addAll(items); 55 | notifyDataSetChanged(); 56 | } 57 | 58 | public int getSize(){ 59 | return topCoursesEntities.size(); 60 | } 61 | 62 | @NonNull 63 | @Override 64 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 65 | View view = LayoutInflater.from(context).inflate(R.layout.kanner_content_layout,parent,false); 66 | ViewHolder holder = new ViewHolder(view); 67 | return holder; 68 | } 69 | 70 | public Result getItem(int pos){ 71 | return topCoursesEntities.get(pos); 72 | } 73 | 74 | @Override 75 | public void onBindViewHolder(@NonNull final ViewHolder holder, int position) { 76 | if(getSize() <= 0) 77 | return; 78 | final int pos = position % getSize(); 79 | Articleinfo course = topCoursesEntities.get(pos).getName(); 80 | holder.tv_title.setText(course.getTitle()); 81 | Glide.with(context).load(course.getUrls()).into(holder.iv_title); 82 | if (onItemClickListener != null) { 83 | holder.iv_title.setOnClickListener(new View.OnClickListener() { 84 | @Override 85 | public void onClick(View v) { 86 | //在TextView的地方进行监听点击事件,并且实现接口 87 | onItemClickListener.onItemClick(pos % topCoursesEntities.size()); 88 | } 89 | }); 90 | } 91 | } 92 | 93 | @Override 94 | public int getItemCount() { 95 | return Integer.MAX_VALUE; 96 | } 97 | 98 | class ViewHolder extends RecyclerView.ViewHolder{ 99 | 100 | private ImageView iv_title; 101 | private TextView tv_title; 102 | 103 | public ViewHolder(@NonNull View itemView){ 104 | super(itemView); 105 | iv_title = itemView.findViewById(R.id.iv_title); 106 | tv_title = itemView.findViewById(R.id.tv_title); 107 | } 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/adapter/CommentAdapter.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import androidx.annotation.NonNull; 11 | import androidx.cardview.widget.CardView; 12 | import androidx.recyclerview.widget.RecyclerView; 13 | 14 | import com.bumptech.glide.Glide; 15 | import com.star.foodfans.R; 16 | import com.star.foodfans.entity.Articleinfo; 17 | import com.star.foodfans.entity.Commentinfo; 18 | import com.star.foodfans.entity.Userinfo; 19 | 20 | import org.w3c.dom.Comment; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import de.hdodenhof.circleimageview.CircleImageView; 26 | 27 | public class CommentAdapter extends RecyclerView.Adapter { 28 | 29 | private Context context; 30 | private ArrayList dataSet; 31 | private ArrayList userinfoArrayList; 32 | 33 | private OnItemClickListener onItemClickListener; 34 | 35 | /** 36 | * 设置RecyclerView某个的监听 37 | * @param itemClickListener 38 | */ 39 | public void setOnItemClickListener(OnItemClickListener itemClickListener){ 40 | onItemClickListener = itemClickListener; 41 | } 42 | 43 | public interface OnItemClickListener { 44 | void onItemClick(int position); 45 | } 46 | 47 | public CommentAdapter(Context context) { 48 | this.context = context; 49 | this.dataSet = new ArrayList<>(); 50 | userinfoArrayList = new ArrayList<>(); 51 | } 52 | 53 | public void resetList(List items, List userinfos){ 54 | this.dataSet.clear(); 55 | this.dataSet.addAll(items); 56 | userinfoArrayList.addAll(userinfos); 57 | notifyDataSetChanged(); 58 | } 59 | 60 | public Commentinfo getComment(int pos){ 61 | return dataSet.get(pos); 62 | } 63 | 64 | public Userinfo getUserinfo(int pos){ 65 | return userinfoArrayList.get(pos); 66 | } 67 | 68 | @NonNull 69 | @Override 70 | public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 71 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_text_feed, parent, false); 72 | return new CourseImageHolder(view); 73 | } 74 | 75 | @Override 76 | public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, final int position) { 77 | ((CourseImageHolder) holder).textView.setText(dataSet.get(position).getContent()); 78 | ((CourseImageHolder) holder).name.setText(userinfoArrayList.get(position).getUsername()); 79 | Glide.with(context).load(userinfoArrayList.get(position).getHeadpicture()).into(((CourseImageHolder)holder).circleImageView); 80 | // if (onItemClickListener != null) { 81 | // ((CourseImageHolder) holder).cardView.setOnClickListener(new View.OnClickListener() { 82 | // @Override 83 | // public void onClick(View v) { 84 | // //在TextView的地方进行监听点击事件,并且实现接口 85 | // onItemClickListener.onItemClick(position % dataSet.size()); 86 | // } 87 | // }); 88 | // } 89 | } 90 | 91 | @Override 92 | public long getItemId(int position) { 93 | return position; 94 | } 95 | 96 | 97 | @Override 98 | public int getItemCount() { 99 | return dataSet.size(); 100 | } 101 | 102 | protected static class CourseImageHolder extends RecyclerView.ViewHolder{ 103 | 104 | // private ImageView imageView; 105 | private TextView textView; 106 | private TextView name; 107 | private CircleImageView circleImageView; 108 | 109 | protected CourseImageHolder(@NonNull View itemView) { 110 | super(itemView); 111 | // imageView = itemView.findViewById(R.id.title_image); 112 | textView = itemView.findViewById(R.id.post_content_text); 113 | circleImageView = itemView.findViewById(R.id.profile_picture); 114 | name = itemView.findViewById(R.id.profile_name); 115 | 116 | } 117 | 118 | } 119 | 120 | 121 | } -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/adapter/DishItemAdapter.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import androidx.annotation.NonNull; 11 | import androidx.cardview.widget.CardView; 12 | import androidx.recyclerview.widget.RecyclerView; 13 | 14 | import com.bumptech.glide.Glide; 15 | import com.star.foodfans.R; 16 | import com.star.foodfans.entity.Articleinfo; 17 | import com.star.foodfans.entity.Result; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | public class DishItemAdapter extends RecyclerView.Adapter { 23 | 24 | private Context context; 25 | private ArrayList dataSet; 26 | 27 | private OnItemClickListener onItemClickListener; 28 | 29 | /** 30 | * 设置RecyclerView某个的监听 31 | * @param itemClickListener 32 | */ 33 | public void setOnItemClickListener(OnItemClickListener itemClickListener){ 34 | onItemClickListener = itemClickListener; 35 | } 36 | 37 | public interface OnItemClickListener { 38 | void onItemClick(int position); 39 | } 40 | 41 | public DishItemAdapter(Context context) { 42 | this.context = context; 43 | this.dataSet = new ArrayList<>(); 44 | } 45 | 46 | public void addList(List items) { 47 | this.dataSet.addAll(items); 48 | notifyDataSetChanged(); 49 | } 50 | 51 | public void resetList(List items){ 52 | this.dataSet.clear(); 53 | this.dataSet.addAll(items); 54 | notifyDataSetChanged(); 55 | } 56 | 57 | public Result getItem(int pos){ 58 | return dataSet.get(pos); 59 | } 60 | 61 | 62 | @NonNull 63 | @Override 64 | public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 65 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_dish, parent, false); 66 | return new CourseImageHolder(view); 67 | } 68 | 69 | @Override 70 | public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, final int position) { 71 | ((CourseImageHolder) holder).textView.setText(dataSet.get(position).getName().getTitle()); 72 | Glide.with(context).load(dataSet.get(position).getName().getUrls()).into(((CourseImageHolder)holder).imageView); 73 | if (onItemClickListener != null) { 74 | ((CourseImageHolder) holder).cardView.setOnClickListener(new View.OnClickListener() { 75 | @Override 76 | public void onClick(View v) { 77 | //在TextView的地方进行监听点击事件,并且实现接口 78 | onItemClickListener.onItemClick(position % dataSet.size()); 79 | } 80 | }); 81 | } 82 | } 83 | 84 | @Override 85 | public long getItemId(int position) { 86 | return position; 87 | } 88 | 89 | 90 | @Override 91 | public int getItemCount() { 92 | return dataSet.size(); 93 | } 94 | 95 | protected static class CourseImageHolder extends RecyclerView.ViewHolder{ 96 | 97 | private ImageView imageView; 98 | private TextView textView; 99 | private CardView cardView; 100 | 101 | protected CourseImageHolder(@NonNull View itemView) { 102 | super(itemView); 103 | imageView = itemView.findViewById(R.id.title_image); 104 | textView = itemView.findViewById(R.id.title_text); 105 | cardView = itemView.findViewById(R.id.card_view); 106 | } 107 | 108 | } 109 | 110 | 111 | } 112 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/adapter/FoodCategoryListViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.TextView; 9 | 10 | import com.star.foodfans.R; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | 16 | public class FoodCategoryListViewAdapter extends BaseAdapter { 17 | //当前Item被点击的位置 18 | private int currentItem; 19 | private Context mContext; 20 | private List mList; 21 | 22 | public FoodCategoryListViewAdapter(Context context) { 23 | this.mContext = context; 24 | mList = new ArrayList(); 25 | } 26 | 27 | public void resetList(List list){ 28 | mList.clear(); 29 | mList = list; 30 | } 31 | 32 | public void setCurrentItem(int currentItem) { 33 | this.currentItem = currentItem; 34 | } 35 | 36 | @Override 37 | public int getCount() { 38 | return mList.size(); 39 | } 40 | 41 | @Override 42 | public String getItem(int position) { 43 | return mList.get(position); 44 | } 45 | 46 | @Override 47 | public long getItemId(int position) { 48 | return position; 49 | } 50 | 51 | @Override 52 | public View getView(final int position, View convertView, ViewGroup parent) { 53 | ViewHolder holder = null; 54 | if (convertView == null) { 55 | convertView = LayoutInflater.from(mContext).inflate(R.layout.item_listview, null); 56 | holder = new ViewHolder(convertView); 57 | convertView.setTag(holder); 58 | } else { 59 | holder = (ViewHolder) convertView.getTag(); 60 | } 61 | //设置文字 62 | holder.foodcategory.setText(mList.get(position)); 63 | if (currentItem == position) { 64 | holder.foodcategory.setSelected(true); 65 | } else { 66 | holder.foodcategory.setSelected(false); 67 | } 68 | return convertView; 69 | } 70 | 71 | class ViewHolder { 72 | TextView foodcategory; 73 | 74 | public ViewHolder(View convertView) { 75 | foodcategory = convertView.findViewById(R.id.tv_foodcategory_left); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/adapter/GridViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.provider.ContactsContract; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | import androidx.annotation.NonNull; 14 | 15 | import com.bumptech.glide.Glide; 16 | import com.star.foodfans.R; 17 | import com.star.foodfans.entity.Articleinfo; 18 | import com.star.foodfans.entity.Result; 19 | import com.star.foodfans.entity.SearchResultBean; 20 | import com.star.foodfans.ui.activity.DishInfoActivity; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class GridViewAdapter extends BaseAdapter { 26 | private Context mContext; 27 | private List mList; 28 | 29 | public GridViewAdapter(Context context) { 30 | this.mContext = context; 31 | this.mList = new ArrayList<>(); 32 | } 33 | 34 | public void resetList(List list) { 35 | mList.clear(); 36 | mList = list; 37 | notifyDataSetChanged(); 38 | } 39 | 40 | @Override 41 | public int getCount() { 42 | return mList.size(); 43 | } 44 | 45 | @Override 46 | public Object getItem(int position) { 47 | return mList.get(position); 48 | } 49 | 50 | @Override 51 | public long getItemId(int position) { 52 | return position; 53 | } 54 | 55 | @Override 56 | public View getView(int position, View convertView, ViewGroup parent) { 57 | ViewHolder holder; 58 | if (convertView == null) { 59 | convertView = LayoutInflater.from(mContext).inflate(R.layout.item_gridview, parent, false); 60 | holder = new ViewHolder(convertView); 61 | convertView.setTag(holder); 62 | } else { 63 | holder = (ViewHolder) convertView.getTag(); 64 | } 65 | //当前菜类别的名字 66 | final String foodName = mList.get(position).getName().getTitle(); 67 | //当前菜类别的ID 68 | final Integer foodId = mList.get(position).getName().getArticleid(); 69 | System.out.println(foodName); 70 | Glide.with(mContext).load(mList.get(position).getName().getUrls()).into(holder.imageView); 71 | holder.tv_name.setText(foodName); 72 | //点击事件 73 | holder.tv_name.setOnClickListener(new View.OnClickListener() { 74 | @Override 75 | public void onClick(View v) { 76 | //带参跳转界面 77 | Intent intent = new Intent(mContext, DishInfoActivity.class); 78 | //传递数组 79 | intent.putExtra("name", foodName); 80 | intent.putExtra("id", foodId); 81 | mContext.startActivity(intent); 82 | } 83 | }); 84 | return convertView; 85 | } 86 | 87 | 88 | class ViewHolder { 89 | ImageView imageView; 90 | TextView tv_name; 91 | 92 | public ViewHolder(View convertView) { 93 | tv_name = convertView.findViewById(R.id.title_text); 94 | imageView = convertView.findViewById(R.id.iv_grid); 95 | } 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/adapter/LoveAdapter.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import androidx.annotation.NonNull; 11 | import androidx.cardview.widget.CardView; 12 | import androidx.recyclerview.widget.RecyclerView; 13 | 14 | import com.bumptech.glide.Glide; 15 | import com.star.foodfans.R; 16 | import com.star.foodfans.entity.Articleinfo; 17 | import com.star.foodfans.entity.Result; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | public class LoveAdapter extends RecyclerView.Adapter { 23 | 24 | private Context context; 25 | private ArrayList dataSet; 26 | 27 | private OnItemClickListener onItemClickListener; 28 | 29 | /** 30 | * 设置RecyclerView某个的监听 31 | * @param itemClickListener 32 | */ 33 | public void setOnItemClickListener(OnItemClickListener itemClickListener){ 34 | onItemClickListener = itemClickListener; 35 | } 36 | 37 | public interface OnItemClickListener { 38 | void onItemClick(int position); 39 | } 40 | 41 | public LoveAdapter(Context context) { 42 | this.context = context; 43 | this.dataSet = new ArrayList<>(); 44 | } 45 | 46 | public void addList(List items) { 47 | this.dataSet.addAll(items); 48 | notifyDataSetChanged(); 49 | } 50 | 51 | public void resetList(List items){ 52 | this.dataSet.clear(); 53 | this.dataSet.addAll(items); 54 | notifyDataSetChanged(); 55 | } 56 | 57 | public Articleinfo getItem(int pos){ 58 | return dataSet.get(pos); 59 | } 60 | 61 | 62 | @NonNull 63 | @Override 64 | public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 65 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_dish, parent, false); 66 | return new CourseImageHolder(view); 67 | } 68 | 69 | @Override 70 | public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, final int position) { 71 | ((CourseImageHolder) holder).textView.setText(dataSet.get(position).getTitle()); 72 | Glide.with(context).load(dataSet.get(position).getUrls()).into(((CourseImageHolder)holder).imageView); 73 | if (onItemClickListener != null) { 74 | ((CourseImageHolder) holder).cardView.setOnClickListener(new View.OnClickListener() { 75 | @Override 76 | public void onClick(View v) { 77 | //在TextView的地方进行监听点击事件,并且实现接口 78 | onItemClickListener.onItemClick(position % dataSet.size()); 79 | } 80 | }); 81 | } 82 | } 83 | 84 | @Override 85 | public long getItemId(int position) { 86 | return position; 87 | } 88 | 89 | 90 | @Override 91 | public int getItemCount() { 92 | return dataSet.size(); 93 | } 94 | 95 | protected static class CourseImageHolder extends RecyclerView.ViewHolder{ 96 | 97 | private ImageView imageView; 98 | private TextView textView; 99 | private CardView cardView; 100 | 101 | protected CourseImageHolder(@NonNull View itemView) { 102 | super(itemView); 103 | imageView = itemView.findViewById(R.id.title_image); 104 | textView = itemView.findViewById(R.id.title_text); 105 | cardView = itemView.findViewById(R.id.card_view); 106 | } 107 | 108 | } 109 | 110 | 111 | } 112 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/adapter/MyPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.adapter; 2 | 3 | import android.view.ViewGroup; 4 | 5 | import androidx.fragment.app.Fragment; 6 | import androidx.fragment.app.FragmentManager; 7 | import androidx.fragment.app.FragmentPagerAdapter; 8 | 9 | import com.star.foodfans.ui.fragment.DiscoverFragment; 10 | import com.star.foodfans.ui.fragment.HomeFragment; 11 | import com.star.foodfans.ui.fragment.MeFragment; 12 | 13 | import java.util.ArrayList; 14 | 15 | public class MyPagerAdapter extends FragmentPagerAdapter { 16 | 17 | private ArrayList fragments = new ArrayList<>(); 18 | private Fragment currentFragment; 19 | 20 | public MyPagerAdapter(FragmentManager fm) { 21 | super(fm); 22 | fragments.clear(); 23 | fragments.add(new HomeFragment()); 24 | fragments.add(new DiscoverFragment()); 25 | fragments.add(new MeFragment()); 26 | } 27 | 28 | @Override 29 | public Fragment getItem(int position) { 30 | return fragments.get(position); 31 | } 32 | 33 | @Override 34 | public int getCount() { 35 | return fragments.size(); 36 | } 37 | 38 | @Override 39 | public void setPrimaryItem(ViewGroup container, int position, Object object) { 40 | if (getCurrentFragment() != object) { 41 | currentFragment = ((Fragment) object); 42 | } 43 | super.setPrimaryItem(container, position, object); 44 | } 45 | 46 | /** 47 | * Get the current fragment 48 | */ 49 | public Fragment getCurrentFragment() { 50 | return currentFragment; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/fragment/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.fragment; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import androidx.annotation.Nullable; 10 | import androidx.fragment.app.Fragment; 11 | 12 | public abstract class BaseFragment extends Fragment { 13 | 14 | protected Activity mActivity; 15 | 16 | @Nullable 17 | @Override 18 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 19 | mActivity = getActivity(); 20 | return initView(inflater, container, savedInstanceState); 21 | } 22 | 23 | @Override 24 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 25 | super.onActivityCreated(savedInstanceState); 26 | initData(); 27 | setListener(); 28 | } 29 | 30 | protected abstract void setListener(); 31 | 32 | protected abstract void initData(); 33 | 34 | @Override 35 | public void onDestroy() { 36 | super.onDestroy(); 37 | mActivity = null; 38 | } 39 | 40 | protected abstract View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); 41 | 42 | /** 43 | * Refresh 44 | */ 45 | public abstract void refresh(); 46 | /** 47 | * Called when a fragment will be displayed 48 | */ 49 | public abstract void willBeDisplayed(); 50 | 51 | /** 52 | * Called when a fragment will be hidden 53 | */ 54 | public abstract void willBeHidden(); 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/fragment/DishCoverFragment.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.fragment; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.view.animation.Animation; 10 | import android.view.animation.AnimationUtils; 11 | import android.widget.ImageView; 12 | import android.widget.RatingBar; 13 | import android.widget.TextView; 14 | 15 | import androidx.fragment.app.Fragment; 16 | 17 | import com.bumptech.glide.Glide; 18 | import com.star.foodfans.R; 19 | import com.star.foodfans.entity.Result; 20 | 21 | 22 | /** 23 | * Created by HaPBoy on 5/22/16. 24 | */ 25 | public class DishCoverFragment extends Fragment { 26 | 27 | private Context context; 28 | private Result dishInfo; 29 | 30 | public static DishCoverFragment newInstance(Context context, Result dishInfo) { 31 | DishCoverFragment fragment = new DishCoverFragment(); 32 | fragment.context=context; 33 | fragment.dishInfo=dishInfo; 34 | Bundle args = new Bundle(); 35 | fragment.setArguments(args); 36 | return fragment; 37 | } 38 | 39 | @Override 40 | public void onCreate(Bundle savedInstanceState) { 41 | super.onCreate(savedInstanceState); 42 | } 43 | 44 | @Override 45 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 46 | View view = inflater.inflate(R.layout.fragment_dish_cover, container, false); 47 | 48 | ImageView ivDishCover = (ImageView) view.findViewById(R.id.dish_cover); 49 | 50 | TextView tvRate = (TextView) view.findViewById(R.id.tv_cover_rate); 51 | RatingBar rbRate = (RatingBar) view.findViewById(R.id.rb_cover_rate); 52 | 53 | View viewRate = view.findViewById(R.id.dish_rate); 54 | 55 | ivDishCover.setImageResource(R.drawable.recipe); 56 | 57 | Glide.with(getContext()).load(dishInfo.getName().getUrls()).into(ivDishCover); 58 | 59 | // 评分 60 | tvRate.setText(String.valueOf(dishInfo.getName().getAvgscore())); 61 | rbRate.setRating(dishInfo.getName().getAvgscore()); 62 | 63 | // 封面入场动画 64 | Animation cover_an = AnimationUtils.loadAnimation(getContext(), R.anim.book_cover_anim); 65 | ivDishCover.startAnimation(cover_an); 66 | // 评分入场动画 67 | Animation rate_an = AnimationUtils.loadAnimation(getContext(), R.anim.book_cover_rate_anim); 68 | viewRate.startAnimation(rate_an); 69 | return view; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/fragment/DishInfoItemFragment.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.fragment; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.TextView; 9 | 10 | import androidx.fragment.app.Fragment; 11 | 12 | import com.star.foodfans.R; 13 | import com.star.foodfans.entity.Result; 14 | 15 | 16 | /** 17 | * Created by HaPBoy on 5/18/16. 18 | */ 19 | public class DishInfoItemFragment extends Fragment { 20 | 21 | 22 | private Result dishInfo; 23 | private Context context; 24 | 25 | private TextView dishNameView; 26 | private TextView dishIntroductionView; 27 | private TextView dishRestaurantNameView; 28 | private TextView dishTasteView; 29 | private TextView dishPriceView; 30 | private TextView dishAddressView; 31 | 32 | public static DishInfoItemFragment newInstance(Context context, Result dishInfo) { 33 | DishInfoItemFragment fragment = new DishInfoItemFragment(); 34 | fragment.context=context; 35 | fragment.dishInfo=dishInfo; 36 | Bundle args = new Bundle(); 37 | fragment.setArguments(args); 38 | return fragment; 39 | } 40 | 41 | @Override 42 | public void onCreate(Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | } 45 | 46 | @Override 47 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 48 | View view = (View)inflater.inflate(R.layout.fragment_dish_info_item_list, container, false); 49 | dishNameView= (TextView) view.findViewById(R.id.dishName); 50 | dishIntroductionView= (TextView) view.findViewById(R.id.dish_introduction); 51 | dishRestaurantNameView= (TextView) view.findViewById(R.id.dish_restaurant_name); 52 | dishTasteView= (TextView) view.findViewById(R.id.dishTaste); 53 | dishAddressView= (TextView) view.findViewById(R.id.dishAddress); 54 | dishPriceView= (TextView) view.findViewById(R.id.dishPrice); 55 | return view; 56 | } 57 | 58 | @Override 59 | public void onActivityCreated(Bundle savedInstanceState) { 60 | super.onActivityCreated(savedInstanceState); 61 | updateDishInfo(); 62 | } 63 | 64 | private void updateDishInfo() { 65 | dishNameView.setText(dishInfo.getName().getTitle()); 66 | dishPriceView.setText("55"); 67 | dishAddressView.setText("北下关"); 68 | dishTasteView.setText("超辣"); 69 | dishRestaurantNameView.setText("上原饭店"); 70 | System.out.println(dishInfo.getName().getContent()); 71 | System.out.println(dishInfo.getName().getTitle()); 72 | dishIntroductionView.setText(dishInfo.getName().getContent()); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/fragment/RecommentFragment.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | import androidx.fragment.app.Fragment; 9 | 10 | import com.star.foodfans.R; 11 | import com.star.foodfans.entity.Result; 12 | 13 | 14 | /** 15 | * Created by HaPBoy on 5/18/16. 16 | */ 17 | public class RecommentFragment extends Fragment { 18 | 19 | private Result restaurantInfo; 20 | 21 | @Override 22 | public void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | } 25 | 26 | @Override 27 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 28 | View lv = (View)inflater.inflate(R.layout.fragment_recommend, container, false); 29 | return lv; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/ui/view/NonScrollGridView.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.ui.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.GridView; 6 | 7 | /** 8 | * 不可滑动的GridView 此处用于ExpandableListView + GridView 9 | */ 10 | 11 | public class NonScrollGridView extends GridView { 12 | public NonScrollGridView(Context context) { 13 | super(context); 14 | } 15 | 16 | public NonScrollGridView(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | public NonScrollGridView(Context context, AttributeSet attrs, int defStyleAttr) { 21 | super(context, attrs, defStyleAttr); 22 | } 23 | //重写此方法可设置ListView禁止滑动 24 | @Override 25 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 26 | 27 | int expandSpec = MeasureSpec.makeMeasureSpec( 28 | Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); 29 | super.onMeasure(widthMeasureSpec, expandSpec); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/util/AppConfig.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.util; 2 | 3 | import com.star.foodfans.entity.Userinfo; 4 | 5 | public class AppConfig { 6 | 7 | public static final String PROJECT_URL = "https://github.com/kelekle/food_fans"; 8 | 9 | public static final String DB_NAME = "food_fans_database"; 10 | public static final String LOGIN_STATE = "LOGIN_STATE"; 11 | 12 | public static Userinfo CURRENT_USER = null; 13 | public static final String CURRENT_EMAIL = "CURRENT_EMAIL"; 14 | public static final String CURRENT_TOKEN = "CURRENT_TOKEN"; 15 | 16 | 17 | public static final String BASE_URL = "http://192.168.0.109:8085/"; 18 | 19 | public static final String[] TAGS = {"川菜","鲁菜","粤菜","苏菜","浙菜","闽菜","湘菜","徽菜"}; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/star/foodfans/util/Session.java: -------------------------------------------------------------------------------- 1 | package com.star.foodfans.util; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | /** 7 | * Created by Akshay Raj on 7/28/2016. 8 | * Snow Corporation Inc. 9 | * www.snowcorp.org 10 | */ 11 | public class Session { 12 | SharedPreferences pref; 13 | SharedPreferences.Editor editor; 14 | Context _context; 15 | 16 | // shared pref mode 17 | int PRIVATE_MODE = 0; 18 | 19 | // Shared preferences file name 20 | private static final String PREF_NAME = "snow-intro-slider"; 21 | 22 | private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; 23 | 24 | public Session(Context context) { 25 | this._context = context; 26 | pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); 27 | editor = pref.edit(); 28 | } 29 | 30 | public void setFirstTimeLaunch(boolean isFirstTime) { 31 | editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); 32 | editor.commit(); 33 | } 34 | 35 | public boolean isFirstTimeLaunch() { 36 | return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /app/src/main/res/anim/book_cover_anim.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 18 | 19 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/anim/book_cover_rate_anim.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_left_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_left_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_right_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_right_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_up_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_up_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/color/selector_food_namecolor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/selector_search_textcolor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/selector_searchresult_textcolor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/color/selector_tab_textcolor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_login_input_ok.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_login_submit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/book_rate_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite_border_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/ic_favorite_border_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/ic_favorite_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_more_vert_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/ic_more_vert_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_faviroute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/icon_faviroute.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_unfavourite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/icon_unfavourite.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/rating_yellow_middle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/recipe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/recipe.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/save_profile_lock.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_common_click.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/setting_item_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/star_empty_middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/star_empty_middle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/star_empty_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/star_empty_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/star_full_middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/star_full_middle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/star_full_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/star_full_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/star_half_middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/star_half_middle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/star_half_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kelekle/food_fans/86392ae79b5f923ed2ab060f67d9c4a514615f14/app/src/main/res/drawable/star_half_small.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/textview_tag_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_comment.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 30 | 31 | 35 | 36 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_dish_info.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_history.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 33 | 34 | 43 | 44 | 48 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 18 | 19 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_love.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 34 | 35 | 44 | 45 | 49 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 15 | 23 | 24 | 25 | 31 | 32 |