Ver código fonte

home page header refact

hanjing 6 anos atrás
pai
commit
ddc56b39f6

+ 0 - 14
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameCenter.java

@@ -70,10 +70,6 @@ public class FgtGameCenter extends BaseFragment {
     TabLayout indicator;
     @BindView(R.id.pager)
     ViewPager pager;
-    @BindView(R.id.download_btn)
-    ImageView downloadBtn;
-    @BindView(R.id.search_btn)
-    ImageView searchBtn;
     @BindView(R.id.fgt_gc_hb_500_yuan_drl)
     View fgt_gc_hb_500_yuan_drl;
 
@@ -137,16 +133,6 @@ public class FgtGameCenter extends BaseFragment {
         super.onResume();
     }
 
-    @OnClick(R.id.download_btn)
-    public void doDownload(View v) {
-        Jump2View.getInstance().goActDownloadManager(getActivity());
-    }
-
-    @OnClick(R.id.search_btn)
-    public void doSearch(View v) {
-        Jump2View.getInstance().goActSearch(getActivity());
-    }
-
     @OnClick(R.id.fgt_gc_hb_500_yuan_drl)
     public void goGet500YuanHb(View v) {
         Jump2View.getInstance().goWeb(SheepApp.getInstance().getCurrentActivity(), new WebParams(Config.getUrlByPath(Config.PATH_WELFARE_MONEY_REWARD_LIST)).setTitle(Config.NAME_WELFARE_MONEY_REWARD_LIST));

+ 8 - 102
app/src/main/java/com/sheep/gamegroup/module/home/fragment/FgtHome.java

@@ -45,20 +45,8 @@ import rx.functions.Action1;
 
 public class FgtHome extends BaseFragment {
 
-    @BindView(R.id.iv_user_face)
-    ImageView iv_user_face;
-    @BindView(R.id.tv_nickname)
-    TextView tv_nickname;
-    @BindView(R.id.tv_user_asset)
-    TextView tv_user_asset;
-    @BindView(R.id.tv_msg_count)
-    TextView tv_msg_count;
-    @BindView(R.id.iv_flag_vip)
-    ImageView iv_flag_vip;
     @BindView(R.id.tip_news)
     View tip_news;
-    @BindView(R.id.v_red_dot)
-    View v_red_dot;
     @BindView(R.id.tv_recommend)
     TextView tv_recommend;
     @BindView(R.id.tv_news)
@@ -67,8 +55,6 @@ public class FgtHome extends BaseFragment {
     View line_recommend;
     @BindView(R.id.line_news)
     View line_news;
-    @BindView(R.id.show_hide_pwd_btn)
-    ImageView show_hide_pwd_btn;
 
     private UserEntity user;
 
@@ -91,8 +77,6 @@ public class FgtHome extends BaseFragment {
     @Override
     public void onPause() {
         super.onPause();
-        show_hide_pwd_btn.setImageResource(R.mipmap.pwd_hide);
-        tv_user_asset.setText("****");
     }
 
     @Override
@@ -103,8 +87,6 @@ public class FgtHome extends BaseFragment {
 
     @Override
     public void onViewCreated() {
-        getUnReadMessageCounts();
-        ViewUtil.setVisibility(v_red_dot, SpUtils.isVoucherFirst());
     }
 
     @Override
@@ -112,53 +94,6 @@ public class FgtHome extends BaseFragment {
         super.onViewCreated(view, savedInstanceState);
         configFragments(savedInstanceState);
         user = DataUtil.getInstance().getUserEntity();
-        if (user != null) {
-            showUserProfile();
-        } else {
-            CommonUtil.getInstance().getUserInfo(false, (userEntity) -> {
-                user = userEntity;
-                showUserProfile();
-            });
-        }
-    }
-
-    private void showUserProfile() {
-        GlideImageLoader.setAvatar(iv_user_face, user.getAvatar(), Color.argb(128, 255, 255, 255));
-        ViewUtil.setVisibility(iv_flag_vip, user.isVIP());
-        ViewUtil.setText(tv_nickname, user.getNickname());
-    }
-
-    @OnClick(R.id.show_hide_pwd_btn)
-    public void showAsset(View v) {
-        ImageView btn = (ImageView) v;
-        btn.setSelected(!btn.isSelected());
-        if (btn.isSelected()) {
-            btn.setImageResource(R.mipmap.pwd_show);
-            tv_user_asset.setText(String.format(Locale.CHINA, "%s\u0020元", NumberFormatUtils.retainMost2W(user.getBalance())));
-        } else {
-            btn.setImageResource(R.mipmap.pwd_hide);
-            tv_user_asset.setText("****");
-        }
-    }
-
-    @OnClick(R.id.iv_user_face)
-    public void onFaceClick() {
-        Jump2View.getInstance().goPersonnalCenterView(getActivity(), null);
-    }
-
-    @OnClick(R.id.iv_msg)
-    public void onMsgClick() {
-        startActivity(new Intent(getActivity(), ActMsg.class));
-    }
-
-    @OnClick(R.id.iv_download)
-    public void onDownloadClick() {
-        Jump2View.getInstance().goActDownloadManager(getActivity());
-    }
-
-    @OnClick(R.id.iv_search)
-    public void onSearchClick() {
-        Jump2View.getInstance().goActSearch(getActivity());
     }
 
     @OnClick(R.id.mall_btn)
@@ -222,51 +157,22 @@ public class FgtHome extends BaseFragment {
         transaction.commitAllowingStateLoss();
     }
 
-    /**
-     * 获取是否有未读消息并更新图标
-     */
-    private void getUnReadMessageCounts() {
-        SheepApp.getInstance()
-                .getNetComponent()
-                .getApiService()
-                .getMessageUnReadNum(DataUtil.getInstance().getUserId())
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        MessageUnReadEntity entity = baseMessage.getData(MessageUnReadEntity.class);
-                        if (entity != null && entity.getNum() > 0) {
-                            ViewUtil.setVisibility(tv_msg_count, true);
-                            ViewUtil.setText(tv_msg_count, entity.getNum());
-                            DialogNotificationOfArrival.checkNotificationOfArrivalList(getActivity());
-                        } else {
-                            ViewUtil.setVisibility(tv_msg_count, false);
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                    }
-                });
-    }
-
     @Subscribe
     public void onEventMainThread(BigEvent event) {
-        switch (event.getEventTypes()) {
-            case FGT_SHEEP_HOME_MESSAGE_COUNT:
-                if (getActivity() != null) {
-                    getActivity().runOnUiThread(() -> getUnReadMessageCounts());
-                }
-                break;
-        }
+//        switch (event.getEventTypes()) {
+//            case FGT_SHEEP_HOME_MESSAGE_COUNT:
+//                if (getActivity() != null) {
+//                    getActivity().runOnUiThread(() -> getUnReadMessageCounts());
+//                }
+//                break;
+//        }
     }
 
     public static final String KEY_HAS_APPOINT_TASK = "hasAppointTask";
 
     @Subscribe
     public void whenPersonVoucherClick(FgtPersonalCenter.PersonVoucherClickEvent ev) {
-        ViewUtil.setVisibility(v_red_dot, DataUtil.getAsBoolean(KEY_HAS_APPOINT_TASK, false));
+//        ViewUtil.setVisibility(v_red_dot, DataUtil.getAsBoolean(KEY_HAS_APPOINT_TASK, false));
     }
 
 }

+ 197 - 0
app/src/main/java/com/sheep/gamegroup/module/home/fragment/FgtMainHeader.java

@@ -0,0 +1,197 @@
+package com.sheep.gamegroup.module.home.fragment;
+
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.kfzs.duanduan.utils.NumberFormatUtils;
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.MessageUnReadEntity;
+import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.GlideImageLoader;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.view.activity.ActMsg;
+import com.sheep.gamegroup.view.dialog.DialogNotificationOfArrival;
+import com.sheep.gamegroup.view.fragment.FgtFind;
+import com.sheep.gamegroup.view.fragment.FgtPersonalCenter;
+import com.sheep.gamegroup.view.fragment.FgtSmallSheep;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
+import java.util.Locale;
+
+import butterknife.BindView;
+import butterknife.OnClick;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+public class FgtMainHeader extends BaseFragment {
+
+    @BindView(R.id.iv_user_face)
+    ImageView iv_user_face;
+    @BindView(R.id.tv_nickname)
+    TextView tv_nickname;
+    @BindView(R.id.tv_user_asset)
+    TextView tv_user_asset;
+    @BindView(R.id.tv_msg_count)
+    TextView tv_msg_count;
+    @BindView(R.id.iv_flag_vip)
+    ImageView iv_flag_vip;
+    @BindView(R.id.v_red_dot)
+    View v_red_dot;
+    @BindView(R.id.show_hide_pwd_btn)
+    ImageView show_hide_pwd_btn;
+
+    private UserEntity user;
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.fgt_main_header;
+    }
+
+    @Override
+    public void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+        EventBus.getDefault().register(this);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        show_hide_pwd_btn.setImageResource(R.mipmap.pwd_hide);
+        tv_user_asset.setText("****");
+    }
+
+    @Override
+    public void onDestroy() {
+        EventBus.getDefault().unregister(this);
+        super.onDestroy();
+    }
+
+    @Override
+    public void onViewCreated() {
+        getUnReadMessageCounts();
+        ViewUtil.setVisibility(v_red_dot, SpUtils.isVoucherFirst());
+    }
+
+    @Override
+    public void onViewCreated(View view, Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        user = DataUtil.getInstance().getUserEntity();
+        if (user != null) {
+            showUserProfile();
+        } else {
+            CommonUtil.getInstance().getUserInfo(false, (userEntity) -> {
+                user = userEntity;
+                showUserProfile();
+            });
+        }
+    }
+
+    private void showUserProfile() {
+        GlideImageLoader.setAvatar(iv_user_face, user.getAvatar(), Color.argb(128, 255, 255, 255));
+        ViewUtil.setVisibility(iv_flag_vip, user.isVIP());
+        ViewUtil.setText(tv_nickname, user.getNickname());
+    }
+
+    @OnClick(R.id.show_hide_pwd_btn)
+    public void showAsset(View v) {
+        ImageView btn = (ImageView) v;
+        btn.setSelected(!btn.isSelected());
+        if (btn.isSelected()) {
+            btn.setImageResource(R.mipmap.pwd_show);
+            tv_user_asset.setText(String.format(Locale.CHINA, "%s\u0020元", NumberFormatUtils.retainMost2W(user.getBalance())));
+        } else {
+            btn.setImageResource(R.mipmap.pwd_hide);
+            tv_user_asset.setText("****");
+        }
+    }
+
+    @OnClick(R.id.iv_user_face)
+    public void onFaceClick() {
+        Jump2View.getInstance().goPersonnalCenterView(getActivity(), null);
+    }
+
+    @OnClick(R.id.iv_msg)
+    public void onMsgClick() {
+        startActivity(new Intent(getActivity(), ActMsg.class));
+    }
+
+    @OnClick(R.id.iv_download)
+    public void onDownloadClick() {
+        Jump2View.getInstance().goActDownloadManager(getActivity());
+    }
+
+    @OnClick(R.id.iv_search)
+    public void onSearchClick() {
+        Jump2View.getInstance().goActSearch(getActivity());
+    }
+
+    /**
+     * 获取是否有未读消息并更新图标
+     */
+    private void getUnReadMessageCounts() {
+        SheepApp.getInstance()
+                .getNetComponent()
+                .getApiService()
+                .getMessageUnReadNum(DataUtil.getInstance().getUserId())
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        MessageUnReadEntity entity = baseMessage.getData(MessageUnReadEntity.class);
+                        if (entity != null && entity.getNum() > 0) {
+                            ViewUtil.setVisibility(tv_msg_count, true);
+                            ViewUtil.setText(tv_msg_count, entity.getNum());
+                            DialogNotificationOfArrival.checkNotificationOfArrivalList(getActivity());
+                        } else {
+                            ViewUtil.setVisibility(tv_msg_count, false);
+                        }
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                    }
+                });
+    }
+
+    @Subscribe
+    public void onEventMainThread(BigEvent event) {
+        switch (event.getEventTypes()) {
+            case FGT_SHEEP_HOME_MESSAGE_COUNT:
+                if (getActivity() != null) {
+                    getActivity().runOnUiThread(() -> getUnReadMessageCounts());
+                }
+                break;
+        }
+    }
+
+    public static final String KEY_HAS_APPOINT_TASK = "hasAppointTask";
+
+    @Subscribe
+    public void whenPersonVoucherClick(FgtPersonalCenter.PersonVoucherClickEvent ev) {
+        ViewUtil.setVisibility(v_red_dot, DataUtil.getAsBoolean(KEY_HAS_APPOINT_TASK, false));
+    }
+
+}

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

@@ -397,7 +397,7 @@ public class Jump2View {
      * @param object
      */
     public void goHomePageView(final Activity context, Object object) {
-        final Intent intent = new Intent(context, ActTest.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+        final Intent intent = new Intent(context, ActMain.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
         if (object instanceof String) {
             //统计用户登录信息
             UMConfigUtils.onProfileSignIn();

+ 13 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -28,6 +28,7 @@ import com.sheep.gamegroup.model.entity.Container;
 import com.sheep.gamegroup.model.entity.Lp;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.util.ShowRedDot;
+import com.sheep.gamegroup.module.home.fragment.FgtMainHeader;
 import com.sheep.gamegroup.module.home.fragment.FgtWrapper;
 import com.sheep.gamegroup.util.ActionUtil;
 import com.sheep.gamegroup.util.ChannelContent;
@@ -148,6 +149,8 @@ public class ActMain extends BaseActYmPermissionCheck {
     LinearLayout tab_container;
     @BindView(R.id.main_layout)
     RelativeLayout main_layout;
+    @BindView(R.id.main_header)
+    View main_header;
 
     @Override
     protected int getLayoutId() {
@@ -195,6 +198,15 @@ public class ActMain extends BaseActYmPermissionCheck {
         }
 
         FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+        Fragment headerFragment = getSupportFragmentManager().findFragmentByTag("fragment_main_header");
+        if (headerFragment == null) {
+            headerFragment = new FgtMainHeader();
+        }
+        if (!headerFragment.isAdded()) {
+            transaction.add(R.id.main_header, headerFragment, "fragment_main_header");
+        }
+        transaction.show(headerFragment);
+
         MainTab[] mainTabs = MainTab.values();
         int index = 0;
         int iconSize = ScreenUtil.dip2px(this, 30);
@@ -238,6 +250,7 @@ public class ActMain extends BaseActYmPermissionCheck {
     }
 
     private void switchFragment(int position) {
+        ViewUtil.setVisibility(main_header, position != 1);
         View lastTab = ListUtil.getItem(tabs, lastPosition);
         View curTab = ListUtil.getItem(tabs, position);
         if (lastTab != null) {

+ 7 - 0
app/src/main/res/layout/act_bottom_bar.xml

@@ -11,10 +11,17 @@
         android:adjustViewBounds="true"
         android:src="@mipmap/home_blue_bg" />
 
+    <RelativeLayout
+        android:id="@+id/main_header"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
+        android:layout_marginTop="32dp"></RelativeLayout>
+
     <include
         layout="@layout/main_frame_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_below="@+id/main_header"
         android:layout_marginBottom="@dimen/bottom_height" />
 
 

+ 8 - 0
app/src/main/res/layout/act_main.xml

@@ -10,8 +10,16 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
+    <RelativeLayout
+        android:id="@+id/main_header"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
+        android:layout_marginTop="32dp">
+    </RelativeLayout>
+
     <include
         layout="@layout/main_frame_layout"
+        android:layout_below="@+id/main_header"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_marginBottom="@dimen/bottom_height" />

+ 0 - 39
app/src/main/res/layout/fgt_game_center.xml

@@ -4,45 +4,6 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <RelativeLayout
-        android:id="@+id/top_bar"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="26dp">
-
-        <ImageView
-            android:id="@+id/download_btn"
-            android:layout_width="@dimen/content_padding_36"
-            android:layout_height="@dimen/content_padding_36"
-            android:layout_alignParentEnd="true"
-            android:layout_centerVertical="true"
-            android:gravity="center"
-            android:padding="8dp"
-            android:layout_marginRight="16dp"
-            android:src="@drawable/drawable_selector_ic_home_download"
-            android:tint="@color/white" />
-
-        <TextView
-            android:text="游戏中心"
-            android:textSize="16sp"
-            android:textColor="@color/white"
-            android:layout_centerInParent="true"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" />
-
-        <ImageView
-            android:id="@+id/search_btn"
-            android:layout_width="@dimen/content_padding_36"
-            android:layout_height="@dimen/content_padding_36"
-            android:layout_centerVertical="true"
-            android:gravity="center"
-            android:padding="8dp"
-            android:layout_marginLeft="16dp"
-            android:src="@drawable/drawable_selector_ic_home_search"
-            android:tint="@color/white" />
-
-    </RelativeLayout>
-
     <android.support.design.widget.TabLayout
         android:id="@+id/indicator"
         style="@style/style_tab_2"

+ 0 - 124
app/src/main/res/layout/fgt_home.xml

@@ -5,130 +5,6 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="40dp"
-        android:layout_marginTop="32dp">
-
-        <ImageView
-            android:id="@+id/iv_user_face"
-            android:layout_width="40dp"
-            android:layout_height="40dp"
-            android:layout_marginStart="@dimen/content_padding_16"
-            android:src="@drawable/avatar" />
-
-        <View
-            android:id="@+id/v_red_dot"
-            android:layout_width="8dp"
-            android:layout_height="8dp"
-            android:layout_marginLeft="45dp"
-            android:background="@drawable/shape_oval_red"
-            android:visibility="visible" />
-
-        <TextView
-            android:id="@+id/tv_nickname"
-            android:layout_width="wrap_content"
-            android:layout_height="20dp"
-            android:layout_marginLeft="12dp"
-            android:layout_toRightOf="@+id/iv_user_face"
-            android:text="七天的绵羊"
-            android:textStyle="bold"
-            android:textColor="@color/white"
-            android:textSize="14sp" />
-
-        <TextView
-            android:id="@+id/tv_coin_flag"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/iv_user_face"
-            android:layout_marginLeft="12dp"
-            android:layout_toRightOf="@+id/iv_user_face"
-            android:text="绵羊币:"
-            android:textColor="@color/white"
-            android:textSize="11sp" />
-
-        <TextView
-            android:id="@+id/tv_user_asset"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignBottom="@+id/iv_user_face"
-            android:layout_marginLeft="4dp"
-            android:layout_toRightOf="@+id/tv_coin_flag"
-            android:text="****"
-            android:textColor="@color/white"
-            android:textSize="11sp"
-            android:textStyle="bold" />
-
-        <ImageView
-            android:id="@+id/show_hide_pwd_btn"
-            android:layout_width="25dp"
-            android:layout_height="wrap_content"
-            android:layout_toRightOf="@+id/tv_user_asset"
-            android:layout_below="@+id/tv_nickname"
-            android:layout_marginLeft="6dp"
-            android:layout_marginTop="4dp"
-            android:padding="3dp"
-            android:adjustViewBounds="true"
-            android:src="@mipmap/pwd_hide"
-            android:tint="#1299C4" />
-
-        <ImageView
-            android:id="@+id/iv_flag_vip"
-            android:layout_width="28dp"
-            android:layout_height="13dp"
-            android:layout_marginLeft="@dimen/content_padding_4"
-            android:layout_marginTop="4dp"
-            android:layout_toRightOf="@+id/tv_nickname"
-            android:src="@mipmap/level_vip" />
-
-        <ImageView
-            android:id="@+id/iv_msg"
-            android:layout_width="40dp"
-            android:layout_height="40dp"
-            android:layout_alignParentEnd="true"
-            android:layout_marginEnd="8dp"
-            android:padding="10dp"
-            android:src="@mipmap/ic_msg"
-            android:tint="@color/white" />
-
-        <TextView
-            android:id="@+id/tv_msg_count"
-            android:layout_width="wrap_content"
-            android:layout_height="14dp"
-            android:layout_alignParentEnd="true"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="8dp"
-            android:background="@drawable/shape_f81b5f_rec_7"
-            android:gravity="center"
-            android:minWidth="14dp"
-            android:paddingStart="4dp"
-            android:paddingEnd="4dp"
-            android:text="0"
-            android:textColor="@color/white"
-            android:textSize="9sp" />
-
-        <ImageView
-            android:id="@+id/iv_download"
-            android:layout_width="40dp"
-            android:layout_height="40dp"
-            android:layout_alignParentEnd="true"
-            android:layout_marginEnd="48dp"
-            android:padding="10dp"
-            android:src="@drawable/drawable_selector_ic_home_download"
-            android:tint="@color/white" />
-
-        <ImageView
-            android:id="@+id/iv_search"
-            android:layout_width="40dp"
-            android:layout_height="40dp"
-            android:layout_alignParentEnd="true"
-            android:layout_marginEnd="90dp"
-            android:padding="10dp"
-            android:src="@drawable/drawable_selector_ic_home_search"
-            android:tint="@color/white" />
-
-    </RelativeLayout>
-
     <LinearLayout
         android:layout_marginTop="4dp"
         android:layout_width="match_parent"

+ 124 - 0
app/src/main/res/layout/fgt_main_header.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="40dp">
+
+    <ImageView
+        android:id="@+id/iv_user_face"
+        android:layout_width="40dp"
+        android:layout_height="40dp"
+        android:layout_marginStart="@dimen/content_padding_16"
+        android:src="@drawable/avatar" />
+
+    <View
+        android:id="@+id/v_red_dot"
+        android:layout_width="8dp"
+        android:layout_height="8dp"
+        android:layout_marginLeft="45dp"
+        android:background="@drawable/shape_oval_red"
+        android:visibility="visible" />
+
+    <TextView
+        android:id="@+id/tv_nickname"
+        android:layout_width="wrap_content"
+        android:layout_height="20dp"
+        android:layout_marginLeft="12dp"
+        android:layout_toRightOf="@+id/iv_user_face"
+        android:text="七天的绵羊"
+        android:textColor="@color/white"
+        android:textSize="14sp"
+        android:textStyle="bold" />
+
+    <TextView
+        android:id="@+id/tv_coin_flag"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignBottom="@+id/iv_user_face"
+        android:layout_marginLeft="12dp"
+        android:layout_toRightOf="@+id/iv_user_face"
+        android:text="绵羊币:"
+        android:textColor="@color/white"
+        android:textSize="11sp" />
+
+    <TextView
+        android:id="@+id/tv_user_asset"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignBottom="@+id/iv_user_face"
+        android:layout_marginLeft="4dp"
+        android:layout_toRightOf="@+id/tv_coin_flag"
+        android:text="****"
+        android:textColor="@color/white"
+        android:textSize="11sp"
+        android:textStyle="bold" />
+
+    <ImageView
+        android:id="@+id/show_hide_pwd_btn"
+        android:layout_width="25dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/tv_nickname"
+        android:layout_marginLeft="6dp"
+        android:layout_marginTop="4dp"
+        android:layout_toRightOf="@+id/tv_user_asset"
+        android:adjustViewBounds="true"
+        android:padding="3dp"
+        android:src="@mipmap/pwd_hide"
+        android:tint="#1299C4" />
+
+    <ImageView
+        android:id="@+id/iv_flag_vip"
+        android:layout_width="28dp"
+        android:layout_height="13dp"
+        android:layout_marginLeft="@dimen/content_padding_4"
+        android:layout_marginTop="4dp"
+        android:layout_toRightOf="@+id/tv_nickname"
+        android:src="@mipmap/level_vip" />
+
+    <ImageView
+        android:id="@+id/iv_msg"
+        android:layout_width="40dp"
+        android:layout_height="40dp"
+        android:layout_alignParentEnd="true"
+        android:layout_marginEnd="8dp"
+        android:padding="10dp"
+        android:src="@mipmap/ic_msg"
+        android:tint="@color/white" />
+
+    <TextView
+        android:id="@+id/tv_msg_count"
+        android:layout_width="wrap_content"
+        android:layout_height="14dp"
+        android:layout_alignParentEnd="true"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:background="@drawable/shape_f81b5f_rec_7"
+        android:gravity="center"
+        android:minWidth="14dp"
+        android:paddingStart="4dp"
+        android:paddingEnd="4dp"
+        android:text="0"
+        android:textColor="@color/white"
+        android:textSize="9sp" />
+
+    <ImageView
+        android:id="@+id/iv_download"
+        android:layout_width="40dp"
+        android:layout_height="40dp"
+        android:layout_alignParentEnd="true"
+        android:layout_marginEnd="48dp"
+        android:padding="10dp"
+        android:src="@drawable/drawable_selector_ic_home_download"
+        android:tint="@color/white" />
+
+    <ImageView
+        android:id="@+id/iv_search"
+        android:layout_width="40dp"
+        android:layout_height="40dp"
+        android:layout_alignParentEnd="true"
+        android:layout_marginEnd="90dp"
+        android:padding="10dp"
+        android:src="@drawable/drawable_selector_ic_home_search"
+        android:tint="@color/white" />
+
+</RelativeLayout>