ソースを参照

添加vip界面并提交代码

zengjiebin 7 年 前
コミット
2a5bef6a6d

+ 4 - 0
app/src/main/AndroidManifest.xml

@@ -891,6 +891,10 @@
             android:name="com.sheep.gamegroup.module.login.ReLoginNameAct"
             android:screenOrientation="portrait"
             android:theme="@style/AppActionTheme"></activity>
+        <activity
+            android:name="com.sheep.gamegroup.module.user.activity.ActVip"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppActionTheme"/>
     </application>
 
 </manifest>

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -1585,5 +1585,14 @@ public interface ApiService {
     @GET("app/yf_shop/receive_coupons/check")
     Observable<BaseMessage> getYfShopReceiveCouponsCheck(@Query("type") int type);
 //---------------------------end 商城相关-------------------------------------
+//---------------------------start 小绵羊3.4.7新增 -- vip相关-------------------------------------
+    /**
+     * 用户充值vip
+     * level:	integer ($int32) 1:VIP
+     * pay_type:	integer ($int32) 支付方式 1:支付宝 2:微信
+     */
+    @POST("app/user/buy_vip")
+    Observable<BaseMessage> postBuyVip(@Body JSONObject jsonObject);
+//---------------------------end 小绵羊3.4.7新增 -- vip相关-------------------------------------
 
 }

+ 67 - 0
app/src/main/java/com/sheep/gamegroup/module/user/activity/ActVip.java

@@ -0,0 +1,67 @@
+package com.sheep.gamegroup.module.user.activity;
+
+import android.support.v4.content.ContextCompat;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.LinearLayout;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.module.user.model.BuyVipReq;
+import com.sheep.jiuyan.samllsheep.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+
+/**
+ * Created by realicing on 2018/12/25.
+ * realicing@sina.com
+ *
+ * vip介绍界面
+ */
+public class ActVip extends BaseActivity {
+    @BindView(R.id.recyclerView)
+    RecyclerView recyclerView;
+    @Override
+    protected int getLayoutId() {
+        return R.layout.act_vip;
+    }
+
+    private List<BuyVipReq> list = new ArrayList<>();
+    @Override
+    public void initView() {
+        recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
+        BaseQuickAdapter<BuyVipReq, BaseViewHolder> adapter = new BaseQuickAdapter<BuyVipReq, BaseViewHolder>(R.layout.rechargeprice_gridview_item, list) {
+            @Override
+            protected void convert(BaseViewHolder helper, BuyVipReq item) {
+                int position = helper.getAdapterPosition();
+//                if (priceShow.isSelectState()){
+//                    convertView.setBackground(context.getResources().getDrawable(R.drawable.layer_list_check_rectgangle_small));
+//                    holder.item_tv_y.setTextColor(ContextCompat.getColor(context,R.color.main_tab_activated));
+//                }else{
+//                    convertView.setBackground(context.getResources().getDrawable(R.drawable.btn_main_stroke_no_check_small));
+//                    holder.item_tv_y.setTextColor(ContextCompat.getColor(context,R.color.main_tab));
+//                }
+            }
+        };
+        adapter.bindToRecyclerView(recyclerView);
+        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
+                if(curPosition != position){
+                    curPosition = position;
+                    adapter.notifyDataSetChanged();
+                }
+            }
+        });
+    }
+    private int curPosition = 0;
+
+    public void onClickPay(View view) {
+
+    }
+}

+ 41 - 0
app/src/main/java/com/sheep/gamegroup/module/user/model/BuyVipReq.java

@@ -0,0 +1,41 @@
+package com.sheep.gamegroup.module.user.model;
+
+/**
+ * Created by realicing on 2018/12/25.
+ * realicing@sina.com
+ * 用户充值vip 参数
+ * <p>
+ * level:	integer ($int32)
+ * 1:VIP
+ * pay_type:	integer ($int32)
+ * 支付方式 1:支付宝 2:微信
+ */
+public class BuyVipReq {
+    private int level;
+    private int pay_type;
+    private String pay_name;
+
+    public int getLevel() {
+        return level;
+    }
+
+    public void setLevel(int level) {
+        this.level = level;
+    }
+
+    public int getPay_type() {
+        return pay_type;
+    }
+
+    public void setPay_type(int pay_type) {
+        this.pay_type = pay_type;
+    }
+
+    public String getPay_name() {
+        return pay_name;
+    }
+
+    public void setPay_name(String pay_name) {
+        this.pay_name = pay_name;
+    }
+}

+ 20 - 0
app/src/main/java/com/sheep/gamegroup/module/user/model/TempUserResp.java

@@ -0,0 +1,20 @@
+package com.sheep.gamegroup.module.user.model;
+
+/**
+ * Created by realicing on 2018/12/25.
+ * realicing@sina.com
+ * 用户充值vip结果
+ *
+ * token:	string 临时用户token
+ */
+public class TempUserResp {
+    private String token;// 临时用户token
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+}

+ 28 - 0
app/src/main/java/com/sheep/gamegroup/util/ApiJSONUtil.java

@@ -84,4 +84,32 @@ public class ApiJSONUtil {
                 .observeOn(AndroidSchedulers.mainThread());
 
     }
+
+
+    public static final int PAY_TYPE_ALIPAY = 1;//支付方式 1:支付宝
+    public static final int PAY_TYPE_WX = 2;//支付方式 2:微信
+
+//    @IntDef({PAY_TYPE_ALIPAY, PAY_TYPE_WX})
+//    @Retention(RetentionPolicy.SOURCE)
+//    public  @interface PAY_TYPE {
+//    }
+
+    /**
+     * 用户充值vip
+     * <p>
+     * 返回结果
+     * TempUserResp result = baseMessage.getData(TempUserResp.class);
+     *
+     * @param level:    integer ($int32) 1:VIP
+     * @param pay_type: integer ($int32) 支付方式 1:支付宝 2:微信
+     */
+    public static Observable<BaseMessage> postBuyVip(int level, float pay_type) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("level", level);
+        jsonObject.put("pay_type", pay_type);
+        return SheepApp.getInstance().getNetComponent().getApiService().postBuyVip(jsonObject)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread());
+
+    }
 }

+ 2 - 5
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -68,6 +68,7 @@ import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
+import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.service.AutoCheckService;
@@ -562,10 +563,6 @@ public class CommonUtil {
         }
     }
 
-    //以龙猫开头的则认为是龙猫app
-    public static final String LONG_MAO_APP_NAME = "龙猫";
-    public static final String LONG_MAO_APP_PACKAGE_NAME = "com.cfyl.galesaur.guess";
-    public static final String LONG_MAO_APP_URI = "guess://longmao";
 
     /**
      * 尝试跳转到龙猫竞猜
@@ -575,7 +572,7 @@ public class CommonUtil {
      * @return 判断到已经安装,返回false
      */
     private boolean checkLongMao(Activity activity, IJump jump) {
-        if (jump.getTitle() != null && jump.getTitle().startsWith(LONG_MAO_APP_NAME) && PackageUtil.isAppInstalled(SheepApp.getInstance(), LONG_MAO_APP_PACKAGE_NAME)) {
+        if (jump.getTitle() != null && jump.getTitle().startsWith(Config.LONG_MAO_APP_NAME) && PackageUtil.isAppInstalled(SheepApp.getInstance(), Config.LONG_MAO_APP_PACKAGE_NAME)) {
             return !Jump2View.getInstance().gotoLongMao(activity);
         }
         return true;

+ 10 - 10
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -52,6 +52,7 @@ import com.sheep.gamegroup.module.login.ChangePasswordAct;
 import com.sheep.gamegroup.module.login.LoginAct;
 import com.sheep.gamegroup.module.plugin.model.Plugin;
 import com.sheep.gamegroup.module.plugin.util.SheepPluginUtil;
+import com.sheep.gamegroup.module.user.activity.ActVip;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsCheckResq;
 import com.sheep.gamegroup.util.share.ShareLinkConfig;
 import com.sheep.gamegroup.view.activity.ActApprenticeRedPacket;
@@ -144,6 +145,7 @@ import com.sheep.gamegroup.view.activity.WithdrawalResultAct;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTask1;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskRegisterSuccess;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
+import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.service.AutoCheckService;
@@ -168,7 +170,6 @@ import java.util.List;
 import java.util.Locale;
 
 import io.reactivex.Observable;
-import io.reactivex.ObservableEmitter;
 import io.reactivex.ObservableOnSubscribe;
 import io.reactivex.ObservableSource;
 import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -178,8 +179,6 @@ import me.iwf.photopicker.PhotoPicker;
 import me.iwf.photopicker.PhotoPreview;
 import rx.functions.Action1;
 
-import static com.sheep.gamegroup.util.CommonUtil.LONG_MAO_APP_PACKAGE_NAME;
-import static com.sheep.gamegroup.util.CommonUtil.LONG_MAO_APP_URI;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.ASK_MAKE_MONEY_INVITATION;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_ITEM;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.GAME_DOWNLOAD_WELFARE_LIST;
@@ -2496,23 +2495,24 @@ public class Jump2View {
     }
 
     /**
-     * 跳转VIP介绍界面
+     * 小绵羊3.4.7新增 -- 跳转VIP介绍界面
      * @param activity
      */
     public void goActVip(Activity activity) {
-
+        Intent intent = new Intent(activity, ActVip.class);
+        activity.startActivity(intent);
     }
 
     /**
-     * 跳转龙猫界面
+     * 小绵羊3.4.7新增 -- 跳转龙猫界面
      * @param activity
      */
     public boolean gotoLongMao(Activity activity) {
         try {
-            PackageUtil.startApp(SheepApp.getInstance(), LONG_MAO_APP_PACKAGE_NAME);
+            PackageUtil.startApp(SheepApp.getInstance(), Config.LONG_MAO_APP_PACKAGE_NAME);
         } catch (Exception ignore) {
             try {
-                Intent intent = Intent.parseUri(LONG_MAO_APP_URI, Intent.URI_INTENT_SCHEME);
+                Intent intent = Intent.parseUri(Config.LONG_MAO_APP_URI, Intent.URI_INTENT_SCHEME);
                 intent.setComponent(null);
                 activity.startActivity(intent);
             } catch (Exception ignore2) {
@@ -2523,10 +2523,10 @@ public class Jump2View {
     }
 
     /**
-     * 跳转商城优惠购物界面
+     * 小绵羊3.4.7新增 -- 跳转商城优惠购物界面
      * @param activity
      */
     public void gotoYfShop(Activity activity) {
-
+        goWeb(activity, Config.YF_SHOP_HOME, Config.YF_SHOP_NAME);
     }
 }

+ 10 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java

@@ -11,4 +11,14 @@ public class Config {
     public static int getGameOrTaskOrGiftLayoutId() {
         return USE_CHRISTMAS_THEME ? R.layout.christmas_dialog_game_or_task_or_gift : R.layout.dialog_game_or_task_or_gift;
     }
+
+    //有范商城
+    public final static String YF_SHOP_NAME = "有范商城";
+    public final static String YF_SHOP_HOME = "http://shop.17xmy.com/mobile/";//有范商城主页地址
+
+
+    //以龙猫开头的则认为是龙猫app
+    public static final String LONG_MAO_APP_NAME = "龙猫";
+    public static final String LONG_MAO_APP_PACKAGE_NAME = "com.cfyl.galesaur.guess";
+    public static final String LONG_MAO_APP_URI = "guess://longmao";
 }

+ 35 - 0
app/src/main/res/layout/act_vip.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:orientation="vertical"
+    tools:context="com.sheep.gamegroup.module.user.activity.ActVip">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/content_padding_10"
+        android:layout_marginBottom="10dp"
+        android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+        android:orientation="vertical"
+        android:padding="@dimen/content_padding_13">
+
+        <TextView
+            style="@style/txt_style_15"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="支付方式" />
+
+        <android.support.v7.widget.RecyclerView
+            android:id="@+id/recyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+    </LinearLayout>
+
+    <TextView
+        style="@style/style_button"
+        android:onClick="onClickPay"
+        android:text="立即支付" />
+
+</LinearLayout>