mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Move commons button to out of expanded FABs
This commit is contained in:
parent
8eac2684f7
commit
a369af982e
3 changed files with 42 additions and 21 deletions
|
|
@ -54,10 +54,10 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
private LinearLayout wikipediaButton;
|
private LinearLayout wikipediaButton;
|
||||||
private LinearLayout wikidataButton;
|
private LinearLayout wikidataButton;
|
||||||
private LinearLayout directionsButton;
|
private LinearLayout directionsButton;
|
||||||
|
private LinearLayout commonsButton;
|
||||||
private FloatingActionButton fabPlus;
|
private FloatingActionButton fabPlus;
|
||||||
private FloatingActionButton fabCamera;
|
private FloatingActionButton fabCamera;
|
||||||
private FloatingActionButton fabGallery;
|
private FloatingActionButton fabGallery;
|
||||||
private FloatingActionButton fabCommons;
|
|
||||||
private View transparentView;
|
private View transparentView;
|
||||||
private TextView description;
|
private TextView description;
|
||||||
private TextView title;
|
private TextView title;
|
||||||
|
|
@ -151,7 +151,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
fabPlus = getActivity().findViewById(R.id.fab_plus);
|
fabPlus = getActivity().findViewById(R.id.fab_plus);
|
||||||
fabCamera = getActivity().findViewById(R.id.fab_camera);
|
fabCamera = getActivity().findViewById(R.id.fab_camera);
|
||||||
fabGallery = getActivity().findViewById(R.id.fab_galery);
|
fabGallery = getActivity().findViewById(R.id.fab_galery);
|
||||||
fabCommons = getActivity().findViewById(R.id.fab_commons_page);
|
|
||||||
|
|
||||||
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
|
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
|
||||||
fab_close = AnimationUtils.loadAnimation(getActivity(),R.anim.fab_close);
|
fab_close = AnimationUtils.loadAnimation(getActivity(),R.anim.fab_close);
|
||||||
|
|
@ -169,6 +168,7 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
wikidataButton = getActivity().findViewById(R.id.wikidataButton);
|
wikidataButton = getActivity().findViewById(R.id.wikidataButton);
|
||||||
wikipediaButton = getActivity().findViewById(R.id.wikipediaButton);
|
wikipediaButton = getActivity().findViewById(R.id.wikipediaButton);
|
||||||
directionsButton = getActivity().findViewById(R.id.directionsButton);
|
directionsButton = getActivity().findViewById(R.id.directionsButton);
|
||||||
|
commonsButton = getActivity().findViewById(R.id.commonsButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -338,7 +338,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
p.setAnchorId(View.NO_ID);
|
p.setAnchorId(View.NO_ID);
|
||||||
fabPlus.setLayoutParams(p);
|
fabPlus.setLayoutParams(p);
|
||||||
fabPlus.hide();
|
fabPlus.hide();
|
||||||
fabCommons.hide();
|
|
||||||
fabCamera.hide();
|
fabCamera.hide();
|
||||||
fabGallery.hide();
|
fabGallery.hide();
|
||||||
}
|
}
|
||||||
|
|
@ -370,14 +369,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fabCommons.setEnabled(
|
|
||||||
!(place.siteLinks == null || Uri.EMPTY.equals(place.siteLinks.getCommonsLink())));
|
|
||||||
fabCommons.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
openWebView(place.siteLinks.getCommonsLink()); }
|
|
||||||
});
|
|
||||||
|
|
||||||
directionsButton.setOnClickListener(new View.OnClickListener() {
|
directionsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
@ -394,6 +385,15 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
commonsButton.setEnabled(
|
||||||
|
!(place.siteLinks == null || Uri.EMPTY.equals(place.siteLinks.getCommonsLink())));
|
||||||
|
commonsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
openWebView(place.siteLinks.getCommonsLink());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
icon.setImageResource(place.getDescription().getIcon());
|
icon.setImageResource(place.getDescription().getIcon());
|
||||||
description.setText(place.getDescription().getText());
|
description.setText(place.getDescription().getText());
|
||||||
title.setText(place.name.toString());
|
title.setText(place.name.toString());
|
||||||
|
|
@ -412,23 +412,16 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
fabPlus.startAnimation(rotate_backward);
|
fabPlus.startAnimation(rotate_backward);
|
||||||
fabCamera.startAnimation(fab_close);
|
fabCamera.startAnimation(fab_close);
|
||||||
fabGallery.startAnimation(fab_close);
|
fabGallery.startAnimation(fab_close);
|
||||||
fabCommons.startAnimation(fab_close);
|
|
||||||
fabCamera.hide();
|
fabCamera.hide();
|
||||||
fabGallery.hide();
|
fabGallery.hide();
|
||||||
fabCommons.hide();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
fabPlus.startAnimation(rotate_forward);
|
fabPlus.startAnimation(rotate_forward);
|
||||||
fabCamera.startAnimation(fab_open);
|
fabCamera.startAnimation(fab_open);
|
||||||
fabGallery.startAnimation(fab_open);
|
fabGallery.startAnimation(fab_open);
|
||||||
fabCommons.startAnimation(fab_open);
|
|
||||||
fabCamera.show();
|
fabCamera.show();
|
||||||
fabGallery.show();
|
fabGallery.show();
|
||||||
fabCommons.show();
|
|
||||||
fabCommons.setClickable(
|
|
||||||
!(place.siteLinks == null
|
|
||||||
|| Uri.EMPTY.equals(place.siteLinks.getCommonsLink())));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -440,10 +433,8 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
fabPlus.startAnimation(rotate_backward);
|
fabPlus.startAnimation(rotate_backward);
|
||||||
fabCamera.startAnimation(fab_close);
|
fabCamera.startAnimation(fab_close);
|
||||||
fabGallery.startAnimation(fab_close);
|
fabGallery.startAnimation(fab_close);
|
||||||
fabCommons.startAnimation(fab_close);
|
|
||||||
fabCamera.hide();
|
fabCamera.hide();
|
||||||
fabGallery.hide();
|
fabGallery.hide();
|
||||||
fabCommons.hide();
|
|
||||||
this.isFabOpen=!isFabOpen;
|
this.isFabOpen=!isFabOpen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,35 @@
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/commonsButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:background="@drawable/button_background_selector"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:duplicateParentState="true"
|
||||||
|
app:srcCompat="@drawable/ic_commons_icon_vector"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:duplicateParentState="true"
|
||||||
|
android:textColor="@color/text_color_selector"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:text="@string/nearby_commons"
|
||||||
|
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -218,4 +218,5 @@
|
||||||
<string name="nearby_directions">DIRECTIONS</string>
|
<string name="nearby_directions">DIRECTIONS</string>
|
||||||
<string name="nearby_wikidata">WIKIDATA</string>
|
<string name="nearby_wikidata">WIKIDATA</string>
|
||||||
<string name="nearby_wikipedia">WIKIPEDIA</string>
|
<string name="nearby_wikipedia">WIKIPEDIA</string>
|
||||||
|
<string name="nearby_commons">COMMONS</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue