msayan / tutorial-view Goto Github PK
View Code? Open in Web Editor NEWAndroid Tutorial View
License: MIT License
Android Tutorial View
License: MIT License
Is there any provision to show a skip button replacing probably the back button? Is this currently doable?
I have to swipe between two fragments for custom strings to load, by default I always see English ones.
I am very new to android development only made small project which i need to work for my physics classes
i am facing isshu that is.
i am stuck on first fragment and can not go to any other page and on this page only cancel button is working...
this is my code
package com.example.demoreel;
import androidx.appcompat.app.AppCompatActivity;
import android.Manifest;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.Toast;
import com.hololo.tutorial.library.PermissionStep;
import com.hololo.tutorial.library.Step;
import com.hololo.tutorial.library.TutorialActivity;
public class MyTuorialSlider extends TutorialActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_my_tuorial_slider);
addFragment(
new PermissionStep
.Builder()
.setPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
.setTitle(getString(R.string.permission_title)).setContent(getString(R.string.permission_detail))
.setBackgroundColor(Color.parseColor("#FF0957"))
.setDrawable(R.drawable.ss_1)
.setSummary(getString(R.string.continue_and_learn))
.build());
addFragment(
new Step.Builder()
.setTitle(getString(R.string.automatic_data))
.setContent(getString(R.string.gm_finds_photos))
.setBackgroundColor(Color.parseColor("#FF0957"))
.setDrawable(R.drawable.ss_1)
.setSummary(getString(R.string.continue_and_learn))
.build());
addFragment(
new Step.Builder()
.setTitle(getString(R.string.choose_the_song))
.setContent(getString(R.string.swap_to_the_tab))
.setBackgroundColor(Color.parseColor("#00D4BA"))
.setDrawable(R.drawable.ss_2)
.setSummary(getString(R.string.continue_and_update))
.build());
addFragment(
new Step.Builder()
.setTitle(getString(R.string.edit_data))
.setContent(getString(R.string.update_easily))
.setBackgroundColor(Color.parseColor("#1098FE"))
.setDrawable(R.drawable.ss_2)
.setSummary(getString(R.string.continue_and_result))
.build());
addFragment(
new Step.Builder()
.setTitle(getString(R.string.result_awesome))
.setContent(getString(R.string.after_updating))
.setBackgroundColor(Color.parseColor("#CA70F3"))
.setDrawable(R.drawable.ss_1)
.setSummary(getString(R.string.thank_you))
.build());
setPrevText("LAST"); // Previous button text
setNextText("NEXT"); // Next button text
setFinishText("ENTER"); // Finish button text
// setCancelText("Heelo cance"); // Cancel button text
//setIndicatorSelected(int drawable); // Indicator drawable when selected
//setIndicator(int drawable); // Indicator drawable
setGivePermissionText("DONE"); // Permission button text
Toast.makeText(getApplicationContext(),"Play",Toast.LENGTH_LONG).show();
}
@Override
public void finishTutorial() {
Toast.makeText(this, "Tutorial finished", Toast.LENGTH_SHORT).show();
finish();
}
@Override
public void currentFragmentPosition(int position) {
Toast.makeText(this, "Position : " + position, Toast.LENGTH_SHORT).show();
}
}
java.lang.NoSuchFieldError: No field viewPager of type I in class Lcom/hololo/tutorial/library/R$id; or its superclasses (declaration of 'com.hololo.tutorial.library.R$id' appears in /data/app/test.app.pro-2/base.apk:classes2.dex)
public class TutorialActivity1 extends TutorialActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#FF0957")) // int background color
.setDrawable(R.drawable.ss_1) // int top drawable
.setSummary("This is summary")
.build());
}
}
How can I fix this error?
How can I change the size of images?
Crashed on Genymotion Nexus 4 version 5.0 api 21. Library v1.0.8.
--------- beginning of crash
04-05 00:07:13.291 12931-12931/com.helloandroid E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.helloandroid, PID: 12931
java.lang.OutOfMemoryError: Failed to allocate a 15728652 byte allocation with 3872544 free bytes and 3MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:973)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2423)
at android.content.res.Resources.loadDrawable(Resources.java:2330)
at android.content.res.Resources.getDrawable(Resources.java:758)
at android.content.Context.getDrawable(Context.java:402)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:358)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:85)
at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:93)
at com.hololo.tutorial.library.StepFragment.initData(StepFragment.java:59)
at com.hololo.tutorial.library.StepFragment.onCreateView(StepFragment.java:43)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2346)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1428)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1759)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1827)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2596)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2383)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2338)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2215)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:649)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:145)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1238)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:663)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:625)
at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:617)
at com.hololo.tutorial.library.TutorialActivity.changeFragment(TutorialActivity.java:241)
at com.hololo.tutorial.library.TutorialActivity.onClick(TutorialActivity.java:203)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
How can I fix this error? Any unload method or bitmap options?
10 PNG images from 23362 to 71362 bytes. 768x1280px. Crashed on 6th.
This class appears to have no function. Why not use and ImageView instead?
Great library BTW, thanks for sharing!
I have created a sample implementation. The below is the complete code. When I load I can see the first page and when I swipe I can see the next page till I lift my finger of the screen. Then the app breaks. I believe it is something to do with currentFragmentPosition but I don't know what to do or how to resolve. Can someone help?
`package .ui.welcome
import android.Manifest
import android.os.Bundle
import android.support.v4.content.ContextCompat
import com.hololo.tutorial.library.Step
import com.hololo.tutorial.library.TutorialActivity
import matrimony.matrimony.R
class Introduction: TutorialActivity() {
override fun currentFragmentPosition(position: Int) {
//super.currentFragmentPosition(position)
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addFragment(Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary)) // int background color
.setDrawable(R.drawable.avatar) // int top drawable
.setSummary("This is summary")
.build())
addFragment(Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(ContextCompat.getColor(this, R.color.colorAccent)) // int background color
.setDrawable(R.drawable.avatar) // int top drawable
.setSummary("This is summary")
.build())
addFragment(Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary)) // int background color
.setDrawable(R.drawable.avatar) // int top drawable
.setSummary("This is summary")
.build())
addFragment(Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(ContextCompat.getColor(this, R.color.colorAccent)) // int background color
.setDrawable(R.drawable.avatar) // int top drawable
.setSummary("This is summary")
.build())
}
override fun finishTutorial() {
// Your implementation
finish()
}
}`
Is the permission ammust? Like do I have to include the permission fragment...or I can just do away with it if Im not going to use it?
I've made the tutoria, all works perfectly. But I've made 2 leng application and I need to set the button text on the strings file. In this case I call
setPrevText(R.strings.myres)
but:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: teiacare.android, PID: 9903
java.lang.RuntimeException: Unable to start activity ComponentInfo{teiacare.android/teiacare.android.OnBoardActivity}: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2804)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2875)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1578)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6623)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:411)
at com.hololo.tutorial.library.TutorialActivity.controlPermission(TutorialActivity.java:217)
at com.hololo.tutorial.library.TutorialActivity.controlPosition(TutorialActivity.java:111)
at com.hololo.tutorial.library.TutorialActivity.setPrevText(TutorialActivity.java:250)
at teiacare.android.OnBoardActivity.onCreate(OnBoardActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6910)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2757)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2875)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1578)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6623)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
my code is very simple:
public class OnBoardActivity extends TutorialActivity{
...
setPrevText(getString(R.string.tutorial_pre)); // Previous button text
setNextText(getString(R.string.tutorial_next)); // Next button text
setFinishText(getString(R.string.tutorial_finish)); // Finish button text
setCancelText(getString(R.string.tutorial_cancel));
all other stuff
}
any advice?
Thanks
EDIT
My fault, I had not updated to 10v. After the update, it works perfectly.
I can't figure out how to change the design of the view. The instructions are not clear.
I want to start another activity from this library. Please Help. Thanks!
How do I change the text of the buttons ?. When using the setPrevText ("") method; This throws me an error when opening the activity.
Hey !
I have been trying to use this sweet dependency to beautify my app but seems it ain't working. In the past I have used this in my projects and it worked smooth, seems compatibility issues to me.
Error :
> Task :app:checkDebugDuplicateClasses FAILED
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-27.0.2-runtime (com.android.support:support-compat:27.0.2)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-27.0.2-runtime (com.android.support:support-compat:27.0.2)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-27.0.2-runtime (com.android.support:support-compat:27.0.2)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-27.0.2-runtime (com.android.support:support-compat:27.0.2)
settings.gradle :
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "onboarding"
include ':app'
build.gradle (app) :
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.onboarding'
compileSdk 34
defaultConfig {
applicationId "com.example.onboarding"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.github.msayan:tutorial-view:v1.0.10'
}
Please use R.string.*
values in your R.id.next
and R.id.prev
buttons
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.