Skip to content

Commit

Permalink
2.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
zayvius-dev committed May 21, 2022
1 parent 65c04d1 commit b0b50a8
Show file tree
Hide file tree
Showing 22 changed files with 384 additions and 157 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions app/src/main/java/com/zayvius/adsall/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.zayvius.zs_ads.ads.ZayviusAdsBackup;
import com.zayvius.zs_ads.ads.ZayviusAdsBanner;
import com.zayvius.zs_ads.ads.ZayviusAdsGDPR;
import com.zayvius.zs_ads.ads.ZayviusAdsIDAdmob;
import com.zayvius.zs_ads.ads.ZayviusAdsIDApplovinMax;
import com.zayvius.zs_ads.ads.ZayviusAdsIDApplovinZone;
import com.zayvius.zs_ads.ads.ZayviusAdsIDUnity;
import com.zayvius.zs_ads.ads.ZayviusAdsInitialize;
import com.zayvius.zs_ads.ads.ZayviusAdsInterstitial;
import com.zayvius.zs_ads.ads.ZayviusAdsMain;
Expand All @@ -26,6 +24,8 @@
import com.zayvius.zs_ads.ads.ZayviusAdsReward;
import com.zayvius.zs_ads.settings.Config;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -39,14 +39,20 @@ protected void onCreate(Bundle savedInstanceState) {

/* Ads End*/
Button next_config = findViewById(R.id.bt_next);
next_config.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, MenuActivity.class);
startActivity(intent);
}
next_config.setOnClickListener(v -> {
Intent intent = new Intent(MainActivity.this, MenuActivity.class);
startActivity(intent);
});

}

@Override
public void onResume() {
super.onResume();
if (ZayviusAdsNative.Disable_Click_ONOFF){
Toast.makeText(this, "disable klik on", Toast.LENGTH_SHORT).show();
}

}

}
2 changes: 2 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
android:layout_below="@id/bt_next"/>

<FrameLayout
android:background="@drawable/bg_native"
android:id="@+id/native_ads"
android:layout_margin="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
Expand Down
107 changes: 106 additions & 1 deletion zs-ads/src/main/java/com/zayvius/zs_ads/ads/NativeAdsConfigAdmob.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public class NativeAdsConfigAdmob {

public static void populateNativeAdView(NativeAd nativeAd, NativeAdView adView) {
protected static void populateNativeAdView(NativeAd nativeAd, NativeAdView adView) {
// Set the media view.
adView.setMediaView( adView.findViewById(R.id.ad_media));
// Set other ad assets.
Expand Down Expand Up @@ -110,4 +110,109 @@ public void onVideoEnd() {
});
}
}

protected static void populateNativeAdView_disable_click(NativeAd nativeAd, NativeAdView adView) {
// Set the media view.
adView.setMediaView( adView.findViewById(R.id.ad_media));
// Set other ad assets.
adView.setHeadlineView(adView.findViewById(R.id.ad_headline));
adView.setBodyView(adView.findViewById(R.id.ad_body));
adView.setCallToActionView(adView.findViewById(R.id.ad_call_to_action));
adView.setIconView(adView.findViewById(R.id.ad_app_icon));
adView.setPriceView(adView.findViewById(R.id.ad_price));
adView.setStarRatingView(adView.findViewById(R.id.ad_stars));
adView.setStoreView(adView.findViewById(R.id.ad_store));
adView.setAdvertiserView(adView.findViewById(R.id.ad_advertiser));
adView.findViewById(R.id.ad_media).setEnabled(false);
adView.findViewById(R.id.ad_headline).setEnabled(false);
adView.findViewById(R.id.ad_body).setEnabled(false);
adView.findViewById(R.id.ad_call_to_action).setEnabled(false);
adView.findViewById(R.id.ad_app_icon).setEnabled(false);
adView.findViewById(R.id.ad_price).setEnabled(false);
adView.findViewById(R.id.ad_stars).setEnabled(false);
adView.findViewById(R.id.ad_store).setEnabled(false);
adView.findViewById(R.id.ad_advertiser).setEnabled(false);

// The headline and mediaContent are guaranteed to be in every NativeAd.
((TextView) Objects.requireNonNull(adView.getHeadlineView())).setText(nativeAd.getHeadline());
Objects.requireNonNull(adView.getMediaView()).setMediaContent(Objects.requireNonNull(nativeAd.getMediaContent()));

// These assets aren't guaranteed to be in every NativeAd, so it's important to
// check before trying to display them.
if (nativeAd.getBody() == null) {
Objects.requireNonNull(adView.getBodyView()).setVisibility(View.INVISIBLE);
} else {
Objects.requireNonNull(adView.getBodyView()).setVisibility(View.VISIBLE);
((TextView) adView.getBodyView()).setText(nativeAd.getBody());
}

if (nativeAd.getCallToAction() == null) {
Objects.requireNonNull(adView.getCallToActionView()).setVisibility(View.INVISIBLE);
} else {
Objects.requireNonNull(adView.getCallToActionView()).setVisibility(View.VISIBLE);
((Button) adView.getCallToActionView()).setText(nativeAd.getCallToAction());
}

if (nativeAd.getIcon() == null) {
Objects.requireNonNull(adView.getIconView()).setVisibility(View.GONE);
} else {
((ImageView) Objects.requireNonNull(adView.getIconView())).setImageDrawable(
nativeAd.getIcon().getDrawable());
adView.getIconView().setVisibility(View.VISIBLE);
}

if (nativeAd.getPrice() == null) {
Objects.requireNonNull(adView.getPriceView()).setVisibility(View.INVISIBLE);
} else {
Objects.requireNonNull(adView.getPriceView()).setVisibility(View.VISIBLE);
((TextView) adView.getPriceView()).setText(nativeAd.getPrice());
}

if (nativeAd.getStore() == null) {
Objects.requireNonNull(adView.getStoreView()).setVisibility(View.INVISIBLE);
} else {
Objects.requireNonNull(adView.getStoreView()).setVisibility(View.VISIBLE);
((TextView) adView.getStoreView()).setText(nativeAd.getStore());
}

if (nativeAd.getStarRating() == null) {
Objects.requireNonNull(adView.getStarRatingView()).setVisibility(View.INVISIBLE);
} else {
((RatingBar) Objects.requireNonNull(adView.getStarRatingView()))
.setRating(nativeAd.getStarRating().floatValue());
adView.getStarRatingView().setVisibility(View.VISIBLE);
}

if (nativeAd.getAdvertiser() == null) {
Objects.requireNonNull(adView.getAdvertiserView()).setVisibility(View.INVISIBLE);
} else {
((TextView) Objects.requireNonNull(adView.getAdvertiserView())).setText(nativeAd.getAdvertiser());
adView.getAdvertiserView().setVisibility(View.VISIBLE);
}

// This method tells the Google Mobile Ads SDK that you have finished populating your
// native ad view with this native ad.
adView.setNativeAd(nativeAd);

// Get the video controller for the ad. One will always be provided, even if the ad doesn't
// have a video asset.
VideoController vc = nativeAd.getMediaContent().getVideoController();

// Updates the UI to say whether or not this ad has a video asset.
if (vc.hasVideoContent()) {


// Create a new VideoLifecycleCallbacks object and pass it to the VideoController. The
// VideoController will call methods on this object when events occur in the video
// lifecycle.
vc.setVideoLifecycleCallbacks(new VideoController.VideoLifecycleCallbacks() {
@Override
public void onVideoEnd() {
// Publishers should allow native ads to complete video playback before
// refreshing or replacing them with another ad in the same UI location.
super.onVideoEnd();
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,81 @@

public class NativeAdsConfigAdmobSmall {

public static void populateNativeAdView(NativeAd nativeAd, NativeAdView adView) {
protected static void populateNativeAdView(NativeAd nativeAd, NativeAdView adView) {
// Set the media view.
adView.setHeadlineView(adView.findViewById(R.id.ad_headline));
adView.setBodyView(adView.findViewById(R.id.ad_body));
adView.setCallToActionView(adView.findViewById(R.id.ad_call_to_action));
adView.setIconView(adView.findViewById(R.id.ad_app_icon));

// The headline and mediaContent are guaranteed to be in every NativeAd.
((TextView) Objects.requireNonNull(adView.getHeadlineView())).setText(nativeAd.getHeadline());
//Objects.requireNonNull(adView.getMediaView()).setMediaContent(Objects.requireNonNull(nativeAd.getMediaContent()));

// These assets aren't guaranteed to be in every NativeAd, so it's important to
// check before trying to display them.
if (nativeAd.getBody() == null) {
Objects.requireNonNull(adView.getBodyView()).setVisibility(View.INVISIBLE);
} else {
Objects.requireNonNull(adView.getBodyView()).setVisibility(View.VISIBLE);
((TextView) adView.getBodyView()).setText(nativeAd.getBody());
}

if (nativeAd.getCallToAction() == null) {
Objects.requireNonNull(adView.getCallToActionView()).setVisibility(View.INVISIBLE);
} else {
Objects.requireNonNull(adView.getCallToActionView()).setVisibility(View.VISIBLE);
((TextView) adView.getCallToActionView()).setText(nativeAd.getCallToAction());
}

if (nativeAd.getIcon() == null) {
Objects.requireNonNull(adView.getIconView()).setVisibility(View.GONE);
} else {
((ImageView) Objects.requireNonNull(adView.getIconView())).setImageDrawable(
nativeAd.getIcon().getDrawable());
adView.getIconView().setVisibility(View.VISIBLE);
}




// This method tells the Google Mobile Ads SDK that you have finished populating your
// native ad view with this native ad.
adView.setNativeAd(nativeAd);

// Get the video controller for the ad. One will always be provided, even if the ad doesn't
// have a video asset.
VideoController vc = Objects.requireNonNull(nativeAd.getMediaContent()).getVideoController();

// Updates the UI to say whether or not this ad has a video asset.
if (vc.hasVideoContent()) {


// Create a new VideoLifecycleCallbacks object and pass it to the VideoController. The
// VideoController will call methods on this object when events occur in the video
// lifecycle.
vc.setVideoLifecycleCallbacks(new VideoController.VideoLifecycleCallbacks() {
@Override
public void onVideoEnd() {
// Publishers should allow native ads to complete video playback before
// refreshing or replacing them with another ad in the same UI location.
super.onVideoEnd();
}
});
}
}

protected static void populateNativeAdView_disable_click(NativeAd nativeAd, NativeAdView adView) {
// Set the media view.
adView.setMediaView((MediaView) adView.findViewById(R.id.ad_media));
// Set other ad assets.
adView.setHeadlineView(adView.findViewById(R.id.ad_headline));
adView.setBodyView(adView.findViewById(R.id.ad_body));
adView.setCallToActionView(adView.findViewById(R.id.ad_call_to_action));
adView.setIconView(adView.findViewById(R.id.ad_app_icon));
adView.setPriceView(adView.findViewById(R.id.ad_price));
adView.setStarRatingView(adView.findViewById(R.id.ad_stars));
adView.setStoreView(adView.findViewById(R.id.ad_store));
adView.setAdvertiserView(adView.findViewById(R.id.ad_advertiser));
adView.findViewById(R.id.ad_headline).setEnabled(false);
adView.findViewById(R.id.ad_body).setEnabled(false);
adView.findViewById(R.id.ad_call_to_action).setEnabled(false);
adView.findViewById(R.id.ad_app_icon).setEnabled(false);

// The headline and mediaContent are guaranteed to be in every NativeAd.
((TextView) Objects.requireNonNull(adView.getHeadlineView())).setText(nativeAd.getHeadline());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.zayvius.zs_ads.ads;

public class ZayviusAdsBackup {
public static String backup_ad;
protected static String backup_ad;
public static void config(String ad){
backup_ad = ad;
}
Expand Down
Loading

0 comments on commit b0b50a8

Please sign in to comment.