Tags now open search on click.

When you click on a topic / tag, it will now open `SearchActivity` with
the tag. ( It currently can't search, getting crashes. Will try to fix.
)
This commit is contained in:
Jedi Burrell 2017-05-13 09:11:16 -04:00
parent 8adb0b6ca4
commit 66974044a6
2 changed files with 16 additions and 0 deletions

View File

@ -1,13 +1,18 @@
package com.fastaccess.ui.adapter;
import android.content.Intent;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.view.ViewGroup;
import com.fastaccess.App;
import com.fastaccess.R;
import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.helper.AppHelper;
import com.fastaccess.helper.ViewHelper;
import com.fastaccess.ui.adapter.viewholder.SimpleViewHolder;
import com.fastaccess.ui.modules.search.SearchActivity;
import com.fastaccess.ui.widgets.FontTextView;
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter;
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder;
@ -35,6 +40,12 @@ public class TopicsAdapter extends BaseRecyclerAdapter<String, SimpleViewHolder<
if (isLightTheme) {
holder.itemView.setBackgroundColor(cardBackground);
}
holder.itemView.setOnClickListener((view) -> {
FontTextView topic = (FontTextView) view;
Intent intent = new Intent(new Intent(App.getInstance().getApplicationContext(), SearchActivity.class));
intent.putExtra("search", topic.getText().toString());
ActivityHelper.getActivity(view.getContext()).startActivity(intent);
});
holder.bind(getItem(position));
}
}

View File

@ -105,6 +105,11 @@ public class SearchActivity extends BaseActivity<SearchMvp.View, SearchPresenter
if (!tabsCountSet.isEmpty()) {
setupTab();
}
if(getIntent().hasExtra("search")){
searchEditText.setText(getIntent().getStringExtra("search"));
onTextChange(searchEditText.getEditableText());
}
}
private void setupTab() {