mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
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:
parent
8adb0b6ca4
commit
66974044a6
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user