|
|
@@ -9,10 +9,15 @@ import androidx.annotation.Nullable;
|
|
|
import androidx.recyclerview.widget.GridLayoutManager;
|
|
|
|
|
|
import com.atmob.app.lib.base.BaseFragment;
|
|
|
+import com.atmob.mediation.api.AdError;
|
|
|
import com.datarecovery.master.R;
|
|
|
+import com.datarecovery.master.data.consts.AdFuncId;
|
|
|
import com.datarecovery.master.databinding.FragmentHomePageBinding;
|
|
|
import com.datarecovery.master.dialog.CommonSureDialog;
|
|
|
+import com.datarecovery.master.sdk.ad.AtmobAdHelper;
|
|
|
+import com.datarecovery.master.sdk.ad.RewardVideoListenerAdapter;
|
|
|
import com.datarecovery.master.utils.PermissionUtil;
|
|
|
+import com.datarecovery.master.utils.ToastUtil;
|
|
|
import com.datarecovery.master.utils.xfile.XFilePermission;
|
|
|
import com.datarecovery.master.widget.InformationSwitchBanner;
|
|
|
import com.gyf.immersionbar.ImmersionBar;
|
|
|
@@ -93,7 +98,37 @@ public class HomePageFragment extends BaseFragment<FragmentHomePageBinding> {
|
|
|
otherFunctionAdapter = new OtherFunctionAdapter(getViewLifecycleOwner(), homePageViewModel.getFunctionList());
|
|
|
binding.ryOtherFunction.setAdapter(otherFunctionAdapter);
|
|
|
binding.ryOtherFunction.setLayoutManager(new GridLayoutManager(requireContext(), 2));
|
|
|
- otherFunctionAdapter.setOnItemClick(bean -> homePageViewModel.clickItemFunction(bean));
|
|
|
+ otherFunctionAdapter.setOnItemClick(bean -> AtmobAdHelper.showVideo(AdFuncId.REWARD_BEFORE_SCAN, new RewardVideoListenerAdapter() {
|
|
|
+ boolean isRewarded = false;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onRewarded(@NonNull String token) {
|
|
|
+ super.onRewarded(token);
|
|
|
+ isRewarded = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onLoadFailed(AdError adError) {
|
|
|
+ super.onLoadFailed(adError);
|
|
|
+ homePageViewModel.clickItemFunction(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onRewardAdShowFail(AdError adError) {
|
|
|
+ super.onRewardAdShowFail(adError);
|
|
|
+ homePageViewModel.clickItemFunction(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onRewardAdClosed() {
|
|
|
+ super.onRewardAdClosed();
|
|
|
+ if (isRewarded) {
|
|
|
+ homePageViewModel.clickItemFunction(bean);
|
|
|
+ } else {
|
|
|
+ ToastUtil.show(R.string.scan_failed, ToastUtil.LENGTH_SHORT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
private void initTextViewBanner() {
|