|
|
@@ -318,7 +318,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
if (!userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() == 1)) {
|
|
|
|
|
|
} else {
|
|
|
- changeRedPackage(getActivity(), LayoutInflater.from(getContext()).inflate(R.layout.activity_main, null), this);
|
|
|
+ changeRedPackage(activity, LayoutInflater.from(activity.getApplicationContext()).inflate(R.layout.activity_main, null), this);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -546,16 +546,15 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
*/
|
|
|
@SuppressLint("InflateParams")
|
|
|
private void initTitleCardLayout(final Context context) {
|
|
|
- WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
|
|
titleCardLayout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.view_float_title_card, null);
|
|
|
doIt = titleCardLayout.findViewById(R.id.do_it_text);
|
|
|
willStart = titleCardLayout.findViewById(R.id.will_start_text);
|
|
|
doItLine = titleCardLayout.findViewById(R.id.do_it_every_day_line);
|
|
|
lines = titleCardLayout.findViewById(R.id.but_will_start);
|
|
|
- int linex = (wm.getDefaultDisplay().getWidth() / 6) - (getViewWidth(doItLine) / 2);
|
|
|
- lines.setX(linex);
|
|
|
+ int lineX = (G.WIDTH / 6) - (getViewWidth(doItLine) / 2);
|
|
|
+ lines.setX(lineX);
|
|
|
ViewGroup.LayoutParams layoutParams = lines.getLayoutParams();
|
|
|
- layoutParams.width = wm.getDefaultDisplay().getWidth() - (linex * 2);
|
|
|
+ layoutParams.width = G.WIDTH - (lineX * 2);
|
|
|
doIt.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
@@ -574,7 +573,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
willStartClick();
|
|
|
}
|
|
|
});
|
|
|
- ((ViewGroup) this.getActivity().getWindow().getDecorView()).addView(titleCardLayout);
|
|
|
+ ((ViewGroup) activity.getWindow().getDecorView()).addView(titleCardLayout);
|
|
|
titleCardLayout.setVisibility(View.GONE);
|
|
|
}
|
|
|
|
|
|
@@ -582,24 +581,24 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
* 每日必做按钮事件回调
|
|
|
*/
|
|
|
private void toDayClick() {
|
|
|
- doIt.setTextColor(getContext().getResources().getColor(R.color.blue_34a6e7));
|
|
|
- willStart.setTextColor(getContext().getResources().getColor(R.color.black_444444));
|
|
|
+ doIt.setTextColor(getResources().getColor(R.color.blue_34a6e7));
|
|
|
+ willStart.setTextColor(getResources().getColor(R.color.black_444444));
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
|
TransitionManager.beginDelayedTransition(titleCardLayout, new ChangeBounds());
|
|
|
}
|
|
|
- lines.setGravity(Gravity.LEFT);
|
|
|
+ lines.setGravity(Gravity.START);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 即将开始按钮事件回调
|
|
|
*/
|
|
|
private void willStartClick() {
|
|
|
- doIt.setTextColor(getContext().getResources().getColor(R.color.black_444444));
|
|
|
- willStart.setTextColor(getContext().getResources().getColor(R.color.blue_34a6e7));
|
|
|
+ doIt.setTextColor(getResources().getColor(R.color.black_444444));
|
|
|
+ willStart.setTextColor(getResources().getColor(R.color.blue_34a6e7));
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
|
TransitionManager.beginDelayedTransition(titleCardLayout, new ChangeBounds());
|
|
|
}
|
|
|
- lines.setGravity(Gravity.RIGHT);
|
|
|
+ lines.setGravity(Gravity.END);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -626,7 +625,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
showPDialog();
|
|
|
initView();
|
|
|
initListener();
|
|
|
- initTitleCardLayout(this.getContext());
|
|
|
+ initTitleCardLayout(activity.getApplicationContext());
|
|
|
TestUtil.testChange(activity, test_change);
|
|
|
TestUtil.testChangeUser(activity, test_change_user);
|
|
|
GlideImageLoader.setImage(bg_newbie_task, "http://cdngame.kuaifazs.com/bg_newbie_task.png");
|
|
|
@@ -1058,7 +1057,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
public void call(RobTask robTask) {
|
|
|
if (robTask != null) {
|
|
|
SheepApp.getInstance().setOrder(robTask.getOrder());
|
|
|
- ViewUtil.newInstance().showRobDutyDialog(getActivity(), getView(), robTask);
|
|
|
+ ViewUtil.newInstance().showRobDutyDialog(activity, getView(), robTask);
|
|
|
} else {
|
|
|
G.showToast("任务已被抢光!请实时关注任务发布!");
|
|
|
}
|