Skip to content

Commit c334ada

Browse files
committed
added intro screen & splash screen
1 parent 5fe30ad commit c334ada

File tree

8 files changed

+216
-4
lines changed

8 files changed

+216
-4
lines changed

.idea/modules.xml

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ dependencies {
5454
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
5555
compile 'com.google.firebase:firebase-ads:11.0.2'
5656
compile 'com.google.firebase:firebase-core:11.0.2'
57+
compile 'com.github.armcha:Vertical-Intro:2.0.0'
58+
compile 'com.android.support.constraint:constraint-layout:1.0.2'
5759
testCompile 'junit:junit:4.12'
5860
}
5961

app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
android:supportsRtl="true"
1515
android:theme="@style/AppTheme">
1616
<activity
17-
android:name=".Main2Activity"
17+
android:name=".SplashActivity"
1818
android:configChanges="orientation"
1919
android:label="@string/title_activity_main2"
2020
android:screenOrientation="sensorPortrait"
@@ -26,6 +26,13 @@
2626
<category android:name="android.intent.category.LAUNCHER"/>
2727
</intent-filter>
2828
</activity>
29+
<activity
30+
android:name=".Main2Activity"
31+
android:configChanges="orientation"
32+
android:label="@string/title_activity_main2"
33+
android:screenOrientation="sensorPortrait"
34+
android:theme="@style/AppTheme.NoActionBar"
35+
android:windowSoftInputMode="stateHidden"/>
2936
<!--
3037
<activity
3138
android:name=".Main2Activity"
@@ -40,6 +47,8 @@
4047
android:label="Image"
4148
android:theme="@style/AppTheme.Translucent">
4249
</activity>
50+
<activity android:name=".IntroActivity">
51+
</activity>
4352
</application>
4453

4554
</manifest>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package rudiment.jsoupexample;
2+
3+
import android.content.Intent;
4+
import android.view.View;
5+
6+
import com.luseen.verticalintrolibrary.VerticalIntro;
7+
import com.luseen.verticalintrolibrary.VerticalIntroItem;
8+
9+
public class IntroActivity extends VerticalIntro {
10+
11+
@Override
12+
protected void init() {
13+
addIntroItem(new VerticalIntroItem.Builder()
14+
.backgroundColor(R.color.colorAccent)
15+
.image(R.drawable.ic_image)
16+
.title("Lorem Ipsum Lorem Ipsum")
17+
.text("Lorem Ipsum is simply dummy text of the printing and typesetting industry." +
18+
"Lorem Ipsum is simply dummy text of the printing and typesetting industry." +
19+
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
20+
.textSize(14)
21+
.titleSize(17)
22+
.build());
23+
24+
addIntroItem(new VerticalIntroItem.Builder()
25+
.backgroundColor(R.color.colorPrimaryDark)
26+
.image(R.drawable.ic_image)
27+
.title("Lorem Ipsum Lorem Ipsum ")
28+
.text("Lorem Ipsum is simply dummy text of the printing and typesetting industry." +
29+
"Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
30+
.build());
31+
32+
addIntroItem(new VerticalIntroItem.Builder()
33+
.backgroundColor(R.color.colorPrimary)
34+
.image(R.drawable.ic_image)
35+
.title("Lorem Ipsum")
36+
.text("Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
37+
.build());
38+
39+
}
40+
41+
@Override
42+
protected Integer setLastItemBottomViewColor() {
43+
return null;
44+
}
45+
46+
@Override
47+
protected void onSkipPressed(View view) {
48+
49+
}
50+
51+
@Override
52+
protected void onFragmentChanged(int position) {
53+
54+
}
55+
56+
@Override
57+
protected void onDonePressed() {
58+
Intent intent = new Intent(this, IntroActivity.class);
59+
startActivity(intent);
60+
finish();
61+
}
62+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package rudiment.jsoupexample;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.os.Handler;
6+
import android.os.Message;
7+
import android.support.v7.app.AppCompatActivity;
8+
9+
import com.google.android.gms.ads.AdRequest;
10+
import com.google.android.gms.ads.AdView;
11+
12+
public class SplashActivity extends AppCompatActivity {
13+
14+
Handler handler;
15+
public static int SPLASHTIME = 4000;
16+
Message msg;
17+
18+
@Override
19+
protected void onCreate(Bundle savedInstanceState) {
20+
super.onCreate(savedInstanceState);
21+
setContentView(R.layout.activity_splash);
22+
AdView adView = (AdView) findViewById(R.id.adView);
23+
AdView adView2 = (AdView) findViewById(R.id.adView2);
24+
25+
AdRequest adRequest = new AdRequest.Builder().build();
26+
adView.loadAd(adRequest);
27+
adView2.loadAd(adRequest);
28+
29+
30+
addHandler();
31+
msg = new Message();
32+
msg.what = 1;
33+
handler.sendMessageDelayed(msg, SPLASHTIME);
34+
}
35+
36+
private void switchActivityToLogin() {
37+
Intent intent = new Intent(this, IntroActivity.class);
38+
startActivity(intent);
39+
finish();
40+
}
41+
42+
@Override
43+
protected void onDestroy() {
44+
super.onDestroy();
45+
try {
46+
handler.removeMessages(msg.what);
47+
} catch (Exception e) {
48+
e.printStackTrace();
49+
}
50+
}
51+
52+
private void addHandler() {
53+
handler = new Handler(new Handler.Callback() {
54+
@Override
55+
public boolean handleMessage(Message message) {
56+
if (message.what == 1) {
57+
runOnUiThread(new Runnable() {
58+
@Override
59+
public void run() {
60+
switchActivityToLogin();
61+
}
62+
});
63+
}
64+
return false;
65+
}
66+
});
67+
}
68+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
tools:context="rudiment.jsoupexample.IntroActivity">
9+
10+
</android.support.constraint.ConstraintLayout>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:id="@+id/activity_splash"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:background="@color/colorPrimary">
8+
9+
<com.google.android.gms.ads.AdView
10+
xmlns:ads="http://schemas.android.com/apk/res-auto"
11+
android:id="@+id/adView"
12+
android:layout_width="wrap_content"
13+
android:layout_height="wrap_content"
14+
android:layout_centerHorizontal="true"
15+
ads:adSize="SMART_BANNER"
16+
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
17+
</com.google.android.gms.ads.AdView>
18+
19+
<LinearLayout
20+
android:layout_width="match_parent"
21+
android:layout_height="wrap_content"
22+
android:layout_above="@+id/adView2"
23+
android:layout_below="@+id/adView"
24+
android:gravity="center"
25+
android:orientation="vertical">
26+
27+
<ImageView
28+
android:layout_width="wrap_content"
29+
android:layout_height="wrap_content"
30+
android:layout_centerHorizontal="true"
31+
android:src="@mipmap/ic_launcher_round"/>
32+
33+
<LinearLayout
34+
android:layout_width="match_parent"
35+
android:layout_height="wrap_content"
36+
android:layout_marginTop="10dp"
37+
android:gravity="center|center_vertical"
38+
android:orientation="horizontal">
39+
40+
<TextView
41+
android:layout_width="wrap_content"
42+
android:layout_height="wrap_content"
43+
android:layout_gravity="center_vertical"
44+
android:layout_marginStart="16dp"
45+
android:lines="1"
46+
android:text="Loading..."
47+
android:textColor="@color/white"
48+
android:textSize="19sp"/>
49+
</LinearLayout>
50+
</LinearLayout>
51+
52+
<com.google.android.gms.ads.AdView
53+
xmlns:ads="http://schemas.android.com/apk/res-auto"
54+
android:id="@+id/adView2"
55+
android:layout_width="wrap_content"
56+
android:layout_height="wrap_content"
57+
android:layout_alignParentBottom="true"
58+
android:layout_centerHorizontal="true"
59+
ads:adSize="MEDIUM_RECTANGLE"
60+
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"/>
61+
62+
</RelativeLayout>

app/src/main/res/values/styles.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
88
<item name="colorAccent">@color/colorAccent</item>
9-
9+
<item name="windowActionBar">false</item>
10+
<item name="windowNoTitle">true</item>
1011
</style>
1112

1213
<style name="AppTheme.NoActionBar">

0 commit comments

Comments
 (0)