|
|
@@ -80,6 +80,11 @@ import com.sheep.jiuyan.samllsheep.utils.ClassFileHelper;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
+import com.umeng.socialize.ShareAction;
|
|
|
+import com.umeng.socialize.UMShareListener;
|
|
|
+import com.umeng.socialize.bean.SHARE_MEDIA;
|
|
|
+import com.umeng.socialize.media.UMImage;
|
|
|
+import com.umeng.socialize.media.UMWeb;
|
|
|
|
|
|
import org.afinal.simplecache.ACache;
|
|
|
|
|
|
@@ -212,17 +217,17 @@ public class ViewUtil {
|
|
|
CommonUtil.getInstance().robTask(new Action1<RobTask>() {
|
|
|
@Override
|
|
|
public void call(RobTask robTask) {
|
|
|
- if(robTask != null){
|
|
|
+ if (robTask != null) {
|
|
|
try {
|
|
|
mRobTask = robTask;
|
|
|
SpUtils.saveOrder("order", mRobTask.getOrder());
|
|
|
SheepApp.getInstance().setOrder(mRobTask.getOrder());
|
|
|
- tvDutyMoney.setText("+"+mRobTask.getM().getBonus() + "元");//设置任务奖励金额
|
|
|
- tvTitel.setText(mRobTask.getM().getName()+"");//设置任务名字--getTask().getTask_name()
|
|
|
+ tvDutyMoney.setText("+" + mRobTask.getM().getBonus() + "元");//设置任务奖励金额
|
|
|
+ tvTitel.setText(mRobTask.getM().getName() + "");//设置任务名字--getTask().getTask_name()
|
|
|
GlideImageLoader.setImage(ivIcon, mRobTask.getM().getTask().getIcon());//设置任务图标
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
G.showToast("任务已被抢光!请实时关注任务发布!");
|
|
|
}
|
|
|
}
|
|
|
@@ -247,14 +252,14 @@ public class ViewUtil {
|
|
|
final TextView tvDutyMoney = view.findViewById(R.id.tv_robduty_money);
|
|
|
ViewUtil.setDefaultText(tvTitel);
|
|
|
ViewUtil.setDefaultText(tvDutyMoney);
|
|
|
- if(robTask != null){
|
|
|
+ if (robTask != null) {
|
|
|
mRobTask = robTask;
|
|
|
SpUtils.saveOrder("order", mRobTask.getOrder());
|
|
|
SheepApp.getInstance().setOrder(mRobTask.getOrder());
|
|
|
- tvDutyMoney.setText("+"+mRobTask.getM().getBonus() + "元");//设置任务奖励金额
|
|
|
- tvTitel.setText(mRobTask.getM().getName()+"");//设置任务名字--getTask().getTask_name()
|
|
|
+ tvDutyMoney.setText("+" + mRobTask.getM().getBonus() + "元");//设置任务奖励金额
|
|
|
+ tvTitel.setText(mRobTask.getM().getName() + "");//设置任务名字--getTask().getTask_name()
|
|
|
GlideImageLoader.setImage(ivIcon, mRobTask.getM().getTask().getIcon());//设置任务图标
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
mRobTask = getTask(ivIcon, tvTitel, tvDutyMoney);
|
|
|
}
|
|
|
final PopupWindow popupWindow = new PopupWindow(mActivity);
|
|
|
@@ -373,7 +378,7 @@ public class ViewUtil {
|
|
|
if (clipData != null && clipData.getItemCount() > 0) {
|
|
|
// 从数据集中获取(粘贴)第一条文本数据
|
|
|
CharSequence codetext = clipData.getItemAt(0).getText();
|
|
|
- if (!TextUtils.isEmpty(codetext)){
|
|
|
+ if (!TextUtils.isEmpty(codetext)) {
|
|
|
edInvitationCode.setText(codetext);
|
|
|
}
|
|
|
}
|
|
|
@@ -480,11 +485,11 @@ public class ViewUtil {
|
|
|
|
|
|
public static View setBottomLine(final XRecyclerView view_list, final Action1<String> action1) {
|
|
|
View view = LayoutInflater.from(SheepApp.getInstance()).inflate(action1 != null ? R.layout.empty : R.layout.common_foot_view, null);
|
|
|
- if(view_list != null){
|
|
|
+ if (view_list != null) {
|
|
|
view_list.setFootView(view, new CustomFooterViewCallBack() {
|
|
|
@Override
|
|
|
public void onLoadingMore(View yourFooterView) {
|
|
|
- if(action1 != null) {
|
|
|
+ if (action1 != null) {
|
|
|
action1.call("onLoadingMore");
|
|
|
} else {
|
|
|
TextView bottom_line_text = yourFooterView.findViewById(R.id.bottom_line_text);
|
|
|
@@ -494,7 +499,7 @@ public class ViewUtil {
|
|
|
|
|
|
@Override
|
|
|
public void onLoadMoreComplete(View yourFooterView) {
|
|
|
- if(action1 != null) {
|
|
|
+ if (action1 != null) {
|
|
|
action1.call("onLoadMoreComplete");
|
|
|
} else {
|
|
|
TextView bottom_line_text = yourFooterView.findViewById(R.id.bottom_line_text);
|
|
|
@@ -502,7 +507,7 @@ public class ViewUtil {
|
|
|
yourFooterView.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- if(canScrollToTop())
|
|
|
+ if (canScrollToTop())
|
|
|
view_list.scrollToPosition(0);
|
|
|
}
|
|
|
});
|
|
|
@@ -511,7 +516,7 @@ public class ViewUtil {
|
|
|
|
|
|
@Override
|
|
|
public void onSetNoMore(View yourFooterView, boolean noMore) {
|
|
|
- if(action1 != null) {
|
|
|
+ if (action1 != null) {
|
|
|
action1.call("onSetNoMore");
|
|
|
} else {
|
|
|
yourFooterView.setVisibility(isEmpty() ? View.GONE : View.VISIBLE);
|
|
|
@@ -520,16 +525,18 @@ public class ViewUtil {
|
|
|
yourFooterView.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- if(canScrollToTop())
|
|
|
+ if (canScrollToTop())
|
|
|
view_list.scrollToPosition(0);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- private boolean isEmpty(){
|
|
|
+
|
|
|
+ private boolean isEmpty() {
|
|
|
return view_list.getAdapter().getItemCount() == 0;
|
|
|
}
|
|
|
- private boolean canScrollToTop(){
|
|
|
+
|
|
|
+ private boolean canScrollToTop() {
|
|
|
return view_list.getAdapter().getItemCount() > 10;
|
|
|
}
|
|
|
});
|
|
|
@@ -537,7 +544,7 @@ public class ViewUtil {
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
- public static View setBottomLine(final SmartRefreshLayout refreshLayout, final Action1<String> action1){
|
|
|
+ public static View setBottomLine(final SmartRefreshLayout refreshLayout, final Action1<String> action1) {
|
|
|
View view = LayoutInflater.from(SheepApp.getInstance()).inflate(action1 != null ? R.layout.empty : R.layout.common_foot_view, null);
|
|
|
TextView bottom_line_text = view.findViewById(R.id.bottom_line_text);
|
|
|
bottom_line_text.setText("点击加载更多...");
|
|
|
@@ -549,6 +556,7 @@ public class ViewUtil {
|
|
|
});
|
|
|
return view;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* popwindow消失监听类,消失恢复window透明度
|
|
|
*/
|
|
|
@@ -593,13 +601,49 @@ public class ViewUtil {
|
|
|
View view = LayoutInflater.from(activity).inflate(R.layout.x_recommend_dialog, dialog_center_ll, true);
|
|
|
dialog_title.setText("推荐给好友");
|
|
|
|
|
|
- TextView withdrawal = view.findViewById(R.id.withdrawal);
|
|
|
- TextView tv_link = view.findViewById(R.id.tv_link);
|
|
|
+ View wx = view.findViewById(R.id.but_share_wx);
|
|
|
+ View qq = view.findViewById(R.id.but_share_qq);
|
|
|
+ View pyq = view.findViewById(R.id.but_share_pyq);
|
|
|
+ View zone = view.findViewById(R.id.but_share_zone);
|
|
|
+ final View url = view.findViewById(R.id.but_share_link);
|
|
|
TextView save_pic = view.findViewById(R.id.save_pic);
|
|
|
final ImageView iv_qr = view.findViewById(R.id.iv_qr);
|
|
|
|
|
|
- if (!TextUtils.isEmpty(link))
|
|
|
- tv_link.setText(link);
|
|
|
+ /* 分享到微信 */
|
|
|
+ wx.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ shareAction(activity, link, SHARE_MEDIA.WEIXIN);
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /* 分享到QQ */
|
|
|
+ qq.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ shareAction(activity, link, SHARE_MEDIA.QQ);
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /* 分享到朋友圈 */
|
|
|
+ pyq.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ shareAction(activity, link, SHARE_MEDIA.WEIXIN_CIRCLE);
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /* 分享到QQ空间 */
|
|
|
+ zone.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ shareAction(activity, link, SHARE_MEDIA.QZONE);
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
GlideImageLoader.saveAndSetRqImage(iv_qr, link, 800);
|
|
|
dialog_close.setOnClickListener(new View.OnClickListener() {
|
|
|
@@ -609,12 +653,12 @@ public class ViewUtil {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- withdrawal.setOnClickListener(new View.OnClickListener() {
|
|
|
+ url.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
QR_COPY.onEvent();
|
|
|
StringUtils.CopyText(link);
|
|
|
- G.showToast("复制链接成功");
|
|
|
+ G.showToast("复制链接成功!");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -643,14 +687,58 @@ public class ViewUtil {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 创建链接并分享
|
|
|
+ *
|
|
|
+ * @param activity 上下文参数
|
|
|
+ * @param url 分享链接
|
|
|
+ * @param media 分享平台
|
|
|
+ */
|
|
|
+ private static void shareAction(Activity activity, String url, SHARE_MEDIA media) {
|
|
|
+ /* 缩略图 */
|
|
|
+ UMImage image = new UMImage(activity, R.drawable.icon);
|
|
|
+ /* URL */
|
|
|
+ UMWeb web = new UMWeb(url);
|
|
|
+ /* 标题 */
|
|
|
+ web.setTitle("赚钱就来小绵羊");
|
|
|
+ web.setThumb(image);
|
|
|
+ web.setDescription("更懂你的赚钱工具,超多福利,超多赏金,拿到你手软!");
|
|
|
+ ShareAction action = new ShareAction(activity);
|
|
|
+ action.setPlatform(media);
|
|
|
+ action.withMedia(web);
|
|
|
+ action.setCallback(new UMShareListener() {
|
|
|
+ @Override
|
|
|
+ public void onStart(SHARE_MEDIA share_media) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResult(SHARE_MEDIA share_media) {
|
|
|
+ G.showToast("分享成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(SHARE_MEDIA share_media, Throwable throwable) {
|
|
|
+ G.showToast("分享失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCancel(SHARE_MEDIA share_media) {
|
|
|
+ G.showToast("您已取消分享!");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ action.share();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 领取福利成功的对话框
|
|
|
*
|
|
|
* @param activity
|
|
|
* @param item
|
|
|
*/
|
|
|
public static void showGetWelfareDialog(final Activity activity, final GiftBagApp item) {
|
|
|
- showGetWelfareDialog(activity, item,null);
|
|
|
+ showGetWelfareDialog(activity, item, null);
|
|
|
}
|
|
|
+
|
|
|
public static void showGetWelfareDialog(final Activity activity, final GiftBagApp item, final String packageName) {
|
|
|
View dialog_parent = View.inflate(activity, R.layout.dialog_parent, null);
|
|
|
final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.MyDialogActivityTheme)
|
|
|
@@ -686,9 +774,9 @@ public class ViewUtil {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
dialog.dismiss();
|
|
|
- GIFT_BAG_DIALOG_START_APP.onEvent("gift_bag_id", item.getGift_bag().getId(), "package_name", TextUtils.isEmpty(packageName)?item.getApp().getPackage_names():packageName);
|
|
|
+ GIFT_BAG_DIALOG_START_APP.onEvent("gift_bag_id", item.getGift_bag().getId(), "package_name", TextUtils.isEmpty(packageName) ? item.getApp().getPackage_names() : packageName);
|
|
|
//启动游戏
|
|
|
- PackageUtil.startApp(activity, TextUtils.isEmpty(packageName)?item.getApp().getPackage_names():packageName);
|
|
|
+ PackageUtil.startApp(activity, TextUtils.isEmpty(packageName) ? item.getApp().getPackage_names() : packageName);
|
|
|
}
|
|
|
});
|
|
|
dialog_btn_left.setOnClickListener(new View.OnClickListener() {
|
|
|
@@ -1232,16 +1320,17 @@ public class ViewUtil {
|
|
|
payEntity.setGame_name(gameName);
|
|
|
newInstance().showGamePayAccount(activity, payEntity);
|
|
|
}
|
|
|
+
|
|
|
public static void showGamePayAccount(Activity activity, TaskEty taskEty) {
|
|
|
PayEntity payEntity = new PayEntity();
|
|
|
payEntity.setGame_id(taskEty.getThird_task_id());
|
|
|
payEntity.setGame_name(taskEty.getName());
|
|
|
- payEntity.setTask_type(taskEty.getTask_type()+"");
|
|
|
+ payEntity.setTask_type(taskEty.getTask_type() + "");
|
|
|
newInstance().showGamePayAccount(activity, payEntity);
|
|
|
}
|
|
|
|
|
|
public void showGamePayAccount(Activity activity, PayEntity payEntity) {
|
|
|
- GAME_INSTEAD_OF_RECHARGE_PLATFORM.onEvent("game_id", payEntity.getGame_id()+"", "name", payEntity.getGame_name()+"");
|
|
|
+ GAME_INSTEAD_OF_RECHARGE_PLATFORM.onEvent("game_id", payEntity.getGame_id() + "", "name", payEntity.getGame_name() + "");
|
|
|
new DialogPayAccount(activity, payEntity).showPayaccount();
|
|
|
}
|
|
|
|
|
|
@@ -1403,8 +1492,10 @@ public class ViewUtil {
|
|
|
public void showAddAccount(Activity activity, Action1<Integer> action1) {
|
|
|
new DialogAddAccount(activity).showAddAccount(action1);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 幂动详情diaolog
|
|
|
+ *
|
|
|
* @param activity
|
|
|
* @param action1
|
|
|
*/
|
|
|
@@ -1412,7 +1503,7 @@ public class ViewUtil {
|
|
|
new DialogMidong(activity).showMidongDialog(isSign, data);
|
|
|
}
|
|
|
|
|
|
- public static void showShareDialog(final Activity activity, final String url, final String description){
|
|
|
+ public static void showShareDialog(final Activity activity, final String url, final String description) {
|
|
|
View dialog_parent = View.inflate(activity, R.layout.ask_to_share, null);
|
|
|
final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.AppTheme_Dialog_Alert)
|
|
|
.setView(dialog_parent)
|
|
|
@@ -1474,7 +1565,7 @@ public class ViewUtil {
|
|
|
try {
|
|
|
dialog.show();
|
|
|
Window window = dialog.getWindow();
|
|
|
- if(window != null) {
|
|
|
+ if (window != null) {
|
|
|
window.setGravity(Gravity.BOTTOM);
|
|
|
WindowManager.LayoutParams params = window.getAttributes();
|
|
|
params.width = G.WIDTH > G.HEIGHT ? G.HEIGHT : G.WIDTH;
|
|
|
@@ -1540,12 +1631,12 @@ public class ViewUtil {
|
|
|
* R.color.green
|
|
|
* R.color.yellow_text_light
|
|
|
* R.color.black_text_gray
|
|
|
- *
|
|
|
- android:textColor="#cc8e8e8e"
|
|
|
- android:textSize="10sp"
|
|
|
- R.drawable.shape_blue_stroke_rectangle_no_lb
|
|
|
+ * <p>
|
|
|
+ * android:textColor="#cc8e8e8e"
|
|
|
+ * android:textSize="10sp"
|
|
|
+ * R.drawable.shape_blue_stroke_rectangle_no_lb
|
|
|
*/
|
|
|
- public View paintView(Context context, String text, int color, int drawable){
|
|
|
+ public View paintView(Context context, String text, int color, int drawable) {
|
|
|
|
|
|
View view = LayoutInflater.from(context).inflate(R.layout.game_tag_textview, null, false);
|
|
|
TextView textView = view.findViewById(R.id.user_label_tv);
|
|
|
@@ -1555,9 +1646,9 @@ public class ViewUtil {
|
|
|
textView.setBackgroundResource(drawable);
|
|
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
|
|
|
int padding = textView.getContext().getResources().getDimensionPixelSize(R.dimen.content_padding_2);
|
|
|
- textView.setPadding(2* padding, padding, 2 * padding, padding);
|
|
|
+ textView.setPadding(2 * padding, padding, 2 * padding, padding);
|
|
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(textView.getLayoutParams());
|
|
|
- lp.setMargins(0,0,padding,0);
|
|
|
+ lp.setMargins(0, 0, padding, 0);
|
|
|
textView.setLayoutParams(lp);
|
|
|
|
|
|
return view;
|