Skip to content

Commit 117a780

Browse files
authored
Fixes commons-app#4300 Limited connection mode banner occupies too much space (commons-app#4375)
* done * fixed * minor changes made changed tv, Tv to text_view, TextView, improved comment for toggleDescriptionListener
1 parent 845a901 commit 117a780

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public class ContributionsFragment
8989
@BindView(R.id.card_view_nearby) public NearbyNotificationCardView nearbyNotificationCardView;
9090
@BindView(R.id.campaigns_view) CampaignView campaignView;
9191
@BindView(R.id.limited_connection_enabled_layout) LinearLayout limitedConnectionEnabledLayout;
92+
@BindView(R.id.limited_connection_description_text_view) TextView limitedConnectionDescriptionTextView;
9293

9394
@Inject ContributionsPresenter contributionsPresenter;
9495

@@ -158,6 +159,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
158159
&& sessionManager.getCurrentAccount() != null) {
159160
setUploadCount();
160161
}
162+
limitedConnectionEnabledLayout.setOnClickListener(toggleDescriptionListener);
161163
setHasOptionsMenu(true);
162164
return view;
163165
}
@@ -617,5 +619,21 @@ public void backButtonClicked() {
617619
public MediaDetailPagerFragment getMediaDetailPagerFragment() {
618620
return mediaDetailPagerFragment;
619621
}
622+
623+
// click listener to toggle description that means uses can press the limited connection
624+
// banner and description will hide. Tap again to show description.
625+
private View.OnClickListener toggleDescriptionListener = new View.OnClickListener() {
626+
627+
@Override
628+
public void onClick(View view) {
629+
View view2 = limitedConnectionDescriptionTextView;
630+
if (view2.getVisibility() == View.GONE) {
631+
view2.setVisibility(View.VISIBLE);
632+
} else {
633+
view2.setVisibility(View.GONE);
634+
}
635+
}
636+
};
637+
620638
}
621639

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,27 @@
2020

2121
<LinearLayout
2222
android:id="@+id/limited_connection_enabled_layout"
23+
android:animateLayoutChanges="true"
2324
android:layout_width="match_parent"
2425
android:layout_height="wrap_content"
2526
android:layout_margin="@dimen/miniscule_margin"
2627
android:padding="@dimen/standard_gap"
2728
android:orientation="vertical"
29+
android:clickable="true"
30+
android:focusable="true"
2831
android:background="@color/wikimedia_green">
29-
<ImageView
30-
android:layout_width="wrap_content"
31-
android:layout_height="wrap_content"
32-
android:layout_marginBottom="@dimen/small_gap"
33-
app:srcCompat="@drawable/ic_baseline_cloud_off_72"/>
3432
<TextView
3533
android:layout_width="wrap_content"
3634
android:layout_height="wrap_content"
35+
android:drawablePadding="5dp"
3736
android:textColor="@android:color/white"
3837
android:layout_marginBottom="@dimen/tiny_gap"
3938
android:textSize="@dimen/subheading_text_size"
40-
android:text="@string/limited_connection_is_on"/>
39+
android:text="@string/limited_connection_is_on"
40+
app:drawableTint="@color/white"
41+
app:drawableStartCompat="@drawable/ic_baseline_cloud_off_24"/>
4142
<TextView
43+
android:id="@+id/limited_connection_description_text_view"
4244
android:layout_width="wrap_content"
4345
android:layout_height="wrap_content"
4446
android:textColor="@android:color/white"

0 commit comments

Comments
 (0)