Drew 6 жил өмнө
parent
commit
7f2516fa97

+ 2 - 2
app/build.gradle

@@ -7,8 +7,8 @@ android {
         applicationId "com.android.chmo"
         minSdkVersion 15
         targetSdkVersion 28
-        versionCode 109
-        versionName "1.0.9"
+        versionCode 110
+        versionName "1.1.0"
         ndk {
             abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
         }

BIN
app/release/app-release.apk


+ 0 - 1
app/release/output.json

@@ -1 +0,0 @@
-[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":109,"versionName":"1.0.9","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

+ 4 - 2
app/src/main/java/com/android/chmo/http/service/ModelService.java

@@ -34,12 +34,13 @@ public class ModelService {
     /**
      * 艺人列表
      */
-    public static Callback.Cancelable getModelList(String search, int pageNo, RequestCallback callback) {
+    public static Callback.Cancelable getModelList(String search, String area, int pageNo, RequestCallback callback) {
         LoginUser user = ChmoApplication.getApp().getLoginUser();
         RequestParams params = getRequestParams();
         params.addQueryStringParameter("action", "dogetQueryModel");
         params.addQueryStringParameter("LikeName", search);
         params.addQueryStringParameter("memberpk", user.pk);
+        params.addQueryStringParameter("area", area);
         params.addQueryStringParameter("index", pageNo + "");
         params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");
 
@@ -49,11 +50,12 @@ public class ModelService {
     /**
      * 推荐列表
      */
-    public static Callback.Cancelable getRecommedList(int pageNo, RequestCallback callback) {
+    public static Callback.Cancelable getRecommedList(int pageNo, String area, RequestCallback callback) {
         LoginUser user = ChmoApplication.getApp().getLoginUser();
         RequestParams params = getRequestParams();
         params.addQueryStringParameter("action", "dogetmodel");
         params.addQueryStringParameter("memberpk", user.pk);
+        params.addQueryStringParameter("area", area);
         params.addQueryStringParameter("index", pageNo + "");
         params.addQueryStringParameter("size", Constants.PAGE_SIZE + "");
 

+ 12 - 13
app/src/main/java/com/android/chmo/ui/activity/model/SearchResultActivity.java

@@ -22,7 +22,7 @@ import java.util.List;
 import butterknife.BindView;
 
 
-public class SearchResultActivity extends BaseActivity implements RefreshListView.RefreshListener{
+public class SearchResultActivity extends BaseActivity implements RefreshListView.RefreshListener {
 
     @BindView(R.id.refreshList)
     RefreshListView refreshListView;
@@ -46,9 +46,9 @@ public class SearchResultActivity extends BaseActivity implements RefreshListVie
 
     @Override
     public void initView() {
-        if(getIntent().hasExtra("search")) {
+        if (getIntent().hasExtra("search")) {
             searchText = getIntent().getStringExtra("search");
-        }else if(getIntent().hasExtra("label")) {
+        } else if (getIntent().hasExtra("label")) {
             label = (LabelInfo) getIntent().getSerializableExtra("label");
         }
 
@@ -76,28 +76,27 @@ public class SearchResultActivity extends BaseActivity implements RefreshListVie
     }
 
 
-
     private void search(final int page) {
         RequestCallback requestCallback = new RequestCallback() {
             @Override
             public void onSuccess(String result) {
                 refreshListView.finishRefresh();
                 ModelListRes res = new Gson().fromJson(result, ModelListRes.class);
-                if(res.data != null) {
-                    if(page == 1) {
+                if (res.data != null) {
+                    if (page == 1) {
                         mList.clear();
                     }
                     mList.addAll(res.data);
                     pageNo = page;
                     modelAdapter.setList(mList);
 
-                    if(res.data.size() == Constants.PAGE_SIZE) {
+                    if (res.data.size() == Constants.PAGE_SIZE) {
                         refreshListView.setEnableLoadMore(true);
-                    }else {
+                    } else {
                         refreshListView.setNoMoreData();
                     }
                 }
-                emptyView.setVisibility(mList.size() ==0 ? View.VISIBLE : View.GONE);
+                emptyView.setVisibility(mList.size() == 0 ? View.VISIBLE : View.GONE);
             }
 
             @Override
@@ -106,10 +105,10 @@ public class SearchResultActivity extends BaseActivity implements RefreshListVie
             }
         };
 
-        if(!TextUtils.isEmpty(searchText)) {
-            ModelService.getModelList(searchText,page, requestCallback);
-        }else if(label != null) {
-            ModelService.getModelByLabel(label.pk,page, requestCallback);
+        if (!TextUtils.isEmpty(searchText)) {
+            ModelService.getModelList(searchText, null, page, requestCallback);
+        } else if (label != null) {
+            ModelService.getModelByLabel(label.pk, page, requestCallback);
         }
 
     }

+ 1 - 1
app/src/main/java/com/android/chmo/ui/dialog/UpdateDialog.java

@@ -64,7 +64,7 @@ public class UpdateDialog extends Dialog {
 
     @OnClick(R.id.btn_update)
     void update() {
-        final File file = new File(getContext().getExternalCacheDir(), "update.apk");
+        final File file = new File(getContext().getExternalCacheDir(), "update" + System.currentTimeMillis() + ".apk");
         final ProgressDialog progressDialog = new ProgressDialog(getContext(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
         progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
         progressDialog.setTitle("正在下载");

+ 20 - 5
app/src/main/java/com/android/chmo/ui/fragment/HomeFragment.java

@@ -6,10 +6,12 @@ import android.support.v4.app.FragmentPagerAdapter;
 import android.support.v4.view.ViewPager;
 import android.view.View;
 import android.widget.LinearLayout;
+import android.widget.TextView;
 
 import com.android.chmo.R;
 import com.android.chmo.base.BaseFragment;
 import com.android.chmo.ui.activity.model.SearchModelActivity;
+import com.android.chmo.ui.dialog.SelectDialog;
 import com.android.chmo.ui.fragment.home.ActivitiesFragment;
 import com.android.chmo.ui.fragment.home.ActorFragment;
 import com.android.chmo.ui.fragment.home.FollowFragment;
@@ -17,6 +19,8 @@ import com.android.chmo.ui.fragment.home.RecommendFragment;
 import com.android.chmo.utils.CommonUtils;
 import com.android.chmo.utils.PixelUtils;
 
+import org.greenrobot.eventbus.EventBus;
+
 import butterknife.BindView;
 import butterknife.OnClick;
 
@@ -27,10 +31,10 @@ import static com.android.chmo.R.id.pager;
  */
 
 public class HomeFragment extends BaseFragment {
-    private final int PAGE_FOLLOW    = 0;
+    private final int PAGE_FOLLOW = 0;
     private final int PAGE_RECOMMEND = 1;
-    private final int PAGE_ACTOR     = 2;
-    private final int PAGE_ACTIVITY  = 3;
+    private final int PAGE_ACTOR = 2;
+    private final int PAGE_ACTIVITY = 3;
 
     @BindView(R.id.top)
     View topBar;
@@ -42,8 +46,8 @@ public class HomeFragment extends BaseFragment {
     View tabActor;
     @BindView(R.id.tab_activity)
     View tabActivity;
-
-
+    @BindView(R.id.tv_city)
+    TextView tvCity;
     @BindView(pager)
     ViewPager viewPager;
 
@@ -121,6 +125,17 @@ public class HomeFragment extends BaseFragment {
         viewPager.setCurrentItem(curPage, true);
     }
 
+    @OnClick(R.id.tv_city)
+    void clickCity() {
+        String[] strs = new String[]{"全国", "烟台"};
+        new SelectDialog(getContext())
+                .setItems(strs)
+                .setItemListener(pos -> {
+                    tvCity.setText(strs[pos]);
+                    EventBus.getDefault().post("chooseCity" + strs[pos]);
+                }).show();
+    }
+
     private void changeTab() {
         if (curTab != null) {
             curTab.setSelected(false);

+ 25 - 15
app/src/main/java/com/android/chmo/ui/fragment/home/ActorFragment.java

@@ -2,6 +2,7 @@ package com.android.chmo.ui.fragment.home;
 
 import android.os.Bundle;
 import android.view.View;
+import android.widget.TextView;
 
 import com.android.chmo.R;
 import com.android.chmo.base.BaseFragment;
@@ -11,6 +12,7 @@ import com.android.chmo.http.response.ModelListRes;
 import com.android.chmo.http.service.ModelService;
 import com.android.chmo.model.ModelInfo;
 import com.android.chmo.ui.adpater.ModelAdapter;
+import com.android.chmo.ui.dialog.SelectDialog;
 import com.android.chmo.ui.view.BannerView;
 import com.android.chmo.ui.view.EmptyView;
 import com.android.chmo.ui.view.RefreshListView;
@@ -24,12 +26,13 @@ import java.util.ArrayList;
 import java.util.List;
 
 import butterknife.BindView;
+import butterknife.OnClick;
 
 /**
  * Created by Administrator on 2018/7/31.
  */
 
-public class ActorFragment extends BaseFragment implements RefreshListView.RefreshListener{
+public class ActorFragment extends BaseFragment implements RefreshListView.RefreshListener {
     @BindView(R.id.refreshList)
     RefreshListView refreshListView;
 
@@ -46,6 +49,8 @@ public class ActorFragment extends BaseFragment implements RefreshListView.Refre
 
     private boolean isInit = false;
 
+    private String area = null;
+
     @Override
     public int getLayoutRes() {
         return R.layout.page_actor;
@@ -63,13 +68,20 @@ public class ActorFragment extends BaseFragment implements RefreshListView.Refre
         EventBus.getDefault().unregister(this);
     }
 
-
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void onMessageEvent(String event) {
-        if(event.equals("modelChange")) {
+        if (event.equals("modelChange")) {
+            onRefresh();
+        } else if (event.startsWith("chooseCity")) {
+            String city = event.replace("chooseCity", "");
+            if (!"全国".equals(city)) {
+                area = city;
+            } else {
+                area = null;
+            }
             onRefresh();
         }
-    };
+    }
 
     @Override
     public void initView() {
@@ -82,7 +94,7 @@ public class ActorFragment extends BaseFragment implements RefreshListView.Refre
     }
 
     private View initHeaderView() {
-        if(bannerView == null) {
+        if (bannerView == null) {
             bannerView = new BannerView(getActivity());
             bannerView.setFragmentManager(getChildFragmentManager());
             bannerView.startLoop();
@@ -92,8 +104,8 @@ public class ActorFragment extends BaseFragment implements RefreshListView.Refre
 
     @Override
     public void onVisible() {
-        if(!isInit) {
-            if(refreshListView != null) {
+        if (!isInit) {
+            if (refreshListView != null) {
                 refreshListView.autoRefresh();
             }
             isInit = true;
@@ -145,29 +157,27 @@ public class ActorFragment extends BaseFragment implements RefreshListView.Refre
 
     }
 
-
-
     private void loadModelList(final int page) {
-        ModelService.getModelList(null,page, new RequestCallback() {
+        ModelService.getModelList(null, area, page, new RequestCallback() {
             @Override
             public void onSuccess(String result) {
                 refreshListView.finishRefresh();
                 ModelListRes res = new Gson().fromJson(result, ModelListRes.class);
-                if(res.data != null) {
-                    if(page == 1) {
+                if (res.data != null) {
+                    if (page == 1) {
                         mList.clear();
                     }
                     mList.addAll(res.data);
                     pageNo = page;
                     modelAdapter.setList(mList);
 
-                    if(res.data.size() == Constants.PAGE_SIZE) {
+                    if (res.data.size() == Constants.PAGE_SIZE) {
                         refreshListView.setEnableLoadMore(true);
-                    }else {
+                    } else {
                         refreshListView.setNoMoreData();
                     }
                 }
-                emptyView.setVisibility(mList.size() ==0 ? View.VISIBLE : View.GONE);
+                emptyView.setVisibility(mList.size() == 0 ? View.VISIBLE : View.GONE);
 
             }
 

+ 20 - 11
app/src/main/java/com/android/chmo/ui/fragment/home/RecommendFragment.java

@@ -30,7 +30,7 @@ import butterknife.BindView;
  * Created by Administrator on 2018/7/31.
  */
 
-public class RecommendFragment extends BaseFragment implements RefreshListView.RefreshListener{
+public class RecommendFragment extends BaseFragment implements RefreshListView.RefreshListener {
     @BindView(R.id.refreshList)
     RefreshListView refreshListView;
 
@@ -46,7 +46,8 @@ public class RecommendFragment extends BaseFragment implements RefreshListView.R
 
     private int pageNo = 1;
 
-//    private boolean isInit = false;
+    //    private boolean isInit = false;
+    private String area = null;
 
     @Override
     public int getLayoutRes() {
@@ -68,10 +69,18 @@ public class RecommendFragment extends BaseFragment implements RefreshListView.R
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void onMessageEvent(String event) {
-        if(event.equals("modelChange")) {
+        if (event.equals("modelChange")) {
+            onRefresh();
+        } else if (event.startsWith("chooseCity")) {
+            String city = event.replace("chooseCity", "");
+            if (!"全国".equals(city)) {
+                area = city;
+            } else {
+                area = null;
+            }
             onRefresh();
         }
-    };
+    }
 
     @Override
     public void initView() {
@@ -117,7 +126,7 @@ public class RecommendFragment extends BaseFragment implements RefreshListView.R
 
 
     private View initHeaderView() {
-        if(bannerView == null) {
+        if (bannerView == null) {
             bannerView = new BannerView(getActivity());
             bannerView.setFragmentManager(getChildFragmentManager());
             bannerView.startLoop();
@@ -145,26 +154,26 @@ public class RecommendFragment extends BaseFragment implements RefreshListView.R
 
     private void loadRecommendList(final int page) {
         String pk = ChmoApplication.getApp().getLoginUser().pk;
-        ModelService.getRecommedList(page, new RequestCallback() {
+        ModelService.getRecommedList(page, area, new RequestCallback() {
             @Override
             public void onSuccess(String result) {
                 refreshListView.finishRefresh();
                 ModelListRes res = new Gson().fromJson(result, ModelListRes.class);
-                if(res.data != null) {
-                    if(page == 1) {
+                if (res.data != null) {
+                    if (page == 1) {
                         mList.clear();
                     }
                     mList.addAll(res.data);
                     pageNo = page;
                     modelAdapter.setList(mList);
 
-                    if(res.data.size() == Constants.PAGE_SIZE) {
+                    if (res.data.size() == Constants.PAGE_SIZE) {
                         refreshListView.setEnableLoadMore(true);
-                    }else {
+                    } else {
                         refreshListView.setNoMoreData();
                     }
                 }
-                emptyView.setVisibility(mList.size() ==0 ? View.VISIBLE : View.GONE);
+                emptyView.setVisibility(mList.size() == 0 ? View.VISIBLE : View.GONE);
             }
 
             @Override

+ 23 - 21
app/src/main/res/layout/activity_search_model.xml

@@ -1,36 +1,37 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/bg">
+    android:background="@color/white"
+    android:orientation="vertical">
+
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@color/white"
         android:orientation="horizontal"
-        android:paddingTop="35dp"
-        android:paddingBottom="10dp"
         android:paddingLeft="20dp"
-        android:paddingRight="20dp">
+        android:paddingTop="35dp"
+        android:paddingRight="20dp"
+        android:paddingBottom="10dp">
 
         <EditText
             android:id="@+id/searchEdit"
             android:layout_width="0dp"
             android:layout_height="40dp"
             android:layout_weight="1"
-            android:paddingLeft="15dp"
-            android:paddingRight="15dp"
-            android:maxLines="1"
+            android:background="@drawable/top_search_bg"
+            android:cursorVisible="true"
+            android:hint="输入艺人信息"
             android:imeOptions="actionSearch"
             android:inputType="text"
-            android:hint="输入艺人信息"
+            android:maxLines="1"
+            android:paddingLeft="15dp"
+            android:paddingRight="15dp"
+            android:textColor="@color/black"
             android:textColorHint="@color/hint_color"
-            android:background="@drawable/top_search_bg"
-            android:cursorVisible="true"
             android:textCursorDrawable="@drawable/edit_cursor"
-            android:textSize="15sp"
-            android:textColor="@color/black"/>
+            android:textSize="15sp" />
 
         <TextView
             android:id="@+id/cancel"
@@ -38,34 +39,35 @@
             android:layout_height="wrap_content"
             android:layout_marginLeft="10dp"
             android:padding="10dp"
+            android:text="取消"
             android:textColor="@color/black"
-            android:textSize="15sp"
-            android:text="取消"/>
+            android:textSize="15sp" />
     </LinearLayout>
-    <View style="@style/line"/>
+
+    <View style="@style/line" />
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:orientation="vertical"
         android:background="@color/white"
+        android:orientation="vertical"
         android:padding="15dp">
 
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginBottom="15dp"
+            android:text="标签快搜"
             android:textColor="@color/black"
-            android:textSize="14sp"
-            android:text="标签快搜"/>
+            android:textSize="14sp" />
 
         <GridView
             android:id="@+id/gridview"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:numColumns="3"
             android:horizontalSpacing="30dp"
-            android:verticalSpacing="15dp"/>
+            android:numColumns="3"
+            android:verticalSpacing="15dp" />
     </LinearLayout>
 
 </LinearLayout>

+ 6 - 5
app/src/main/res/layout/page_actor.xml

@@ -1,17 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
     <com.android.chmo.ui.view.EmptyView
         android:id="@+id/empty"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        app:empty="暂无艺人"/>
+        app:empty="暂无艺人" />
+
     <com.android.chmo.ui.view.RefreshListView
         android:id="@+id/refreshList"
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
-    </com.android.chmo.ui.view.RefreshListView>
+        android:layout_height="match_parent" />
 </FrameLayout>

+ 29 - 19
app/src/main/res/layout/page_home.xml

@@ -1,19 +1,25 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
     <LinearLayout
         android:id="@+id/top"
         android:layout_width="match_parent"
         android:layout_height="@dimen/top_bar_height"
-        android:orientation="horizontal"
+        android:background="@color/white"
         android:gravity="center_vertical"
-        android:background="@color/white">
-        <View
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/tv_city"
             android:layout_width="50dp"
-            android:layout_height="wrap_content"/>
+            android:layout_height="match_parent"
+            android:gravity="center"
+            android:text="全国"
+            android:textColor="#999999" />
 
         <LinearLayout
             android:layout_width="0dp"
@@ -23,41 +29,45 @@
             <LinearLayout
                 android:id="@+id/tab_follow"
                 style="@style/Tab">
+
                 <TextView
                     style="@style/TopTabFont"
-                    android:text="关注"/>
-                <View
-                    style="@style/TopTabLine"/>
+                    android:text="关注" />
+
+                <View style="@style/TopTabLine" />
             </LinearLayout>
 
             <LinearLayout
                 android:id="@+id/tab_recommend"
                 style="@style/Tab">
+
                 <TextView
                     style="@style/TopTabFont"
-                    android:text="推荐"/>
-                <View
-                    style="@style/TopTabLine"/>
+                    android:text="推荐" />
+
+                <View style="@style/TopTabLine" />
             </LinearLayout>
 
             <LinearLayout
                 android:id="@+id/tab_actor"
                 style="@style/Tab">
+
                 <TextView
                     style="@style/TopTabFont"
-                    android:text="艺人"/>
-                <View
-                    style="@style/TopTabLine"/>
+                    android:text="艺人" />
+
+                <View style="@style/TopTabLine" />
             </LinearLayout>
 
             <LinearLayout
                 android:id="@+id/tab_activity"
                 style="@style/Tab">
+
                 <TextView
                     style="@style/TopTabFont"
-                    android:text="活动"/>
-                <View
-                    style="@style/TopTabLine"/>
+                    android:text="活动" />
+
+                <View style="@style/TopTabLine" />
             </LinearLayout>
 
         </LinearLayout>
@@ -74,5 +84,5 @@
     <android.support.v4.view.ViewPager
         android:id="@+id/pager"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"/>
+        android:layout_height="match_parent" />
 </LinearLayout>

BIN
app/src/main/res/mipmap-hdpi/img_qidong.png


BIN
app/src/main/res/mipmap-xhdpi/img_qidong.png


BIN
app/src/main/res/mipmap-xxhdpi/img_qidong.png


BIN
app/src/main/res/mipmap-xxxhdpi/img_qidong.png