mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Add progress bar to nearby cardview
This commit is contained in:
parent
7de3ad8b89
commit
f4b055607e
2 changed files with 24 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
@ -29,6 +30,7 @@ public class NearbyNoificationCardView extends CardView{
|
||||||
private TextView notificationTitle;
|
private TextView notificationTitle;
|
||||||
private TextView notificationDistance;
|
private TextView notificationDistance;
|
||||||
private ImageView notificationIcon;
|
private ImageView notificationIcon;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
public NearbyNoificationCardView(@NonNull Context context) {
|
public NearbyNoificationCardView(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
@ -59,6 +61,8 @@ public class NearbyNoificationCardView extends CardView{
|
||||||
|
|
||||||
notificationIcon = rootView.findViewById(R.id.nearby_icon);
|
notificationIcon = rootView.findViewById(R.id.nearby_icon);
|
||||||
|
|
||||||
|
progressBar = rootView.findViewById(R.id.progressBar);
|
||||||
|
|
||||||
setActionListeners();
|
setActionListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,11 +120,24 @@ public class NearbyNoificationCardView extends CardView{
|
||||||
} else {
|
} else {
|
||||||
Log.d("deneme","called2");
|
Log.d("deneme","called2");
|
||||||
contentLayout.setVisibility(VISIBLE);
|
contentLayout.setVisibility(VISIBLE);
|
||||||
|
// Set visibility of elements in content layout once it become visible
|
||||||
|
progressBar.setVisibility(VISIBLE);
|
||||||
|
notificationTitle.setVisibility(GONE);
|
||||||
|
notificationDistance.setVisibility(GONE);
|
||||||
|
notificationIcon.setVisibility(GONE);
|
||||||
|
|
||||||
permissionRequestButton.setVisibility(GONE);
|
permissionRequestButton.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateContent(boolean isClosestNearbyPlaceFound, Place place) {
|
public void updateContent(boolean isClosestNearbyPlaceFound, Place place) {
|
||||||
|
// Make progress bar invisible once data is ready
|
||||||
|
progressBar.setVisibility(GONE);
|
||||||
|
// And content views visible since they are ready
|
||||||
|
notificationTitle.setVisibility(VISIBLE);
|
||||||
|
notificationDistance.setVisibility(VISIBLE);
|
||||||
|
notificationIcon.setVisibility(VISIBLE);
|
||||||
|
|
||||||
if (isClosestNearbyPlaceFound) {
|
if (isClosestNearbyPlaceFound) {
|
||||||
notificationTitle.setText(place.name);
|
notificationTitle.setText(place.name);
|
||||||
notificationDistance.setText(place.distance);
|
notificationDistance.setText(place.distance);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,13 @@
|
||||||
android:id="@+id/content_layout"
|
android:id="@+id/content_layout"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/nearby_icon"
|
android:id="@+id/nearby_icon"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
|
|
@ -36,8 +43,6 @@
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:contentDescription="@string/no_image_found"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
app:srcCompat="@drawable/ic_location_white_24dp"/>
|
app:srcCompat="@drawable/ic_location_white_24dp"/>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue