|
|
@@ -1,20 +1,13 @@
|
|
|
package com.sheep.gamegroup.view.activity;
|
|
|
|
|
|
-import android.Manifest;
|
|
|
-import android.app.Activity;
|
|
|
-import android.content.DialogInterface;
|
|
|
-import android.content.Intent;
|
|
|
import android.media.MediaPlayer;
|
|
|
import android.net.Uri;
|
|
|
-import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Looper;
|
|
|
import android.os.Message;
|
|
|
-import android.provider.Settings;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
-import android.support.v7.app.AlertDialog;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -25,89 +18,58 @@ import com.bumptech.glide.Glide;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.model.entity.Advertising;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
-import com.sheep.gamegroup.model.entity.DialogConfig;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.module.skin.util.SkinUtil;
|
|
|
import com.sheep.gamegroup.util.ApiJSONUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
-import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
-import com.sheep.gamegroup.util.IDConstant;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
|
import com.sheep.gamegroup.util.RxjavaCountDownTimer;
|
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
|
-import com.sheep.gamegroup.util.ViewUtil;
|
|
|
+import com.sheep.gamegroup.view.activity.helper.SplashHelper;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
|
|
|
import org.afinal.simplecache.ApiKey;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.OnClick;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
-import pub.devrel.easypermissions.AfterPermissionGranted;
|
|
|
-import pub.devrel.easypermissions.EasyPermissions;
|
|
|
-
|
|
|
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_ACT;
|
|
|
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_GMAE;
|
|
|
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_INFORMATION;
|
|
|
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_FIND_RECOMMEND;
|
|
|
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_GMAE;
|
|
|
-import static com.sheep.gamegroup.util.CommonUtil.JUMP_WATCH_FOCUS;
|
|
|
+
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.AD_SPLASH;
|
|
|
|
|
|
/**
|
|
|
* Created by ljy on 2018/3/9.
|
|
|
*/
|
|
|
|
|
|
-public class SplashAct extends BaseActivity implements EasyPermissions.PermissionCallbacks {
|
|
|
+public class SplashAct extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
- protected void initSlidr(){
|
|
|
+ protected void initSlidr() {
|
|
|
// doNothing
|
|
|
}
|
|
|
- @BindView(R.id.login_bg_img)
|
|
|
- ImageView login_bg_img;
|
|
|
- @BindView(R.id.splash_bg)
|
|
|
- ImageView splash_bg;
|
|
|
+
|
|
|
+ @BindView(R.id.splash_image_view)
|
|
|
+ ImageView splash_image_view;
|
|
|
@BindView(R.id.splash_skip)
|
|
|
TextView splash_skip;
|
|
|
- // @BindView(R.id.splash_know_ad_tv)
|
|
|
- TextView splash_know_ad_tv;
|
|
|
-
|
|
|
-
|
|
|
@BindView(R.id.splash_video_view)
|
|
|
VideoView splash_video_view;
|
|
|
- @BindView(R.id.btn_join)
|
|
|
- TextView btnJoin;
|
|
|
- private Activity activity;
|
|
|
-
|
|
|
- VideoView videoView;
|
|
|
- private boolean isClick;
|
|
|
private boolean goLink;//跳转到了广告对应的页面
|
|
|
|
|
|
- private static final int PERMISSON_REQUESTCODE = 1;
|
|
|
- /**
|
|
|
- * 需要进行检测的权限数组
|
|
|
- */
|
|
|
- protected String[] needPermissions = {
|
|
|
- Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
- Manifest.permission.READ_EXTERNAL_STORAGE,
|
|
|
- };
|
|
|
private RxjavaCountDownTimer timer;
|
|
|
|
|
|
+ private Advertising advertising;
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
-
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ hideSystemStatusBar();
|
|
|
+ hideSystemNavBar();
|
|
|
try {
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
- hideSystemStatusBar();
|
|
|
- hideSystemNavBar();
|
|
|
if (!isTaskRoot()) {
|
|
|
LogUtil.println("SheepApp SplashAct isTaskRoot");
|
|
|
finish();
|
|
|
@@ -115,378 +77,205 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if(!TextUtils.isEmpty(SpUtils.getToken(SheepApp.getInstance())))
|
|
|
+ if (!TextUtils.isEmpty(SpUtils.getToken(SheepApp.getInstance()))) {
|
|
|
ApiJSONUtil.postUserDeviceLog();
|
|
|
+ }
|
|
|
+ if (SplashHelper.requestStoragePermission(this)) {
|
|
|
+ init();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected void onStart() {
|
|
|
- super.onStart();
|
|
|
- LogUtil.println("SplashAct onStart");
|
|
|
- requestCodePermissions();
|
|
|
- }
|
|
|
-
|
|
|
- private boolean isRequestCodePermissions = true;//是否正在获取权限或者没有获取到权限
|
|
|
-
|
|
|
- @AfterPermissionGranted(PERMISSON_REQUESTCODE)
|
|
|
- private void requestCodePermissions() {
|
|
|
- if (!EasyPermissions.hasPermissions(this, needPermissions)) {
|
|
|
- EasyPermissions.requestPermissions(this, "应用需要这些权限", PERMISSON_REQUESTCODE, needPermissions);
|
|
|
- } else {
|
|
|
- isRequestCodePermissions = false;
|
|
|
- sendHandlerMessages(1000);
|
|
|
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
|
+ if (SplashHelper.requestStoragePermission(this)) {
|
|
|
+ init();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Handler mHandler = new Handler(Looper.getMainLooper()) {
|
|
|
- @Override
|
|
|
- public void handleMessage(Message msg) {
|
|
|
- super.handleMessage(msg);
|
|
|
- switch (msg.what) {
|
|
|
- case 0:
|
|
|
- if (!isRequestCodePermissions && !isLoadingData && timerIsFinish() && !goLink)
|
|
|
- gotoNext();
|
|
|
- else
|
|
|
- sendHandlerMessages(100);
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if (SysAppUtil.isNewSmallSheep() || TestUtil.isDev()) {//新版本只显示引导页面,不展示弹窗和开屏广告
|
|
|
- isLoadingData = false;
|
|
|
- initAdvertisement(false);//只更新,不加载,下次加载上次的数据
|
|
|
- } else {
|
|
|
- Advertising cacheAdvertising = DataUtil.getInstance().getCacheResult(ApiKey.advertisements(1), Advertising.class);
|
|
|
- if (cacheAdvertising != null) {
|
|
|
- isLoadingData = false;
|
|
|
- advertising = cacheAdvertising;
|
|
|
- try {
|
|
|
- loadAdvertising();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- initAdvertisement(false);//只更新,不加载,下次加载上次的数据
|
|
|
- } else {
|
|
|
- initAdvertisement(true);
|
|
|
- }
|
|
|
- }
|
|
|
- sendHandlerMessages(200);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 调用接口更新开屏广告数据
|
|
|
- * @param isLoad 是否加载数据
|
|
|
- */
|
|
|
- private void initAdvertisement(boolean isLoad) {
|
|
|
- SheepApp.getInstance().getNetComponent().getApiService().getAdvertising(1)
|
|
|
+ private void init() {
|
|
|
+ if (SplashHelper.isNotSupport(this)) return;
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().checkUserFirst()
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(activity) {
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
@Override
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
- isLoadingData = false;
|
|
|
- if(isLoad) {
|
|
|
- advertising = baseMessage.getData(Advertising.class);
|
|
|
- try {
|
|
|
- loadAdvertising();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
+ boolean isNewSmallSheep = baseMessage.getData(Boolean.class);
|
|
|
+ handleResult(isNewSmallSheep);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(BaseMessage baseMessage) {
|
|
|
- isLoadingData = false;
|
|
|
+ //访问出错时,认为不是新设备
|
|
|
+ handleResult(false);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- private boolean timerIsFinish() {
|
|
|
- return timer == null || splash_skip.getVisibility() == View.INVISIBLE;
|
|
|
- }
|
|
|
-
|
|
|
- private void gotoNext() {
|
|
|
- if (!isClick) {
|
|
|
- isClick = true;
|
|
|
- SkinUtil.changeSkin(s -> Jump2View.getInstance().gotoGuide(activity));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- protected int getLayoutId() {
|
|
|
- return R.layout.splash_activity;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void initView() {
|
|
|
- activity = this;
|
|
|
- GlideImageLoader.setImage(login_bg_img, "http://cdngame.kuaifazs.com/login_bg_img.png");
|
|
|
-// if(BuildConfig.DEBUG){
|
|
|
-// Jump2View.getInstance().checkCommendApp(activity, null);
|
|
|
-// } else {
|
|
|
-// mHandler.sendEmptyMessageDelayed(1, 500);
|
|
|
-// }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void initListener() {
|
|
|
|
|
|
+ private void handleResult(boolean isNewSmallSheep) {
|
|
|
+ DataUtil.getInstance().setIsNewSmallSheep(isNewSmallSheep);
|
|
|
+ if (SysAppUtil.isNewSmallSheep() || TestUtil.isDev()) {//新版本只显示引导页面,不展示弹窗和开屏广告
|
|
|
+ initAdvertisement(false);//只更新,不加载,下次加载上次的数据
|
|
|
+ } else {
|
|
|
+ Advertising cacheAdvertising = DataUtil.getInstance().getCacheResult(ApiKey.advertisements(1), Advertising.class);
|
|
|
+ if (cacheAdvertising != null) {
|
|
|
+ advertising = cacheAdvertising;
|
|
|
+ loadAdvertising();
|
|
|
+ initAdvertisement(false);//只更新,不加载,下次加载上次的数据
|
|
|
+ } else {
|
|
|
+ initAdvertisement(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- private boolean isLoadingData = true;//是否正在获取开屏广告数据
|
|
|
- private Advertising advertising;
|
|
|
-
|
|
|
- @Override
|
|
|
- public void initData() {
|
|
|
- if(isNotSupport()){
|
|
|
- return;
|
|
|
- }
|
|
|
- SheepApp.getInstance().getNetComponent().getApiService().checkUserFirst()
|
|
|
+ private void initAdvertisement(boolean isLoad) {
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getAdvertising(1)
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(this) {
|
|
|
@Override
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
- boolean isNewSmallSheep = baseMessage.getData(Boolean.class);
|
|
|
- DataUtil.getInstance().setIsNewSmallSheep(isNewSmallSheep);
|
|
|
- mHandler.sendEmptyMessageDelayed(1, 300);
|
|
|
+ if (isLoad) {
|
|
|
+ advertising = baseMessage.getData(Advertising.class);
|
|
|
+ loadAdvertising();
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(BaseMessage baseMessage) {
|
|
|
- //访问出错时,认为不是新设备
|
|
|
- DataUtil.getInstance().setIsNewSmallSheep(false);
|
|
|
- mHandler.sendEmptyMessageDelayed(1, 300);
|
|
|
+ if (isLoad) {
|
|
|
+ sendHandlerMessages(2000);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private boolean isNotSupport() {
|
|
|
- if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1){
|
|
|
- ViewUtil.showMsgDialog(this, new DialogConfig().setMsg("尊敬的羊羊用户,智能绵羊管家检测到你系统版本过低,已为你推荐了优质通道,是否立即前往?")
|
|
|
- .setBtnLeftText("知道了").setBtnRightText("前往").setBtnRightOnClickListener(view -> Jump2View.getInstance().goWeb(this, "http://shop.17xmy.com/mobile/category.php?id=144")));
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
private void loadAdvertising() {
|
|
|
if (advertising.isImage()) {
|
|
|
- Glide.with(activity).load(advertising.getDisplay_src()).into(splash_bg);
|
|
|
-// btnJoin.setVisibility(View.GONE);
|
|
|
+ Glide.with(this).load(advertising.getDisplay_src()).into(splash_image_view);
|
|
|
splash_video_view.setVisibility(View.GONE);
|
|
|
} else {
|
|
|
Uri uri = Uri.parse(advertising.getDisplay_src());
|
|
|
splash_video_view.setVisibility(View.VISIBLE);
|
|
|
- videoView = splash_video_view;
|
|
|
- videoView.setOnInfoListener(new MediaPlayer.OnInfoListener() {
|
|
|
+ splash_video_view.setOnInfoListener(new MediaPlayer.OnInfoListener() {
|
|
|
@Override
|
|
|
public boolean onInfo(MediaPlayer mediaPlayer, int what, int extra) {
|
|
|
if (!mediaPlayer.isLooping())
|
|
|
mediaPlayer.setLooping(true);
|
|
|
LogUtil.println("onInfo what = " + what + " extra = " + extra);
|
|
|
if (MediaPlayer.MEDIA_INFO_BUFFERING_START == what) {
|
|
|
- splash_bg.setVisibility(View.GONE);
|
|
|
-// btnJoin.setVisibility(View.GONE);
|
|
|
+ splash_image_view.setVisibility(View.GONE);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
- videoView.setVideoURI(uri);
|
|
|
- videoView.start();
|
|
|
- videoView.requestFocus();
|
|
|
+ splash_video_view.setVideoURI(uri);
|
|
|
+ splash_video_view.start();
|
|
|
+ splash_video_view.requestFocus();
|
|
|
}
|
|
|
|
|
|
- if (splash_know_ad_tv != null)
|
|
|
- splash_know_ad_tv.setVisibility(View.VISIBLE);
|
|
|
mHandler.removeMessages(0);
|
|
|
if (advertising.getShow_time() > 0) {
|
|
|
splash_skip.setVisibility(View.VISIBLE);
|
|
|
- timer = RxjavaCountDownTimer.getInstance(/*BuildConfig.DEBUG ? 10 : */advertising.getShow_time())
|
|
|
+ timer = RxjavaCountDownTimer.getInstance(advertising.getShow_time())
|
|
|
.setOnTickListener(new RxjavaCountDownTimer.OnTickListener() {
|
|
|
@Override
|
|
|
public void onFinish() {
|
|
|
splash_skip.setVisibility(View.INVISIBLE);//设置为INVISIBLE代表定时器结束
|
|
|
-// btnJoin.setVisibility(View.VISIBLE);
|
|
|
if (isResume)
|
|
|
sendHandlerMessages(10);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onTicker(long time) {
|
|
|
- splash_skip.setText(activity.getString(R.string.tip_skip, time));
|
|
|
+ splash_skip.setText(getString(R.string.tip_skip, time));
|
|
|
}
|
|
|
}).start();
|
|
|
} else {
|
|
|
-// btnJoin.setVisibility(View.VISIBLE);
|
|
|
sendHandlerMessages(1000);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private boolean isResume = false;
|
|
|
+ Handler mHandler = new Handler(Looper.getMainLooper()) {
|
|
|
+ @Override
|
|
|
+ public void handleMessage(Message msg) {
|
|
|
+ super.handleMessage(msg);
|
|
|
+ switch (msg.what) {
|
|
|
+ case 0:
|
|
|
+ gotoNext();
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- protected void onResume() {
|
|
|
- super.onResume();
|
|
|
- isResume = true;
|
|
|
- goLink = false;
|
|
|
- if (videoView != null)
|
|
|
- videoView.resume();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ private void gotoNext() {
|
|
|
+ SkinUtil.changeSkin(s -> Jump2View.getInstance().gotoGuide(this));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected void onPause() {
|
|
|
- super.onPause();
|
|
|
- isResume = false;
|
|
|
- if (videoView != null)
|
|
|
- videoView.pause();
|
|
|
+ protected int getLayoutId() {
|
|
|
+ return R.layout.splash_activity;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void onPermissionsGranted(int i, @NonNull List<String> list) {
|
|
|
- recreate();
|
|
|
+ public void initView() {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void onPermissionsDenied(int i, @NonNull List<String> list) {
|
|
|
- showMissingPermissionDialog();
|
|
|
- }
|
|
|
+ public void initListener() {
|
|
|
|
|
|
- private void showMissingPermissionDialog() {
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
- builder.setTitle("提示");
|
|
|
- builder.setMessage("当前应用缺少必要权限。请点击\"设置\"-\"权限\"-打开所需权限。");
|
|
|
+ }
|
|
|
|
|
|
- // 拒绝, 退出应用
|
|
|
- builder.setNegativeButton("取消",
|
|
|
- new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- finish();
|
|
|
- }
|
|
|
- });
|
|
|
+ @Override
|
|
|
+ public void initData() {
|
|
|
|
|
|
- builder.setPositiveButton("设置",
|
|
|
- new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- startAppSettings();
|
|
|
- }
|
|
|
- });
|
|
|
+ }
|
|
|
|
|
|
- builder.setCancelable(false);
|
|
|
+ private boolean isResume = false;
|
|
|
|
|
|
- builder.show();
|
|
|
+ @Override
|
|
|
+ protected void onResume() {
|
|
|
+ super.onResume();
|
|
|
+ isResume = true;
|
|
|
+ if (splash_video_view != null)
|
|
|
+ splash_video_view.resume();
|
|
|
+ if (goLink) {
|
|
|
+ sendHandlerMessages(10);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 启动应用的设置
|
|
|
- */
|
|
|
- private void startAppSettings() {
|
|
|
- Intent intent = new Intent(
|
|
|
- Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
- intent.setData(Uri.parse("package:" + getPackageName()));
|
|
|
- startActivity(intent);
|
|
|
+ @Override
|
|
|
+ protected void onPause() {
|
|
|
+ super.onPause();
|
|
|
+ isResume = false;
|
|
|
+ if (splash_video_view != null)
|
|
|
+ splash_video_view.pause();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @OnClick({R.id.btn_join, R.id.splash_skip, R.id.splash_know_ad_tv, R.id.splash_bg, R.id.splash_video_view, R.id.splash_click_view})
|
|
|
+ @OnClick({R.id.splash_skip, R.id.splash_image_view, R.id.splash_video_view})
|
|
|
public void onViewClicked(View view) {
|
|
|
- if(isNotSupport()){
|
|
|
- return;
|
|
|
- }
|
|
|
switch (view.getId()) {
|
|
|
- case R.id.btn_join:
|
|
|
case R.id.splash_skip:
|
|
|
- gotoNext();
|
|
|
+
|
|
|
+ sendHandlerMessages(10);
|
|
|
break;
|
|
|
- case R.id.splash_bg:
|
|
|
+ case R.id.splash_image_view:
|
|
|
case R.id.splash_video_view:
|
|
|
- case R.id.splash_know_ad_tv:
|
|
|
- case R.id.splash_click_view:
|
|
|
if (advertising != null) {
|
|
|
+ mHandler.removeMessages(0);
|
|
|
goLink = true;
|
|
|
- goAdLink(activity, advertising);
|
|
|
+ SplashHelper.goAdLink(this, advertising);
|
|
|
AD_SPLASH.onEvent("ad_id", advertising.getId());
|
|
|
} else {
|
|
|
- gotoNext();
|
|
|
+ sendHandlerMessages(10);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void goAdLink(Activity activity, Advertising advertising) {
|
|
|
- if (TextUtils.isEmpty(SpUtils.getToken(SheepApp.getInstance()))) {
|
|
|
- Jump2View.getInstance().goLoginView(activity, null);
|
|
|
- if (activity instanceof SplashAct) {
|
|
|
- activity.finish();
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- if (advertising != null) {
|
|
|
- switch (advertising.getLinkType()) {//转跳类型1:H5外部 2:H5内部 3:试玩赚钱 4:单个任务 5:信用卡 6:微信二维码 7:连续任务 8:打卡赚钱
|
|
|
- case 1:
|
|
|
- Jump2View.getInstance().goWeb(activity, advertising.getLink());
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- Jump2View.getInstance().goWeb(activity, advertising.getLink(), advertising.getName());
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- Jump2View.getInstance().goTryplayView(activity, null);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- Jump2View.getInstance().goTaskDetailView(activity, advertising.getLink_id());
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- Jump2View.getInstance().goCreditCardTaskList(activity, null);
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- Jump2View.getInstance().goWeb(activity, advertising.getLink(), "微信二维码辅助好友注册");
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- Jump2View.getInstance().goSequentialTaskView(activity);
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- Jump2View.getInstance().goSignCardAct(activity, null);
|
|
|
- break;
|
|
|
- case 15://小米游戏列表
|
|
|
- Jump2View.getInstance().goXiaomiGameList(activity, null);
|
|
|
- break;
|
|
|
- case JUMP_GMAE://游戏详情
|
|
|
- Jump2View.getInstance().goPlayGameDetail(advertising.getLink_id());
|
|
|
- break;
|
|
|
- case JUMP_FIND_RECOMMEND://发现--推荐
|
|
|
- case JUMP_FIND_ACT://发现--活动
|
|
|
- case JUMP_FIND_INFORMATION://webView资讯
|
|
|
- case JUMP_FIND_GMAE://发现中的游戏详情
|
|
|
- Jump2View.getInstance().goFindItem(activity, advertising.getLink_id());
|
|
|
- break;
|
|
|
- case JUMP_WATCH_FOCUS://看点
|
|
|
- Jump2View.getInstance().goWatchFocus(activity, advertising.getLink_id());
|
|
|
- break;
|
|
|
- case IDConstant.JUMP_VIP://vip
|
|
|
- Jump2View.getInstance().gotoVip(activity);
|
|
|
- break;
|
|
|
- case IDConstant.JUMP_LONG_MAO://龙猫
|
|
|
- Jump2View.getInstance().gotoLongMao(activity);
|
|
|
- break;
|
|
|
- case IDConstant.JUMP_YF_SHOP://商城
|
|
|
- Jump2View.getInstance().gotoYfShop(activity);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onActivityReenter(int resultCode, Intent data) {
|
|
|
- super.onActivityReenter(resultCode, data);
|
|
|
- isRequestCodePermissions = false;
|
|
|
- sendHandlerMessages(10);
|
|
|
- }
|
|
|
-
|
|
|
private void sendHandlerMessages(int time) {
|
|
|
try {
|
|
|
mHandler.removeMessages(0);
|
|
|
@@ -499,8 +288,10 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|
|
|
- if (timer != null)
|
|
|
+ if (timer != null) {
|
|
|
timer.clear();
|
|
|
+ timer = null;
|
|
|
+ }
|
|
|
try {
|
|
|
mHandler.removeMessages(0);
|
|
|
} catch (Exception e) {
|