Screenshots
Dependencies
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'com.google.android.gms:play-services-ads:19.1.0'
Android manifest
<uses-permission android:name="android.permission.INTERNET" />
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EEEEEE">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="230dp"
android:orientation="vertical"
android:gravity="center"
android:background="@drawable/classes">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MAK TUTORIALS"
android:textColor="#F8F5F5"
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginTop="-100dp"
/>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-8494578888352473/1050818750">
</com.google.android.gms.ads.AdView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="215dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="135dp"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/physics" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Physics"
android:textSize="16dp"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/btnPhysics"
android:onClick="physics"
android:background="@android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/chemistry" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chemistry"
android:textSize="16dp"
android:layout_below="@+id/imageView2"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/btnChemistry"
android:onClick="chemistry"
android:background="@android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="135dp"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView3"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/maths" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Maths"
android:textSize="16dp"
android:layout_below="@+id/imageView3"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/btnMaths"
android:onClick="maths"
android:background="@android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/biology" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Biology"
android:textSize="16dp"
android:layout_below="@+id/imageView4"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/btnBiology"
android:onClick="biology"
android:background="@android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="135dp"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView5"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/quetionbank" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Question Bank"
android:textSize="16dp"
android:layout_below="@+id/imageView5"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/btnQB"
android:onClick="qb"
android:background="@android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView6"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/test" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"
android:textSize="16dp"
android:layout_below="@+id/imageView6"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/btnTest"
android:onClick="test"
android:background="@android:color/transparent"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-8494578888352473/1050818750">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.java
package com.maktech.maharashtra12books;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
public class MainActivity extends AppCompatActivity {
private AdView mAdView,mAdView1;
private InterstitialAd mInterstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
}
});
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
mAdView1 = findViewById(R.id.adView1);
AdRequest adRequest1 = new AdRequest.Builder().build();
mAdView1.loadAd(adRequest);
//interstietial ads
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("ca-app-pub-8494578888352473/9841761735");
mInterstitialAd.loadAd(new AdRequest.Builder().build());
}
public void physics(View view){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mInterstitialAd.show();
}
}, 5000);
Intent i =new Intent(this,PhysicsActivity.class);
startActivity(i);
}
public void chemistry(View view){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mInterstitialAd.show();
}
}, 5000);
Intent i=new Intent(this,ChemistryActivity.class);
startActivity(i);
}
public void maths(View view){
Intent i=new Intent(this,MathActivity.class);
startActivity(i);
}
public void biology(View view){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mInterstitialAd.show();
}
}, 5000);
Intent i=new Intent(this,BiologyActivity.class);
startActivity(i);
}
public void qb(View view){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mInterstitialAd.show();
}
}, 5000);
Intent i=new Intent(this,QBActivity.class);
startActivity(i);
}
public void test(View view){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mInterstitialAd.show();
}
}, 5000);
Intent i=new Intent(this,TestActivity.class);
startActivity(i);
}
}
activity_physics.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PhysicsActivity">
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfPhysics"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
PhysicsActivity.java
package com.maktech.maharashtra12books;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.github.barteksc.pdfviewer.PDFView;
public class PhysicsActivity extends AppCompatActivity {
PDFView pdfPhysics;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_physics);
pdfPhysics=findViewById(R.id.pdfPhysics);
pdfPhysics.fromAsset("Physics_compressed.pdf").load();
}
}
Comments
Post a Comment