界面优化
This commit is contained in:
@ -6,7 +6,9 @@ import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.StrategyActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.StrategyDialogViewHolder;
|
||||
@ -54,6 +56,19 @@ public class StrategyDialogAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
||||
viewHolder.selectIcon.setImageDrawable(new ColorDrawable(0));
|
||||
}
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
if (getItemCount() == 1) {
|
||||
params.setMargins(0, DisplayUtils.dip2px(mContext, 12), 0, DisplayUtils.dip2px(mContext, 12));
|
||||
} else if (position == 0) {
|
||||
params.setMargins(0, DisplayUtils.dip2px(mContext, 12), 0, 0);
|
||||
} else if (position == getItemCount() - 1){
|
||||
params.setMargins(0, 0, 0, DisplayUtils.dip2px(mContext, 12));
|
||||
} else {
|
||||
params.setMargins(0, 0, 0, 0);
|
||||
}
|
||||
viewHolder.itemView.setLayoutParams(params);
|
||||
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@ -11,7 +11,6 @@ import android.widget.LinearLayout;
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.gc.materialdesign.views.ProgressBarCircularIndeterminate;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.download.DataWatcher;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadManager;
|
||||
@ -188,20 +187,17 @@ public class NewGameFragment extends NewHomeFragment implements SwipeRefreshLayo
|
||||
if ("卸载".equals(busFour.getType())
|
||||
&& DownloadManager.getInstance(getActivity()).get(
|
||||
list.get(i).getApk().get(0).getUrl()) != null) {
|
||||
adapter.notifyItemChanged(2 + i); //TODO 2
|
||||
Utils.log("卸载aaa" + (3 + i));
|
||||
adapter.notifyItemChanged(2 + i);
|
||||
} else {
|
||||
list.remove(i);
|
||||
if (list.isEmpty()) {
|
||||
adapter.initItemCount();
|
||||
adapter.notifyItemRangeRemoved(1, 2);
|
||||
adapter.notifyItemChanged(1); // 如果position是1为图片时 需要刷新卡片高度
|
||||
Utils.log("卸载bbb" + (3 + i));
|
||||
// adapter.notifyItemChanged(1); // 如果position是1为图片时 需要刷新卡片高度
|
||||
} else {
|
||||
adapter.initItemCount();
|
||||
adapter.notifyItemRemoved(location);
|
||||
adapter.notifyItemChanged(1);
|
||||
Utils.log("卸载accc" + location);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -910,7 +910,7 @@ public class NewGameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
gameEntity = subjectList.get(i).getData().get(index);
|
||||
if (position == offset && !TextUtils.isEmpty(gameEntity.getImage())) {
|
||||
|
||||
if (i == 0 && pluginList.isEmpty()) {
|
||||
if (i == 0 && position != 1) {
|
||||
((CardLinearLayout) holder.itemView).setmTop(DisplayUtils.dip2px(context, 8));
|
||||
} else {
|
||||
((CardLinearLayout) holder.itemView).setmTop(0);
|
||||
@ -1000,7 +1000,7 @@ public class NewGameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
if (position == offset && TextUtils.isEmpty(gameEntity.getImage()) || position == offset + 1
|
||||
&& !TextUtils.isEmpty(subjectList.get(i).getData().get(0).getImage())) {
|
||||
if (TextUtils.isEmpty(subjectList.get(i).getData().get(0).getImage())
|
||||
&& pluginList.isEmpty() && i == 0) {
|
||||
&& pluginList.isEmpty() && i == 0 && position != 1) {
|
||||
((CardLinearLayout) holder.itemView).setmTop(DisplayUtils.dip2px(context, 8));
|
||||
} else {
|
||||
((CardLinearLayout) holder.itemView).setmTop(0);
|
||||
|
||||
@ -30,7 +30,6 @@ public class NewsFragment extends HomeFragment implements View.OnClickListener,
|
||||
private TextView tv_guanzhu;
|
||||
private TextView tv_zixun;
|
||||
private TextView tv_yuanchuang;
|
||||
private TextView tv_gonglve;
|
||||
|
||||
private int width;
|
||||
private int currentItem;
|
||||
@ -49,7 +48,6 @@ public class NewsFragment extends HomeFragment implements View.OnClickListener,
|
||||
list.add(new News1Fragment());
|
||||
list.add(new News2Fragment());
|
||||
list.add(new News3Fragment());
|
||||
list.add(new News4Fragment());
|
||||
home_vp_content.setAdapter(new FragmentAdapter(getChildFragmentManager(), list));
|
||||
home_vp_content.addOnPageChangeListener(this);
|
||||
|
||||
@ -62,7 +60,7 @@ public class NewsFragment extends HomeFragment implements View.OnClickListener,
|
||||
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
|
||||
width = outMetrics.widthPixels / 4;
|
||||
width = outMetrics.widthPixels / 3;
|
||||
lparams = new LinearLayout.LayoutParams(width / 2,
|
||||
DisplayUtils.dip2px(getActivity(), 2));
|
||||
lparams.leftMargin = (int) (width * (currentItem + 0.25f));
|
||||
@ -118,20 +116,6 @@ public class NewsFragment extends HomeFragment implements View.OnClickListener,
|
||||
0, DisplayUtils.dip2px(getActivity(), 35));
|
||||
lparams2.weight = 1;
|
||||
home_ll_top.addView(tv_yuanchuang, lparams2);
|
||||
|
||||
tv_gonglve = new TextView(getActivity());
|
||||
tv_gonglve.setText("攻略");
|
||||
if (currentItem == 3) {
|
||||
tv_gonglve.setTextColor(getResources().getColor(R.color.theme));
|
||||
} else {
|
||||
tv_gonglve.setTextColor(getResources().getColor(R.color.title));
|
||||
}
|
||||
tv_gonglve.setGravity(Gravity.CENTER);
|
||||
tv_gonglve.setOnClickListener(this);
|
||||
LinearLayout.LayoutParams lparams3 = new LinearLayout.LayoutParams(
|
||||
0, DisplayUtils.dip2px(getActivity(), 35));
|
||||
lparams3.weight = 1;
|
||||
home_ll_top.addView(tv_gonglve, lparams3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -141,8 +125,6 @@ public class NewsFragment extends HomeFragment implements View.OnClickListener,
|
||||
home_vp_content.setCurrentItem(1);
|
||||
} else if (v == tv_yuanchuang) {
|
||||
home_vp_content.setCurrentItem(2);
|
||||
} else if (v == tv_gonglve) {
|
||||
home_vp_content.setCurrentItem(3);
|
||||
} else if (v == tv_guanzhu) {
|
||||
home_vp_content.setCurrentItem(0);
|
||||
}
|
||||
@ -166,22 +148,14 @@ public class NewsFragment extends HomeFragment implements View.OnClickListener,
|
||||
if (position == 0){
|
||||
tv_zixun.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_yuanchuang.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_gonglve.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_guanzhu.setTextColor(getResources().getColor(R.color.theme));
|
||||
} else if (position == 1) {
|
||||
tv_zixun.setTextColor(getResources().getColor(R.color.theme));
|
||||
tv_yuanchuang.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_gonglve.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_guanzhu.setTextColor(getResources().getColor(R.color.title));
|
||||
} else if (position == 2) {
|
||||
tv_zixun.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_yuanchuang.setTextColor(getResources().getColor(R.color.theme));
|
||||
tv_gonglve.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_guanzhu.setTextColor(getResources().getColor(R.color.title));
|
||||
} else if (position == 3) {
|
||||
tv_zixun.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_yuanchuang.setTextColor(getResources().getColor(R.color.title));
|
||||
tv_gonglve.setTextColor(getResources().getColor(R.color.theme));
|
||||
tv_guanzhu.setTextColor(getResources().getColor(R.color.title));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/textview_white_style">
|
||||
|
||||
<TextView
|
||||
@ -11,7 +11,9 @@
|
||||
android:text="少年三国志"
|
||||
android:textSize="16sp"
|
||||
android:layout_centerInParent="true"
|
||||
android:textColor="@color/theme"/>
|
||||
android:textColor="@color/theme"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingTop="12dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dialog_strategy_item_icon"
|
||||
|
||||
Reference in New Issue
Block a user