|
|
@@ -1,9 +1,12 @@
|
|
|
package com.sheep.gamegroup.view.fragment;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
+import android.graphics.Paint;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.text.Html;
|
|
|
+import android.text.SpannableString;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
@@ -86,6 +89,8 @@ public class FgtAskGetMoneyRank extends BaseFragment {
|
|
|
private void initView() {
|
|
|
initAskTop5View();
|
|
|
askTop5NotYou.setVisibility(View.INVISIBLE);
|
|
|
+ this_last_tv.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
|
|
|
+ this_last_tv.getPaint().setAntiAlias(true);//抗锯齿
|
|
|
initData();
|
|
|
}
|
|
|
public void initData() {
|
|
|
@@ -123,33 +128,39 @@ public class FgtAskGetMoneyRank extends BaseFragment {
|
|
|
View itemView = holder.itemView;
|
|
|
int position = holder.getAdapterPosition();
|
|
|
if (position == 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- TextView x_ask_top5_item_user = itemView.findViewById(R.id.x_ask_top5_item_user);
|
|
|
- TextView x_ask_top5_item_money = itemView.findViewById(R.id.x_ask_top5_item_money);
|
|
|
- TextView x_ask_top5_item_award = itemView.findViewById(R.id.x_ask_top5_item_award);
|
|
|
- ImageView ask_top5_item_iv = itemView.findViewById(R.id.ask_top5_item_iv);
|
|
|
-
|
|
|
- if (item == null) {//空数据占位置
|
|
|
- itemView.setVisibility(View.INVISIBLE);
|
|
|
- return;
|
|
|
- }
|
|
|
- ViewUtil.setText(x_ask_top5_item_user, String.format(Locale.CHINA, "昵称\n%s", item.getNickname()));
|
|
|
- ViewUtil.setText(x_ask_top5_item_money, String.format(Locale.CHINA, "%d", item.getSum_friend()));
|
|
|
- ViewUtil.setText(x_ask_top5_item_award, item.getPrize());
|
|
|
- switch (position) {
|
|
|
- case 1:
|
|
|
- ask_top5_item_iv.setImageResource(R.mipmap.ask_top_1);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- ask_top5_item_iv.setImageResource(R.mipmap.ask_top_2);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- ask_top5_item_iv.setImageResource(R.mipmap.ask_top_3);
|
|
|
- break;
|
|
|
+ }else {
|
|
|
+ TextView x_ask_top5_item_user = itemView.findViewById(R.id.x_ask_top5_item_user);
|
|
|
+ TextView x_ask_top5_item_money = itemView.findViewById(R.id.x_ask_top5_item_money);
|
|
|
+ TextView x_ask_top5_item_award = itemView.findViewById(R.id.x_ask_top5_item_award);
|
|
|
+ ImageView ask_top5_item_iv = itemView.findViewById(R.id.ask_top5_item_iv);
|
|
|
+
|
|
|
+ if (item == null) {//空数据占位置
|
|
|
+ itemView.setVisibility(View.INVISIBLE);
|
|
|
+ }else {
|
|
|
+ itemView.setVisibility(View.VISIBLE);
|
|
|
+ ViewUtil.setText(x_ask_top5_item_user, String.format(Locale.CHINA, "昵称\n%s", item.getNickname()));
|
|
|
+ ViewUtil.setText(x_ask_top5_item_money, String.format(Locale.CHINA, "%d", item.getSum_friend()));
|
|
|
+ ViewUtil.setText(x_ask_top5_item_award, item.getPrize());
|
|
|
+ switch (position) {
|
|
|
+ case 1:
|
|
|
+ ask_top5_item_iv.setImageResource(R.mipmap.ask_top_1);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ ask_top5_item_iv.setImageResource(R.mipmap.ask_top_2);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ ask_top5_item_iv.setImageResource(R.mipmap.ask_top_3);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ ask_top5_item_iv.setVisibility(View.INVISIBLE);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
askTop5List.setAdapter(adapter);
|
|
|
@@ -163,22 +174,24 @@ public class FgtAskGetMoneyRank extends BaseFragment {
|
|
|
@Override
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
List<AskTop> newList = baseMessage.getDataList(AskTop.class);
|
|
|
- if (ListUtil.isEmpty(newList)) {
|
|
|
- return;
|
|
|
- }
|
|
|
list.clear();
|
|
|
list.add(null);
|
|
|
- list.addAll(newList);
|
|
|
- notifyDataSetChanged();
|
|
|
- String userId = DataUtil.getInstance().getUserId();
|
|
|
boolean hasMe = false;
|
|
|
- for (AskTop item : newList) {
|
|
|
- if (TextUtils.equals(userId, item.getUser_id())) {
|
|
|
- hasMe = true;
|
|
|
- break;
|
|
|
+ if (!ListUtil.isEmpty(newList)) {
|
|
|
+
|
|
|
+ list.addAll(newList);
|
|
|
+ String userId = DataUtil.getInstance().getUserId();
|
|
|
+ for (AskTop item : newList) {
|
|
|
+ if (TextUtils.equals(userId, item.getUser_id())) {
|
|
|
+ hasMe = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- askTop5NotYou.setVisibility(hasMe ? View.INVISIBLE : View.VISIBLE);
|
|
|
+ if(this_last_tv.getText().equals(activity.getResources().getString(R.string.last_this_month_rank))){
|
|
|
+ askTop5NotYou.setVisibility(hasMe ? View.INVISIBLE : View.VISIBLE);
|
|
|
+ }
|
|
|
+ notifyDataSetChanged();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -191,6 +204,7 @@ public class FgtAskGetMoneyRank extends BaseFragment {
|
|
|
|
|
|
private void notifyDataSetChanged() {
|
|
|
hideProgress();
|
|
|
+ ViewUtil.newInstance().hideProgress(activity);
|
|
|
CommonUtil.getInstance().updateEmptyView(emptyView, list.size() == 1, true);
|
|
|
while (list.size() < 5) {
|
|
|
list.add(null);
|
|
|
@@ -222,6 +236,7 @@ public class FgtAskGetMoneyRank extends BaseFragment {
|
|
|
case R.id.this_last_tv://
|
|
|
if(this_last_tv.getText().equals(activity.getResources().getString(R.string.last_this_month_rank))){//查上月
|
|
|
this_last_tv.setText(activity.getResources().getString(R.string.this_month_rank));
|
|
|
+ askTop5Title.setText(activity.getResources().getString(R.string.last_this_month_rank_top5));
|
|
|
long[] longs = CommonUtil.getInstance().getLastMonth();
|
|
|
start_time = longs[0];
|
|
|
end_time = longs[1];
|
|
|
@@ -229,7 +244,9 @@ public class FgtAskGetMoneyRank extends BaseFragment {
|
|
|
start_time = 0;
|
|
|
end_time = 0;
|
|
|
this_last_tv.setText(activity.getResources().getString(R.string.last_this_month_rank));
|
|
|
+ askTop5Title.setText(activity.getResources().getString(R.string.this_month_rank_top5));
|
|
|
}
|
|
|
+ ViewUtil.newInstance().showProgress(activity);
|
|
|
initAskTop5(start_time,end_time);
|
|
|
break;
|
|
|
}
|