├── .gitignore ├── .idea ├── assetWizardSettings.xml ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml └── runConfigurations.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── labawsrh │ │ └── aws │ │ └── introscreen │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── labawsrh │ │ │ └── aws │ │ │ └── introscreen │ │ │ ├── IntroActivity.java │ │ │ ├── IntroViewPagerAdapter.java │ │ │ ├── MainActivity.java │ │ │ └── ScreenItem.java │ └── res │ │ ├── anim │ │ └── button_animation.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── btn_gradient_style.xml │ │ ├── ic_arrow_forward_black_24dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── img1.png │ │ ├── img2.png │ │ ├── img3.png │ │ ├── indicator_default.xml │ │ ├── indicator_selected.xml │ │ └── indicator_selector.xml │ │ ├── layout │ │ ├── activity_intro.xml │ │ ├── activity_main.xml │ │ └── layout_screen.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── labawsrh │ └── aws │ └── introscreen │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches/build_file_checksums.ser 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | .DS_Store 9 | /build 10 | /captures 11 | .externalNativeBuild 12 | -------------------------------------------------------------------------------- /.idea/assetWizardSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 45 | 46 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.labawsrh.aws.introscreen" 7 | minSdkVersion 15 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'com.android.support:appcompat-v7:28.0.0' 24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 25 | testImplementation 'junit:junit:4.12' 26 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 28 | implementation 'com.android.support:support-v4:28.0.0' 29 | implementation 'com.android.support:design:28.0.0' 30 | } 31 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/labawsrh/aws/introscreen/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.labawsrh.aws.introscreen; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.labawsrh.aws.introscreen", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/labawsrh/aws/introscreen/IntroActivity.java: -------------------------------------------------------------------------------- 1 | package com.labawsrh.aws.introscreen; 2 | 3 | import android.content.Intent; 4 | import android.content.SharedPreferences; 5 | import android.support.design.widget.TabLayout; 6 | import android.support.v4.view.ViewPager; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.os.Bundle; 9 | import android.view.View; 10 | import android.view.Window; 11 | import android.view.WindowManager; 12 | import android.view.animation.Animation; 13 | import android.view.animation.AnimationUtils; 14 | import android.widget.Button; 15 | import android.widget.TextView; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | public class IntroActivity extends AppCompatActivity { 21 | 22 | private ViewPager screenPager; 23 | IntroViewPagerAdapter introViewPagerAdapter ; 24 | TabLayout tabIndicator; 25 | Button btnNext; 26 | int position = 0 ; 27 | Button btnGetStarted; 28 | Animation btnAnim ; 29 | TextView tvSkip; 30 | 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | 36 | // make the activity on full screen 37 | 38 | requestWindowFeature(Window.FEATURE_NO_TITLE); 39 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 40 | WindowManager.LayoutParams.FLAG_FULLSCREEN); 41 | 42 | 43 | // when this activity is about to be launch we need to check if its openened before or not 44 | 45 | if (restorePrefData()) { 46 | 47 | Intent mainActivity = new Intent(getApplicationContext(),MainActivity.class ); 48 | startActivity(mainActivity); 49 | finish(); 50 | 51 | 52 | } 53 | 54 | setContentView(R.layout.activity_intro); 55 | 56 | // hide the action bar 57 | 58 | getSupportActionBar().hide(); 59 | 60 | // ini views 61 | btnNext = findViewById(R.id.btn_next); 62 | btnGetStarted = findViewById(R.id.btn_get_started); 63 | tabIndicator = findViewById(R.id.tab_indicator); 64 | btnAnim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.button_animation); 65 | tvSkip = findViewById(R.id.tv_skip); 66 | 67 | // fill list screen 68 | 69 | final List mList = new ArrayList<>(); 70 | mList.add(new ScreenItem("Fresh Food","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur consectetur adipiscing elit",R.drawable.img1)); 71 | mList.add(new ScreenItem("Fast Delivery","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur consectetur adipiscing elit",R.drawable.img2)); 72 | mList.add(new ScreenItem("Easy Payment","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur consectetur adipiscing elit",R.drawable.img3)); 73 | 74 | // setup viewpager 75 | screenPager =findViewById(R.id.screen_viewpager); 76 | introViewPagerAdapter = new IntroViewPagerAdapter(this,mList); 77 | screenPager.setAdapter(introViewPagerAdapter); 78 | 79 | // setup tablayout with viewpager 80 | 81 | tabIndicator.setupWithViewPager(screenPager); 82 | 83 | // next button click Listner 84 | 85 | btnNext.setOnClickListener(new View.OnClickListener() { 86 | @Override 87 | public void onClick(View v) { 88 | 89 | position = screenPager.getCurrentItem(); 90 | if (position < mList.size()) { 91 | 92 | position++; 93 | screenPager.setCurrentItem(position); 94 | 95 | 96 | } 97 | 98 | if (position == mList.size()-1) { // when we rech to the last screen 99 | 100 | // TODO : show the GETSTARTED Button and hide the indicator and the next button 101 | 102 | loaddLastScreen(); 103 | 104 | 105 | } 106 | 107 | 108 | 109 | } 110 | }); 111 | 112 | // tablayout add change listener 113 | 114 | 115 | tabIndicator.addOnTabSelectedListener(new TabLayout.BaseOnTabSelectedListener() { 116 | @Override 117 | public void onTabSelected(TabLayout.Tab tab) { 118 | 119 | if (tab.getPosition() == mList.size()-1) { 120 | 121 | loaddLastScreen(); 122 | 123 | } 124 | 125 | 126 | } 127 | 128 | @Override 129 | public void onTabUnselected(TabLayout.Tab tab) { 130 | 131 | } 132 | 133 | @Override 134 | public void onTabReselected(TabLayout.Tab tab) { 135 | 136 | } 137 | }); 138 | 139 | 140 | 141 | // Get Started button click listener 142 | 143 | btnGetStarted.setOnClickListener(new View.OnClickListener() { 144 | @Override 145 | public void onClick(View v) { 146 | 147 | 148 | //open main activity 149 | 150 | Intent mainActivity = new Intent(getApplicationContext(),MainActivity.class); 151 | startActivity(mainActivity); 152 | // also we need to save a boolean value to storage so next time when the user run the app 153 | // we could know that he is already checked the intro screen activity 154 | // i'm going to use shared preferences to that process 155 | savePrefsData(); 156 | finish(); 157 | 158 | 159 | 160 | } 161 | }); 162 | 163 | // skip button click listener 164 | 165 | tvSkip.setOnClickListener(new View.OnClickListener() { 166 | @Override 167 | public void onClick(View v) { 168 | screenPager.setCurrentItem(mList.size()); 169 | } 170 | }); 171 | 172 | 173 | 174 | } 175 | 176 | private boolean restorePrefData() { 177 | 178 | 179 | SharedPreferences pref = getApplicationContext().getSharedPreferences("myPrefs",MODE_PRIVATE); 180 | Boolean isIntroActivityOpnendBefore = pref.getBoolean("isIntroOpnend",false); 181 | return isIntroActivityOpnendBefore; 182 | 183 | 184 | 185 | } 186 | 187 | private void savePrefsData() { 188 | 189 | SharedPreferences pref = getApplicationContext().getSharedPreferences("myPrefs",MODE_PRIVATE); 190 | SharedPreferences.Editor editor = pref.edit(); 191 | editor.putBoolean("isIntroOpnend",true); 192 | editor.commit(); 193 | 194 | 195 | } 196 | 197 | // show the GETSTARTED Button and hide the indicator and the next button 198 | private void loaddLastScreen() { 199 | 200 | btnNext.setVisibility(View.INVISIBLE); 201 | btnGetStarted.setVisibility(View.VISIBLE); 202 | tvSkip.setVisibility(View.INVISIBLE); 203 | tabIndicator.setVisibility(View.INVISIBLE); 204 | // TODO : ADD an animation the getstarted button 205 | // setup animation 206 | btnGetStarted.setAnimation(btnAnim); 207 | 208 | 209 | 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /app/src/main/java/com/labawsrh/aws/introscreen/IntroViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.labawsrh.aws.introscreen; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.view.PagerAdapter; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | import java.util.List; 13 | 14 | public class IntroViewPagerAdapter extends PagerAdapter { 15 | 16 | Context mContext ; 17 | List mListScreen; 18 | 19 | public IntroViewPagerAdapter(Context mContext, List mListScreen) { 20 | this.mContext = mContext; 21 | this.mListScreen = mListScreen; 22 | } 23 | 24 | 25 | @NonNull 26 | @Override 27 | public Object instantiateItem(@NonNull ViewGroup container, int position) { 28 | 29 | LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 30 | View layoutScreen = inflater.inflate(R.layout.layout_screen,null); 31 | 32 | ImageView imgSlide = layoutScreen.findViewById(R.id.intro_img); 33 | TextView title = layoutScreen.findViewById(R.id.intro_title); 34 | TextView description = layoutScreen.findViewById(R.id.intro_description); 35 | 36 | title.setText(mListScreen.get(position).getTitle()); 37 | description.setText(mListScreen.get(position).getDescription()); 38 | imgSlide.setImageResource(mListScreen.get(position).getScreenImg()); 39 | 40 | container.addView(layoutScreen); 41 | 42 | return layoutScreen; 43 | 44 | 45 | 46 | 47 | 48 | } 49 | 50 | @Override 51 | public int getCount() { 52 | return mListScreen.size(); 53 | } 54 | 55 | @Override 56 | public boolean isViewFromObject(@NonNull View view, @NonNull Object o) { 57 | return view == o; 58 | } 59 | 60 | @Override 61 | public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { 62 | 63 | container.removeView((View)object); 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/labawsrh/aws/introscreen/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.labawsrh.aws.introscreen; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/labawsrh/aws/introscreen/ScreenItem.java: -------------------------------------------------------------------------------- 1 | package com.labawsrh.aws.introscreen; 2 | 3 | public class ScreenItem { 4 | 5 | String Title,Description; 6 | int ScreenImg; 7 | 8 | public ScreenItem(String title, String description, int screenImg) { 9 | Title = title; 10 | Description = description; 11 | ScreenImg = screenImg; 12 | } 13 | 14 | public void setTitle(String title) { 15 | Title = title; 16 | } 17 | 18 | public void setDescription(String description) { 19 | Description = description; 20 | } 21 | 22 | public void setScreenImg(int screenImg) { 23 | ScreenImg = screenImg; 24 | } 25 | 26 | public String getTitle() { 27 | return Title; 28 | } 29 | 30 | public String getDescription() { 31 | return Description; 32 | } 33 | 34 | public int getScreenImg() { 35 | return ScreenImg; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/res/anim/button_animation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_gradient_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_forward_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws1994/IntroScreen/ae13015dc7ae27e41fdc4c8f23ad7cab05014591/app/src/main/res/drawable/img1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws1994/IntroScreen/ae13015dc7ae27e41fdc4c8f23ad7cab05014591/app/src/main/res/drawable/img2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws1994/IntroScreen/ae13015dc7ae27e41fdc4c8f23ad7cab05014591/app/src/main/res/drawable/img3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/indicator_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/indicator_selected.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/indicator_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_intro.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 20 | 21 |