ai
Some checks failed
Flask 提示词大师 - CI/CD 流水线 / 代码质量检查 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 单元测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 集成测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 构建Docker镜像 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到测试环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到生产环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署监控系统 (push) Has been cancelled
Some checks failed
Flask 提示词大师 - CI/CD 流水线 / 代码质量检查 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 单元测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 集成测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 构建Docker镜像 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到测试环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到生产环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署监控系统 (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.ruilaizi.example;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* AI 应用列表项:标题、副标题、标签、点击跳转的 Activity(null 表示占位或特殊处理)。
|
||||
*/
|
||||
public class AIServiceEntry {
|
||||
public final String title;
|
||||
public final String subtitle;
|
||||
public final String badge;
|
||||
@Nullable
|
||||
public final Class<?> activityClass;
|
||||
|
||||
public AIServiceEntry(String title, String subtitle, String badge, @Nullable Class<?> activityClass) {
|
||||
this.title = title;
|
||||
this.subtitle = subtitle;
|
||||
this.badge = badge;
|
||||
this.activityClass = activityClass;
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,10 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.ruilaizi.example.databinding.ActivityAiServicesBinding;
|
||||
import com.ruilaizi.example.databinding.ItemAiServiceBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -19,86 +15,68 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* AI 智能应用列表:有参考实现的跳转对应页,无的跳转占位页。
|
||||
* 使用 ConstraintLayout + findViewById 确保列表区域有高度且容器正确。
|
||||
*/
|
||||
public class AIServicesActivity extends AppCompatActivity {
|
||||
|
||||
private static final class Entry {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final String badge;
|
||||
@Nullable final Class<?> activityClass;
|
||||
final boolean placeholder;
|
||||
|
||||
Entry(String title, String subtitle, String badge, @Nullable Class<?> activityClass) {
|
||||
this.title = title;
|
||||
this.subtitle = subtitle;
|
||||
this.badge = badge;
|
||||
this.activityClass = activityClass;
|
||||
this.placeholder = (activityClass == null);
|
||||
}
|
||||
}
|
||||
|
||||
private final List<Entry> entries = new ArrayList<>();
|
||||
private final List<AIServiceEntry> entries = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ActivityAiServicesBinding binding = ActivityAiServicesBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
setContentView(R.layout.activity_ai_services);
|
||||
|
||||
buildEntries();
|
||||
binding.btnBack.setOnClickListener(v -> finish());
|
||||
|
||||
LinearLayout container = binding.containerAiList;
|
||||
findViewById(R.id.btn_back).setOnClickListener(v -> finish());
|
||||
|
||||
LinearLayout container = findViewById(R.id.container_ai_list);
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
Entry e = entries.get(i);
|
||||
for (AIServiceEntry e : entries) {
|
||||
ItemAiServiceBinding itemBinding = ItemAiServiceBinding.inflate(inflater, container, false);
|
||||
itemBinding.itemTitle.setText(e.title);
|
||||
itemBinding.itemSubtitle.setText(e.subtitle);
|
||||
itemBinding.itemBadge.setText(e.badge);
|
||||
itemBinding.itemBadge.setVisibility(View.VISIBLE);
|
||||
final int index = i;
|
||||
itemBinding.getRoot().setOnClickListener(v -> onItemClick(entries.get(index)));
|
||||
itemBinding.getRoot().setOnClickListener(v -> onItemClick(e));
|
||||
container.addView(itemBinding.getRoot());
|
||||
}
|
||||
}
|
||||
|
||||
private void buildEntries() {
|
||||
entries.clear();
|
||||
// 有参考实现的:跳转对应 Activity
|
||||
entries.add(new Entry("智能饭菜规划", "AI智能推荐营养搭配,让每一餐都健康美味", "热门", MealPlanningActivity.class));
|
||||
entries.add(new Entry("提示词优化", "两阶段专家生成专业提示词", "通用", null)); // 主界面已有,可跳回主界面
|
||||
entries.add(new Entry("旅行攻略规划", "根据目的地与天数,AI 生成行程与实用建议", "出行", TravelPlanningActivity.class));
|
||||
entries.add(new Entry("智能周报生成", "输入工作要点,一键生成规范周报/日报", "办公", WeeklyReportActivity.class));
|
||||
entries.add(new Entry("会议纪要整理", "粘贴会议转写或要点,一键生成结构化会议纪要", "办公", MeetingMinutesActivity.class));
|
||||
// 以下为占位
|
||||
entries.add(new Entry("古诗词解析", "深度解析古诗词意境,感受中华文化之美", "文化", null));
|
||||
entries.add(new Entry("古诗词收藏", "收藏喜爱的古诗词,建立个人文化宝库", "收藏", null));
|
||||
entries.add(new Entry("简历/求职信优化", "润色简历或根据岗位生成针对性求职信", "求职", null));
|
||||
entries.add(new Entry("智能提示词优化2号专家", "需求分析 + 领域专家生成高质量提示词", "专家", null));
|
||||
entries.add(new Entry("智能提示词优化3号专家", "需求分析 + 领域专家生成,含历史记录", "专家", null));
|
||||
entries.add(new Entry("读书笔记/摘要", "生成摘要、金句、思维导图式大纲或读后感", "文化", null));
|
||||
entries.add(new Entry("育儿/教育助手", "育儿建议、睡前故事、简单科普或习题讲解", "教育", null));
|
||||
entries.add(new Entry("健身/运动计划", "根据目标与场地生成一周训练计划", "健康", null));
|
||||
entries.add(new Entry("合同/条款解读", "人话版要点、风险提示与建议关注条款", "法律", null));
|
||||
entries.add(new Entry("小红书/短视频脚本", "生成标题、分镜文案、口播稿", "创作", null));
|
||||
entries.add(new Entry("面试模拟/问答准备", "按岗位类型出题并给参考答案与点评", "求职", null));
|
||||
entries.add(new Entry("节日/祝福语生成", "祝福语、贺卡文案、红包配文", "生活", null));
|
||||
entries.add(new Entry("个人复盘/周复盘", "结构化复盘与下周重点", "成长", null));
|
||||
entries.add(new Entry("待办/日程整理", "零散待办生成按优先级与日期的日程清单", "效率", null));
|
||||
entries.add(new Entry("邮件润色/回复建议", "草稿或要点生成得体邮件回复", "办公", null));
|
||||
entries.add(new Entry("演讲稿/汇报稿", "根据主题与场合生成演讲稿或汇报大纲", "办公", null));
|
||||
entries.add(new Entry("取名/品牌名", "公司名、产品名或宝宝取名建议", "创意", null));
|
||||
entries.add(new Entry("菜谱/做法", "根据食材或菜名生成详细做法", "生活", null));
|
||||
entries.add(new Entry("学习计划/备考规划", "生成学习计划与复习建议", "教育", null));
|
||||
// 已实现:跳转对应 Activity
|
||||
entries.add(new AIServiceEntry("智能饭菜规划", "AI智能推荐营养搭配,让每一餐都健康美味", "热门", MealPlanningActivity.class));
|
||||
entries.add(new AIServiceEntry("提示词优化", "两阶段专家生成专业提示词", "通用", null)); // 主界面已有,点击返回主界面
|
||||
entries.add(new AIServiceEntry("旅行攻略规划", "根据目的地与天数,AI 生成行程与实用建议", "出行", TravelPlanningActivity.class));
|
||||
entries.add(new AIServiceEntry("智能周报生成", "输入工作要点,一键生成规范周报/日报", "办公", WeeklyReportActivity.class));
|
||||
entries.add(new AIServiceEntry("会议纪要整理", "粘贴会议转写或要点,一键生成结构化会议纪要", "办公", MeetingMinutesActivity.class));
|
||||
// 占位:点击进入 PlaceholderActivity 显示「敬请期待」
|
||||
entries.add(new AIServiceEntry("古诗词解析", "深度解析古诗词意境,感受中华文化之美", "文化", null));
|
||||
entries.add(new AIServiceEntry("古诗词收藏", "收藏喜爱的古诗词,建立个人文化宝库", "收藏", null));
|
||||
entries.add(new AIServiceEntry("简历/求职信优化", "润色简历或根据岗位生成针对性求职信", "求职", null));
|
||||
entries.add(new AIServiceEntry("2号专家", "需求分析 + 领域专家生成高质量提示词", "专家", null));
|
||||
entries.add(new AIServiceEntry("3号专家", "需求分析 + 领域专家生成,含历史记录", "专家", null));
|
||||
entries.add(new AIServiceEntry("读书笔记", "生成摘要、金句、思维导图式大纲或读后感", "文化", null));
|
||||
entries.add(new AIServiceEntry("育儿助手", "育儿建议、睡前故事、简单科普或习题讲解", "教育", null));
|
||||
entries.add(new AIServiceEntry("健身计划", "根据目标与场地生成一周训练计划", "健康", null));
|
||||
entries.add(new AIServiceEntry("合同解读", "人话版要点、风险提示与建议关注条款", "法律", null));
|
||||
entries.add(new AIServiceEntry("小红书脚本", "生成标题、分镜文案、口播稿", "创作", null));
|
||||
entries.add(new AIServiceEntry("面试模拟", "按岗位类型出题并给参考答案与点评", "求职", null));
|
||||
entries.add(new AIServiceEntry("节日祝福", "祝福语、贺卡文案、红包配文", "生活", null));
|
||||
entries.add(new AIServiceEntry("复盘", "结构化复盘与下周重点", "成长", null));
|
||||
entries.add(new AIServiceEntry("待办", "零散待办生成按优先级与日期的日程清单", "效率", null));
|
||||
entries.add(new AIServiceEntry("邮件润色", "草稿或要点生成得体邮件回复", "办公", null));
|
||||
entries.add(new AIServiceEntry("演讲稿", "根据主题与场合生成演讲稿或汇报大纲", "办公", null));
|
||||
entries.add(new AIServiceEntry("取名", "公司名、产品名或宝宝取名建议", "创意", null));
|
||||
entries.add(new AIServiceEntry("菜谱", "根据食材或菜名生成详细做法", "生活", null));
|
||||
entries.add(new AIServiceEntry("学习计划", "生成学习计划与复习建议", "教育", null));
|
||||
}
|
||||
|
||||
private void onItemClick(Entry e) {
|
||||
private void onItemClick(AIServiceEntry e) {
|
||||
if (e.activityClass != null) {
|
||||
startActivity(new Intent(this, e.activityClass));
|
||||
} else if ("提示词优化".equals(e.title)) {
|
||||
// 主界面已有优化提示词,返回主界面
|
||||
startActivity(new Intent(this, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
|
||||
finish();
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.ruilaizi.example.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ruilaizi.example.AIServiceEntry;
|
||||
import com.ruilaizi.example.databinding.ItemAiServiceBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AI 应用列表适配器,展示全部条目并支持点击。
|
||||
*/
|
||||
public class AIServiceAdapter extends RecyclerView.Adapter<AIServiceAdapter.ViewHolder> {
|
||||
|
||||
private final List<AIServiceEntry> list = new ArrayList<>();
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(AIServiceEntry entry);
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
|
||||
public void setEntries(List<AIServiceEntry> entries) {
|
||||
list.clear();
|
||||
if (entries != null) {
|
||||
list.addAll(entries);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ItemAiServiceBinding binding = ItemAiServiceBinding.inflate(
|
||||
LayoutInflater.from(parent.getContext()), parent, false);
|
||||
return new ViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
AIServiceEntry e = list.get(position);
|
||||
holder.binding.itemTitle.setText(e.title);
|
||||
holder.binding.itemSubtitle.setText(e.subtitle);
|
||||
holder.binding.itemBadge.setText(e.badge);
|
||||
holder.binding.itemBadge.setVisibility(View.VISIBLE);
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
final ItemAiServiceBinding binding;
|
||||
|
||||
ViewHolder(ItemAiServiceBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/colorSurface">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="16dp">
|
||||
android:padding="16dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_back"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
@@ -27,30 +28,40 @@
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:gravity="center" />
|
||||
<View android:layout_width="48dp" android:layout_height="wrap_content" />
|
||||
<View android:layout_width="48dp" android:layout_height="1dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/ai_services_subtitle"
|
||||
android:textSize="13sp"
|
||||
android:textColor="@color/colorTextSecondary" />
|
||||
android:textColor="@color/colorTextSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/header" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/scroll_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="24dp">
|
||||
android:paddingBottom="24dp"
|
||||
android:clipToPadding="false"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/container_ai_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
android:orientation="vertical"
|
||||
android:minHeight="200dp" />
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user