steps

A controller enabling a paginated layout style

Лицензия

Лицензия

Группа

Группа

com.guardanis
Идентификатор

Идентификатор

steps
Последняя версия

Последняя версия

2.0.1
Дата

Дата

Тип

Тип

aar
Описание

Описание

steps
A controller enabling a paginated layout style
Ссылка на сайт

Ссылка на сайт

https://github.com/mattsilber/steps
Система контроля версий

Система контроля версий

https://github.com/mattsilber/steps.git

Скачать steps

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.guardanis/steps/ -->
<dependency>
    <groupId>com.guardanis</groupId>
    <artifactId>steps</artifactId>
    <version>2.0.1</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.guardanis/steps/
implementation 'com.guardanis:steps:2.0.1'
// https://jarcasting.com/artifacts/com.guardanis/steps/
implementation ("com.guardanis:steps:2.0.1")
'com.guardanis:steps:aar:2.0.1'
<dependency org="com.guardanis" name="steps" rev="2.0.1">
  <artifact name="steps" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.guardanis', module='steps', version='2.0.1')
)
libraryDependencies += "com.guardanis" % "steps" % "2.0.1"
[com.guardanis/steps "2.0.1"]

Зависимости

runtime (1)

Идентификатор библиотеки Тип Версия
androidx.appcompat » appcompat jar 1.2.0

Модули Проекта

Данный проект не имеет модулей.

steps

Download

A controller enabling a paginated layout style in either a Dialog or a full-screen Activity.

Steps Sample

Installation

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.guardanis:steps:2.0.1'
}

Usage

The concept is pretty simple: attach StepModule (a View controller) to a StepController, which in turn handles the navigation between them.

The StepController will inflate the next StepModule as it's needed (using the layout resource ID you pass into the constructor) and then call the setup(StepController, View) method with the View it inflates. It's the setup method where you should build your View information (e.g. setting text, images, etc.).

For convenience, there is a base View to inflate, called R.layout.step__base_module which contains a centered ImageView, a title TextView, and a description TextView (vertically in that order). The attributes for each are entirely customizable via dimens/colors/strings.

If you want to use your own resources, make sure your root View is a DraggableLinearLayout (supplied with the library) if you want the content to be swipe-able.

Example from the Gif

public class MainActivity extends ActionBarActivity implements StepController.StepEventListener {

    @Override
    public void onCreate(Bundle savedInstance){
        super.onCreate(savedInstance);
        setContentView(R.layout.activity_main);

        new Handler(Looper.getMainLooper())
                .postDelayed(() -> showDialog(), 300);
    }

    private void showDialog(){
        new StepDialogBuilder(this)
                .show(this, getModules());
    }

    private List<StepModule> getModules(){
        List<StepModule> modules = new ArrayList<StepModule>();

        for(int i = 0; i < 5; i++)
            modules.add(new BaseStepModule(R.drawable.some_image, "Some awesome title", "This is some text This is some more text And even more text And more"));

        return modules;
    }

    private String generateRandomDescription(){
        String random = "";

        String toReturn = "";
        for(int i = 0; i < new Random().nextInt(20) + 3; i++)
            toReturn += random;

        return toReturn;
    }

    @Override
    public void onFinished() {
        new Handler(Looper.getMainLooper())
                .postDelayed(() -> showDialog(), 1000);
    }

    @Override
    public void onSkipped() {
        new Handler(Looper.getMainLooper())
                .postDelayed(() -> showDialog(), 1000);
    }
}

So, basically all you need to do is call

new StepDialogBuilder(this)
    .show(this, getModules());

And just pass in a list of Modules and an EventListener (which can be null if you don't want to do anything after).

BaseStepModule

The BaseModule helper class can set the image resource, title, and description values for the Views found in the step__base_module layout file. Just pass in the arguments to its constructor and it handles the rest. e.g.

new BaseStepModule(R.drawable.some_image, "Some title", "Some description"));

Moved to MavenCentral

As of version 2.0.1, steps will be hosted on MavenCentral. Versions 2.0.0 and below will remain on JCenter.

Версии библиотеки

Версия
2.0.1