// Path: app/src/main/java/me/zsj/interessant/api/SearchApi.java
// public interface SearchApi {
// 
//     @GET("v3/queries/hot")
//     Flowable<List<String>> getTrendingTag();
// 
//     @GET("v1/search?num=10")
//     Flowable<SearchResult> query(@Query("query") String key, @Query("start") int start);
// 
// }
// 
// Path: app/src/main/java/me/zsj/interessant/base/ToolbarActivity.java
// public abstract class ToolbarActivity extends RxAppCompatActivity {
// 
//     public Toolbar toolbar;
//     public ActionBar ab;
// 
//     public abstract int providerLayoutId();
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(providerLayoutId());
// 
//         toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
// 
//         ab = getSupportActionBar();
//         if (ab != null)
//             ab.setDisplayHomeAsUpEnabled(true);
// 
//     }
// 
//     public void toSearch(Activity context) {
//         Intent intent = new Intent(context, SearchActivity.class);
//         startActivity(intent);
//     }
// }
// 
// Path: app/src/main/java/me/zsj/interessant/rx/ErrorAction.java
// public class ErrorAction {
// 
//     private ErrorAction() {
//         throw new AssertionError("No instances.");
//     }
// 
//     public static Consumer<Throwable> error(Context context) {
//         return throwable -> {
//             throwable.printStackTrace();
//             Toasty.error(context, throwable.getMessage()).show();
//         };
//     }
// }


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;
import java.util.ArrayList;
import java.util.List;
import es.dmoral.toasty.Toasty;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.zsj.interessant.api.SearchApi;
import me.zsj.interessant.base.ToolbarActivity;
import me.zsj.interessant.rx.ErrorAction;

package me.zsj.interessant;





/**
 * @author zsj
 */

public class SearchActivity extends ToolbarActivity implements View.OnClickListener {

    public static final String KEYWORD = "keyword";

    private TagFlowLayout tagLayout;
    private EditText searchEdit;

    private List<String> tags = new ArrayList<>();


    @Override
    public int providerLayoutId() {
        return R.layout.search_activity;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        tagLayout = (TagFlowLayout) findViewById(R.id.tag_layout);

// Path: app/src/main/java/me/zsj/interessant/api/SearchApi.java
// public interface SearchApi {
// 
//     @GET("v3/queries/hot")
//     Flowable<List<String>> getTrendingTag();
// 
//     @GET("v1/search?num=10")
//     Flowable<SearchResult> query(@Query("query") String key, @Query("start") int start);
// 
// }
// 
// Path: app/src/main/java/me/zsj/interessant/base/ToolbarActivity.java
// public abstract class ToolbarActivity extends RxAppCompatActivity {
// 
//     public Toolbar toolbar;
//     public ActionBar ab;
// 
//     public abstract int providerLayoutId();
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(providerLayoutId());
// 
//         toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
// 
//         ab = getSupportActionBar();
//         if (ab != null)
//             ab.setDisplayHomeAsUpEnabled(true);
// 
//     }
// 
//     public void toSearch(Activity context) {
//         Intent intent = new Intent(context, SearchActivity.class);
//         startActivity(intent);
//     }
// }
// 
// Path: app/src/main/java/me/zsj/interessant/rx/ErrorAction.java
// public class ErrorAction {
// 
//     private ErrorAction() {
//         throw new AssertionError("No instances.");
//     }
// 
//     public static Consumer<Throwable> error(Context context) {
//         return throwable -> {
//             throwable.printStackTrace();
//             Toasty.error(context, throwable.getMessage()).show();
//         };
//     }
// }


// Path: app/src/main/java/me/zsj/interessant/SearchActivity.java
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;
import java.util.ArrayList;
import java.util.List;
import es.dmoral.toasty.Toasty;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.zsj.interessant.api.SearchApi;
import me.zsj.interessant.base.ToolbarActivity;
import me.zsj.interessant.rx.ErrorAction;

package me.zsj.interessant;





/**
 * @author zsj
 */

public class SearchActivity extends ToolbarActivity implements View.OnClickListener {

    public static final String KEYWORD = "keyword";

    private TagFlowLayout tagLayout;
    private EditText searchEdit;

    private List<String> tags = new ArrayList<>();


    @Override
    public int providerLayoutId() {
        return R.layout.search_activity;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        tagLayout = (TagFlowLayout) findViewById(R.id.tag_layout);

        searchEdit = (EditText) findViewById(R.id.search_edit);
