EasyButtonDelayed


Easy Delay TabLayout or Button.


Content List


Download

Add maven jitpack.io and dependencies in build.gradle (Project) :

// build.gradle project
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

// build.gradle app/module
dependencies {
  ...
  implementation 'com.github.gzeinnumer:EasyButtonDelayed:version'
}

Feature List

DelayButton

Default Delay 2 second (2000)

button.setOnClickListener(new DelayButton(button, new View.OnClickListener() {}));
Button button = findViewById(R.id.btn);

button.setOnClickListener(new DelayButton(button, new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        Toast.makeText(getApplicationContext(), "Test", Toast.LENGTH_SHORT).show();
    }
}));

Custom Delay 1 second (1000)

int delay = 1000;
button.setOnClickListener(new DelayButton(button, new View.OnClickListener() {}, delay));

DelayTabLayout

Default Delay 2 second (2000)

tabLayout.addOnTabSelectedListener(new DelayTabLayout(tabLayout, new TabLayout.OnTabSelectedListener() {}));
TabLayout tabLayout = findViewById(R.id.tab_layout);

tabLayout.addOnTabSelectedListener(new DelayTabLayout(tabLayout, new TabLayout.OnTabSelectedListener() {
    @Override
    public void onTabSelected(TabLayout.Tab tab) {
        Toast.makeText(getApplicationContext(), "test aja", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onTabUnselected(TabLayout.Tab tab) {}

    @Override
    public void onTabReselected(TabLayout.Tab tab) {}
}));

Custom Delay 1 second (1000)

int delay = 1000;
tabLayout.addOnTabSelectedListener(new DelayTabLayout(tabLayout, new TabLayout.OnTabSelectedListener() {}, delay));

Example Code/App

MainActivity.java activity_main.xml


Version

  • 1.0.3
    • First Release
  • 1.1.0
    • Validasi Valid Time
  • 1.1.1
    • Bug Fixing

Contribution

You can sent your constribution to branch open-pull.

Fore More All My Library


Copyright 2022 M. Fadli Zein