mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Remove texts when they dont fit to one line
This commit is contained in:
parent
0c131b46fe
commit
6ca841fd18
2 changed files with 28 additions and 1 deletions
|
|
@ -10,10 +10,12 @@ import android.support.design.widget.BottomSheetBehavior;
|
|||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
|
|
@ -64,6 +66,11 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
|||
private TextView distance;
|
||||
private ImageView icon;
|
||||
|
||||
private TextView wikipediaButtonText;
|
||||
private TextView wikidataButtonText;
|
||||
private TextView commonsButtonText;
|
||||
private TextView directionsButtonText;
|
||||
|
||||
private boolean isFabOpen=false;
|
||||
private Animation rotate_backward;
|
||||
private Animation fab_close;
|
||||
|
|
@ -151,7 +158,7 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
|||
fabPlus = getActivity().findViewById(R.id.fab_plus);
|
||||
fabCamera = getActivity().findViewById(R.id.fab_camera);
|
||||
fabGallery = getActivity().findViewById(R.id.fab_galery);
|
||||
|
||||
|
||||
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
|
||||
fab_close = AnimationUtils.loadAnimation(getActivity(),R.anim.fab_close);
|
||||
rotate_forward = AnimationUtils.loadAnimation(getActivity(),R.anim.rotate_forward);
|
||||
|
|
@ -170,6 +177,11 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
|||
directionsButton = getActivity().findViewById(R.id.directionsButton);
|
||||
commonsButton = getActivity().findViewById(R.id.commonsButton);
|
||||
|
||||
wikidataButtonText = getActivity().findViewById(R.id.wikidataButtonText);
|
||||
wikipediaButtonText = getActivity().findViewById(R.id.wikipediaButtonText);
|
||||
directionsButtonText = getActivity().findViewById(R.id.directionsButtonText);
|
||||
commonsButtonText = getActivity().findViewById(R.id.commonsButtonText);
|
||||
|
||||
}
|
||||
|
||||
private void setListeners() {
|
||||
|
|
@ -226,6 +238,17 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
// Remove texts if it doesnt fit
|
||||
if (wikipediaButtonText.getLineCount() > 1
|
||||
|| wikidataButtonText.getLineCount() > 1
|
||||
|| commonsButtonText.getLineCount() > 1
|
||||
|| directionsButtonText.getLineCount() > 1) {
|
||||
wikipediaButtonText.setVisibility(View.GONE);
|
||||
wikidataButtonText.setVisibility(View.GONE);
|
||||
commonsButtonText.setVisibility(View.GONE);
|
||||
directionsButtonText.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupMapView(Bundle savedInstanceState) {
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/directionsButtonText"
|
||||
android:paddingTop="8dp"
|
||||
android:duplicateParentState="true"
|
||||
android:textColor="@color/text_color_selector"
|
||||
|
|
@ -101,6 +102,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/wikidataButtonText"
|
||||
android:paddingTop="8dp"
|
||||
android:duplicateParentState="true"
|
||||
android:textColor="@color/text_color_selector"
|
||||
|
|
@ -129,6 +131,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/wikipediaButtonText"
|
||||
android:paddingTop="8dp"
|
||||
android:duplicateParentState="true"
|
||||
android:textColor="@color/text_color_selector"
|
||||
|
|
@ -158,6 +161,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/commonsButtonText"
|
||||
android:paddingTop="8dp"
|
||||
android:duplicateParentState="true"
|
||||
android:textColor="@color/text_color_selector"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue