Messaging: Use an extended FAB

With proper color scheme and "Start chat" text

Change-Id: I320b169b2bec354db7b0ebc3e81149aaf575092f
This commit is contained in:
Michael W
2024-12-22 22:44:41 +01:00
parent 056cf5f79e
commit d4ac014a74
9 changed files with 31 additions and 81 deletions

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="true"
android:state_pressed="true">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="translationZ"
android:valueTo="@dimen/fab_elevation_pressed"
android:valueType="floatType" />
</item>
<item>
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="translationZ"
android:valueTo="@dimen/fab_elevation"
android:valueType="floatType" />
</item>
</selector>

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/fab_ripple" >
<item>
<shape android:shape="oval">
<solid android:color="@color/fab_color" />
</shape>
</item>
</ripple>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2024 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -16,9 +17,10 @@
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@android:id/list"
@@ -35,19 +37,19 @@
android:visibility="gone"
android:layout_marginBottom="@dimen/conversation_list_empty_text_bottom_margin" />
<ImageView
style="@style/ConversationListFragmentStartNewButtonStyle"
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay"
android:id="@+id/start_new_conversation_button"
android:layout_width="@dimen/fab_size"
android:layout_height="@dimen/fab_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/fab_bottom_margin"
android:paddingBottom="@dimen/fab_padding_bottom"
android:background="@drawable/fab_new_message_bg"
android:elevation="@dimen/fab_elevation"
android:scaleType="center"
android:src="@drawable/ic_message"
android:stateListAnimator="@animator/fab_anim"
android:contentDescription="@string/start_new_conversation"/>
android:layout_margin="16dp"
android:text="@string/start_chat"
android:forceDarkAllowed="false"
android:textColor="@color/fab_fg_color"
app:backgroundTint="@color/fab_color"
app:icon="@drawable/ic_message"
app:iconTint="@color/fab_fg_color"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" />
</FrameLayout>

View File

@@ -21,4 +21,6 @@
<color name="window_background">@*android:color/system_neutral1_900</color>
<color name="compose_send_text_background_color">@*android:color/system_neutral1_600</color>
<color name="fab_fg_color">@android:color/black</color>
</resources>

View File

@@ -134,7 +134,6 @@
<color name="people_and_options_list_divider">#cccccc</color>
<color name="fab_color">@color/lineage_accent</color>
<color name="fab_ripple">#40ffffff</color>
<color name="message_body_size_text_color">#555555</color>
<color name="mms_indicator_color">#681faf</color>

View File

@@ -23,4 +23,6 @@
<color name="navigation_bar_bg">@color/window_background</color>
<color name="compose_send_text_background_color">@android:color/white</color>
<color name="fab_fg_color">@android:color/white</color>
</resources>

View File

@@ -803,4 +803,6 @@
<!-- When making a call to emergency numbers, show this toast -->
<string name="disallow_emergency_call">Can\'t make a voice call to emergency services here.</string>
<string name="start_chat">Start chat</string>
</resources>

View File

@@ -19,7 +19,7 @@
<!--
Base application theme
-->
<style name="BugleBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="BugleBaseTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="android:forceDarkAllowed">true</item>
<item name="android:navigationBarColor">@color/navigation_bar_bg</item>
<item name="android:windowLightNavigationBar">@bool/light_navigation_bar</item>
@@ -38,7 +38,7 @@
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
</style>
<style name="LaunchTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<style name="LaunchTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/action_bar_background_color</item>
<item name="colorPrimaryDark">@color/action_bar_background_color_dark</item>
</style>
@@ -648,4 +648,9 @@
<item name="widgetLayout">@layout/preference_material_switch</item>
</style>
<style name="ShapeAppearanceOverlay" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">16dp</item>
</style>
</resources>

View File

@@ -58,6 +58,7 @@ import com.android.messaging.util.Assert;
import com.android.messaging.util.ImeUtil;
import com.android.messaging.util.LogUtil;
import com.android.messaging.util.UiUtils;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
@@ -91,7 +92,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
private ConversationListFragmentHost mHost;
private RecyclerView mRecyclerView;
private ImageView mStartNewConversationButton;
private ExtendedFloatingActionButton mStartNewConversationButton;
private ListEmptyView mEmptyListMessageView;
private ConversationListAdapter mAdapter;
@@ -221,7 +222,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
mListState = savedInstanceState.getParcelable(SAVED_INSTANCE_STATE_LIST_VIEW_STATE_KEY);
}
mStartNewConversationButton = (ImageView) rootView.findViewById(
mStartNewConversationButton = (ExtendedFloatingActionButton) rootView.findViewById(
R.id.start_new_conversation_button);
if (mArchiveMode) {
mStartNewConversationButton.setVisibility(View.GONE);