Commit 6890a753 authored by mengcuiguang's avatar mengcuiguang

添加喝水界面

parent e4634a4a
......@@ -168,6 +168,7 @@ public interface Constant {
String CARRIER_HOTACTIVITY = "HOTACTIVITY";//热门活动
String CARRIER_ROTATIONCHART = "ROTATIONCHART";//轮播图
String CARRIER_YILANVEIDO_REDENVELOPE = "YILANVEIDO_REDENVELOPE";//yl视频红包
String CARRIER_WALK_BUBBLE = "WALK_BUBBLE";//走路第4个汽泡
String CARRIER_CHALLENGE_FIRSTWATER = "CHALLENGE_FIRSTWATER";//首次喝水挑战
String CARRIER_CHALLENGE_IDCODE = "CHALLENGE_IDCODE";//绑定邀请码挑战
......
......@@ -6,13 +6,16 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.widget.RemoteViews;
import com.mints.highgold.MintsApplication;
import com.mints.highgold.R;
import com.mints.highgold.ui.activitys.MainActivity;
import com.mints.highgold.utils.SpanUtils;
import static android.content.Context.NOTIFICATION_SERVICE;
......@@ -21,7 +24,7 @@ import static android.content.Context.NOTIFICATION_SERVICE;
*/
public class NotifyManager {
public static final String CHINALL_ID = "MINTS_GOLDSPACE";
public static final String CHINALL_ID = "GOLDSPACE";
public static final String CHINALL_NAME = "淘金高额版通知";
private static NotifyManager _inst;
......@@ -46,13 +49,14 @@ public class NotifyManager {
/**
* 创建通知
*
* @param water
* @param step
*/
public void createNotifyDialog(int water, int step) {
manager = (NotificationManager) activity.getSystemService(NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel(CHINALL_ID, CHINALL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
createNotificationChannel(CHINALL_ID, CHINALL_NAME, NotificationManager.IMPORTANCE_MAX);
}
notification = new NotificationCompat.Builder(activity, CHINALL_ID)
.setOngoing(true)
......@@ -60,10 +64,11 @@ public class NotifyManager {
.setContentTitle("")
.setContentText("")
.setWhen(System.currentTimeMillis())
.setOngoing(true)
.setSmallIcon(R.mipmap.ic_launcher)
.setContent(getRemoteViews(water, step))
.setVibrate(new long[]{0})
.build();
updateRemoteView(water, step);
}
......@@ -73,6 +78,8 @@ public class NotifyManager {
@TargetApi(Build.VERSION_CODES.O)
private void createNotificationChannel(String channelId, String channelName, int importance) {
NotificationChannel channel = new NotificationChannel(channelId, channelName, importance);
channel.enableVibration(false);//震动不可用
channel.setSound(null, null); //设置没有声
NotificationManager notificationManager = (NotificationManager) activity.getSystemService(
NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(channel);
......@@ -89,10 +96,9 @@ public class NotifyManager {
Intent intent = new Intent(activity, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(activity, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
remoteViews = new RemoteViews(activity.getPackageName(), R.layout.remoteview);
remoteViews.setTextViewText(R.id.tv_left, "开始" + System.currentTimeMillis());//设置textView内容
remoteViews.setTextViewText(R.id.tv_right, "跳转" + step);//设置textView内容
remoteViews.setImageViewResource(R.id.icon, R.mipmap.ic_launcher);//设置图片样式
remoteViews.setOnClickPendingIntent(R.id.tv_right, pendingIntent);//点击跳转事件
remoteViews.setTextViewText(R.id.notify_step, "今日步数 " + step + " 步");
remoteViews.setImageViewResource(R.id.icon, R.mipmap.ic_launcher);
remoteViews.setOnClickPendingIntent(R.id.notify_root, pendingIntent);
return remoteViews;
}
......@@ -103,8 +109,15 @@ public class NotifyManager {
* @param step
*/
public void updateRemoteView(int water, int step) {
if (remoteViews != null) {
remoteViews.setTextViewText(R.id.tv_right, "跳转" + step);//设置textView内容
Context context = MintsApplication.getContext();
if (remoteViews != null && context != null) {
// remoteViews.setTextViewText(R.id.notify_step,
// new SpanUtils()
// .append("今日步数 ").setForegroundColor(context.getResources().getColor(R.color.black_text))
// .append(step + "").setBold().setForegroundColor(context.getResources().getColor(R.color.main_mints))
// .append(" 步").setForegroundColor(context.getResources().getColor(R.color.black_text))
// .create());//设置textView内容
remoteViews.setTextViewText(R.id.notify_step, "今日步数 " + step + " 步");
if (manager != null && notification != null) {
manager.notify(1, notification);
}
......
......@@ -45,6 +45,8 @@ public class TTAdManagerHolder {
/*信息流*/
public static final String TT_AD_NATIVEEXPRESS_ID_DIALOG = "945131750";//信息流弹窗
public static final String TT_AD_NATIVEEXPRESS_ID_WATER1 = "945450706";//喝水界面1
public static final String TT_AD_NATIVEEXPRESS_ID_WATER2 = "945450708";//喝水界面2
public static final String TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT = "945131730";//猎豹列表和退出
/*全屏广告*/
......
......@@ -14,6 +14,7 @@ import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.mints.highgold.ui.widgets.DislikeDialog;
import com.mints.highgold.utils.LogUtil;
import java.util.List;
......@@ -81,7 +82,6 @@ public class TTNativeExpressManager {
* 获取穿山甲banner
*
* @param context
* @param frameLayout
* @param viewWidth
* @param viewHeight
*/
......@@ -100,6 +100,8 @@ public class TTNativeExpressManager {
mTTAdNative.loadNativeExpressAd(adSlot, new TTAdNative.NativeExpressAdListener() {
@Override
public void onError(int code, String message) {
LogUtil.d("TTNativeExpressManager",message);
if (view != null) {
view.removeAllViews();
}
......
package com.mints.highgold.mvp.model;
import java.io.Serializable;
public class WalkBean implements Serializable {
//"walk":"步数"
// "coin":"走路气泡"
// maxWalk 步数上限
// isWalk 是否领取奖励
// walkText 下次奖励内容
private int walk;
private int coin;
private int maxWalk;
private boolean isWalk;
private String walkText;
public int getWalk() {
return walk;
}
public int getCoin() {
return coin;
}
public int getMaxWalk() {
return maxWalk;
}
public boolean isWalk() {
return isWalk;
}
public String getWalkText() {
return walkText;
}
}
......@@ -17,6 +17,7 @@ import com.mints.highgold.mvp.model.LocationBean;
import com.mints.highgold.mvp.model.MainWaterBean;
import com.mints.highgold.mvp.model.UserBean;
import com.mints.highgold.mvp.model.UserTaskMsgBean;
import com.mints.highgold.mvp.model.WalkBean;
import com.mints.highgold.mvp.views.LoanView;
import com.mints.highgold.utils.DeviceUuidFactory;
import com.mints.highgold.utils.DevicesUtil;
......@@ -141,7 +142,7 @@ public class LoanPresenter extends BasePresenter<LoanView> {
public void getWalkMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getWalkMsg(),
new BaseSubscriber<BaseResponse<MainWaterBean>>() {
new BaseSubscriber<BaseResponse<WalkBean>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
......@@ -158,7 +159,7 @@ public class LoanPresenter extends BasePresenter<LoanView> {
}
@Override
public void onNext(BaseResponse<MainWaterBean> baseResponse) {
public void onNext(BaseResponse<WalkBean> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
......
......@@ -4,6 +4,7 @@ package com.mints.highgold.mvp.views;
import com.mints.highgold.mvp.model.GameBean;
import com.mints.highgold.mvp.model.MainWaterBean;
import com.mints.highgold.mvp.model.UserTaskMsgBean;
import com.mints.highgold.mvp.model.WalkBean;
public interface LoanView extends BaseView {
......@@ -34,7 +35,7 @@ public interface LoanView extends BaseView {
*
* @param data
*/
void getWalkMsgSuc(MainWaterBean data);
void getWalkMsgSuc(WalkBean data);
/**
* 提交游戏信息
......
......@@ -36,27 +36,8 @@ public interface WaterView extends BaseView {
*/
void getWaterMsgHomeSuc(MainWaterBean data);
/**
* 提交游戏信息
*
* @param data
*/
void gameAddSuc(String eventType, Object data);
/**
* 获取server端游戏列表
*
* @param data
*/
void getGameListSuc(GameBean data);
/**
* 首页喝水打卡成功
*/
void clickForWaterSuc(int waterCoin);
/**
* 获取红包状态成功
*/
void getRedboxEnterSuc();
}
......@@ -26,6 +26,7 @@ import com.mints.highgold.mvp.model.UserBean;
import com.mints.highgold.mvp.model.UserTaskMsgBean;
import com.mints.highgold.mvp.model.UserVersusBean;
import com.mints.highgold.mvp.model.Version;
import com.mints.highgold.mvp.model.WalkBean;
import com.mints.highgold.mvp.model.WaterMsgBean;
import com.mints.highgold.utils.AESUtils;
import com.mints.highgold.utils.SPUtil;
......@@ -370,7 +371,7 @@ public interface LoanService {
* @return
*/
@POST("api/hv110/getWalkMsg")
Observable<BaseResponse<MainWaterBean>> getWalkMsg();
Observable<BaseResponse<WalkBean>> getWalkMsg();
/**
* 猎豹游戏 上传信息
......
......@@ -36,15 +36,18 @@ import com.mints.highgold.common.Constant;
import com.mints.highgold.manager.AdMngrHolder;
import com.mints.highgold.manager.AmapLocationManager;
import com.mints.highgold.manager.LiebaoManager;
import com.mints.highgold.manager.NotifyManager;
import com.mints.highgold.manager.ShumeiManager;
import com.mints.highgold.manager.TTAdManagerHolder;
import com.mints.highgold.manager.TTBannerManager;
import com.mints.highgold.manager.TTNativeExpressManager;
import com.mints.highgold.manager.TTPreLoadExpressManager;
import com.mints.highgold.manager.UserManager;
import com.mints.highgold.mvp.model.GameBean;
import com.mints.highgold.mvp.model.MainWaterBean;
import com.mints.highgold.mvp.model.UserTaskMsgBean;
import com.mints.highgold.mvp.model.VedioAdingBean;
import com.mints.highgold.mvp.model.WalkBean;
import com.mints.highgold.mvp.presenters.LoanPresenter;
import com.mints.highgold.mvp.views.LoanView;
import com.mints.highgold.ui.activitys.AdWebActivity;
......@@ -115,8 +118,6 @@ public class MainFragment extends BaseFragment
StepView wvWater;
@Bind(R.id.iv_fragment_main_gift)
ImageView ivFragmentMainGift;
@Bind(R.id.tv_fragment_main_friend_hint)
TextView tvFragmentMainFriendHint;
@Bind(R.id.tv_fragment_main_gamehint)
TextView tvFragmentMainGamehint;
@Bind(R.id.rl_fragment_main_redbox)
......@@ -160,8 +161,9 @@ public class MainFragment extends BaseFragment
private boolean isShowGiftPop = false;// true-点击过pop
private TTBannerManager ttUtil;
private MainWaterBean waterBean;
private WalkBean waterBean;
private MintegralInscreenVedioAdManager mintegralInscreenVedioAdManager;
private NotifyManager notifyManager;
@Override
protected int getContentViewLayoutID() {
......@@ -394,7 +396,7 @@ public class MainFragment extends BaseFragment
}
break;
case R.id.ll_fragment_main_friend:// 邀请好友
readyGo(FriendsNewActivity.class);
readyGo(WaterActivity.class);
// readyGo(AdWebActivity.class);
break;
case R.id.iv_fragment_main_banner:
......@@ -655,51 +657,36 @@ public class MainFragment extends BaseFragment
}
@Override
public void getWalkMsgSuc(MainWaterBean data) {
public void getWalkMsgSuc(WalkBean data) {
if (data == null) {
waterBean = null;
return;
}
waterBean = data;
// wvWater.setWaterMaxProgress(data.getNeedDrink());
wvWater.setWaterProgress(data.getComplete(), data.getNeedDrink());
// 老用户未登录
if (spUtil.getBoolean(Constant.USER_DEVICE_LOGIN, false) && !userManager.userIsLogin()) {
wvWater.setTvDrinkBtnText("去登录");
}
// 喝水按钮状态
if (data.isStatus()) {
wvWater.setWaterMaxProgress(data.getMaxWalk());
wvWater.setWaterProgress(data.getWalk(), data.getMaxWalk());
// 是否可领取奖励
if (data.isWalk()) {
wvWater.setTvDrinkBtnEnable();
} else {
wvWater.setTvDrinkBtnNone();
}
// 喝水时间
if (data.getNextGetCoinTime() > 0) {
if (!AppConfig.isMintegralInscreenFlag) {
if (mintegralInscreenVedioAdManager != null) {
mintegralInscreenVedioAdManager.loadMintegralInscreen();
}
}
wvWater.setTvDrinkBtnText("喝水打卡");
// wvWater.setWaterViewTime(getActivity(), data.getNextGetCoinTime());
wvWater.setTvDrinkBtnText(data.getWalkText());
if (data.getCoin() > 0) {
wvWater.setFourWaterViewVisible(data.getCoin());
} else {
wvWater.setTvDrinkBtnText("喝水领金币");
// wvWater.setWaterViewTimeGone();
}
if (spUtil.getBoolean(Constant.USER_DEVICE_LOGIN, false) && !userManager.userIsLogin()) {
wvWater.setTvDrinkBtnText("去登录");
wvWater.setFourWaterViewGone();
}
// 第4个汽泡
if (userManager.getAdShowFlag()) {
if (data.getCoin() > 0) {
wvWater.setFourWaterViewVisible(data.getCoin());
} else {
wvWater.setFourWaterViewGone();
}
} else {
wvWater.setFourWaterViewGone();
if (notifyManager != null) {
notifyManager.updateRemoteView(0, data.getWalk());
}
}
......@@ -746,7 +733,7 @@ public class MainFragment extends BaseFragment
if (waterCoin > 0) {
// 显示喝水金币
bundle.putInt(Constant.MAIN_CUR_COIN, waterCoin);
bundle.putString(Constant.MAIN_CARRIET_TURN, Constant.CARRIER_HOMEWATER_BUBBLE_TIME);
bundle.putString(Constant.MAIN_CARRIET_TURN, Constant.CARRIER_WALK_BUBBLE);
} else {
bundle.putString(Constant.MAIN_CARRIET_TURN, Constant.CARRIER_HOMEWATER_HIT);
}
......@@ -892,6 +879,8 @@ public class MainFragment extends BaseFragment
userManager = UserManager.getInstance();
liebaoManager = LiebaoManager.getInstance();
vedioAdingManager = VedioAdingManager.getInstance(getActivity());
notifyManager = NotifyManager.getInstance(getActivity());
notifyManager.createNotifyDialog(0, 0);
mintegralInscreenVedioAdManager = MintegralInscreenVedioAdManager.getInstance(getActivity());
mLocationHandler = new AmapLocationManager.LocationHandler(getActivity());
......@@ -1067,11 +1056,6 @@ public class MainFragment extends BaseFragment
CmGameSdk.setGameExitInfoCallback(this);
// 显示游戏文字
// tvFragmentMainFriendHint.setText(new SpanUtils().append("每邀一位得")
// .append("1000").setForegroundColor(getResources().getColor(R.color.main_mints))
// .create());
// 显示红包动画
initGiftAnim(rlFragmentMainRedbox);
......@@ -1204,6 +1188,7 @@ public class MainFragment extends BaseFragment
TextView tvDrinkWatch = v_help.findViewById(R.id.tv_maindrink_watch);
TextView tvDrinkExit = v_help.findViewById(R.id.tv_maindrink_exit);
TextView tvDrinkCash = v_help.findViewById(R.id.tv_maindrink_cash);
TextView tvDrinkWalk = v_help.findViewById(R.id.tv_maindrink_walk);
BigDecimal allcoinBig = new BigDecimal(String.valueOf(allCoin));
BigDecimal rateBig = new BigDecimal("10000");
......@@ -1219,6 +1204,8 @@ public class MainFragment extends BaseFragment
.create()
);
tvDrinkWalk.setText("当天累计超过2000步,需观看趣味视频兑换");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.notice_dialog);
drinkDialog = builder.create();
drinkDialog.setView(v_help);
......@@ -1229,7 +1216,7 @@ public class MainFragment extends BaseFragment
waterIncome = curCoin;
getRandomVedioAd(Constant.CARRIER_HOMEWATER_BUBBLE, curCoin, "", userConfig.getConfigDownloadTaskDownloadCoin());
getRandomVedioAd(Constant.CARRIER_WALK_BUBBLE, curCoin, "", userConfig.getConfigDownloadTaskDownloadCoin());
}
});
ivDrinkExit.setOnClickListener(v -> {
......
......@@ -50,9 +50,6 @@ public class StepView extends FrameLayout
private BubbleSeekBar bsStep;
private RelativeLayout rlNext;
// 喝水进度
private CircleProgress cpWater;
// 浮云金币动画
private ObjectAnimator oneAnimator;
private ObjectAnimator twoAnimator;
......@@ -145,6 +142,7 @@ public class StepView extends FrameLayout
tvTwoWater.setOnClickListener(this);
tvThreeWater.setOnClickListener(this);
tvFouroneWater.setOnClickListener(this);
tvNext.setOnClickListener(this);
}
/**
......@@ -247,7 +245,6 @@ public class StepView extends FrameLayout
} else {
bsStep.setProgress(maxProgress);
}
bsStep.setmMax(maxProgress);
}
if (tvStep != null) {
tvStep.setText(progress + "");
......@@ -260,10 +257,9 @@ public class StepView extends FrameLayout
* @param maxProgress
*/
public void setWaterMaxProgress(int maxProgress) {
// if (cpWater != null && tvDrink != null) {
// cpWater.setMaxValue(maxProgress);
// tvDrink.setText("0/" + maxProgress + "ml");
// }
if (bsStep != null) {
bsStep.setmMax(maxProgress);
}
}
/**
......
......@@ -517,7 +517,8 @@ public class BubbleSeekBar extends View {
// draw thumb
mPaint.setColor(mThumbColor);
canvas.drawCircle(mThumbCenterX, yTop, isThumbOnDragging ? mThumbRadiusOnDragging : mThumbRadius, mPaint);
// canvas.drawCircle(mThumbCenterX, yTop, isThumbOnDragging ? mThumbRadiusOnDragging : mThumbRadius, mPaint);
canvas.drawCircle(mThumbCenterX, yTop, isThumbOnDragging ? mThumbRadiusOnDragging / 2 : mThumbRadius / 2, mPaint);
}
@Override
......
......@@ -194,7 +194,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="邀请好友"
android:text="喝水打卡"
android:textColor="@color/black"
android:textSize="18sp" />
......@@ -203,7 +203,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2pt"
android:text="邀请好友来赚钱"
android:text="邀请好友来打卡"
android:textColor="@color/graya"
android:textSize="12sp" />
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/notify_root"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#0f0"
android:orientation="vertical">
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/notify_title_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/domob_dimen18"
android:layout_marginTop="@dimen/domob_dimen20">
<ImageView
android:layout_width="@dimen/domob_dimen18"
android:layout_height="@dimen/domob_dimen18"
android:src="@mipmap/ic_launcher" />
<ImageView
android:id="@+id/icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerInParent="true"
android:src="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/domob_dimen6"
android:gravity="center_vertical"
android:text="淘金空间高额版"
android:textColor="@color/black"
android:textSize="@dimen/font_size_10" />
</LinearLayout>
<TextView
android:id="@+id/tv_left"
android:id="@+id/notity_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_marginLeft="@dimen/domob_dimen18"
android:gravity="center_vertical"
android:text="Left" />
android:text="淘金空间高额版"
android:layout_marginTop="@dimen/domob_dimen10"
android:textColor="@color/black"
android:textSize="@dimen/font_size_14" />
<TextView
android:id="@+id/tv_right"
android:id="@+id/notify_step"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_marginLeft="@dimen/domob_dimen18"
android:gravity="center_vertical"
android:text="Right" />
</RelativeLayout>
android:text=""
android:layout_marginTop="4dp"
android:textColor="@color/black"
android:layout_marginBottom="20dp"
android:textSize="@dimen/font_size_14" />
</LinearLayout>
......@@ -31,6 +31,7 @@
android:visibility="gone" />
<TextView
android:id="@+id/tv_maindrink_walk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
......
......@@ -34,8 +34,8 @@
app:bsb_min="0"
app:bsb_progress="0"
app:bsb_track_size="4dp"
app:bsb_track_color="@color/gray"
app:bsb_second_track_color="@color/tv_basic_color"
app:bsb_track_color="@color/tv_basic_color"
app:bsb_second_track_color="@color/main_mints"
app:bsb_section_count="4"
app:bsb_section_text_position="below_section_mark"
app:bsb_show_section_mark="true"
......@@ -49,7 +49,7 @@
<RelativeLayout
android:id="@+id/rl_water_next"
android:layout_width="220pt"
android:layout_width="250pt"
android:layout_height="70pt"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginRight="4pt"
......@@ -65,7 +65,7 @@
android:gravity="center"
android:text="继续努力"
android:textColor="@color/water_hint_btn"
android:textSize="14sp" />
android:textSize="12sp" />
</RelativeLayout>
......
......@@ -34,4 +34,5 @@
<dimen name="font_size_13">13sp</dimen>
<dimen name="font_size_12">12sp</dimen>
<dimen name="font_size_10">10sp</dimen>
<dimen name="font_size_8">8sp</dimen>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment