权限判断
This commit is contained in:
parent
1959a7933b
commit
b0ba5b7d57
@ -7,8 +7,6 @@ import android.view.Window;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.lzf.easyfloat.interfaces.OnPermissionResult;
|
|
||||||
import com.lzf.easyfloat.permission.PermissionUtils;
|
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
@ -48,9 +46,10 @@ public class HintDialog extends AbsDialogFragment {
|
|||||||
TextView hint = (TextView) findViewById(R.id.hint);
|
TextView hint = (TextView) findViewById(R.id.hint);
|
||||||
TextView toSetUp = (TextView) findViewById(R.id.to_set_up);
|
TextView toSetUp = (TextView) findViewById(R.id.to_set_up);
|
||||||
TextView knowThe = (TextView) findViewById(R.id.know_the);
|
TextView knowThe = (TextView) findViewById(R.id.know_the);
|
||||||
IMLoginManager.get(mContext).initISHint();
|
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
if (args != null && !TextUtils.isEmpty(args.getString("close")) && TextUtils.equals(args.getString("close"), "1")) {
|
if (args != null && !TextUtils.isEmpty(args.getString("close")) && TextUtils.equals(args.getString("close"), "1")) {
|
||||||
|
IMLoginManager.get(mContext).initISHint2();
|
||||||
hint.setText(getString(R.string.do_you_like));
|
hint.setText(getString(R.string.do_you_like));
|
||||||
toSetUp.setText(getString(R.string.to_set_up));
|
toSetUp.setText(getString(R.string.to_set_up));
|
||||||
knowThe.setText(getString(R.string.know_the));
|
knowThe.setText(getString(R.string.know_the));
|
||||||
@ -63,28 +62,29 @@ public class HintDialog extends AbsDialogFragment {
|
|||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.know_the), () -> dismiss());
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.know_the), () -> dismiss());
|
||||||
} else {
|
} else {
|
||||||
|
IMLoginManager.get(mContext).initISHint();
|
||||||
hint.setText(getString(R.string.want_pre));
|
hint.setText(getString(R.string.want_pre));
|
||||||
toSetUp.setText(getString(R.string.know_the));
|
toSetUp.setText(getString(R.string.know_the));
|
||||||
knowThe.setText(getString(R.string.to_set_up));
|
knowThe.setText(getString(R.string.to_set_up));
|
||||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.know_the), () -> {
|
||||||
@Override
|
if (listener != null) {
|
||||||
public void onViewClicks() {
|
listener.requestPermission();
|
||||||
PermissionUtils.requestPermission(getActivity(), new OnPermissionResult() {
|
|
||||||
@Override
|
|
||||||
public void permissionResult(boolean b) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() {
|
|
||||||
@Override
|
|
||||||
public void onViewClicks() {
|
|
||||||
dismiss();
|
|
||||||
}
|
}
|
||||||
|
dismiss();
|
||||||
});
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), () -> dismiss());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HintListener listener;
|
||||||
|
|
||||||
|
public HintDialog setListener(HintListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HintListener {
|
||||||
|
void requestPermission();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class IMLoginManager extends BaseCacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initISHint2() {
|
public void initISHint2() {
|
||||||
put(IS_HINT, false);
|
put(IS_HINT2, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,8 @@ import com.google.firebase.messaging.FirebaseMessaging;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.jakewharton.rxbinding3.view.RxView;
|
import com.jakewharton.rxbinding3.view.RxView;
|
||||||
|
import com.lzf.easyfloat.interfaces.OnPermissionResult;
|
||||||
|
import com.lzf.easyfloat.permission.PermissionUtils;
|
||||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||||
import com.tencent.imsdk.v2.V2TIMManager;
|
import com.tencent.imsdk.v2.V2TIMManager;
|
||||||
import com.tencent.imsdk.v2.V2TIMSDKConfig;
|
import com.tencent.imsdk.v2.V2TIMSDKConfig;
|
||||||
@ -483,6 +485,14 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
if (IMLoginManager.get(mContext).isHint()) {
|
if (IMLoginManager.get(mContext).isHint()) {
|
||||||
HintDialog fragment = new HintDialog();
|
HintDialog fragment = new HintDialog();
|
||||||
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
|
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
|
||||||
|
fragment.setListener(new HintDialog.HintListener() {
|
||||||
|
@Override
|
||||||
|
public void requestPermission() {
|
||||||
|
PermissionUtils.requestPermission(mContext, b -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1265,7 +1275,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onLiveFloatEvent(LiveFloatEvent event) {
|
public void onLiveFloatEvent(LiveFloatEvent event) {
|
||||||
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())){
|
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
|
||||||
new Handler().post(() -> LiveFloatView.getInstance()
|
new Handler().post(() -> LiveFloatView.getInstance()
|
||||||
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
|
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
|
||||||
.builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
|
.builderFloat(mContext, event.getmLiveBean().getPull(), LiveAudienceActivity.class));
|
||||||
|
Loading…
Reference in New Issue
Block a user