Commit 7e2defa8 authored by Varun Patil's avatar Varun Patil

Cleanup, make minor tweaks to Explore

parent d78ef929
...@@ -8,16 +8,20 @@ import android.support.v7.widget.RecyclerView; ...@@ -8,16 +8,20 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import app.insti.R; import app.insti.R;
import app.insti.Utils; import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.adapter.GenericAdapter; import app.insti.adapter.GenericAdapter;
import app.insti.api.EmptyCallback; import app.insti.api.EmptyCallback;
import app.insti.api.RetrofitInterface; import app.insti.api.RetrofitInterface;
...@@ -98,6 +102,19 @@ public class ExploreFragment extends Fragment { ...@@ -98,6 +102,19 @@ public class ExploreFragment extends Fragment {
// Search on text change in search // Search on text change in search
final EditText searchEditText = getView().findViewById(R.id.explore_search); final EditText searchEditText = getView().findViewById(R.id.explore_search);
// Close keyboard on search click
searchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
MainActivity.hideKeyboard(getActivity());
return true;
}
return false;
}
});
searchEditText.addTextChangedListener(new TextWatcher() { searchEditText.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
...@@ -176,7 +193,7 @@ public class ExploreFragment extends Fragment { ...@@ -176,7 +193,7 @@ public class ExploreFragment extends Fragment {
public void initRecyclerView() { public void initRecyclerView() {
if (getActivity() == null || getView() == null) return; if (getActivity() == null || getView() == null) return;
RecyclerView bodiesRecyclerView = getView().findViewById(R.id.explore_body_recycler_view); RecyclerView bodiesRecyclerView = getView().findViewById(R.id.explore_recycler_view);
genericAdapter = new GenericAdapter(cards, this); genericAdapter = new GenericAdapter(cards, this);
bodiesRecyclerView.setAdapter(genericAdapter); bodiesRecyclerView.setAdapter(genericAdapter);
bodiesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); bodiesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
......
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
android:paddingRight="6dp" android:paddingRight="6dp"
android:paddingTop="3dp" android:paddingTop="3dp"
android:textColor="@color/primaryTextColor" android:textColor="@color/primaryTextColor"
android:textColorHint="@color/primaryTextColor" /> android:textColorHint="@color/primaryTextColor"
android:imeOptions="actionSearch"
android:inputType="text" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -31,18 +33,7 @@ ...@@ -31,18 +33,7 @@
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/explore_body_recycler_view" android:id="@+id/explore_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/explore_event_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/explore_user_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment