show admob banne
This commit is contained in:
@@ -53,4 +53,6 @@ dependencies {
|
||||
compile('com.mikepenz:aboutlibraries:5.3.6@aar') {
|
||||
transitive = true
|
||||
}
|
||||
|
||||
compile 'com.google.android.gms:play-services-ads:8.3.0'
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.AdView;
|
||||
|
||||
import net.headlezz.notificationlogger.createnotification.NotificationCreationFragment;
|
||||
import net.headlezz.notificationlogger.logger.LoggerUtils;
|
||||
import net.headlezz.notificationlogger.notificationlist.NotificationListFragment;
|
||||
@@ -30,6 +33,9 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences
|
||||
@Bind(R.id.main_menu_fab_add_notification)
|
||||
FloatingActionButton mFAB;
|
||||
|
||||
@Bind(R.id.adView)
|
||||
AdView mAdView;
|
||||
|
||||
SharedPreferences mSharedPrefs;
|
||||
|
||||
LoggerWarningPresenter mLoggerWarningPresenter;
|
||||
@@ -57,6 +63,14 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences
|
||||
.add(R.id.main_menu_fragment_container, new NotificationListFragment())
|
||||
.commit();
|
||||
}
|
||||
setupAdView();
|
||||
}
|
||||
|
||||
private void setupAdView() {
|
||||
AdRequest req = new AdRequest.Builder()
|
||||
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
|
||||
.build();
|
||||
mAdView.loadAd(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,32 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/viewholder"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/toolbar" />
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/main_menu_fragment_container"
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/viewholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
android:layout_above="@+id/adView">
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/main_menu_fab_add_notification"
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/toolbar" />
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/main_menu_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/main_menu_fab_add_notification"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:contentDescription="@string/fab_cd_create_notification"
|
||||
android:src="@drawable/ic_action_add"
|
||||
app:fabSize="normal" />
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<com.google.android.gms.ads.AdView
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/adView"
|
||||
app:adSize="BANNER"
|
||||
app:adUnitId="@string/banner_ad_unit_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:contentDescription="@string/fab_cd_create_notification"
|
||||
android:src="@drawable/ic_action_add"
|
||||
app:fabSize="normal" />
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
</RelativeLayout>
|
||||
4
app/src/main/res/values/system_strings.xml
Normal file
4
app/src/main/res/values/system_strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="banner_ad_unit_id">ca-app-pub-0000000000000000/0000000000</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user