Coder Social home page Coder Social logo

Comments (10)

heinrichreimer avatar heinrichreimer commented on May 18, 2024

Can you record a vido of your screen?

from material-intro.

ercsoftware11 avatar ercsoftware11 commented on May 18, 2024

https://www.dropbox.com/s/pjvsrpygexvfpi0/SCR_20160428_082421.mp4?dl=0

I implemetd this the same way as it is done in the example app, however the issue is that the app closes in my case

from material-intro.

heinrichreimer avatar heinrichreimer commented on May 18, 2024

So you used the gradle dependency and I guess SimpleSlide?
And the example App works?

from material-intro.

heinrichreimer avatar heinrichreimer commented on May 18, 2024

Fragment lifecycle is tricky especially when used in a ViewPager. Did you override anything lifecycle related in your activity?
You can also try the new version 1.4.

from material-intro.

ercsoftware11 avatar ercsoftware11 commented on May 18, 2024

Sorry i do not believe i fully understand? I am not all that knowledgeable with java. My drawer activity is my splash screen, which checks a preference for if it is the first time the app is starting. If so, then it is set to execute the activity which extends the IntroActivity and implements the SimpleSlide. I can attach some code if necesary. My app is based off an open-source dashboard, called Polar if this is of any use to you. :-)

from material-intro.

heinrichreimer avatar heinrichreimer commented on May 18, 2024

That would be useful!

from material-intro.

ercsoftware11 avatar ercsoftware11 commented on May 18, 2024

Splash Screen:
`package com.afollestad.polar.ui.base;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;

import com.afollestad.polar.R;
import com.afollestad.polar.ui.MainActivity;
import com.afollestad.polar.ui.WelcomeActivity;

/**

  • Created by Ethan on 14/04/2016.
    */
    public class SplashScreen extends Activity {

    public static final String PREFS_NAME = "MatWallsPref"; // Name of prefs file; don't change this after it's saved something
    @OverRide
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    Thread timerThread = new Thread(){
        public void run(){
            try{
                sleep(700);
            }catch(InterruptedException e){
                e.printStackTrace();
            }finally{
    
                SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); // Get preferences file (0 = no option flags set)
                boolean firstRun = settings.getBoolean("firstRun", true); // Is it first run? If not specified, use "true"
                if (firstRun) {
                    Log.w("activity", "first time");
    
                    SharedPreferences.Editor editor = settings.edit(); // Open the editor for our settings
                    editor.putBoolean("firstRun", false); // It is no longer the first run
                    editor.commit(); // Save all changed settings
    
                    Intent intent = new Intent(SplashScreen.this, WelcomeActivity.class);
                    startActivity(intent);
                } else {
                    Log.w("activity", "second time");
                    Intent intent = new Intent(SplashScreen.this,MainActivity.class);
                    startActivity(intent);
                }
    
            }
        }
    };
    timerThread.start();
    

    }

    @OverRide
    protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    finish();
    }

}

Welcome Activity: package com.afollestad.polar.ui;

import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;

import com.afollestad.polar.R;
import com.heinrichreimersoftware.materialintro.app.IntroActivity;
import com.heinrichreimersoftware.materialintro.app.NavigationPolicy;
import com.heinrichreimersoftware.materialintro.app.OnNavigationBlockedListener;
import com.heinrichreimersoftware.materialintro.slide.SimpleSlide;

/**

  • Created by Ethan on 14/04/2016.
    */
    public class WelcomeActivity extends IntroActivity {

    @OverRide
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    setFullscreen(true);
    super.onCreate(savedInstanceState);
    /* Enable/disable skip button */
    setSkipEnabled(true);

    /* Enable/disable finish button */
    setFinishEnabled(true);
    addSlide(new SimpleSlide.Builder()
            .title(R.string.app_name)
            .description(R.string.homepage_description)
            .image(R.drawable.ic_web2)
            .background(R.color.theme_default_primary)
            .backgroundDark(R.color.theme_default_primary_dark)
            .build());
    
    addSlide(new SimpleSlide.Builder()
            .title(R.string.app_name)
            .description(R.string.homepage_description)
            .image(R.drawable.ic_web2)
            .background(R.color.accent_2_dark)
            .backgroundDark(R.color.accent_1_dark)
            .build());
    
    
    
    
    
    /* Add a navigation policy to define when users can go forward/backward */
    

    }

    @OverRide
    protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    finish();
    }

}

`

from material-intro.

ercsoftware11 avatar ercsoftware11 commented on May 18, 2024

Sorry its not formatted correctly.

from material-intro.

ercsoftware11 avatar ercsoftware11 commented on May 18, 2024

Hey there never mind. The issue seems to be resolved! It was an issue on my end, where I was calling the intro from the splash screen, and the splash screen would close. So when you rotated it there was no activity holding the intro I believe.

Anyway I've added your awesome into into my app! Feel free to check it out! https://play.google.com/store/apps/details?id=com.erc.software.materialwallpapers

Thank you very much for your assistance and sorry for the inconvenience.

from material-intro.

heinrichreimer avatar heinrichreimer commented on May 18, 2024

Yep, that's the issue here. You should start the intro in your MainActivity.java. I should add a demo for implementing the intro with a splash screen

from material-intro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.