Skip to content

Commit

Permalink
call: distribute buttons evenly
Browse files Browse the repository at this point in the history
We use flexbox for this. Since other layouts did not seem to work properly.
  • Loading branch information
mwarning committed Jan 12, 2023
1 parent dd06a06 commit 3d6aa7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.google.android:flexbox:2.0.0'
}
16 changes: 7 additions & 9 deletions app/src/main/res/layout/activity_call.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,19 @@

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
<com.google.android.flexbox.FlexboxLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:paddingBottom="10dp" >
android:paddingBottom="10dp"
app:justifyContent="space_evenly">

<ImageButton
android:id="@+id/acceptButton"
android:layout_width="@dimen/call_button_size"
android:layout_height="@dimen/call_button_size"
android:layout_marginEnd="30dp"
android:background="@drawable/ic_button_background"
android:padding="@dimen/call_button_image_padding"
android:scaleType="fitXY"
Expand All @@ -131,7 +132,6 @@
android:id="@+id/declineButton"
android:layout_width="@dimen/call_button_size"
android:layout_height="@dimen/call_button_size"
android:layout_marginEnd="30dp"
android:background="@drawable/ic_button_background"
android:padding="@dimen/call_button_image_padding"
android:scaleType="fitXY"
Expand All @@ -152,7 +152,6 @@
android:id="@+id/frontFacingSwitch"
android:layout_width="@dimen/call_button_size"
android:layout_height="@dimen/call_button_size"
android:layout_marginStart="30dp"
android:background="@drawable/ic_button_background"
android:padding="@dimen/call_button_image_padding"
android:scaleType="fitXY"
Expand All @@ -164,7 +163,6 @@
android:id="@+id/toggleMicButton"
android:layout_width="@dimen/call_button_size"
android:layout_height="@dimen/call_button_size"
android:layout_marginStart="30dp"
android:background="@drawable/ic_button_background"
android:padding="@dimen/call_button_image_padding"
android:scaleType="fitXY"
Expand All @@ -175,12 +173,12 @@
android:id="@+id/speakerphoneButton"
android:layout_width="@dimen/call_button_size"
android:layout_height="@dimen/call_button_size"
android:layout_marginStart="30dp"
android:background="@drawable/ic_button_background"
android:padding="@dimen/call_button_image_padding"
android:scaleType="fitXY"
android:src="@drawable/ic_audio_device_speakerphone"
android:contentDescription="audio source selection" />
</LinearLayout>

</com.google.android.flexbox.FlexboxLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 3d6aa7f

Please sign in to comment.