Code Monkey home page Code Monkey logo

simplecustomtabs's Introduction

SimpleCustomTabs

A library made to use custom tabs without going crazy!

Android Arsenal

To use this library in your project add the dependency to your build.gradle file.

dependencies {
    compile 'io.github.eliseomartelli:simple-custom-tabs:1.1.0'
}

You can see an example use of this library opening "example" module.

Bare Minimum

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        //Warm up section
        CustomTabs.with(getApplicationContext()).warm();
        
        
        //Load section
        CustomTabs.with(getApplicationContext()).openUrl("http://google.com", this);
    }

Styling

Choose what to style!

    CustomTabs.Style style = new CustomTabs.Style(getApplicationContext());
    style.setActionButton(icon, description, pendingIntent, tint);
    style.setCloseButton(closeIcon);
    style.setShowTitle(showTitle);
    style.setStartAnimation(android.R.anim.fade_in, android.R.anim.fade_out);
    style.setExitAnimation(android.R.anim.fade_in, android.R.anim.fade_out);
    style.setToolbarColor(R.color.colorPrimary);
    style.addMenuItem(itemDescription, itemPendingIntent);

    CustomTabs
        .with(getApplicationContext())
        .setStyle(style)
        .openUrl("http://google.com", this);

Do you want to write less? No Problem!

    CustomTabs.with(getApplicationContext())
        .setStyle(new CustomTabs.Style(getApplicationContext())
                .setShowTitle(true)
                .setStartAnimation(R.anim.animation, R.anim.animation)
                .setExitAnimation(R.anim.animation, R.anim.animation)
                .setToolbarColor(R.color.toolbarColor))
        .openUrl("http://google.com", this);

Fallback

Your user doesn't have Chrome Installed? No Problem! The Url will be opened in his browser!

Screenshots


Hope you enjoy!

simplecustomtabs's People

Contributors

eliseomartelli avatar

Stargazers

米奇云科技 avatar  avatar KARL--dujinyang avatar

Watchers

James Cloos avatar KARL--dujinyang avatar  avatar

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.