Skip to main content

JellyToolbar



DOWNLOAD LINK
 HERE

Requirements

  • Android SDK 16+

Usage

Add to your root build.gradle:
allprojects {
 repositories {
   ...
   maven { url "https://jitpack.io" }
 }
}
Add the dependency:
dependencies {
  compile 'com.github.yalantis:jellytoolbar:v1.0'
}

How to use this library in your project?

First of all, add JellyToolbar to the xml layout of your activity, so it looks like that:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <com.yalantis.jellytoolbar.widget.JellyToolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimary"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingStart="@dimen/activity_horizontal_margin"
        app:cancelIcon="@drawable/ic_close"
        app:endColor="@color/colorEnd"
        app:icon="@drawable/ic_search"
        app:startColor="@color/colorStart"
        app:title="@string/str_news_feed"
        app:titleTextColor="@android:color/white" />

</LinearLayout>
After that pass an instance of the JellyListener and content view (the view which would be inserted to the toolbar) to the JellyToolbarJellyToolbar has getToolbar() method to let you use all the methods of the standard Toolbar.
public class MainActivity extends AppCompatActivity {

    private JellyToolbar toolbar;
    private AppCompatEditText editText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        toolbar = (JellyToolbar) findViewById(R.id.toolbar);
        toolbar.getToolbar().setNavigationIcon(R.drawable.ic_menu);
        toolbar.setJellyListener(jellyListener);

        editText = (AppCompatEditText) LayoutInflater.from(this).inflate(R.layout.edit_text, null);
        editText.setBackgroundResource(R.color.colorTransparent);
        toolbar.setContentView(editText);
    }

    private JellyListener jellyListener = new JellyListener() {
        @Override
        public void onCancelIconClicked() {
            if (TextUtils.isEmpty(editText.getText())) {
                toolbar.collapse();
            } else {
                editText.getText().clear();
            }
        }
    };

}
To control the animation flow use collapse() and expand() methods.
Override onToolbarExpandingStarted()onToolbarCollapsingStarted()onToolbarExpanded() and onToolbarCollapsed()methods of the JellyListener to get all the animation events.

Comments

Popular posts from this blog

MaterialSkin for .NET WinForms C# & VB.NET

DOWNLOAD  HERE images: A simple demo interface with MaterialSkin components. The MaterialSkin checkboxes. The MaterialSkin radiobuttons. The MaterialSkin ListView. 1. Add the library to your project You can do this on multiple ways. The easiest way would be adding the  NuGet Package . Right click on your project and click 'Manage NuGet Packages...'. Search for 'MaterialSkin' and click on install. Once installed the library will be included in your project references. (Or install it through the package manager console: PM> Install-Package MaterialSkin) Another way of doing this step would be cloning the project from GitHub, compiling the library yourself and adding it as a reference. 2. Add the MaterialSkin components to your ToolBox If you have installed the NuGet package, the MaterialSkin.dll file should be in the folder //bin/Debug. Simply drag the MaterialSkin.dll file into your IDE's ToolBox and all the controls should be ad...

Bottom Dialogs Sheet

Bottom Dialogs Sheet      Android Library that shows a customizable Material-based bottom sheet. How to include Add the repository to your project  build.gradle : repositories { maven { url " https://jitpack.io " } } And add the library to your module  build.gradle : dependencies { compile ' com.github.javiersantos:BottomDialogs:1.2.1 ' } Usage Basic Bottom Dialog A basic bottom dialog will be shown. You have access to methods such as  setTitle() ,  setContent() ,  setIcon() ,  setCancelable() ,  dismiss() , etc. Customizations are explained below. new BottomDialog . Builder ( this ) .setTitle( " Awesome! " ) .setContent( " What can we improve? Your feedback is always welcome. " ) .show(); or BottomDialog bottomDialog = new BottomDialog . Builder ( this ) .setTitle( " Awesome! " ) .setContent( " What can we improve? Your feedback is always welcome. " ) .build(); ....

New ver Of Android Studio 3.1.2

Android Studio provides the fastest tools for building apps on every type of Android device. ___________ This update to Android Studio 3.1 includes fixes for the following bugs: In some cases, Android Studio hung indefinitely during exit. Builds configured with  source sets  failed with the following message when Instant Run was enabled: "The SourceSet  name  is not recognized by the Android Gradle Plugin." When Instant Run was enabled, builds of new Kotlin projects failed when triggered by the  Run command. During editing of the  build.gradle  file, there was sometimes a noticeable delay between typing a character and the character appearing on the screen. Build failures occurred during dexing in some projects with large numbers of modules or external dependencies, with the following error message: "RejectedExecutionException: Thread limit exceeded replacing blocked worker" The computation of the D8 main DEX list was not...