|
|
@@ -2,11 +2,13 @@ package com.kfzs.duanduan.fragment;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
import android.content.Context;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
import android.support.v4.widget.SwipeRefreshLayout;
|
|
|
+import android.support.v7.app.AlertDialog;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.TextUtils;
|
|
|
@@ -32,6 +34,7 @@ import com.bumptech.glide.request.RequestOptions;
|
|
|
import com.kfzs.duanduan.BaseCompatFragment;
|
|
|
import com.kfzs.duanduan.event.BigEvent;
|
|
|
import com.kfzs.duanduan.react.ReactUtil;
|
|
|
+import com.kfzs.duanduan.react.SharedPreferences;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.di.components.DaggerSmallSheepComponent;
|
|
|
import com.sheep.gamegroup.di.modules.SmallSheepModule;
|
|
|
@@ -69,6 +72,7 @@ import com.sheep.gamegroup.util.MyListview;
|
|
|
import com.sheep.gamegroup.util.PreferenceUtils;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
+import com.sheep.gamegroup.view.activity.NotificationsUtils;
|
|
|
import com.sheep.gamegroup.view.adapter.AdpHomeListGrideview;
|
|
|
import com.sheep.gamegroup.view.adapter.AdpHomeListListview;
|
|
|
import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
|
|
|
@@ -204,6 +208,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
@Override
|
|
|
protected void initView(Bundle savedInstanceState) {
|
|
|
setContentView(R.layout.homepage_act_layout);
|
|
|
+ showPDialog();
|
|
|
initView();
|
|
|
initListener();
|
|
|
TestUtil.testChange(getActivity(), (TextView) getViewById(R.id.test_change));
|
|
|
@@ -952,4 +957,31 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提示用户开启推送通知权限
|
|
|
+ * 1)只提示一次,如果用户取消,以后都不在提示
|
|
|
+ */
|
|
|
+ private void showPDialog(){
|
|
|
+ boolean isShowDialog = SharedPreferences.getInstance().getBoolean("isShowDialog",true);
|
|
|
+ if(isShowDialog && !NotificationsUtils.isNotificationEnabled(mContext)){//没有开启通知权限
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
|
|
+ builder.setTitle("提示");
|
|
|
+ builder.setMessage("是否开启推送?");
|
|
|
+ builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ SharedPreferences.getInstance().putBoolean("isShowDialog",false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ NotificationsUtils.goToNotificationSetting(mContext);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ builder.show();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|