B4A Library [Class] Startup Wizard

I posted a demo apk here before: http://www.b4x.com/forum/basic4android-share-your-creations/30961-startup-wizard.html

StartupWizard basically shows a startup guide, or help screen or settings screen, on the first launch of an app.

This is basically comprising of a couple of components:
- ViewPager
- PageIndicators
- Footer (Buttons for Next/Skip)

It will expose some panels, and you will have to add your own layout/views to these panels (since they are app-specific).

It uses 2 Classes:
clsStartWizard
- Uses ViewPager by corwin42
clsPageIndicator
- Uses AnimationPlus by Informatix (for Animation Interpolation), you can use Animation too but remove Interpolation

The Demo itself also uses:
- LabelExtras by warwound, to generate hyperlinks in a label
- RichString by agraham to format a label
- StringUtils by Erel to find the height of a label

All the source code and files are included here.
 

Attachments

  • StartupWizard.zip
    308.7 KB · Views: 1,287

DonManfred

Expert
Licensed User
Longtime User
Thanx for sharing this!

Really nice. Thank you for sharing this! :sign0098:
 

Mahares

Expert
Licensed User
Longtime User
You are amazing TDS. As you alluded to, I added a page to display a help document as shown in the code below and it serves the purpose very well:
B4X:
Case 5  
      mainText = File.ReadString(File.DirAssets,"help0.txt")   
      mainText = "{B}" & mainText &"{B}"
Shoukran!
 

thedesolatesoul

Expert
Licensed User
Longtime User
You are amazing TDS. As you alluded to, I added a page to display a help document as shown in the code below and it serves the purpose very well:
B4X:
Case 5  
      mainText = File.ReadString(File.DirAssets,"help0.txt")   
      mainText = "{B}" & mainText &"{B}"
Shoukran!
Thanks Mahares, thats a great idea!
Maybe using one of the translation libs, we can make it easily work in any language :)
 

basil99

Active Member
Licensed User
Longtime User
Tried to launch the example, but got compiling error:

B4X:
Parsing code.                           0.02
Compiling code.                         0.11
Compiling layouts code.                 0.00
Generating R file.                      0.27
Compiling generated Java code.          Error
B4A line: 45
pnlHolder.AddView(pager,0,0,w,h - 50dip)
javac 1.7.0_11
src\b4a\example\clsstartwizard.java:50: error: cannot access ViewPager
_pnlholder.AddView((android.view.View)(_pager.getObject()),(int)(0),(int)(0),_w,(int)(_h-__c.DipToCurrent((int)(50))));
                   ^
  class file for android.support.v4.view.ViewPager not found
1 error


Have ViewPager lib 2.02 installed
 

thedesolatesoul

Expert
Licensed User
Longtime User
The ViewPager requires Android support lib to be installed.

From corwin42's AHViewPager thread:
This library uses the android-support-v4.jar library. You have to install it with the Android SDK Manager. Please add the Extras/Android Support package. Then you will find the jar under <SDK root folder>\extras\android\support\v4. Please copy the android-support-v4.jar file to your custom libs folder!
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Just tried this and got:

Parsing code. 0.05
Compiling code. 0.17
Compiling layouts code. 0.10
Generating R file. 0.08
Compiling debugger engine code. 0.94
Compiling generated Java code. Error
B4A line: 110
Anim.InitializeAlpha(\
javac 1.7.0_60
src\b4a\example\clspageindicator.java:193: error: cannot access AnimationWrapper
__ref._anim.InitializeAlpha(ba,"AnimAlpha1",(float) (1),(float) (0));
^
class file for anywheresoftware.b4a.objects.AnimationWrapper not found
1 error

Any ideas?
Thanks
 

Mashiane

Expert
Licensed User
Longtime User
Hi thedesolatesoul, need some green lights here. I've put the wizard on one activity and want to start another activity as soon as the Skip and Finish buttons are pressed. I have the modules sitting in a shared folder where I'm accessing them. How do I call the Finish and Skip button events from my wizard activity and start another activity?
 

thedesolatesoul

Expert
Licensed User
Longtime User
You could actually call it in Activity_Create of the activity you want to show on it after. I thought the .Show and .Hide method would give you more flexibility.


However (if you want to do it in the class), if you go in clsStartWizard, Line 94 and Line 105, are the two subs that do the Skip/Finish handling. After Hide, you can call the activity you want.

Furthermore, if you want the next starting activity to be generic add a private variable called:
B4X:
Private activityToStart as Object
and a method:
B4X:
Public Sub SetActivityToStart(paramActivity as Object)
  activityToStart = paramActivity
End Sub
Then on Line 85 in the Hide sub, add to the end,
B4X:
StartActivity(activityToStart)

and in the activity that launches the wizard, before Show call SetActivityToStart(NameOfTheActivityToStart),

I have to say im surprised i managed to compact the code in there so much, i remember it was quite big. But yes shameful variable naming.
 

DonManfred

Expert
Licensed User
Longtime User
Top