Bläddra i källkod

season 2 game center

hanjing 7 år sedan
förälder
incheckning
a241361e61

+ 1 - 0
app/build.gradle

@@ -457,6 +457,7 @@ dependencies {
 
     //是否需要ExoPlayer模式
     implementation 'com.shuyu:GSYVideoPlayer-exo2:6.0.2'
+    implementation 'com.makeramen:roundedimageview:2.3.0'
 
     //https://github.com/koral--/android-gif-drawable
     implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'

+ 11 - 4
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameCenter.java

@@ -7,7 +7,9 @@ import android.view.KeyEvent;
 import android.view.View;
 import android.widget.Button;
 import android.widget.ImageButton;
+import android.widget.ImageView;
 
+import com.sheep.gamegroup.model.entity.ArticleTag;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.WebParams;
@@ -19,6 +21,9 @@ import com.sheep.gamegroup.util.KeyEventUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
+import com.sheep.gamegroup.view.fragment.FgtFindChild;
+import com.sheep.gamegroup.view.fragment.FgtGameMall;
+import com.sheep.gamegroup.view.fragment.FgtWelfareCenter;
 import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -53,11 +58,11 @@ public class FgtGameCenter extends BaseFragment {
     @BindView(R.id.pager)
     ViewPager pager;
     @BindView(R.id.back_btn)
-    ImageButton backBtn;
+    ImageView backBtn;
     @BindView(R.id.download_btn)
-    ImageButton downloadBtn;
+    ImageView downloadBtn;
     @BindView(R.id.search_btn)
-    ImageButton searchBtn;
+    ImageView searchBtn;
     @BindView(R.id.my_walfare_btn)
     Button myWalfareBtn;
     @BindView(R.id.fgt_gc_hb_500_yuan_drl)
@@ -69,7 +74,9 @@ public class FgtGameCenter extends BaseFragment {
         backBtn.setVisibility((getActivity() instanceof ActMain) ? View.GONE : View.VISIBLE);
         TitleFragmentListAdapter mAdapter = new TitleFragmentListAdapter(getChildFragmentManager());
         mAdapter.add(new FgtPlayGame(), "玩转游戏");
-        mAdapter.add(new com.sheep.gamegroup.view.fragment.FgtGiftCenter(), "礼包中心");
+        mAdapter.add(new FgtWelfareCenter(), "福利中心");
+        mAdapter.add(FgtFindChild.newInstance(new ArticleTag(3, "游戏资讯")), "游戏资讯");
+        mAdapter.add(new FgtGameMall(), "福利商城");
         pager.setAdapter(mAdapter);
         indicator.setupWithViewPager(pager);
         CommonUtil.getInstance().reflex(indicator, getActivity(), false, G.WIDTH - G.getRealPix(144));

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtPlayGame.java

@@ -22,6 +22,7 @@ import com.sheep.gamegroup.module.game.adapter.AdpGameCenter4_3List;
 import com.sheep.gamegroup.module.game.adapter.AdpGameCenterType;
 import com.sheep.gamegroup.module.game.model.GameCenterType;
 import com.sheep.gamegroup.module.game.model.GamePortTypes;
+import com.sheep.gamegroup.module.game.util.FocusGameHelper;
 import com.sheep.gamegroup.module.game.util.HpRefreshWelfareHelper;
 import com.sheep.gamegroup.module.game.util.OneTaskHelper;
 import com.sheep.gamegroup.module.game.util.PromoteGoodsHelper;
@@ -95,6 +96,8 @@ public class FgtPlayGame extends BaseFragment {
     //单个任务的入口与刷新任务
     @BindView(R.id.play_game_task)
     View play_game_task;
+    @BindView(R.id.play_game_focus)
+    View play_game_focus;
     private OneTaskHelper mOneTaskHelper;//的帮助类
     //商品限时抢购入口与刷新商品
     @BindView(R.id.play_game_promote_goods)
@@ -111,6 +114,7 @@ public class FgtPlayGame extends BaseFragment {
         mHpRefreshWelfareHelper = new HpRefreshWelfareHelper(hp_refresh_welfare_box);
         //玩转游戏  商城限时抢购入口
         mOneTaskHelper = new OneTaskHelper(play_game_task);
+        new FocusGameHelper(play_game_focus).config();
         //玩转游戏  商城限时抢购入口
         mPromoteGoodsHelper = new PromoteGoodsHelper(play_game_promote_goods);
 

+ 86 - 0
app/src/main/java/com/sheep/gamegroup/module/game/util/FocusGameHelper.java

@@ -0,0 +1,86 @@
+package com.sheep.gamegroup.module.game.util;
+
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.bumptech.glide.Glide;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.G;
+import com.youth.banner.loader.ImageLoader;
+
+import org.afinal.simplecache.ApiKey;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+public class FocusGameHelper {
+
+    private View rootView;
+
+    private GameEntity gameEntity;
+
+    @BindView(R.id.item_focus_icon_iv)
+    public ImageView iconView;
+    @BindView(R.id.item_focus_name_tv)
+    public TextView titleView;
+    @BindView(R.id.item_focus_num_tv)
+    public TextView tagView1;
+    @BindView(R.id.item_focus_num_tv1)
+    public TextView tagView2;
+    @BindView(R.id.item_focus_num_tv2)
+    public TextView tagView3;
+    @BindView(R.id.item_focus_size_tv)
+    public TextView sizeView;
+
+    public FocusGameHelper(View rootView) {
+        this.rootView = rootView;
+    }
+
+    public void config() {
+        ButterKnife.bind(this, rootView);
+        loadData();
+    }
+
+    private void loadData() {
+        SheepApp.getInstance().getNetComponent().getApiService().playGameDetail(178)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        gameEntity = baseMessage.getData(GameEntity.class);
+                        bindData();
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        G.showToast(baseMessage);
+                    }
+                });
+    }
+
+    private void bindData() {
+        ViewUtil.setText(titleView, gameEntity.getApp().getName());
+        ViewUtil.setText(sizeView, gameEntity.getApp().getPackage_size());
+        TextView[] tagViews = {tagView1, tagView2, tagView3};
+        for (int i = 0; i < tagViews.length && i < gameEntity.getApp().getTags().size(); i++) {
+            ViewUtil.setText(tagViews[i], gameEntity.getApp().getTags().get(i).getName());
+        }
+        ViewUtil.setGameImage(iconView, gameEntity.getApp().getIcon());
+    }
+
+    @OnClick(R.id.item_focus_btn_tv)
+    public void doDownload(View v) {
+
+    }
+}

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFindChild.java

@@ -312,6 +312,8 @@ public class FgtFindChild extends BaseListFragment5<Article> {
         @Override
         public int getViewIdByType(int type) {//type来源于 getItemViewType 返回的值
             if (type == 2 && newsConverter != null) {
+//                return R.layout.find_item_game_news;
+                //todo
                 return R.layout.find_item_news;
             }
             return R.layout.find_item;

+ 30 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGameMall.java

@@ -0,0 +1,30 @@
+package com.sheep.gamegroup.view.fragment;
+
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.sheep.jiuyan.samllsheep.R;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class FgtGameMall extends Fragment {
+
+
+    public FgtGameMall() {
+        // Required empty public constructor
+    }
+
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
+        // Inflate the layout for this fragment
+        return inflater.inflate(R.layout.fgt_game_mall, container, false);
+    }
+
+}

+ 9 - 0
app/src/main/res/drawable/shape_red_stroke_rectangle_3_radius.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners
+        android:radius="3dp"/>
+    <stroke
+        android:width="1dp"
+        android:color="#FD2D54" />
+</shape>

+ 12 - 15
app/src/main/res/layout/fgt_game_center.xml

@@ -2,6 +2,7 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:background="@color/bg">
 
     <ImageView
@@ -15,14 +16,12 @@
         android:id="@+id/top_bar"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:background="@color/bg_home_color"
-        android:paddingTop="20dp">
+        android:layout_marginTop="20dp">
 
-        <ImageButton
+        <ImageView
             android:id="@+id/back_btn"
             android:layout_width="@dimen/content_padding_36"
             android:layout_height="@dimen/content_padding_36"
-            android:background="@android:color/transparent"
             android:scaleType="centerInside"
             android:src="@drawable/narrow_back_black"
             android:visibility="gone" />
@@ -30,30 +29,28 @@
         <android.support.design.widget.TabLayout
             android:id="@+id/indicator"
             style="@style/style_tab_2"
-            android:layout_width="wrap_content"
-            android:layout_centerInParent="true" />
+            android:layout_marginLeft="@dimen/content_padding_36"
+            android:layout_marginRight="@dimen/content_padding_36"
+            app:tabGravity="fill"
+            app:tabMode="fixed"/>
 
-        <ImageButton
+        <ImageView
             android:id="@+id/download_btn"
             android:layout_width="@dimen/content_padding_36"
             android:layout_height="@dimen/content_padding_36"
+            android:padding="8dp"
             android:layout_alignParentEnd="true"
             android:layout_centerVertical="true"
-            android:background="@android:color/transparent"
             android:gravity="center"
-            android:minWidth="?attr/actionBarSize"
             android:src="@drawable/drawable_selector_ic_home_download" />
 
-        <ImageButton
+        <ImageView
             android:id="@+id/search_btn"
             android:layout_width="@dimen/content_padding_36"
             android:layout_height="@dimen/content_padding_36"
-            android:layout_alignParentEnd="true"
+            android:padding="8dp"
             android:layout_centerVertical="true"
-            android:layout_marginEnd="@dimen/content_padding_36"
-            android:background="@android:color/transparent"
             android:gravity="center"
-            android:minWidth="?attr/actionBarSize"
             android:src="@drawable/drawable_selector_ic_home_search" />
 
         <Button
@@ -63,7 +60,7 @@
             android:layout_height="@dimen/content_padding_36"
             android:layout_alignParentTop="true"
             android:layout_alignParentEnd="true"
-            android:background="@color/translate"
+            android:background="@null"
             android:gravity="center_vertical|end"
             android:lines="1"
             android:paddingStart="17dp"

+ 12 - 0
app/src/main/res/layout/fgt_game_mall.xml

@@ -0,0 +1,12 @@
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <!-- TODO: Update blank fragment layout -->
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:text="@string/hello_blank_fragment" />
+
+</FrameLayout>

+ 14 - 6
app/src/main/res/layout/fgt_play_game.xml

@@ -21,20 +21,28 @@
 
             <include layout="@layout/homepage_item_banner" />
 
+            <include
+                android:id="@+id/play_game_focus"
+                layout="@layout/item_game_focus" />
+
+            <include
+                android:id="@+id/play_game_news"
+                layout="@layout/item_game_news" />
+
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/play_game_center_type_list"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginStart="2dp"
+                android:layout_marginBottom="10dp"
                 android:layout_marginEnd="2dp"
-                android:layout_marginBottom="10dp"/>
+                android:layout_marginStart="2dp" />
 
             <include
                 android:id="@+id/hp_refresh_welfare_box"
+                layout="@layout/inclue_hp_refresh_welfare_box"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:visibility="gone"
-                layout="@layout/inclue_hp_refresh_welfare_box" />
+                android:visibility="gone" />
 
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/play_game_act"
@@ -53,7 +61,7 @@
 
             <include
                 android:id="@+id/play_game_task"
-                layout="@layout/item_game_task"/>
+                layout="@layout/item_game_task" />
 
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/play_game_list_2_rv2"
@@ -62,7 +70,7 @@
 
             <include
                 android:id="@+id/play_game_promote_goods"
-                layout="@layout/item_game_promote_goods"/>
+                layout="@layout/item_game_promote_goods" />
 
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/play_game_list_x_rv"

+ 60 - 0
app/src/main/res/layout/find_item_game_news.xml

@@ -0,0 +1,60 @@
+<?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:id="@+id/find_item_container"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:layout_marginBottom="12dp"
+    android:paddingTop="16dp">
+
+    <TextView
+        android:id="@+id/find_item_name"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dp"
+        android:layout_marginRight="16dp"
+        android:ellipsize="end"
+        android:lines="1"
+        android:text="abcab"
+        android:textColor="@color/black_6_3"
+        android:textSize="15sp" />
+    <TextView
+        android:id="@+id/find_item_des"
+        android:layout_marginTop="6dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginRight="16dp"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textColor="#9B9B9B"
+        android:textSize="12sp" />
+
+    <com.makeramen.roundedimageview.RoundedImageView
+        android:id="@+id/find_item_iv"
+        android:layout_width="match_parent"
+        android:layout_height="120dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginRight="16dp"
+        android:adjustViewBounds="true"
+        android:layout_marginTop="4dp"
+        android:scaleType="centerCrop"
+        android:src="@mipmap/icon"
+        app:riv_corner_radius="5dp"/>
+
+    <TextView
+        android:id="@+id/find_item_time"
+        android:layout_marginTop="4dp"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="16dp"
+        android:layout_marginRight="16dp"
+        android:layout_marginBottom="16dp"
+        android:text="@string/app_name"
+        android:textColor="#9B9B9B"
+        android:textSize="11sp" />
+
+    <View
+        android:background="@color/gray_F0F0F0"
+        android:layout_width="match_parent"
+        android:layout_height="8dp"/>
+</LinearLayout>

+ 129 - 0
app/src/main/res/layout/item_game_focus.xml

@@ -0,0 +1,129 @@
+<?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="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:orientation="vertical">
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="10dp"
+        android:background="@color/bg_home_color"/>
+    <!--<include layout="@layout/hp_game_welfare_entrance"/>-->
+    <TextView
+        android:id="@+id/hp_focus_tv1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:background="@drawable/shape_solid_ffcad7_radius_4"
+        android:paddingStart="5dp"
+        android:paddingTop="4dp"
+        android:paddingEnd="5dp"
+        android:paddingBottom="4dp"
+        android:text="今日焦点"
+        android:textColor="#F02155"
+        android:textSize="13sp" />
+
+    <android.support.constraint.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <ImageView
+            android:id="@+id/item_focus_icon_iv"
+            android:layout_width="63dp"
+            android:layout_height="63dp"
+            android:layout_marginStart="16dp"
+            android:layout_marginTop="6dp"
+            android:layout_marginBottom="11dp"
+            android:src="@mipmap/sheep_logo"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/item_focus_name_tv"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="11dp"
+            android:layout_marginTop="10dp"
+            android:layout_marginEnd="94dp"
+            android:ellipsize="end"
+            android:singleLine="true"
+            android:text="永恒仙域"
+            android:textColor="#ff333333"
+            android:textSize="14sp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@id/item_focus_icon_iv"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <LinearLayout
+            android:id="@+id/item_focus_game_tags"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:orientation="horizontal"
+            android:layout_marginTop="5dp"
+            app:layout_constraintTop_toBottomOf="@+id/item_focus_name_tv"
+            app:layout_constraintEnd_toEndOf="@id/item_focus_name_tv"
+            app:layout_constraintStart_toStartOf="@id/item_focus_name_tv" >
+
+
+            <TextView
+                android:id="@+id/item_focus_num_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@drawable/shape_red_stroke_rectangle_3_radius"
+                android:padding="2dp"
+                android:textColor="#cc8e8e8e"
+                android:textSize="10sp" />
+
+            <TextView
+                android:id="@+id/item_focus_num_tv1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/content_padding"
+                android:background="@drawable/shape_red_stroke_rectangle_3_radius"
+                android:padding="2dp"
+                android:singleLine="true"
+                android:text=""
+                android:textColor="#cc8e8e8e"
+                android:textSize="10sp"
+                android:visibility="gone" />
+
+            <TextView
+                android:id="@+id/item_focus_num_tv2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@drawable/shape_red_stroke_rectangle_3_radius"
+                android:padding="2dp"
+                android:layout_marginStart="@dimen/content_padding"
+                android:singleLine="true"
+                android:text=""
+                android:textColor="#cc8e8e8e"
+                android:textSize="10sp"
+                android:visibility="gone" />
+        </LinearLayout>
+
+        <TextView
+            android:id="@+id/item_focus_size_tv"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="10dp"
+            android:singleLine="true"
+            android:text="截止时间:2018/04/30 23:59"
+            android:textColor="#ff8e8e8e"
+            android:textSize="10sp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="@id/item_focus_name_tv"
+            app:layout_constraintStart_toStartOf="@id/item_focus_name_tv" />
+
+        <TextView
+            android:id="@+id/item_focus_btn_tv"
+            style="@style/style_button_find"
+            android:layout_marginEnd="17dp"
+            android:layout_marginBottom="10dp"
+            android:text="去下载"
+            android:textSize="13sp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent" />
+    </android.support.constraint.ConstraintLayout>
+</LinearLayout>

+ 13 - 0
app/src/main/res/layout/item_game_news.xml

@@ -0,0 +1,13 @@
+<?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="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:orientation="vertical">
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="10dp"
+        android:background="@color/bg_home_color"/>
+
+
+</LinearLayout>

+ 1 - 0
app/src/main/res/values/dd_styles.xml

@@ -407,6 +407,7 @@
         <item name="tabMode">scrollable</item>
         <item name="tabTextAppearance">@style/SheepTabLayoutTextAppearance2</item>
         <item name="tabSelectedTextColor">#2ebef2</item>
+        <item name="tabTextColor">@android:color/darker_gray</item>
     </style>
 
     <style name="style_tab_askgetmoney">

+ 4 - 1
app/src/main/res/values/strings.xml

@@ -101,7 +101,7 @@
     <string name="success_copy_inv_code">复制邀请码成功</string>
     <string name="success_copy_code">复制礼包码成功</string>
     <string name="plus_x_yuan">+%s元</string>
-    <string formatted="false" name="sheep_order_no">小绵羊-%s-订单编号(%s)</string>
+    <string name="sheep_order_no" formatted="false">小绵羊-%s-订单编号(%s)</string>
     <string name="gift_bag_code">礼包码:%s</string>
 
     <string name="change_login_ing">登录授权中&#8230;</string>
@@ -227,4 +227,7 @@
     <string name="to_exchange">去兑换</string>
 
     <string name="app_name_yf">有范商城</string>
+
+    <!-- TODO: Remove or change this placeholder text -->
+    <string name="hello_blank_fragment">Hello blank fragment</string>
 </resources>