Commit 90bdb968 authored by preetamozarde3's avatar preetamozarde3 Committed by Varun Patil

fix(venter): Fix improper layouts in File Complaint (#282)

* Add Creator Image in Complaint card

* Image upload bug fix

* Reverting the change made to complaint card
parent 2c3e0998
......@@ -16,7 +16,6 @@ import android.os.Bundle;
import android.provider.MediaStore;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
......@@ -125,7 +124,6 @@ public class FileComplaintFragment extends Fragment {
private NestedScrollView nestedScrollView;
private boolean GPSIsSetup = false;
private ProgressDialog progressDialog;
private CollapsingToolbarLayout collapsing_toolbar;
private LinearLayout linearLayoutAnalyse;
private LinearLayout linearLayoutScrollTags;
private boolean userAddedTag = false;
......@@ -135,7 +133,9 @@ public class FileComplaintFragment extends Fragment {
private TextView error_message_me;
private SwipeRefreshLayout swipeContainer;
private boolean isCalled = false;
private LinearLayout linearLayoutNestedScrollView;
private LinearLayout place_holder_image;
private LinearLayout image_holder_view;
private LinearLayout linearLayoutAll;
@Override
public void onDestroyView() {
......@@ -177,7 +177,9 @@ public class FileComplaintFragment extends Fragment {
progressDialog = new ProgressDialog(getContext());
swipeContainer = view.findViewById(R.id.swipeContainer);
error_message_me = view.findViewById(R.id.error_message_me);
linearLayoutNestedScrollView = view.findViewById(R.id.linearLayoutNestedScrollView);
linearLayoutAll = view.findViewById(R.id.linearLayoutAll);
place_holder_image = view.findViewById(R.id.place_holder_image);
image_holder_view = view.findViewById(R.id.image_holder_view);
final Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("Add Complaint");
initviews(view);
......@@ -288,15 +290,6 @@ public class FileComplaintFragment extends Fragment {
}
private void initviews(View view) {
LinearLayout imageViewHolder = view.findViewById(R.id.image_holder_view);
CollapsingToolbarLayout.LayoutParams layoutParams = new CollapsingToolbarLayout.LayoutParams(
CollapsingToolbarLayout.LayoutParams.MATCH_PARENT,
getResources().getDisplayMetrics().heightPixels / 2
);
imageViewHolder.setLayoutParams(layoutParams);
collapsing_toolbar = view.findViewById(R.id.collapsing_toolbar);
collapsing_toolbar.setVisibility(View.GONE);
nestedScrollView = view.findViewById(R.id.nested_scrollview);
linearLayoutAnalyse = view.findViewById(R.id.layoutAnalyse);
......@@ -654,14 +647,14 @@ public class FileComplaintFragment extends Fragment {
tagList.add(complaintTag);
}
swipeContainer.setRefreshing(false);
linearLayoutNestedScrollView.setVisibility(View.VISIBLE);
linearLayoutAll.setVisibility(View.VISIBLE);
error_message_me.setVisibility(View.GONE);
getMapReady();
} else {
error_message_me.setVisibility(View.VISIBLE);
error_message_me.setText(getString(R.string.no_complaints));
swipeContainer.setRefreshing(false);
linearLayoutNestedScrollView.setVisibility(View.GONE);
linearLayoutAll.setVisibility(View.GONE);
}
}
@Override
......@@ -669,13 +662,13 @@ public class FileComplaintFragment extends Fragment {
Log.i(TAG, "failure in getting Tags: " + t.toString());
swipeContainer.setRefreshing(false);
error_message_me.setVisibility(View.VISIBLE);
linearLayoutNestedScrollView.setVisibility(View.GONE);
linearLayoutAll.setVisibility(View.GONE);
}
});
} catch (Exception e) {
e.printStackTrace();
swipeContainer.setRefreshing(false);
linearLayoutNestedScrollView.setVisibility(View.GONE);
linearLayoutAll.setVisibility(View.GONE);
}
}
......@@ -851,7 +844,8 @@ public class FileComplaintFragment extends Fragment {
Bundle bundle = data.getExtras();
Bitmap bitmap = (Bitmap) bundle.get("data");
base64Image = convertImageToString(bitmap);
collapsing_toolbar.setVisibility(View.VISIBLE);
place_holder_image.setVisibility(View.GONE);
image_holder_view.setVisibility(View.VISIBLE);
sendImage();
} else if (resultCode == Activity.RESULT_OK && requestCode == RESULT_LOAD_IMAGE && data != null) {
......@@ -866,7 +860,8 @@ public class FileComplaintFragment extends Fragment {
String picturePath = cursor.getString(columnIndex);
cursor.close();
base64Image = convertImageToString(getScaledBitmap(picturePath, 800, 800));
collapsing_toolbar.setVisibility(View.VISIBLE);
place_holder_image.setVisibility(View.GONE);
image_holder_view.setVisibility(View.VISIBLE);
sendImage();
}
}
......@@ -903,7 +898,8 @@ public class FileComplaintFragment extends Fragment {
if (viewPager != null) {
try {
imageViewPagerAdapter = new ImageViewPagerAdapter(getActivity(), uploadedImagesUrl);
collapsing_toolbar.setVisibility(View.VISIBLE);
place_holder_image.setVisibility(View.GONE);
image_holder_view.setVisibility(View.VISIBLE);
viewPager.setAdapter(imageViewPagerAdapter);
indicator.setViewPager(viewPager);
imageViewPagerAdapter.registerDataSetObserver(indicator.getDataSetObserver());
......
......@@ -13,53 +13,6 @@
android:layout_height="match_parent"
android:layout_weight="1">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Widget.AppCompat.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWhite"
app:contentScrim="@android:color/white"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/image_holder_view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:orientation="vertical"
app:layout_collapseMode="parallax">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.viewpager.widget.ViewPager
android:id="@+id/complaint_image_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="48dp"
app:ci_animator="@animator/scale_with_alpha"
app:ci_drawable="@drawable/selected_dot"
app:ci_drawable_unselected="@drawable/white_radius" />
</RelativeLayout>
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<TextView
android:id="@+id/error_message_me"
android:layout_width="wrap_content"
......@@ -69,27 +22,73 @@
android:textColor="?attr/themeColorInverse"
android:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayoutAll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/linearLayoutNestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:orientation="vertical"
android:visibility="gone">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/place_holder_image"
android:layout_height="150dp"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/baseline_photo_black_48"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/image_holder_view"
android:layout_height="150dp"
android:orientation="vertical"
android:visibility="gone"
android:paddingBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.viewpager.widget.ViewPager
android:id="@+id/complaint_image_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator"
android:paddingBottom="5dp"
android:layout_width="match_parent"
android:layout_height="48dp"
app:ci_animator="@animator/scale_with_alpha"
app:ci_drawable="@drawable/selected_dot"
app:ci_drawable_unselected="@drawable/white_radius" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
......@@ -306,7 +305,7 @@
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/layout_buttons"
......@@ -338,6 +337,8 @@
</RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
\ No newline at end of file
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