Tapslash

The Tapslash Developer Hub

Welcome to the Tapslash developer hub. Here you'll find comprehensive guides and documentation to help you start working with the SDK(s) as quickly as possible, as well as support if you get stuck slong the way. Let's jump right in!

Get Started    

Integrate Android SDK

First let's initialize the Tapslash SDK

Use the API Key and Secret Key from your Slash developer account to initialize Slash.

Override onCreate method in your Application.java file and add this code:

@Override
public void onCreate() {
	...
	Slash.init(this, "api-key", "secret-key", "en")
	     .sync();
}

We can now initialize the Toolbar

Creating a SlashView Using XML

Inside your layout file, place the Slash view :

<com.tapslash.slash.sdk.views.SlashView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/slash_bar"/>

And you can access it as follows:

SlashView slashView = (SlashView) findViewById(R.id.slash_bar);

Creating a SlashView Programmatically

SlashView slashView = new SlashView(this);
LinearLayout bottomLayout = (LinearLayout) findViewById(R.id.bottom_layout);
bottomLayout.addView(slashView);

Reacting to User Events

A recommended UX approach is to hide the main EditText when the Slash toolbar appears and show it again when the user closes the results.

slashView.setOnChangeUIModeListener(new OnChangeUIModeListener() {
    @Override
    public void changeUIMode(SlashView.UIMode appearance) {
        SlashView.handleUIModeChange(MainActivity.this, appearance,
                                findViewById(R.id.input_container), findViewById(R.id.edittext));
    }
});

Reacting to Back Button Press

We recommend overriding onBackPressed, so that when a user presses back, it will first close the results view. The second time it presses back, the activity will close.

You can let Slash SDK handle the back button press, or manually process the back event.

@Override
public void onBackPressed() {
    slashView.processBackEvent(this);
}

Multiple Toolbars

Considering you want to have two (or more) bars with different services, you need to have all the services setup on our web platform at http://developer.tapslash.com/ and you will be able to filter what services you want to use on each bar individually:

slashView.filterServices(new String[] {"photos", "giphy", "pin"});

Service selected/deselected callback

If you want to do some custom logic when a service is selected or deselected, you can set your callback like this:

slashView.setOnSelectServiceListener(new OnSelectServiceListener() {
  @Override
  public boolean selectService(RService service) { }
}
                                     
slashView.setOnDeselectServiceListener(new OnDeselectServiceListener() {
  @Override
  public void deselectService(RService service) { }
});

Search callback

If you want to add some custom logic when a search is triggered, you can register your callback like this:

slashView.setOnSearchServiceListener(new OnSearchServiceListener() {
  @Override
  public void searchService(RService service, String searchString, RCategory category) { }
}

Integrate Android SDK