Messaging: Show the automation home preview and shorten pill shadows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 03:18:08 +09:00
co-authored by Cursor
parent 49789fc4a5
commit a34cccdf76
34 changed files with 930 additions and 124 deletions
@@ -78,6 +78,7 @@ import com.android.messaging.datamodel.data.ConversationListData;
import com.android.messaging.datamodel.data.ConversationListData.ConversationListDataListener;
import com.android.messaging.datamodel.data.ConversationListItemData;
import com.android.messaging.ui.ContactIconView;
import com.android.messaging.ui.home.HomeAutomationHome;
import com.android.messaging.ui.home.HomeCategoryAddModal;
import com.android.messaging.ui.home.HomeCategoryAssignSheet;
import com.android.messaging.ui.home.HomeCategoryClassifier;
@@ -521,6 +522,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
bindHomeCategoryStrip();
mHomeTitle = rootView.findViewById(R.id.home_title);
mHomeAutomationPane = rootView.findViewById(R.id.home_automation_pane);
HomeAutomationHome.bind(mHomeAutomationPane);
mHomeNavDock = rootView.findViewById(R.id.home_nav_dock);
mHomeNavMessages = rootView.findViewById(R.id.home_nav_messages);
bindHomeNavTab(mHomeNavMessages, R.drawable.ic_home_nav_messages,
@@ -1473,6 +1475,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
updateHomeComposeButtonVisibility(animate);
updateHomeNavHighlight(animate);
updateHomeMainNavVisibility();
updateHomeEditButtonForPinnedMode();
refreshPinnedStrip();
updateListTopFade();
mHomeTabReady = true;
@@ -3043,8 +3046,14 @@ public class ConversationListFragment extends Fragment implements ConversationLi
} else {
HomeUiMotion.swapOverlayChip(mHomePinnedDoneButton, mHomeEditButton);
if (mHomeEditButton != null) {
mHomeEditButton.setText(R.string.home_edit);
mHomeEditButton.setOnClickListener(this::showHomeEditPopover);
if (mHomeTab == HOME_TAB_AUTOMATE) {
mHomeEditButton.setText(R.string.home_automation_manage);
mHomeEditButton.setOnClickListener(v -> HomeToast.show(requireContext(),
R.string.home_automate_coming_soon));
} else {
mHomeEditButton.setText(R.string.home_edit);
mHomeEditButton.setOnClickListener(this::showHomeEditPopover);
}
}
}
}
@@ -31,6 +31,7 @@ public class HomeAutomationActivity extends BugleActionBarActivity {
getSupportActionBar().hide();
}
HomeSubHeader.bind(this, R.string.home_automation_title, v -> finish());
HomeAutomationHome.bind(findViewById(R.id.home_automation_pane));
}
@Override
@@ -0,0 +1,94 @@
/*
* Copyright (C) 2026 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.
* 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.
*/
package com.android.messaging.ui.home;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.messaging.R;
/** Binds the Automation home preview: modes, sample rules, and local toggles. */
public final class HomeAutomationHome {
private HomeAutomationHome() {
}
public static void bind(final View root) {
if (root == null) {
return;
}
bindChip(root, R.id.home_automation_rule_missed_chip1,
R.string.home_automation_rule_missed_chip1);
bindChip(root, R.id.home_automation_rule_missed_chip2,
R.string.home_automation_rule_missed_chip2);
bindChip(root, R.id.home_automation_rule_thanks_chip1,
R.string.home_automation_rule_thanks_chip1);
bindChip(root, R.id.home_automation_rule_thanks_chip2,
R.string.home_automation_rule_thanks_chip2);
bindChip(root, R.id.home_automation_rule_weekly_chip1,
R.string.home_automation_rule_weekly_chip1);
bindChip(root, R.id.home_automation_rule_weekly_chip2,
R.string.home_automation_rule_weekly_chip2);
comingSoon(root, R.id.home_automation_modes_more);
comingSoon(root, R.id.home_automation_mode_call);
comingSoon(root, R.id.home_automation_mode_cards);
comingSoon(root, R.id.home_automation_rules_sort);
comingSoon(root, R.id.home_automation_rule_missed);
comingSoon(root, R.id.home_automation_rule_thanks);
comingSoon(root, R.id.home_automation_rule_weekly);
bindSwitch(root, R.id.home_automation_rule_missed_switch, true);
bindSwitch(root, R.id.home_automation_rule_thanks_switch, true);
bindSwitch(root, R.id.home_automation_rule_weekly_switch, true);
}
private static void bindChip(final View root, final int chipId, final int labelId) {
final View chip = root.findViewById(chipId);
if (chip == null) {
return;
}
final TextView label = chip.findViewById(R.id.home_automation_chip_label);
if (label != null) {
label.setText(labelId);
}
}
private static void comingSoon(final View root, final int id) {
final View view = root.findViewById(id);
if (view != null) {
view.setOnClickListener(v -> HomeToast.show(v.getContext(),
R.string.home_automate_coming_soon));
}
}
private static void bindSwitch(final View root, final int id, final boolean on) {
final View view = root.findViewById(id);
if (!(view instanceof ImageView)) {
return;
}
final ImageView toggle = (ImageView) view;
applySwitch(toggle, on);
toggle.setOnClickListener(v -> applySwitch(toggle, !toggle.isSelected()));
}
private static void applySwitch(final ImageView toggle, final boolean on) {
toggle.setSelected(on);
toggle.setContentDescription(toggle.getResources().getString(
on ? R.string.home_automation_on : R.string.home_automation_off));
}
}