Commit 33bd4e4a authored by Varun Patil's avatar Varun Patil

Change NotificationsFragment to BottomSheetDialogFragment (fix #223)

parent 21c7f971
...@@ -531,7 +531,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -531,7 +531,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
if (id == R.id.action_notifications) { if (id == R.id.action_notifications) {
NotificationsFragment notificationsFragment = new NotificationsFragment(); NotificationsFragment notificationsFragment = new NotificationsFragment();
updateFragment(notificationsFragment); notificationsFragment.show(getSupportFragmentManager(), TAG);
return true; return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
......
...@@ -2,6 +2,7 @@ package app.insti.fragment; ...@@ -2,6 +2,7 @@ package app.insti.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
...@@ -24,7 +25,7 @@ import retrofit2.Response; ...@@ -24,7 +25,7 @@ import retrofit2.Response;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
*/ */
public class NotificationsFragment extends BaseFragment { public class NotificationsFragment extends BottomSheetDialogFragment {
RecyclerView notificationsRecyclerView; RecyclerView notificationsRecyclerView;
...@@ -67,13 +68,13 @@ public class NotificationsFragment extends BaseFragment { ...@@ -67,13 +68,13 @@ public class NotificationsFragment extends BaseFragment {
private void showNotifications(final List<Notification> notifications) { private void showNotifications(final List<Notification> notifications) {
/* Check if activity is done with */ /* Check if activity is done with */
if (getActivity() == null) return; if (getActivity() == null || getView() == null) return;
/* Hide loader */ /* Hide loader */
getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE); getView().findViewById(R.id.loadingPanel).setVisibility(View.GONE);
NotificationsAdapter notificationsAdapter = new NotificationsAdapter(notifications, this); NotificationsAdapter notificationsAdapter = new NotificationsAdapter(notifications, this);
notificationsRecyclerView = (RecyclerView) getActivity().findViewById(R.id.notifications_recycler_view); notificationsRecyclerView = (RecyclerView) getView().findViewById(R.id.notifications_recycler_view);
notificationsRecyclerView.setAdapter(notificationsAdapter); notificationsRecyclerView.setAdapter(notificationsAdapter);
notificationsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); notificationsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
} }
......
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