|
@@ -1,13 +1,155 @@
|
|
|
package com.kfzs.duanduan.fragment;
|
|
package com.kfzs.duanduan.fragment;
|
|
|
|
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
|
+import android.os.Handler;
|
|
|
|
|
+import android.os.Message;
|
|
|
|
|
+import android.util.Log;
|
|
|
|
|
+import android.view.View;
|
|
|
|
|
+import android.widget.ImageView;
|
|
|
|
|
+import android.widget.LinearLayout;
|
|
|
|
|
+import android.widget.RelativeLayout;
|
|
|
|
|
+import android.widget.TextView;
|
|
|
|
|
+
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.kfzs.duanduan.BaseCompatFragment;
|
|
import com.kfzs.duanduan.BaseCompatFragment;
|
|
|
|
|
+import com.sheep.gamegroup.di.components.DaggerSmallSheepComponent;
|
|
|
|
|
+import com.sheep.gamegroup.di.modules.SmallSheepModule;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
|
|
+import com.sheep.gamegroup.presenter.SmallSheepContract;
|
|
|
|
|
+import com.sheep.gamegroup.presenter.SmallSheepPresenter;
|
|
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
|
|
+import com.sheep.gamegroup.util.MyDbManager;
|
|
|
|
|
+import com.sheep.gamegroup.util.MyListview;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
|
|
+
|
|
|
|
|
+import javax.inject.Inject;
|
|
|
|
|
|
|
|
-public class FgtSmallSheep extends BaseCompatFragment {
|
|
|
|
|
|
|
+import butterknife.BindView;
|
|
|
|
|
+import butterknife.ButterKnife;
|
|
|
|
|
+import butterknife.OnClick;
|
|
|
|
|
+import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
|
|
+
|
|
|
|
|
+public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContract.View {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void initView(Bundle savedInstanceState) {
|
|
protected void initView(Bundle savedInstanceState) {
|
|
|
setContentView(R.layout.homepage_act_layout);
|
|
setContentView(R.layout.homepage_act_layout);
|
|
|
|
|
+ initView();
|
|
|
|
|
+ initListener();
|
|
|
|
|
+ initData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @BindView(R.id.icon_img_iv)
|
|
|
|
|
+ CircleImageView iconImgIv;
|
|
|
|
|
+ @BindView(R.id.name_tv)
|
|
|
|
|
+ TextView nameTv;
|
|
|
|
|
+ @BindView(R.id.sheep_num_tv)
|
|
|
|
|
+ TextView sheepNumTv;
|
|
|
|
|
+ @BindView(R.id.user_layout)
|
|
|
|
|
+ RelativeLayout userLayout;
|
|
|
|
|
+ @BindView(R.id.withdrawal)
|
|
|
|
|
+ TextView withdrawal;
|
|
|
|
|
+ @BindView(R.id.my_price)
|
|
|
|
|
+ TextView myPrice;
|
|
|
|
|
+ @BindView(R.id.my_all_price)
|
|
|
|
|
+ TextView myAllPrice;
|
|
|
|
|
+ @BindView(R.id.couple_red_packets_iv)
|
|
|
|
|
+ ImageView coupleRedPacketsIv;
|
|
|
|
|
+ @BindView(R.id.try_play_layout)
|
|
|
|
|
+ LinearLayout tryPlayLayout;
|
|
|
|
|
+ @BindView(R.id.invitation_layout)
|
|
|
|
|
+ LinearLayout invitationLayout;
|
|
|
|
|
+ @BindView(R.id.lying_layout)
|
|
|
|
|
+ LinearLayout lyingLayout;
|
|
|
|
|
+ @BindView(R.id.listview)
|
|
|
|
|
+ MyListview listview;
|
|
|
|
|
+
|
|
|
|
|
+ @Inject
|
|
|
|
|
+ SmallSheepPresenter pagePresenter;
|
|
|
|
|
+ private Activity activity;
|
|
|
|
|
+ private UserEntity userEntity;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Handler mHanderl = new Handler(){
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void handleMessage(Message msg) {
|
|
|
|
|
+ super.handleMessage(msg);
|
|
|
|
|
+
|
|
|
|
|
+ myPrice.setText(userEntity.getBalance()+" 元");
|
|
|
|
|
+ myAllPrice.setText("累计资产 "+userEntity.getTotal_asset()+" 元");
|
|
|
|
|
+ nameTv.setText(userEntity.getNickname()+"");//绵羊号:123456789
|
|
|
|
|
+ sheepNumTv.setText("绵羊号:"+userEntity.getInvitation_code());
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ public void initView() {
|
|
|
|
|
+ activity = getActivity();
|
|
|
|
|
+ ButterKnife.bind(this,mContentView);
|
|
|
|
|
+ DaggerSmallSheepComponent.builder()
|
|
|
|
|
+ .netComponent(SheepApp.get(getContext()).getNetComponent())
|
|
|
|
|
+ .smallSheepModule(new SmallSheepModule(this))
|
|
|
|
|
+ .build()
|
|
|
|
|
+ .inject(this);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void initListener() {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void initData() {
|
|
|
|
|
+ pagePresenter.getUserInfo();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @OnClick({R.id.icon_img_iv, R.id.user_layout, R.id.withdrawal, R.id.couple_red_packets_iv, R.id.try_play_layout, R.id.invitation_layout, R.id.lying_layout})
|
|
|
|
|
+ public void onViewClicked(View view) {
|
|
|
|
|
+ switch (view.getId()) {
|
|
|
|
|
+ case R.id.icon_img_iv:
|
|
|
|
|
+ break;
|
|
|
|
|
+ case R.id.user_layout:
|
|
|
|
|
+ Jump2View.getInstance().goPersonnalCenterView(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case R.id.withdrawal:
|
|
|
|
|
+ Jump2View.getInstance().goWithdrawal(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case R.id.couple_red_packets_iv:
|
|
|
|
|
+ break;
|
|
|
|
|
+ case R.id.try_play_layout:
|
|
|
|
|
+ Jump2View.getInstance().goTryplayView(activity, null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case R.id.invitation_layout:
|
|
|
|
|
+ break;
|
|
|
|
|
+ case R.id.lying_layout:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void updateData2View(Object o) {
|
|
|
|
|
+ if(o == null){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ BaseMessage baseMessage = (BaseMessage) o;
|
|
|
|
|
+ userEntity = JSON.parseObject(JSONObject.toJSONString(baseMessage.getData()), UserEntity.class);
|
|
|
|
|
+ try {
|
|
|
|
|
+ MyDbManager.getInstance().saveOrUpdateUser(userEntity);
|
|
|
|
|
+// userEntity = MyDbManager.getInstance().dbFindUser();
|
|
|
|
|
+ Log.e("------userEntity",userEntity.getNickname()+"|"+userEntity.getMobile()+"");
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ mHanderl.sendEmptyMessage(0);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void failData2View(Object o) {
|
|
|
|
|
+ G.showToast("网络错误");
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|