Show app introduction; restore original launch icon

pull/30/head
Alinson S. Xavier 10 years ago
parent b24e8aa018
commit 0ccdd2ce2a

@ -24,6 +24,7 @@ android {
dependencies { dependencies {
compile 'com.android.support:support-v4:23.1.1' compile 'com.android.support:support-v4:23.1.1'
compile 'com.github.paolorotolo:appintro:3.4.0'
compile files('libs/ActiveAndroid.jar') compile files('libs/ActiveAndroid.jar')
} }

@ -56,6 +56,10 @@
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="org.isoron.uhabits.MainActivity"/> android:value="org.isoron.uhabits.MainActivity"/>
</activity> </activity>
<activity android:name=".IntroActivity"
android:label=""
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
</application> </application>
</manifest> </manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 40 KiB

@ -0,0 +1,51 @@
package org.isoron.uhabits;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import com.github.paolorotolo.appintro.AppIntro2;
import com.github.paolorotolo.appintro.AppIntroFragment;
public class IntroActivity extends AppIntro2
{
@Override
public void init(Bundle savedInstanceState)
{
showStatusBar(false);
addSlide(AppIntroFragment.newInstance("Welcome",
"Habits Tracker helps you create and mantain good habits.", R.drawable.tutorial_1,
Color.parseColor("#194673")));
addSlide(AppIntroFragment.newInstance("Create some new habits",
"Every day, after performing your habit, put a checkmark on the app.",
R.drawable.tutorial_2, Color.parseColor("#ffa726")));
addSlide(AppIntroFragment.newInstance("Keep doing it",
"Habits performed consistently for a long time will earn a full star.",
R.drawable.tutorial_3, Color.parseColor("#7cb342")));
addSlide(AppIntroFragment.newInstance("Track your progress",
"Detailed graphs show you how your habits improved over time.",
R.drawable.tutorial_4, Color.parseColor("#9575cd")));
}
@Override
public void onNextPressed()
{
}
@Override
public void onDonePressed()
{
finish();
}
@Override
public void onSlideChanged()
{
}
}

@ -1,6 +1,8 @@
package org.isoron.uhabits; package org.isoron.uhabits;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
@ -29,6 +31,24 @@ public class MainActivity extends ReplayableActivity
R.id.fragment1); R.id.fragment1);
ReminderHelper.createReminderAlarms(MainActivity.this); ReminderHelper.createReminderAlarms(MainActivity.this);
showTutorial();
}
private void showTutorial()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Boolean firstRun = prefs.getBoolean("pref_first_run", true);
if(firstRun)
{
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("pref_first_run", false);
editor.apply();
Intent intent = new Intent(this, IntroActivity.class);
this.startActivity(intent);
}
} }
@Override @Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

@ -43,6 +43,18 @@
android:action="android.intent.action.VIEW" android:action="android.intent.action.VIEW"
android:data="https://github.com/iSoron/uhabits"/> android:data="https://github.com/iSoron/uhabits"/>
</Preference> </Preference>
</PreferenceCategory>
<PreferenceCategory
android:key="pref_key_misc"
android:title="Miscellaneous">
<Preference android:title="Replay app introduction">
<intent
android:targetClass="org.isoron.uhabits.IntroActivity"
android:targetPackage="org.isoron.uhabits"/>
</Preference>
</PreferenceCategory> </PreferenceCategory>

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 153 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 164 KiB

Loading…
Cancel
Save