Giter Club home page Giter Club logo

paper-onboarding-android's Introduction

PAPER ONBOARDING

Android library Paper Onboarding is a material design UI slider written on Java


We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Stay tuned for the latest updates:


CircleCI Codacy Badge Twitter Donate

Requirements

  • Android 4.0.3 IceCreamSandwich (API lvl 15) or greater
  • Your favorite IDE

Installation

​ Just download the package from here and add it to your project classpath, or just use the maven repo: ​ Gradle:

'com.ramotion.paperonboarding:paper-onboarding:1.1.3'

SBT:

libraryDependencies += "com.ramotion.paperonboarding" % "paper-onboarding" % "1.1.3"

Maven:

<dependency>
    <groupId>com.ramotion.paperonboarding</groupId>
    <artifactId>paper-onboarding</artifactId>
    <version>1.1.3</version>
    <type>aar</type>
</dependency>

Basic usage

Paper Onboarding is a simple and easy to use onboarding slider for your app. You just need to provide content for each slider page - a main icon, text, and small round icon for the bottom.

1 Use PaperOnboardingPage to prepare your data for slider:

PaperOnboardingPage scr1 = new PaperOnboardingPage("Hotels",
	"All hotels and hostels are sorted by hospitality rating",
        Color.parseColor("#678FB4"), R.drawable.hotels, R.drawable.key);
PaperOnboardingPage scr2 = new PaperOnboardingPage("Banks",
	"We carefully verify all banks before add them into the app",
        Color.parseColor("#65B0B4"), R.drawable.banks, R.drawable.wallet);
PaperOnboardingPage scr3 = new PaperOnboardingPage("Stores",
	"All local stores are categorized for your convenience",
        Color.parseColor("#9B90BC"), R.drawable.stores, R.drawable.shopping_cart);

ArrayList<PaperOnboardingPage> elements = new ArrayList<>();
elements.add(scr1);
elements.add(scr2);
elements.add(scr3);

2 Create a fragment from PaperOnboardingFragment and provide your data.

PaperOnboardingFragment onBoardingFragment = PaperOnboardingFragment.newInstance(elements);

3 Done! Now you can use this fragment as you want in your activity, for example :

FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.fragment_container, onBoardingFragment);
fragmentTransaction.commit();

4 Extra step : You can add event listeners to fragments with your logic, like replacing this fragment to another when the user swipes next from the last screen:

onBoardingFragment.setOnRightOutListener(new PaperOnboardingOnRightOutListener() {
    @Override
    public void onRightOut() {
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        Fragment bf = new BlankFragment();
        fragmentTransaction.replace(R.id.fragment_container, bf);
        fragmentTransaction.commit();
    }
});

Currently, there are three listeners that cover all events - onRightOut, onLeftOut and onChange; see code examples and usage in the repo.


🗂 Check this library on other language:

📄 License

Paper Onboarding Android is released under the MIT license. See LICENSE for details.

This library is a part of a selection of our best UI open-source projects

If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com

📱 Get the Showroom App for Android to give it a try

Try this UI component and more like this in our Android app. Contact us if interested.

paper-onboarding-android's People

Contributors

aleksei1000000 avatar alexmik89 avatar dvg4000 avatar golovin47 avatar juriv avatar oleg-vasiliev avatar ramotiondev avatar ronnielsen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paper-onboarding-android's Issues

SDK 14

Hi, thanks for this library. please develop this for android 14 + .
thanks ❤️

Is it possible to change textcolor?

Hi!
Must say I really like your onboarding!
But in the swift onboarding it is possible to change color on the text,
is it possible to do this in the android version?

Android textcolor and icon color

Is there anyway that there could be an option for changing the android icon color's and also the text color please, I couldn't help notice that the ios version of the library has these features but the android does not.

Manifest allowBackup issue

Hi ,
I'm using AS 3.2 RC 3 to try.After adding the library gradle that synced. But I got an error;

Attribute application@allowBackup value=(false) from AndroidManifest.xml:10:9-36
is also present at [com.ramotion.paperonboarding:paper-onboarding:1.1.1] AndroidManifest.xml:12:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:9:5-40:19 to override.

Background colour to Image

Can we make the foreground text and image hide and replace the background color with a background image (whole screen)?

Ability to load images from url and other needed features

it would be great if i can load images from remote URL, not just local resources.
change text color, weight, typeface, and also control the size of the image.

i have also found an issue when the fragment is left to right (Arabic locale).

i hope if it has these features.

App Stopped working

When i call fragmenttransaction.commit() is gives me fatal exception main error so can anyone help me out with this ,,,,??

ERROR: Failed to resolve: com.ramotion.paperonboarding:paper-onboarding:1.1.2

I am trying to add the dependency with implementation 'com.ramotion.paperonboarding:paper-onboarding:1.1.2' but showing error : ERROR: Failed to resolve: com.ramotion.paperonboarding:paper-onboarding:1.1.2

But adding paper-onboarding:1.1.1 was successful.

compileSdkVersion 28
minSdkVersion 23
targetSdkVersion 28

repositories {
google()
jcenter()
}

Multiple images aren't loading

I have three pages setup just as the readme says. When the fragment shows, the first image and icon show up. When I scroll to the second page, the icon shows, but no background image. Same with the third page. If I scroll back, none of the background images reappear.

Use of specific implementation of List for onBoarding pages

When creating the onboarding engine, we are forced to use an ArrayList to hold ou onboarding pages. This might be a design issue as using a List as constructor parameter would be better than an ArrayList.

For my case, i wanted to take advantage of LinkedList to keep the order of screen. This order in mind would help to better manipulated the screens in bounds to implement further logic

Doesn't respond to onTouch Events

Testing on API 29

I love the onboarding setup. You've done a nice job. The problem I have is that the UI doesn't respond to touch events, only swipe. This creates an accessibility issue for users who may only have access to a keyboard or who have issues performing swipe actions.

In addition, Google's automated testing when submitting applications will get stuck because touch events are not recognized, so it can't get further into the app. This workaround won't fix the automated instrumented testing, because the instrumenting used with clash with the automated testing.

Here's a workaround cobbled together from some stack overflow pages that will simulate the swipe event so that the screen can be passed. Basically in your MainActivity, you would put the following:

override fun onTouchEvent(event: MotionEvent?): Boolean {
        suspend fun fling(
            fromX: Float, toX: Float, fromY: Float,
            toY: Float, stepCount: Int) {
            withContext(Dispatchers.Default) {
                val inst = Instrumentation()

                val downTime = SystemClock.uptimeMillis()
                var eventTime = SystemClock.uptimeMillis()

                var y = fromY
                var x = fromX

                val yStep = (toY - fromY) / stepCount
                val xStep = (toX - fromX) / stepCount

                var event = MotionEvent.obtain(
                    downTime, eventTime,
                    MotionEvent.ACTION_DOWN, fromX, fromY, 0
                )
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
                    event.source = InputDevice.SOURCE_TOUCHSCREEN
                }
                inst.sendPointerSync(event)

                for (i in 0 until stepCount) {
                    y += yStep
                    x += xStep
                    eventTime = SystemClock.uptimeMillis()
                    event = MotionEvent.obtain(
                        downTime, eventTime + stepCount,
                        MotionEvent.ACTION_MOVE, x, y, 0
                    )
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
                        event.source = InputDevice.SOURCE_TOUCHSCREEN
                    }
                    inst.sendPointerSync(event)
                }

                eventTime = SystemClock.uptimeMillis() + stepCount.toLong() + 2
                event = MotionEvent.obtain(
                    downTime, eventTime,
                    MotionEvent.ACTION_UP, toX, toY, 0
                )

                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
                    event.source = InputDevice.SOURCE_TOUCHSCREEN
                }
                inst.sendPointerSync(event)
            }
        }
        if (event?.action == MotionEvent.ACTION_UP) {
            val dm = DisplayMetrics()
            windowManager.defaultDisplay.getMetrics(dm)
            val halfheight = (dm.heightPixels/2).toFloat()
            val width = dm.widthPixels.toFloat()
            val h = Handler()
            lifecycleScope.launch {
                fling(
                    width-1, width/2, halfheight-1, halfheight-1, 5
                )
            }
        }
}

Setting images dynamically from url source

I need to set contentIconRes and bottomBarIconRes images dynamically (from image loaded from url using say Picasso). Is subclassing PaperOnboardingEngine the recommended way of doing that or is there another approach recommended?

How to resolve this error from my project?

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:13:5-174:19 to override.

Not working on Android Pie (9.0)

When finishing the activity with the tutorial screen the previous activity is shown with a gray overlay and you cannot click on anything

NullPointerException error

Your code converted into Kotlin

val engine = PaperOnboardingEngine(findViewById(R.id.onboardingRootView), getDataForOnboarding(), applicationContext)
engine.setOnChangeListener { oldElementIndex, newElementIndex -> Toast.makeText(applicationContext, "Swiped from $oldElementIndex to $newElementIndex", Toast.LENGTH_SHORT).show() }
engine.setOnRightOutListener {
// Probably here will be your exit action
Toast.makeText(applicationContext, "Swiped out right", Toast.LENGTH_SHORT).show()
}

I get error on R.id.onboardingRootView part

Errror is : Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
at com.ramotion.paperonboarding.PaperOnboardingEngine.(PaperOnboardingEngine.java:83)
at io.insyssky.mediassistplus.activity.OnBoardActivity.onCreate(OnBoardActivity.kt:20)

It's not pretty clear that screen react on my swipe gesture

In my point of view, it would be better if a user can see that something happening when he/she swiping the screen.

the easier way to do it is to change background-color during swapping

If you think it is a good feature I may create a pull-request

Correct README

Android 5.0 Lollipop (API lvl 21) or greater should say API lvl 15 or greater (at least that's what the build.gradle file says...)

Layout issue in onboarding_text_content_layout.xml

Hi,

at first, thanks for your nice lib.

During my tests , I found an issue in onboarding_text_content_layout.xml. The top LinearLayout uses:

android:layout_width="wrap_content"

All elements are centered but not the text elements (landscape mode). I changed layout_width to "match_parent" and all looks fine (landscape and portrait mode).

Can you please fix this.

Thanks,
Mario

v1 ETA

Hey, I really appreciate your iOS library for this feature. Just stumbled on this android repo... I was just curious if this is something you're actively working on and would have an ETA for?

help

how can i display onboarding app only first time?

Cannot resolve method 'add(int, com.ramotion.paperonboarding.PaperOnboardingFragment)'

Error occurs on the .add()
I tried casting onBoardingFragment to a regular Fragment, but it wouldn't take.

PaperOnboardingFragment onBoardingFragment = PaperOnboardingFragment.newInstance(elements);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.fragment_container, onBoardingFragment);
fragmentTransaction.commit();

Any ideas for a fix?

Google Play Store - Pre launch report problem

Hello, i used your library for my new app. However, the pre-launch report on Play Store can't proceed beyond the intro slides, so it stucks on the first slide and never makes it to the actual app. I am guessing this is because the devices won't swipe to the next slide. Any solutions?

When i keep MPAndroid PieChart in FrameLayout after swipe half chart going out of screen

In PaperOnboardingEngine.java implemented PieChart to show in each screen swipe. Once i press right swipe PieChart going bottom of screen and only half chart is showing. Please help to fix this issue.

protected ViewGroup createContentTextView(PaperOnboardingPage PaperOnboardingPage) {
LayoutInflater vi = LayoutInflater.from(mAppContext);
ViewGroup contentTextView = (ViewGroup) vi.inflate(R.layout.onboarding_text_content_layout, mContentTextContainer, false);
...
pieChart = (PieChart) contentTextView.getChildAt(1);
pieChart.setRotationEnabled(false);
pieChart.setUsePercentValues(true);
..
..
}

Incompatible with non-androidX projects

Hi.
Created a new project from scratch with Android Studio, without checking use androidx, added the implementation 'com.ramotion.paperonboarding:paper-onboarding:1.1.3' dependency.

Result: does not compile.

What went wrong:
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).

Note: adding 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml does not help.

I thought androidx libs were backward compatible with support library versions?

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.