├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml ├── modules.xml └── runConfigurations.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── najmus │ │ └── introsliderexample │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── najmus │ │ │ └── introsliderexample │ │ │ ├── IntroActivity.java │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ ├── settings.png │ │ ├── shape.xml │ │ ├── shape2.xml │ │ ├── shape3.xml │ │ ├── special.png │ │ └── tools.png │ │ ├── layout │ │ ├── activity_intro.xml │ │ ├── activity_main.xml │ │ ├── slide1.xml │ │ ├── slide2.xml │ │ └── slide3.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 │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── najmus │ └── introsliderexample │ └── 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/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NAJMUS7834/OneTimeIntroSliderExample/2a81dd0ec63be9b8a99bf3978953e11bf872848c/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.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 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Najmus_Seemab 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OneTimeIntroSliderExample 2 | OneTimeIntroSliderExample is an android application inspired from instagram,bookmyshow etc,this application is an example of introSlider Which will appear only one time, when user will install the application. 3 | ![videotogif_2018 04 14_19 05 50](https://user-images.githubusercontent.com/31741209/38769296-2844a848-401e-11e8-80a2-2a64d2d2db13.gif) 4 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | defaultConfig { 6 | applicationId "com.example.najmus.introsliderexample" 7 | minSdkVersion 16 8 | targetSdkVersion 26 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:26.1.0' 24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' 25 | testImplementation 'junit:junit:4.12' 26 | androidTestImplementation 'com.android.support.test:runner:0.5' 27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2' 28 | } 29 | -------------------------------------------------------------------------------- /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/example/najmus/introsliderexample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.najmus.introsliderexample; 2 | /*==================================== 3 | Author : NAJMUS SEEMAB 4 | ======================================*/ 5 | 6 | import android.content.Context; 7 | import android.support.test.InstrumentationRegistry; 8 | import android.support.test.runner.AndroidJUnit4; 9 | 10 | import org.junit.Test; 11 | import org.junit.runner.RunWith; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Instrumented test, which will execute on an Android device. 17 | * 18 | * @see Testing documentation 19 | */ 20 | @RunWith(AndroidJUnit4.class) 21 | public class ExampleInstrumentedTest { 22 | @Test 23 | public void useAppContext() throws Exception { 24 | // Context of the app under test. 25 | Context appContext = InstrumentationRegistry.getTargetContext (); 26 | 27 | assertEquals ( "com.example.najmus.introsliderexample", appContext.getPackageName () ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/najmus/introsliderexample/IntroActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.najmus.introsliderexample; 2 | /*==================================== 3 | Author : NAJMUS SEEMAB 4 | ======================================*/ 5 | 6 | import android.app.Activity; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.content.SharedPreferences; 10 | import android.support.annotation.MainThread; 11 | import android.support.v4.view.PagerAdapter; 12 | import android.support.v4.view.ViewPager; 13 | import android.support.v7.app.AppCompatActivity; 14 | import android.os.Bundle; 15 | import android.text.Html; 16 | import android.view.LayoutInflater; 17 | import android.view.View; 18 | import android.view.ViewGroup; 19 | import android.view.Window; 20 | import android.view.WindowManager; 21 | import android.widget.Button; 22 | import android.widget.LinearLayout; 23 | import android.widget.TextView; 24 | 25 | 26 | public class IntroActivity extends Activity { 27 | private ViewPager viewPager; 28 | private ViewPagerAdapter viewPagerAdapter; 29 | private LinearLayout dotsLayout; 30 | private TextView[] dots; 31 | private int[] layouts; 32 | private Button btnSkip, btnNext; 33 | 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate ( savedInstanceState ); 38 | requestWindowFeature ( Window.FEATURE_NO_TITLE ); 39 | getWindow ().setFlags ( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); 40 | setContentView ( R.layout.activity_intro ); 41 | SharedPreferences share = getSharedPreferences ( "PREFS",MODE_PRIVATE ); 42 | if (share.getInt ( "INTRO",0 )==1){ 43 | startActivity (new Intent ( IntroActivity.this, MainActivity.class )); 44 | finish (); 45 | } 46 | viewPager = (ViewPager) findViewById ( R.id.view_pager ); 47 | dotsLayout = (LinearLayout) findViewById ( R.id.layoutDots ); 48 | btnSkip = (Button) findViewById ( R.id.btn_skip ); 49 | btnNext = (Button) findViewById ( R.id.btn_next ); 50 | 51 | layouts = new int[]{ 52 | R.layout.slide1, 53 | R.layout.slide2, 54 | R.layout.slide3}; 55 | 56 | // adding bottom dots 57 | addBottomDots ( 0 ); 58 | 59 | viewPagerAdapter = new ViewPagerAdapter (); 60 | viewPager.setAdapter ( viewPagerAdapter ); 61 | viewPager.addOnPageChangeListener ( viewPagerPageChangeListener ); 62 | 63 | 64 | 65 | 66 | } 67 | public void btnSkipClick(View v) 68 | { 69 | launchHomeScreen(); 70 | } 71 | 72 | public void btnNextClick(View v) 73 | { 74 | // checking for last page 75 | // if last page home screen will be launched 76 | int current = getItem(1); 77 | if (current < layouts.length) { 78 | // move to next screen 79 | viewPager.setCurrentItem(current); 80 | } else { 81 | launchHomeScreen(); 82 | } 83 | } 84 | 85 | 86 | ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener () { 87 | 88 | 89 | @Override 90 | public void onPageSelected(int position) { 91 | addBottomDots ( position ); 92 | 93 | // changing the next button text 'NEXT' / 'GOT IT' 94 | if (position == layouts.length - 1) { 95 | // last page. make button text to GOT IT 96 | btnNext.setText ( getString ( R.string.start ) ); 97 | btnSkip.setVisibility ( View.GONE ); 98 | } else { 99 | // still pages are left 100 | btnNext.setText ( getString ( R.string.next ) ); 101 | btnSkip.setVisibility ( View.VISIBLE ); 102 | } 103 | } 104 | 105 | @Override 106 | public void onPageScrolled(int arg0, float arg1, int arg2) { 107 | 108 | } 109 | 110 | @Override 111 | public void onPageScrollStateChanged(int arg0) { 112 | 113 | } 114 | }; 115 | private void addBottomDots(int currentPage) { 116 | dots = new TextView[layouts.length]; 117 | 118 | dotsLayout.removeAllViews(); 119 | for (int i = 0; i < dots.length; i++) { 120 | dots[i] = new TextView(this); 121 | dots[i].setText( Html.fromHtml("•")); 122 | dots[i].setTextSize(35); 123 | dots[i].setTextColor(getResources().getColor(R.color.dot_inactive)); 124 | dotsLayout.addView(dots[i]); 125 | } 126 | 127 | if (dots.length > 0) 128 | dots[currentPage].setTextColor(getResources().getColor(R.color.dot_active)); 129 | 130 | 131 | } 132 | private int getItem(int i) { 133 | return viewPager.getCurrentItem() + i; 134 | } 135 | private void launchHomeScreen() { 136 | SharedPreferences share = getSharedPreferences ( "PREFS",MODE_PRIVATE ); 137 | SharedPreferences.Editor editor; 138 | 139 | editor=share.edit (); 140 | editor.putInt ( "INTRO",1 ); 141 | editor.apply (); 142 | startActivity(new Intent(this, MainActivity.class)); 143 | finish(); 144 | } 145 | 146 | 147 | 148 | public class ViewPagerAdapter extends PagerAdapter { 149 | private LayoutInflater layoutInflater; 150 | 151 | 152 | public ViewPagerAdapter() { 153 | 154 | } 155 | 156 | @Override 157 | public Object instantiateItem(ViewGroup container, int position) { 158 | layoutInflater = (LayoutInflater) getSystemService( Context.LAYOUT_INFLATER_SERVICE); 159 | 160 | View view = layoutInflater.inflate(layouts[position], container, false); 161 | container.addView(view); 162 | 163 | return view; 164 | } 165 | 166 | @Override 167 | public int getCount() { 168 | return layouts.length; 169 | } 170 | 171 | @Override 172 | public boolean isViewFromObject(View view, Object obj) { 173 | return view == obj; 174 | } 175 | 176 | 177 | 178 | @Override 179 | public void destroyItem(ViewGroup container, int position, Object object) { 180 | View view = (View) object; 181 | container.removeView(view); 182 | } 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/najmus/introsliderexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.najmus.introsliderexample; 2 | /*==================================== 3 | Author : NAJMUS SEEMAB 4 | ======================================*/ 5 | 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | 9 | public class MainActivity extends AppCompatActivity { 10 | 11 | @Override 12 | protected void onCreate(Bundle savedInstanceState) { 13 | super.onCreate ( savedInstanceState ); 14 | setContentView ( R.layout.activity_main ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /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/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/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NAJMUS7834/OneTimeIntroSliderExample/2a81dd0ec63be9b8a99bf3978953e11bf872848c/app/src/main/res/drawable/settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape2.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape3.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/special.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NAJMUS7834/OneTimeIntroSliderExample/2a81dd0ec63be9b8a99bf3978953e11bf872848c/app/src/main/res/drawable/special.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NAJMUS7834/OneTimeIntroSliderExample/2a81dd0ec63be9b8a99bf3978953e11bf872848c/app/src/main/res/drawable/tools.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_intro.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 23 | 24 | 25 | 26 | 32 | 33 |