移除广告mintegral SDK 1.3(4)
This commit is contained in:
parent
9fd2fcebea
commit
f39a933a0d
@ -12,8 +12,8 @@ android {
|
||||
applicationId = "com.funny.sounds.hd"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
versionCode = 4
|
||||
versionName = "1.3"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -49,14 +49,12 @@ dependencies {
|
||||
implementation ("com.google.code.gson:gson:2.10.1")
|
||||
implementation("com.google.android.material:material:1.11.0")
|
||||
|
||||
|
||||
|
||||
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
|
||||
implementation("com.google.firebase:firebase-analytics-ktx")
|
||||
implementation("com.google.firebase:firebase-crashlytics-ktx")
|
||||
|
||||
//---------------------------------Mintegral SDK
|
||||
implementation ("com.mbridge.msdk.oversea:newinterstitial:16.7.71")
|
||||
implementation ("com.mbridge.msdk.oversea:mbbid:16.7.61")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -32,10 +32,6 @@ import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.example.funnysounds.R;
|
||||
import com.example.funnysounds.ad.ADBean;
|
||||
import com.example.funnysounds.ad.MBrManager;
|
||||
import com.example.funnysounds.ad.onAdStatusListener;
|
||||
import com.example.funnysounds.data.CategoryList;
|
||||
import com.example.funnysounds.data.MyData;
|
||||
import com.example.funnysounds.value.StaticValue;
|
||||
|
||||
@ -44,16 +40,16 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class DetailActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
public class DetailActivity extends AppCompatActivity{
|
||||
private String name;
|
||||
private String image;
|
||||
private MyData resource;
|
||||
private String media;
|
||||
private TextView textView;
|
||||
private ImageView imageView,imageView2;
|
||||
private MediaPlayer mediaPlayer;
|
||||
MediaPlayer mediaPlayer;
|
||||
protected Button btn_play_pause;
|
||||
|
||||
private boolean play = false;
|
||||
|
||||
|
||||
|
||||
@ -66,17 +62,9 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis
|
||||
imageView = findViewById(R.id.data_image);
|
||||
imageView2 = findViewById(R.id.imageview_back);
|
||||
btn_play_pause = findViewById(R.id.btn_play_pause);
|
||||
btn_play_pause.setBackgroundResource(R.mipmap.play);
|
||||
goGetData();
|
||||
initfindview();
|
||||
onMyclick();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initfindview() {
|
||||
|
||||
imageView2.setOnClickListener(this);
|
||||
btn_play_pause.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void goGetData() {
|
||||
@ -84,7 +72,8 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis
|
||||
resource = (MyData) intent.getSerializableExtra(StaticValue.key_resourse);
|
||||
assert resource != null;
|
||||
textView.setText(resource.getTitle());
|
||||
mediaPlayer = MediaPlayer.create(DetailActivity.this, Uri.parse(resource.getMp3Url()));
|
||||
media = resource.getMp3Url();
|
||||
Log.d("----","---media"+media);
|
||||
image = resource.getPreUrl();
|
||||
Glide.with(this).load(image).addListener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
@ -100,24 +89,39 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
public void onMyclick() {
|
||||
btn_play_pause.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(mediaPlayer != null){
|
||||
if(mediaPlayer.isPlaying()){
|
||||
((Button)v).setBackgroundResource(R.mipmap.play);
|
||||
mediaPlayer.pause();
|
||||
}else {
|
||||
((Button)v).setBackgroundResource(R.mipmap.stop);
|
||||
mediaPlayer.start();
|
||||
if (play){
|
||||
play = false;
|
||||
// mediaPlayer.release();
|
||||
btn_play_pause.setBackgroundResource(R.mipmap.play);
|
||||
if(mediaPlayer != null){
|
||||
mediaPlayer.release();
|
||||
mediaPlayer=null;
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
btn_play_pause.setBackgroundResource(R.mipmap.stop);
|
||||
mediaPlayer = new MediaPlayer();
|
||||
try {
|
||||
mediaPlayer.setDataSource(media);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
||||
@Override
|
||||
public void onPrepared(MediaPlayer mp) {
|
||||
Log.d("---------","--------finish");
|
||||
mediaPlayer.start();
|
||||
}
|
||||
});
|
||||
play = true;
|
||||
mediaPlayer.prepareAsync();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
imageView2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -127,50 +131,18 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis
|
||||
}
|
||||
}
|
||||
|
||||
showad();
|
||||
finish();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showad() {
|
||||
ADBean cache = MBrManager.getCache();
|
||||
if(cache == null){
|
||||
finish();
|
||||
Log.d("-------fail","------showfail");
|
||||
}else{
|
||||
MBrManager.setCallBack(cache.getInterstitialHandler(), new onAdStatusListener() {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowFail() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
cache.getInterstitialHandler().showFromBid();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mediaPlayer != null) {
|
||||
if (mediaPlayer != null && mediaPlayer.isPlaying()) {
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.release();
|
||||
mediaPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,13 +19,7 @@ import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.example.funnysounds.R;
|
||||
import com.example.funnysounds.ad.ADBean;
|
||||
|
||||
import com.example.funnysounds.ad.MBrManager;
|
||||
import com.example.funnysounds.ad.onAdStatusListener;
|
||||
import com.example.funnysounds.ad.onInterHandlerListener;
|
||||
import com.example.funnysounds.resolve.Sounds;
|
||||
import com.mbridge.msdk.newinterstitial.out.MBBidNewInterstitialHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -33,93 +27,34 @@ import kotlin.Unit;
|
||||
|
||||
public class IntoActivity extends AppCompatActivity {
|
||||
private boolean needShow = true;
|
||||
public MBBidNewInterstitialHandler MBBidNewInterstitialHandler;
|
||||
protected CountDownTimer countDownTimer;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_into);
|
||||
countDownTimer = new CountDownTimer(11000,100) {
|
||||
countDownTimer = new CountDownTimer(1000,500) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
if (needShow) {
|
||||
startShowAd(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (needShow) {
|
||||
startShowAd(true);
|
||||
// startMainActivity();
|
||||
}
|
||||
startMainActivity();
|
||||
}
|
||||
|
||||
};
|
||||
startAd();
|
||||
}
|
||||
private void startAd() {
|
||||
if (!Sounds.initOK) {
|
||||
IntentFilter intentFilter = new IntentFilter(Sounds.AD_INIT);
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
loadMyAdAndStart();
|
||||
Log.d("------------", "------------1sucess");
|
||||
}
|
||||
},intentFilter);
|
||||
|
||||
} else {
|
||||
loadMyAdAndStart();
|
||||
Log.d("------------", "------------2sucess");
|
||||
}
|
||||
}
|
||||
public void startShowAd(boolean is){
|
||||
ADBean cache = MBrManager.getCache();
|
||||
if(cache == null){
|
||||
if(is){
|
||||
startMainActivity();
|
||||
}
|
||||
}else{
|
||||
needShow = false;
|
||||
MBrManager.setCallBack(cache.getInterstitialHandler(), new onAdStatusListener() {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowFail() {
|
||||
startMainActivity();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
startMainActivity();
|
||||
}
|
||||
});
|
||||
cache.getInterstitialHandler().showFromBid();
|
||||
}
|
||||
starttimer();
|
||||
}
|
||||
|
||||
private void loadMyAdAndStart() {
|
||||
private void starttimer() {
|
||||
countDownTimer.start();
|
||||
|
||||
}
|
||||
|
||||
private void startMainActivity() {
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@ -2,15 +2,26 @@ package com.example.funnysounds.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.example.funnysounds.R;
|
||||
import com.example.funnysounds.action.CategoryNameSoundsrListener;
|
||||
@ -24,8 +35,13 @@ import java.io.Serializable;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements CategoryNameSoundsrListener{
|
||||
private TextView textview_sounds;
|
||||
private TextView text_version;
|
||||
private RecyclerView recyclerview_sounds;
|
||||
private ImageView imageView_menu;
|
||||
private RelativeLayout url_lay;
|
||||
private RelativeLayout version_lay;
|
||||
private String name;
|
||||
private DrawerLayout main_layout;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
@ -33,10 +49,57 @@ public class MainActivity extends AppCompatActivity implements CategoryNameSound
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
textview_sounds = findViewById(R.id.textview_sounds);
|
||||
main_layout =findViewById (R.id.main);
|
||||
recyclerview_sounds = findViewById(R.id.recyclerview_sounds);
|
||||
textview_sounds.setTypeface(Typeface.createFromAsset(getAssets(),"myfont.ttf"));
|
||||
imageView_menu = findViewById(R.id.image_menu);
|
||||
url_lay = findViewById(R.id.url_previcy);
|
||||
version_lay = findViewById(R.id.version_lay);
|
||||
text_version = findViewById(R.id.text_version);
|
||||
imageView_menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
main_layout.openDrawer(Gravity.RIGHT);
|
||||
}
|
||||
});
|
||||
setRecyclerviewSounds();
|
||||
url_lay.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
gotopricy();
|
||||
}
|
||||
});
|
||||
String appVersions = getAppVersions();
|
||||
if (appVersions == null) {
|
||||
text_version.setText("V1.2");
|
||||
} else {
|
||||
String format = String.format(getString(R.string.app_sounds_version), appVersions);
|
||||
text_version.setText(format);
|
||||
}
|
||||
version_lay.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(MainActivity.this,"This Version is V1.2",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getAppVersions() {
|
||||
String appversions = "";
|
||||
try {
|
||||
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(),0);
|
||||
appversions = ((PackageInfo)packageInfo).versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return appversions;
|
||||
}
|
||||
|
||||
private void gotopricy() {
|
||||
String url = getString(R.string.url_privacy);
|
||||
Intent intent2 = new Intent(Intent.ACTION_VIEW);
|
||||
intent2.setData(Uri.parse(url));
|
||||
startActivity(intent2);
|
||||
}
|
||||
|
||||
private void setRecyclerviewSounds() {
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
package com.example.funnysounds.ad;
|
||||
|
||||
import com.mbridge.msdk.newinterstitial.out.MBBidNewInterstitialHandler;
|
||||
|
||||
public class ADBean {
|
||||
|
||||
private MBBidNewInterstitialHandler interstitialHandler;
|
||||
private String token;
|
||||
|
||||
public void setInterstitialHandler(MBBidNewInterstitialHandler interstitialHandler) {
|
||||
this.interstitialHandler = interstitialHandler;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public MBBidNewInterstitialHandler getInterstitialHandler() {
|
||||
return interstitialHandler;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package com.example.funnysounds.ad
|
||||
|
||||
interface AdMsgListener {
|
||||
fun msg(msg: String)
|
||||
}
|
||||
@ -1,232 +0,0 @@
|
||||
package com.example.funnysounds.ad;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.example.funnysounds.resolve.Sounds;
|
||||
import com.mbridge.msdk.MBridgeConstans;
|
||||
import com.mbridge.msdk.mbbid.out.BidListennning;
|
||||
import com.mbridge.msdk.mbbid.out.BidManager;
|
||||
import com.mbridge.msdk.mbbid.out.BidResponsed;
|
||||
import com.mbridge.msdk.newinterstitial.out.MBBidNewInterstitialHandler;
|
||||
import com.mbridge.msdk.newinterstitial.out.NewInterstitialListener;
|
||||
import com.mbridge.msdk.out.MBridgeIds;
|
||||
import com.mbridge.msdk.out.RewardInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MBrManager {
|
||||
|
||||
public static String TAG = "------------ltt";
|
||||
|
||||
public static String[] placeIDs = new String[]{"1613846", "1613849", "1613851"};
|
||||
|
||||
public static String[] unitIDs = new String[]{"3473086", "3473090", "3473092"};
|
||||
|
||||
public static List<ADBean> AdInstances = new ArrayList<>();
|
||||
|
||||
public static void getToken(String placeId, String unitId, onBidTokenListener listener) {
|
||||
BidManager manager = new BidManager(placeId, unitId);
|
||||
manager.setBidListener(new BidListennning() {
|
||||
@Override
|
||||
public void onFailed(String s) {
|
||||
listener.onBidToken("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccessed(BidResponsed bidResponsed) {
|
||||
String mBidToken = bidResponsed.getBidToken();
|
||||
listener.onBidToken(mBidToken);
|
||||
}
|
||||
});
|
||||
manager.bid();
|
||||
}
|
||||
|
||||
public static void loadAllAd() {
|
||||
if (AdInstances.size() > 0) {
|
||||
for (ADBean adBean : AdInstances) {
|
||||
if (!adBean.getInterstitialHandler().isBidReady()) {
|
||||
adBean.getInterstitialHandler().loadFromBid(adBean.getToken());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void init(onInterHandlerListener listener) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
String finalPlaceId = placeIDs[i];
|
||||
String unitId = unitIDs[i];
|
||||
getToken(finalPlaceId, unitId, new onBidTokenListener() {
|
||||
@Override
|
||||
public void onBidToken(String token) {
|
||||
MBBidNewInterstitialHandler mMBBidNewInterstitialHandler = new MBBidNewInterstitialHandler(Sounds.mAppContext, finalPlaceId, unitId);
|
||||
ADBean adBean = new ADBean();
|
||||
Log.d(TAG, "------------token=" + token);
|
||||
adBean.setToken(token);
|
||||
adBean.setInterstitialHandler(mMBBidNewInterstitialHandler);
|
||||
setCallBack(mMBBidNewInterstitialHandler, new onAdStatusListener() {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
|
||||
}
|
||||
});
|
||||
mMBBidNewInterstitialHandler.loadFromBid(token);
|
||||
AdInstances.add(adBean);
|
||||
listener.onAddOK();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ADBean getCache() {
|
||||
Collections.shuffle(AdInstances);
|
||||
for (ADBean adBean : AdInstances) {
|
||||
if (adBean.getInterstitialHandler().isBidReady()) {
|
||||
return adBean;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void setCallBack(MBBidNewInterstitialHandler mbBidNewInterstitialHandler, onAdStatusListener listener) {
|
||||
mbBidNewInterstitialHandler.setInterstitialVideoListener(new NewInterstitialListener() {
|
||||
|
||||
@Override
|
||||
public void onLoadCampaignSuccess(MBridgeIds ids) {
|
||||
/**
|
||||
* 广告已填充
|
||||
* @param ids 封装的广告id对象
|
||||
*/
|
||||
Log.i(TAG, "onLoadCampaignSuccess: " + Thread.currentThread() + " " + ids.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceLoadSuccess(MBridgeIds ids) {
|
||||
/**
|
||||
* 广告资源加载成功,可以播放
|
||||
* @param ids 封装的广告id对象
|
||||
*/
|
||||
Log.i(TAG, "onResourceLoadSuccess: " + Thread.currentThread() + " " + ids.toString());
|
||||
listener.onLoaded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceLoadFail(MBridgeIds ids, String errorMsg) {
|
||||
/**
|
||||
* 广告加载失败
|
||||
* @param errorMsg 加载错误原因
|
||||
*/
|
||||
listener.onLoadFail();
|
||||
Log.e(TAG, "onResourceLoadFail errorMsg: " + errorMsg + " " + ids.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowFail(MBridgeIds ids, String errorMsg) {
|
||||
/**
|
||||
* 广告播放失败
|
||||
* @param errorMsg 错误原因
|
||||
*/
|
||||
listener.onShowFail();
|
||||
Log.e(TAG, "onShowFail: " + errorMsg + " " + ids.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdShow(MBridgeIds ids) {
|
||||
/**
|
||||
* 广告成功展示
|
||||
*/
|
||||
Log.i(TAG, "onAdShow: " + ids.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClose(MBridgeIds ids, RewardInfo info) {
|
||||
/**
|
||||
* 广告关闭时调用
|
||||
* @param info.isCompleteView如果为true,则表示已完全观看了视频
|
||||
*/
|
||||
loadAllAd();
|
||||
listener.onClose();
|
||||
Log.i(TAG, "onAdClose: " + "isCompleteView:" + info.isCompleteView() + " " + ids.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(MBridgeIds ids) {
|
||||
/**
|
||||
* 广告被点击
|
||||
* @param 封装的广告id对象
|
||||
*/
|
||||
Log.i(TAG, "onAdClicked: " + ids.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoComplete(MBridgeIds ids) {
|
||||
/**
|
||||
* 广告播放完成时调用
|
||||
* @param ids 封装的广告id对象
|
||||
*/
|
||||
Log.i(TAG, "onVideoComplete: " + ids.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdCloseWithNIReward(MBridgeIds ids, RewardInfo info) {
|
||||
/**
|
||||
* 如果开发人员设置了IV奖励,则在广告关闭时调用.
|
||||
*
|
||||
* @param 封装的广告id对象
|
||||
* @param info.isCompleteView() 是否完全观看
|
||||
*/
|
||||
Log.i(TAG, "onAdCloseWithNIReward: " + ids.toString() + " " + info.toString());
|
||||
|
||||
Log.i(TAG, info.isCompleteView() ? "Video playback/playable is complete." : "Video playback/playable is not complete.");
|
||||
|
||||
int rewardAlertStatus = info.getRewardAlertStatus();
|
||||
|
||||
if (rewardAlertStatus == MBridgeConstans.IVREWARDALERT_STATUS_NOTSHOWN) {
|
||||
Log.e(TAG, "The dialog is not show.");
|
||||
}
|
||||
|
||||
if (rewardAlertStatus == MBridgeConstans.IVREWARDALERT_STATUS_CLICKCONTINUE) {
|
||||
Log.e(TAG, "The dialog's continue button clicked.");
|
||||
}
|
||||
|
||||
if (rewardAlertStatus == MBridgeConstans.IVREWARDALERT_STATUS_CLICKCANCEL) {
|
||||
Log.e(TAG, "The dialog's cancel button clicked.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEndcardShow(MBridgeIds ids) {
|
||||
/**
|
||||
* 展示广告落地页时调用
|
||||
* @param ids 封装的广告id对象
|
||||
*/
|
||||
Log.i(TAG, "onEndcardShow: " + ids.toString());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
package com.example.funnysounds.ad;
|
||||
|
||||
public interface onAdStatusListener {
|
||||
|
||||
void onLoaded();
|
||||
void onLoadFail();
|
||||
void onShowFail();
|
||||
void onClose();
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
package com.example.funnysounds.ad;
|
||||
|
||||
public interface onBidTokenListener {
|
||||
|
||||
void onBidToken(String token);
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package com.example.funnysounds.ad;
|
||||
|
||||
public interface onInterHandlerListener {
|
||||
|
||||
void onAddOK();
|
||||
|
||||
|
||||
// void onLoaded();
|
||||
// void onLoadFail();
|
||||
// void onShowFail();
|
||||
//
|
||||
// void onClose();
|
||||
}
|
||||
@ -10,15 +10,11 @@ import android.util.Log;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.example.funnysounds.ad.MBrManager;
|
||||
import com.example.funnysounds.ad.onInterHandlerListener;
|
||||
|
||||
import com.example.funnysounds.data.CategoryList;
|
||||
import com.example.funnysounds.value.StaticValue;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.mbridge.msdk.MBridgeSDK;
|
||||
import com.mbridge.msdk.out.MBridgeSDKFactory;
|
||||
import com.mbridge.msdk.out.SDKInitStatusListener;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -38,7 +34,7 @@ public class Sounds extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mAppContext = this;
|
||||
init();
|
||||
// init();
|
||||
try {
|
||||
InputStream open = getAssets().open("prank.json");
|
||||
String covertStr = Readfile.getCovertStr(open);
|
||||
@ -60,29 +56,5 @@ public class Sounds extends Application {
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
MBridgeSDK sdk = MBridgeSDKFactory.getMBridgeSDK();
|
||||
Map<String, String> map = sdk.getMBConfigurationMap(AppId, AppKey);
|
||||
sdk.init(map, this, new SDKInitStatusListener() {
|
||||
@Override
|
||||
public void onInitSuccess() {
|
||||
Log.e(MBrManager.TAG, "onInitSuccess");
|
||||
initOK = true;
|
||||
MBrManager.init( new onInterHandlerListener() {
|
||||
@Override
|
||||
public void onAddOK() {
|
||||
LocalBroadcastManager.getInstance(mAppContext).sendBroadcast(new Intent(AD_INIT));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitFail(String errorMsg) {
|
||||
Log.e(MBrManager.TAG, errorMsg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,9 +24,7 @@ import com.bumptech.glide.request.target.Target;
|
||||
import com.example.funnysounds.R;
|
||||
import com.example.funnysounds.action.CategoryNameSoundsrListener;
|
||||
import com.example.funnysounds.activity.SpecifisoundsActivity;
|
||||
import com.example.funnysounds.ad.ADBean;
|
||||
import com.example.funnysounds.ad.MBrManager;
|
||||
import com.example.funnysounds.ad.onAdStatusListener;
|
||||
|
||||
import com.example.funnysounds.data.CategoryList;
|
||||
import com.example.funnysounds.value.StaticValue;
|
||||
|
||||
@ -64,7 +62,7 @@ public class CgNameAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
Log.e(MBrManager.TAG, "onLoadFailed-----------------categorylist.getCategoryUrl()=---"+categorylist.getCategoryUrl()+"---------e="+e.getMessage());
|
||||
//Log.e(MBrManager.TAG, "onLoadFailed-----------------categorylist.getCategoryUrl()=---"+categorylist.getCategoryUrl()+"---------e="+e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -78,50 +76,13 @@ public class CgNameAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
||||
holder.getLayout_root().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showad(categorylist);
|
||||
Intent intent = new Intent(myContext, SpecifisoundsActivity.class);
|
||||
intent.putExtra(StaticValue.key_category_name, categorylist);
|
||||
myContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showad(CategoryList cate) {
|
||||
ADBean cache = MBrManager.getCache();
|
||||
if(cache == null){
|
||||
startSpecifiActivity(cate);
|
||||
Log.d("-------fail","------showfail");
|
||||
}else{
|
||||
MBrManager.setCallBack(cache.getInterstitialHandler(), new onAdStatusListener() {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowFail() {
|
||||
startSpecifiActivity(cate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
startSpecifiActivity(cate);
|
||||
}
|
||||
});
|
||||
cache.getInterstitialHandler().showFromBid();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void startSpecifiActivity(CategoryList categoryList) {
|
||||
Intent intent = new Intent(myContext, SpecifisoundsActivity.class);
|
||||
intent.putExtra(StaticValue.key_category_name, categoryList);
|
||||
myContext.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataCategoryList.size();
|
||||
|
||||
42
app/src/main/res/drawable/activity_specifisounds.xml
Normal file
42
app/src/main/res/drawable/activity_specifisounds.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#EEF4F4"
|
||||
tools:context=".activity.SpecifisoundsActivity">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
<FrameLayout
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@drawable/back_circle">
|
||||
<ImageView
|
||||
android:id="@+id/imageview_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/svg_back" />
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:id="@+id/categoryname"
|
||||
android:textStyle="italic"
|
||||
android:textSize="25sp"/>
|
||||
</LinearLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview_specific"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
9
app/src/main/res/drawable/go_url.xml
Normal file
9
app/src/main/res/drawable/go_url.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FFffffff"
|
||||
android:pathData="M431.5,1024c-12.8,0 -25.6,-4.9 -35.3,-14.6 -19.5,-19.5 -19.5,-51.2 0,-70.7l426.7,-426.7L396.2,85.3c-19.5,-19.5 -19.5,-51.2 0,-70.7 19.5,-19.5 51.2,-19.5 70.7,0L928.9,476.7c19.5,19.5 19.5,51.2 0,70.7l-462,462c-9.8,9.8 -22.6,14.6 -35.3,14.6z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/menu.xml
Normal file
9
app/src/main/res/drawable/menu.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M64.1,831.8c0,-24.7 20.1,-44.8 44.8,-44.8h420.2c24.7,0 44.8,20.1 44.8,44.8 0,24.7 -20.1,44.8 -44.8,44.8H108.9c-24.8,0 -44.8,-20 -44.8,-44.8zM64.1,511.7c0,-24.7 20.1,-44.8 44.8,-44.8h676.2c24.7,0 44.8,20.1 44.8,44.8 0,24.7 -20.1,44.8 -44.8,44.8H108.9c-24.8,-0.1 -44.8,-20.1 -44.8,-44.8zM785.1,556.4H108.9M108.9,466.9h676.2M64.1,192.2c0,-24.7 20.1,-44.8 44.8,-44.8h806.2c24.7,0 44.8,20.1 44.8,44.8 0,24.7 -20.1,44.8 -44.8,44.8H108.9c-24.8,0 -44.8,-20.1 -44.8,-44.8z"
|
||||
android:fillColor="@color/white"/>
|
||||
</vector>
|
||||
7
app/src/main/res/drawable/menu_background.xml
Normal file
7
app/src/main/res/drawable/menu_background.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="12dp"/>
|
||||
<solid android:color="@color/sounds_main"/>
|
||||
|
||||
</shape>
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.drawerlayout.widget.DrawerLayout 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/main"
|
||||
@ -8,41 +8,132 @@
|
||||
android:orientation="vertical"
|
||||
android:background="#EEF4F4"
|
||||
tools:context=".activity.MainActivity">
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/sounds_main">
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
android:id="@+id/main_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="15dp"
|
||||
android:background="@color/sounds_main">
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@mipmap/logo"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textview_sounds"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="35sp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textColor="@color/sounds_text"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_menu"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/menu" />
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_below="@+id/main_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview_sounds"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="@color/white">
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/right_logo"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:src="@mipmap/logo"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textview_sounds"
|
||||
android:text="@string/app_name"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="35sp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:textColor="@color/sounds_text"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview_sounds"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp" />
|
||||
</LinearLayout>
|
||||
android:layout_below="@id/right_logo"
|
||||
android:layout_marginTop="50dp">
|
||||
<RelativeLayout
|
||||
android:id="@+id/url_previcy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/menu_background"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/text_previcy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/privacy"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:layout_gravity="center"/>
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@mipmap/privacy"/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/version_key"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/go_url"/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/version_lay"
|
||||
android:layout_height="60dp"
|
||||
android:layout_below="@id/url_previcy"
|
||||
android:background="@drawable/menu_background"
|
||||
android:layout_marginTop="60dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_version"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:layout_gravity="center"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textColor="@color/white"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="18sp"
|
||||
android:id="@+id/text_version"/>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
BIN
app/src/main/res/mipmap-hdpi/privacy.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/privacy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@ -1,3 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">Funny Sounds</string>
|
||||
<string name="privacy">Privacy</string>
|
||||
<string name="url_privacy">https://sites.google.com/view/funnysoundsairhorn</string>
|
||||
<string name="app_version">Version</string>
|
||||
<string name="app_sounds_version">V%s</string>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user