-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppIntro.java
More file actions
122 lines (107 loc) · 7.4 KB
/
AppIntro.java
File metadata and controls
122 lines (107 loc) · 7.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package com.Go.GoCart;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import com.github.appintro.AppIntroCustomLayoutFragment;
import com.github.appintro.AppIntroFragment;
public class AppIntro extends com.github.appintro.AppIntro2 {
int bgcolor;
int textcolor;
SharedPreferences sharedPreferences;
SharedPreferences.Editor editor;
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
int theme = Integer.valueOf(sharedPreferences.getString("theme", "0"));
switch (theme) {
case 1:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
bgcolor = Color.rgb(238, 238, 238);
textcolor=Color.rgb(34,34,34);
}
break;
case 2:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
bgcolor = Color.rgb(34, 34, 34);
textcolor=Color.rgb(238,238,238);
}
break;
default:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
}
showStatusBar(true);
setImmersiveMode();
setIndicatorColor(
getColor(R.color.green),
getColor(R.color.colorAccent)
);
if (theme == 0) {
addSlide(AppIntroFragment.newInstance("Welcome to GoCart!", "Comparisons Now Made Easier!",
R.drawable.ic_gocart, ContextCompat.getColor(getApplicationContext(), R.color.cpWhite), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Shopping Now Made Easier", "GoCart helps you compare prices of products to online stores, ad-free!",
R.drawable.ic_baseline_computer_24, ContextCompat.getColor(getApplicationContext(), R.color.cpWhite), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Barcode Scanner", "Tap on the Camera Icon to Scan for the Barcode",
R.drawable.camera_slider, ContextCompat.getColor(getApplicationContext(), R.color.cpWhite), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Search Bar", "Alternatively, You Can Search For Products By Tapping The Search Icon As Well!",
R.drawable.ic_search, ContextCompat.getColor(getApplicationContext(), R.color.cpWhite), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Wishlist", "You Can Also Add Products To Your Wishlist By Tapping On the Add to Wishlist Button",
R.drawable.cart, ContextCompat.getColor(getApplicationContext(), R.color.cpWhite), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Settings", "You Can Also Customize The App (Themes, View etc) By Tapping On the Settings Icon",
R.drawable.ic_settingsforsplash, ContextCompat.getColor(getApplicationContext(), R.color.cpWhite), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), ContextCompat.getColor(getApplicationContext(), R.color.colorAccent), R.font.lato, R.font.lato));
addSlide(AppIntroCustomLayoutFragment.newInstance(R.layout.activity_disclaimer));
} else {
addSlide(AppIntroFragment.newInstance("Welcome to GoCart!", "Comparisons Now Made Easier!",
R.drawable.ic_gocart, bgcolor, textcolor, textcolor, R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Shopping Now Made Easier", "GoCart helps you compare prices of products to online stores, ad-free!",
R.drawable.ic_baseline_computer_24, bgcolor, textcolor, textcolor, R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Barcode Scanner", "Tap on the Camera Icon to Scan for the Barcode",
R.drawable.camera_slider, bgcolor, textcolor, textcolor, R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Search Bar", "Alternatively, You Can Search For Products By Tapping The Search Icon As Well!",
R.drawable.ic_search, bgcolor, textcolor, textcolor, R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Wishlist", "You Can Also Add Products To Your Wishlist By Tapping On the Add to Wishlist Button",
R.drawable.cart, bgcolor, textcolor, textcolor, R.font.lato, R.font.lato));
addSlide(AppIntroFragment.newInstance("Settings", "You Can Also Customize The App (Themes, View etc) By Tapping On the Settings Icon",
R.drawable.ic_settingsforsplash, bgcolor, textcolor, textcolor, R.font.lato, R.font.lato));
addSlide(AppIntroCustomLayoutFragment.newInstance(R.layout.activity_disclaimer));
}
sharedPreferences = getApplicationContext().getSharedPreferences("Preferences", Context.MODE_PRIVATE);
editor = sharedPreferences.edit();
if (sharedPreferences != null) {
boolean checkShared = sharedPreferences.getBoolean("CheckStated", false);
if (checkShared) {
startActivity(new Intent(getApplicationContext(), SplashScreen.class));
finish();
}
}
}
@Override
public void onSkipPressed(Fragment currentFragment) {
super.onSkipPressed(currentFragment);
startActivity(new Intent(getApplicationContext(), SplashScreen.class));
editor.putBoolean("CheckStated", true).commit();
Intent intent = new Intent(getApplicationContext(), SplashScreen.class);
startActivity(intent);
finish();
}
@Override
public void onDonePressed(Fragment currentFragment) {
super.onDonePressed(currentFragment);
startActivity(new Intent(getApplicationContext(), SplashScreen.class));
editor.putBoolean("CheckStated", true).commit();
Intent intent = new Intent(getApplicationContext(), SplashScreen.class);
startActivity(intent);
finish();
}
}