Commit e64a590e authored by Preetam Ozarde's avatar Preetam Ozarde

Fragment Overlapping

parent be6dd191
...@@ -52,5 +52,6 @@ dependencies { ...@@ -52,5 +52,6 @@ dependencies {
implementation "ru.noties:markwon:${markwonVersion}" implementation "ru.noties:markwon:${markwonVersion}"
implementation "com.github.Cutta:TagView:${tagViewVersion}" implementation "com.github.Cutta:TagView:${tagViewVersion}"
implementation "me.relex:circleindicator:${circleIndicatorVersion}" implementation "me.relex:circleindicator:${circleIndicatorVersion}"
implementation 'com.android.support:support-v4:28.0.0'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
...@@ -7,6 +7,7 @@ import android.support.v4.app.FragmentPagerAdapter; ...@@ -7,6 +7,7 @@ import android.support.v4.app.FragmentPagerAdapter;
import app.insti.api.model.Venter; import app.insti.api.model.Venter;
import app.insti.fragment.DetailedComplaintFragment; import app.insti.fragment.DetailedComplaintFragment;
import app.insti.fragment.RelevantComplaintsFragment;
/** /**
* Created by Shivam Sharma on 19-09-2018. * Created by Shivam Sharma on 19-09-2018.
...@@ -14,6 +15,7 @@ import app.insti.fragment.DetailedComplaintFragment; ...@@ -14,6 +15,7 @@ import app.insti.fragment.DetailedComplaintFragment;
public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter { public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
private static final String TAG = ComplaintDetailsPagerAdapter.class.getSimpleName();
Venter.Complaint detailedComplaint; Venter.Complaint detailedComplaint;
Context context; Context context;
String sessionid, complaintid, userid; String sessionid, complaintid, userid;
...@@ -32,6 +34,8 @@ public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter { ...@@ -32,6 +34,8 @@ public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
switch (position) { switch (position) {
case 0: case 0:
return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid); return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid);
case 1:
return RelevantComplaintsFragment.getInstance(sessionid, userid);
default: default:
return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid); return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid);
} }
...@@ -39,11 +43,16 @@ public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter { ...@@ -39,11 +43,16 @@ public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
@Override @Override
public CharSequence getPageTitle(int position) { public CharSequence getPageTitle(int position) {
return "Complaint Details"; if (position == 0){
return "Complaint Details";
} else {
return "Relevant Complaints";
}
} }
@Override @Override
public int getCount() { public int getCount() {
return 1; /* Update as 2 on adding RelevantComplints*/ return 2;
} }
} }
...@@ -3,13 +3,16 @@ package app.insti.fragment; ...@@ -3,13 +3,16 @@ package app.insti.fragment;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -36,6 +39,7 @@ public class ComplaintFragment extends BaseFragment { ...@@ -36,6 +39,7 @@ public class ComplaintFragment extends BaseFragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_complaint, container, false); View view = inflater.inflate(R.layout.fragment_complaint, container, false);
Toolbar toolbar = getActivity().findViewById(R.id.toolbar); Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
...@@ -53,7 +57,6 @@ public class ComplaintFragment extends BaseFragment { ...@@ -53,7 +57,6 @@ public class ComplaintFragment extends BaseFragment {
buttonVentIssues = view.findViewById(R.id.buttonVentIssues); buttonVentIssues = view.findViewById(R.id.buttonVentIssues);
buttonVentIssues.setOnClickListener(new View.OnClickListener() { buttonVentIssues.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
...@@ -61,7 +64,7 @@ public class ComplaintFragment extends BaseFragment { ...@@ -61,7 +64,7 @@ public class ComplaintFragment extends BaseFragment {
fileComplaintFragment.setArguments(getArguments()); fileComplaintFragment.setArguments(getArguments());
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.framelayout_for_fragment, fileComplaintFragment, fileComplaintFragment.getTag()); fragmentTransaction.replace(R.id.framelayout_for_fragment, fileComplaintFragment, fileComplaintFragment.getTag());
fragmentTransaction.addToBackStack(fileComplaintFragment.getTag()).commit(); fragmentTransaction.addToBackStack("ComplaintFragment").commit();
} }
}); });
......
...@@ -605,6 +605,8 @@ public class FileComplaintFragment extends Fragment { ...@@ -605,6 +605,8 @@ public class FileComplaintFragment extends Fragment {
FragmentManager manager = getFragmentManager(); FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction(); FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.framelayout_for_fragment, complaintFragment, complaintFragment.getTag()); transaction.replace(R.id.framelayout_for_fragment, complaintFragment, complaintFragment.getTag());
transaction.addToBackStack(complaintFragment.getTag());
manager.popBackStackImmediate("ComplaintFragment", FragmentManager.POP_BACK_STACK_INCLUSIVE);
transaction.commit(); transaction.commit();
} }
......
...@@ -48,4 +48,5 @@ ...@@ -48,4 +48,5 @@
<string name="getting_current_location">Getting current location. Please try after some time</string> <string name="getting_current_location">Getting current location. Please try after some time</string>
<string name="GPS_not_enables">GPS is not enabled!</string> <string name="GPS_not_enables">GPS is not enabled!</string>
<string name="no_permission">No permission!</string> <string name="no_permission">No permission!</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>
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