Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call button added instead of textview for phone number #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
});
(mDonorSheet.findViewById(R.id.phone)).setOnClickListener(view -> {
String phoneNum = (String) view.getTag();
Uri dialIntentUri = Uri.parse("tel:"+phoneNum);
Intent dialIntent = new Intent(Intent.ACTION_DIAL, dialIntentUri);
dialIntent.setData(dialIntentUri);
startActivity(dialIntent);
});
(mReceiver.findViewById(R.id.phone)).setOnClickListener(view -> {
String phoneNum = (String) view.getTag();
Uri dialIntentUri = Uri.parse("tel:"+phoneNum);
Intent dialIntent = new Intent(Intent.ACTION_DIAL, dialIntentUri);
dialIntent.setData(dialIntentUri);
startActivity(dialIntent);
});
}

@Override
Expand Down Expand Up @@ -321,14 +335,14 @@ public boolean onMarkerClick(Marker marker) {
if (marker.getTitle().contains(getString(R.string.donor))) {
((TextView) mDonorSheet.findViewById(R.id.name)).setText(mReceiverDonorRequestType.getfName() + " " + mReceiverDonorRequestType.getlName());
((TextView) mDonorSheet.findViewById(R.id.blood_group)).setText(mReceiverDonorRequestType.getbGp());
((TextView) mDonorSheet.findViewById(R.id.phone)).setText(mReceiverDonorRequestType.getPhone());
(mDonorSheet.findViewById(R.id.phone)).setTag(mReceiverDonorRequestType.getPhone());
((TextView) mDonorSheet.findViewById(R.id.purpose)).setText(mReceiverDonorRequestType.getPurpose());
(mDonorSheet.findViewById(R.id.direction)).setTag(mReceiverDonorRequestType.getLocation());
toggleBottomSheet(donorBehavior, receiverBehaviour);
} else if (marker.getTitle().contains(getString(R.string.blood_request))) {
((TextView) mReceiver.findViewById(R.id.name)).setText(mReceiverDonorRequestType.getfName() + " " + mReceiverDonorRequestType.getlName());
((TextView) mReceiver.findViewById(R.id.blood_group)).setText(mReceiverDonorRequestType.getbGp());
((TextView) mReceiver.findViewById(R.id.phone)).setText(mReceiverDonorRequestType.getPhone());
(mReceiver.findViewById(R.id.phone)).setTag(mReceiverDonorRequestType.getPhone());
((TextView) mReceiver.findViewById(R.id.purpose)).setText(mReceiverDonorRequestType.getPurpose());
(mReceiver.findViewById(R.id.direction)).setTag(mReceiverDonorRequestType.getLocation());
toggleBottomSheet(receiverBehaviour, donorBehavior);
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/ic_call.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="50dp"
android:viewportHeight="50"
android:viewportWidth="50"
android:width="50dp">

<path
android:fillColor="@color/colorAccent"
android:pathData="M23.895,29.731c-1.237,0-2.731-0.31-4.374-0.93c-3.602-1.358-7.521-4.042-11.035-7.556 c-3.515-3.515-6.199-7.435-7.558-11.037C-0.307,6.933-0.31,4.245,0.921,3.015c0.177-0.177,0.357-0.367,0.543-0.563 c1.123-1.181,2.392-2.51,4.074-2.45C6.697,0.05,7.82,0.77,8.97,2.201c3.398,4.226,1.866,5.732,0.093,7.478l-0.313,0.31 c-0.29,0.29-0.838,1.633,4.26,6.731c1.664,1.664,3.083,2.882,4.217,3.619c0.714,0.464,1.991,1.166,2.515,0.642l0.315-0.318 c1.744-1.769,3.25-3.296,7.473,0.099c1.431,1.15,2.15,2.272,2.198,3.433c0.069,1.681-1.27,2.953-2.452,4.075 c-0.195,0.186-0.385,0.366-0.562,0.542C26.103,29.424,25.126,29.731,23.895,29.731z M5.418,1C4.223,1,3.144,2.136,2.189,3.141 C1.997,3.343,1.811,3.539,1.628,3.722C0.711,4.638,0.804,7.045,1.864,9.856c1.31,3.472,3.913,7.266,7.33,10.683 c3.416,3.415,7.208,6.018,10.681,7.327c2.811,1.062,5.218,1.152,6.133,0.237c0.183-0.183,0.379-0.369,0.581-0.56 c1.027-0.976,2.192-2.082,2.141-3.309c-0.035-0.843-0.649-1.75-1.825-2.695c-3.519-2.83-4.503-1.831-6.135-0.176l-0.32,0.323 c-0.78,0.781-2.047,0.608-3.767-0.51c-1.193-0.776-2.667-2.038-4.379-3.751c-4.231-4.23-5.584-6.819-4.26-8.146l0.319-0.315 c1.659-1.632,2.66-2.617-0.171-6.138C7.245,1.651,6.339,1.037,5.496,1.001C5.47,1,5.444,1,5.418,1z"/>
</vector>
46 changes: 22 additions & 24 deletions app/src/main/res/layout/donor_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
android:orientation="vertical"
app:behavior_hideable="true"
app:behavior_peekHeight="56dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
>

<RelativeLayout
android:padding="@dimen/dp_8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/dp_8">
>

<TextView
android:id="@+id/name"
Expand All @@ -26,52 +28,48 @@
android:textColor="#444"
android:textSize="18sp"
android:textStyle="bold" />

<TextView
android:id="@+id/blood_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:id="@+id/blood_group"
android:textColor="@color/material_red_400"
android:textStyle="bold" />
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
<ImageView
android:id="@+id/phone"
app:srcCompat="@drawable/ic_call"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:autoLink="phone"
android:textSize="18sp" />

android:layout_alignParentEnd="true" />
<Button
android:id="@+id/direction"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_below="@id/phone"
android:text="@string/get_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/phone"
android:text="@string/get_direction"
android:textSize="18sp"
android:visibility="gone" />

android:layout_alignParentEnd="true"
style="@style/Widget.AppCompat.Button.Colored"
android:textSize="18sp" />
<TextView
android:layout_marginTop="@dimen/dp_8"
android:layout_below="@id/blood_group"
android:id="@+id/purpose"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/blood_group"
android:layout_marginTop="@dimen/dp_8" />
android:layout_height="wrap_content" />
</RelativeLayout>


<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginTop="@dimen/dp_8"
android:background="#000000"
android:foreground="?android:attr/selectableItemBackground"
android:text="@string/donor"
android:textColor="#fff" />
android:textColor="#fff"
/>

</LinearLayout>
9 changes: 4 additions & 5 deletions app/src/main/res/layout/receiver_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
<ImageView
android:id="@+id/phone"
app:srcCompat="@drawable/ic_call"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:autoLink="phone"
android:textSize="18sp" />
android:layout_alignParentEnd="true" />
<Button
android:id="@+id/direction"
android:layout_below="@id/phone"
Expand All @@ -65,7 +64,7 @@
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginTop="@dimen/dp_8"
android:background="#000000"
android:foreground="?android:attr/selectableItemBackground"
android:text="@string/receiver"
Expand Down