Skip to content

Commit ada67e0

Browse files
vanshikaaroramaskaravivek
authored andcommitted
Fixed commons-app#1507: Add progress bar in Nearby list
1 parent c04cb8c commit ada67e0

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

app/src/main/java/fr/free/nrw/commons/nearby/NearbyFragment.java

+8
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
import android.os.Bundle;
1010
import android.support.annotation.NonNull;
1111
import android.support.annotation.Nullable;
12+
import android.support.constraint.ConstraintLayout;
1213
import android.support.design.widget.BottomSheetBehavior;
1314
import android.support.design.widget.Snackbar;
1415
import android.support.v4.app.FragmentTransaction;
1516
import android.support.v7.app.AlertDialog;
1617
import android.view.LayoutInflater;
1718
import android.view.View;
1819
import android.view.ViewGroup;
20+
import android.widget.FrameLayout;
1921
import android.widget.LinearLayout;
2022
import android.widget.ProgressBar;
2123

@@ -64,6 +66,10 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
6466
LinearLayout bottomSheetDetails;
6567
@BindView(R.id.transparentView)
6668
View transparentView;
69+
@BindView(R.id.container_sheet)
70+
FrameLayout frameLayout;
71+
@BindView(R.id.loading_nearby_list)
72+
ConstraintLayout loading_nearby_layout;
6773

6874
@Inject
6975
LocationServiceManager locationManager;
@@ -547,6 +553,8 @@ private void setMapFragment() {
547553
* Calls fragment for list view.
548554
*/
549555
private void setListFragment() {
556+
loading_nearby_layout.setVisibility(View.GONE);
557+
frameLayout.setVisibility(View.VISIBLE);
550558
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
551559
nearbyListFragment = new NearbyListFragment();
552560
nearbyListFragment.setArguments(bundle);

app/src/main/res/layout/bottom_sheet_nearby.xml

+27
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@
1010
app:behavior_peekHeight="0dp"
1111
app:behavior_hideable="true"
1212
>
13+
<android.support.constraint.ConstraintLayout
14+
android:id="@+id/loading_nearby_list"
15+
android:layout_width="match_parent"
16+
android:layout_height="match_parent"
17+
android:visibility="visible">
18+
19+
<ProgressBar
20+
android:id="@+id/progress_bar"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
app:layout_constraintLeft_toLeftOf="parent"
24+
app:layout_constraintRight_toRightOf="parent"
25+
app:layout_constraintTop_toTopOf="parent"
26+
app:layout_constraintBottom_toBottomOf="parent"
27+
/>
28+
<TextView
29+
android:layout_width="wrap_content"
30+
android:layout_height="wrap_content"
31+
app:layout_constraintLeft_toLeftOf="parent"
32+
app:layout_constraintRight_toRightOf="parent"
33+
android:layout_marginTop="10dp"
34+
android:textSize="20sp"
35+
app:layout_constraintTop_toBottomOf="@+id/progress_bar"
36+
android:text="Loading..."
37+
/>
38+
</android.support.constraint.ConstraintLayout>
1339

1440
<FrameLayout
1541
android:id="@+id/container_sheet"
@@ -20,6 +46,7 @@
2046
android:layout_marginRight="16dp"
2147
android:layout_marginBottom="8dp"
2248
android:layout_marginTop="8dp"
49+
android:visibility="gone"
2350
></FrameLayout>
2451

2552
</LinearLayout>

0 commit comments

Comments
 (0)