Add forgotten commons link button to fabs

This commit is contained in:
neslihanturan 2017-12-26 11:37:16 +03:00 committed by maskara
parent 8e8472800b
commit b0a54ca89d
3 changed files with 60 additions and 8 deletions

View file

@ -4,19 +4,18 @@ import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
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.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -39,7 +38,6 @@ import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.utils.UriDeserializer;
@ -59,6 +57,7 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
private FloatingActionButton fabPlus;
private FloatingActionButton fabCamera;
private FloatingActionButton fabGallery;
private FloatingActionButton fabCommons;
private View transparentView;
private TextView description;
private TextView title;
@ -71,6 +70,8 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
private Animation fab_open;
private Animation rotate_forward;
private Place place;
public NearbyMapFragment() {
}
@ -150,6 +151,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);
fabCommons = getActivity().findViewById(R.id.fab_commons_page);
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
fab_close = AnimationUtils.loadAnimation(getActivity(),R.anim.fab_close);
@ -348,6 +350,7 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
}
private void passInfoToSheet(Place place) {
this.place = place;
wikipediaButton.setEnabled(
!(place.siteLinks == null || Uri.EMPTY.equals(place.siteLinks.getWikipediaLink())));
wikipediaButton.setOnClickListener(new View.OnClickListener() {
@ -366,6 +369,15 @@ 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) {
Log.d("deneme","deneme");
openWebView(place.siteLinks.getCommonsLink()); }
});
directionsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -400,16 +412,22 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
fabPlus.startAnimation(rotate_backward);
fabCamera.startAnimation(fab_close);
fabGallery.startAnimation(fab_close);
fabCommons.startAnimation(fab_close);
fabCamera.setClickable(false);
fabGallery.setClickable(false);
fabCommons.setClickable(false);
} else {
fabPlus.startAnimation(rotate_forward);
fabCamera.startAnimation(fab_open);
fabGallery.startAnimation(fab_open);
fabCommons.startAnimation(fab_open);
fabCamera.setClickable(true);
fabGallery.setClickable(true);
fabCommons.setClickable(
!(place.siteLinks == null
|| Uri.EMPTY.equals(place.siteLinks.getCommonsLink())));
}
@ -421,8 +439,10 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
fabPlus.startAnimation(rotate_backward);
fabCamera.startAnimation(fab_close);
fabGallery.startAnimation(fab_close);
fabCommons.startAnimation(fab_close);
fabCamera.setClickable(false);
fabGallery.setClickable(false);
fabCommons.setClickable(false);
this.isFabOpen=!isFabOpen;
}
}

View file

@ -0,0 +1,10 @@
<vector
android:height="24dp"
android:viewportHeight="342.03146"
android:viewportWidth="342.03104"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="@color/button_color_selector">
<path android:fillColor="#000000" android:pathData="M146.6,340.1C113.2,333.3 84.6,314 66.1,286 34.6,238.1 39.8,173.2 78.5,132.3l6.9,-7.3 16.8,16.8 16.8,16.8 4.5,-4.4c2.5,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.2,-9 10.8,-15.7 20,-20.3 7.3,-3.6 7.9,-3.7 18.1,-3.7 10.2,0 10.9,0.1 18.1,3.7 33,16.3 31.1,63.3 -3.1,76.8 -6.1,2.4 -17.3,3.4 -23.5,2z"/>
<path android:fillColor="#000000" android:pathData="M146.6,340.1C113.2,333.3 84.6,314 66.1,286 34.6,238.1 39.8,173.2 78.5,132.3l6.9,-7.3 16.8,16.8 16.8,16.8 4.5,-4.4c2.5,-2.4 4.7,-4.2 4.9,-4 0.9,1 9,32 8.5,32.5 -0.5,0.5 -30.4,-7.2 -32.2,-8.2 -0.5,-0.3 1.1,-2.4 3.4,-4.8 4.2,-4.2 4.2,-4.3 2.4,-6.6 -1,-1.3 -3,-3.4 -4.5,-4.6l-2.7,-2.2 -4.7,6.2c-9,12 -15.3,27.5 -17.4,42.9 -1,7.1 -0.5,7.8 4.4,7.8 6.9,0 7.5,-0.6 7.5,-7.5l0,-6.3 15,8.6c8.3,4.7 15,8.9 15,9.2 -0,0.5 -26.5,15.8 -29.2,16.9 -0.4,0.2 -0.8,-2.6 -0.8,-6.3l0,-6.6 -5.9,0c-3.3,0 -6.1,0.3 -6.4,0.8 -0.9,1.6 1.6,15.2 4.4,23.8 3.4,10.3 9.3,21.2 14.9,27.6l3.8,4.4 4.3,-4.2 4.3,-4.2 -4.2,-4.3c-2.3,-2.4 -4.2,-4.6 -4.2,-4.9 0,-0.8 31.9,-9.2 32.6,-8.6 0.3,0.3 -1.4,7.9 -3.8,16.8l-4.4,16.3 -4.6,-4.2c-5.2,-4.8 -6.4,-4.7 -10.4,0.6l-2.7,3.6 4.3,3.7c10.6,9.1 30.3,17.4 44.4,18.6l7.6,0.6 0,-6.1 0,-6.1 -6.5,0c-3.6,0 -6.5,-0.3 -6.5,-0.7 0,-1 16.4,-29.3 17,-29.3 0.6,0 17,28.3 17,29.3 0,0.4 -2.9,0.7 -6.5,0.7l-6.5,0 0,6.1 0,6.1 7.6,-0.6c14.1,-1.2 33.8,-9.4 44.5,-18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7 -3.8,-0.7 -3.1,2.2 2.4,9.9 9.8,20.2 17.8,24.9 2.2,1.3 11.7,5.7 21.1,9.7 20.6,8.9 28.7,14.1 39.7,25.7 16.7,17.5 26.7,36.9 31.9,61.4 3,14.3 3,35.1 -0.1,49.7 -10.6,50.7 -50.6,89.6 -101.1,98.5 -11.9,2.1 -34.9,1.8 -46.4,-0.5zM162.6,258.1c-26.3,-5.8 -40.9,-34.6 -29.6,-58.5 4.2,-9 10.8,-15.7 20,-20.3 7.3,-3.6 7.9,-3.7 18.1,-3.7 10.2,0 10.9,0.1 18.1,3.7 33,16.3 31.1,63.3 -3.1,76.8 -6.1,2.4 -17.3,3.4 -23.5,2z"/>
</vector>

View file

@ -85,16 +85,24 @@
app:layout_anchorGravity="top|right|end"
app:srcCompat="@drawable/ic_add_white_24dp"/>
<View
android:id = "@+id/empty_view1"
android:layout_height = "206dip"
android:id = "@+id/empty_view2"
android:layout_height = "306dip"
android:layout_width = "56dp"
android:visibility="invisible"
app:layout_anchor="@id/fab_plus"
app:layout_anchorGravity="center_horizontal"
/>
<View
android:id = "@+id/empty_view2"
android:layout_height = "86dip"
android:id = "@+id/empty_view1"
android:layout_height = "186dip"
android:layout_width = "56dp"
android:visibility="invisible"
app:layout_anchor="@id/fab_plus"
app:layout_anchorGravity="center_horizontal"
/>
<View
android:id = "@+id/empty_view"
android:layout_height = "66dip"
android:layout_width = "56dp"
android:visibility="invisible"
app:layout_anchor="@id/fab_plus"
@ -123,12 +131,26 @@
app:backgroundTint="@color/main_background_light"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
app:layout_anchor="@id/empty_view2"
app:layout_anchor="@id/empty_view"
app:layout_anchorGravity="center_horizontal"
app:srcCompat="@drawable/ic_photo_white_24dp"
android:tint="@color/button_blue"
android:scaleType="center"
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_commons_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fabSize="mini"
android:visibility="invisible"
app:backgroundTint="@color/main_background_light"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
app:layout_anchor="@id/empty_view2"
app:layout_anchorGravity="center_horizontal"
app:srcCompat="@drawable/ic_commons_icon_vector"
android:scaleType="center"
/>
</android.support.design.widget.CoordinatorLayout>