Adapted class to layout type
This commit is contained in:
parent
81ea83a42f
commit
a7c8b990b4
|
|
@ -347,6 +347,8 @@ public class AddReportActivity extends AppCompatActivity implements View.OnClick
|
||||||
reportTypeAdapter.setSelectedReportTypes(reportEntity.getReportTypeUuids());
|
reportTypeAdapter.setSelectedReportTypes(reportEntity.getReportTypeUuids());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d("tag", "reportTypesList: " + reportTypesList.toString());
|
||||||
|
|
||||||
reportTypeAdapter.notifyDataSetChanged();
|
reportTypeAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.material.button.MaterialButton;
|
||||||
import com.ieslamar.acloc.R;
|
import com.ieslamar.acloc.R;
|
||||||
import com.example.acloc.activity.AddReportActivity;
|
import com.example.acloc.activity.AddReportActivity;
|
||||||
import com.example.acloc.api.LocationApiClient;
|
import com.example.acloc.api.LocationApiClient;
|
||||||
|
|
@ -105,7 +106,7 @@ public class MyReportsAdapter extends RecyclerView.Adapter<MyReportsAdapter.View
|
||||||
|
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
private final TextView tvPlaceName, tvDescription, tvRating;
|
private final TextView tvPlaceName, tvDescription, tvRating;
|
||||||
private final ImageView ivEdit, ivDelete;
|
private final MaterialButton ivEdit, ivDelete;
|
||||||
|
|
||||||
public ViewHolder(@NonNull View itemView) {
|
public ViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,8 @@ public class PlaceBottomSheetDialog extends BottomSheetDialogFragment {
|
||||||
private Context context;
|
private Context context;
|
||||||
private boolean isFavorite = false;
|
private boolean isFavorite = false;
|
||||||
|
|
||||||
private TextView tvPlaceName, tvAddress, tvDescription, tvNoReports;
|
private TextView tvPlaceName, tvAddress, tvDescription;
|
||||||
|
private View tvNoReports;
|
||||||
private ImageView ivFavorite, ivEdit, ivExpand, ivPlaceImage;
|
private ImageView ivFavorite, ivEdit, ivExpand, ivPlaceImage;
|
||||||
private AppCompatButton btnAddReport;
|
private AppCompatButton btnAddReport;
|
||||||
private RecyclerView rvReports, rvAccessibilityOverview;
|
private RecyclerView rvReports, rvAccessibilityOverview;
|
||||||
|
|
@ -391,6 +392,12 @@ public class PlaceBottomSheetDialog extends BottomSheetDialogFragment {
|
||||||
rvAccessibilityOverview.setVisibility(View.VISIBLE);
|
rvAccessibilityOverview.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showNoReports() {
|
||||||
|
rvReports.setVisibility(View.GONE);
|
||||||
|
rvAccessibilityOverview.setVisibility(View.GONE);
|
||||||
|
tvNoReports.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateReportsUI(List<Report> reports) {
|
private void updateReportsUI(List<Report> reports) {
|
||||||
if (reports != null && !reports.isEmpty()) {
|
if (reports != null && !reports.isEmpty()) {
|
||||||
adapter = new PlaceReportsAdapter(context, reports);
|
adapter = new PlaceReportsAdapter(context, reports);
|
||||||
|
|
@ -402,10 +409,24 @@ public class PlaceBottomSheetDialog extends BottomSheetDialogFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNoReports() {
|
/**
|
||||||
rvReports.setVisibility(View.GONE);
|
* Helper method to set text for no reports state
|
||||||
rvAccessibilityOverview.setVisibility(View.GONE);
|
* @param text
|
||||||
tvNoReports.setVisibility(View.VISIBLE);
|
*/
|
||||||
|
private void setNoReportsText(String text) {
|
||||||
|
if (tvNoReports instanceof TextView) {
|
||||||
|
((TextView) tvNoReports).setText(text);
|
||||||
|
} else if (tvNoReports instanceof ViewGroup) {
|
||||||
|
// Search for first TextView in the container
|
||||||
|
ViewGroup container = (ViewGroup) tvNoReports;
|
||||||
|
for (int i = 0; i < container.getChildCount(); i++) {
|
||||||
|
View child = container.getChildAt(i);
|
||||||
|
if (child instanceof TextView) {
|
||||||
|
((TextView) child).setText(text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper class for accessibility statistics
|
// Helper class for accessibility statistics
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.example.acloc.MainActivity;
|
|
||||||
import com.ieslamar.acloc.R;
|
import com.ieslamar.acloc.R;
|
||||||
import com.example.acloc.adapter.MyReportsAdapter;
|
import com.example.acloc.adapter.MyReportsAdapter;
|
||||||
import com.example.acloc.api.LocationApiClient;
|
import com.example.acloc.api.LocationApiClient;
|
||||||
|
|
@ -24,7 +23,6 @@ import com.example.acloc.service.ReportService;
|
||||||
import com.example.acloc.utility.DialogUtils;
|
import com.example.acloc.utility.DialogUtils;
|
||||||
import com.example.acloc.utility.Helper;
|
import com.example.acloc.utility.Helper;
|
||||||
import com.example.acloc.utility.SharedPref;
|
import com.example.acloc.utility.SharedPref;
|
||||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
|
@ -35,13 +33,12 @@ import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
public class MyReportsFragment extends Fragment implements View.OnClickListener {
|
public class MyReportsFragment extends Fragment {
|
||||||
public static final String TAG = MyReportsFragment.class.getSimpleName();
|
public static final String TAG = MyReportsFragment.class.getSimpleName();
|
||||||
private View view;
|
private View view;
|
||||||
private FrameLayout rlMyReport;
|
private FrameLayout rlMyReport;
|
||||||
private RecyclerView rvReport;
|
private RecyclerView rvReport;
|
||||||
private TextView tvNoData;
|
private View tvNoData;
|
||||||
private ExtendedFloatingActionButton extendedFbReport;
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private MyReportsAdapter adapter;
|
private MyReportsAdapter adapter;
|
||||||
private Report reportEntity;
|
private Report reportEntity;
|
||||||
|
|
@ -56,7 +53,6 @@ public class MyReportsFragment extends Fragment implements View.OnClickListener
|
||||||
view = inflater.inflate(R.layout.fragment_my_reports, container, false);
|
view = inflater.inflate(R.layout.fragment_my_reports, container, false);
|
||||||
initUI();
|
initUI();
|
||||||
initObj();
|
initObj();
|
||||||
initListener();
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +86,6 @@ public class MyReportsFragment extends Fragment implements View.OnClickListener
|
||||||
rlMyReport = view.findViewById(R.id.rlMyReport);
|
rlMyReport = view.findViewById(R.id.rlMyReport);
|
||||||
rvReport = view.findViewById(R.id.rvReport);
|
rvReport = view.findViewById(R.id.rvReport);
|
||||||
tvNoData = view.findViewById(R.id.tvNoData);
|
tvNoData = view.findViewById(R.id.tvNoData);
|
||||||
extendedFbReport = view.findViewById(R.id.extendedFbReport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initObj() {
|
private void initObj() {
|
||||||
|
|
@ -98,10 +93,6 @@ public class MyReportsFragment extends Fragment implements View.OnClickListener
|
||||||
reportEntity = new Report();
|
reportEntity = new Report();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initListener() {
|
|
||||||
extendedFbReport.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadData() {
|
private void loadData() {
|
||||||
try {
|
try {
|
||||||
if (reportList == null) {
|
if (reportList == null) {
|
||||||
|
|
@ -134,20 +125,6 @@ public class MyReportsFragment extends Fragment implements View.OnClickListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
int id = v.getId();
|
|
||||||
if (id == R.id.extendedFbReport) {
|
|
||||||
onClickExtendedFbReport();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Open Map Fragment to add new place report
|
|
||||||
private void onClickExtendedFbReport() {
|
|
||||||
((MainActivity) requireActivity())
|
|
||||||
.openFragmentFromChild(new MapFragment(), getString(R.string.Map), R.id.menu_map);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getReportsByUserUuid(String userUuid) {
|
private void getReportsByUserUuid(String userUuid) {
|
||||||
DialogUtils.showLoadingDialog(context, getString(R.string.Loading_reports));
|
DialogUtils.showLoadingDialog(context, getString(R.string.Loading_reports));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue