gai2 #9

Merged
p5tyirj4z merged 5 commits from wangze_part into master 2 months ago

@ -2,8 +2,16 @@
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="未命名">
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-10-11T11:49:33.560456900Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\asus\.android\avd\Pixel.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
<component name="VcsProjectSettings">
<option name="detectVcsMappingsAutomatically" value="false" />
</component>
</project>

@ -39,10 +39,6 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13.2'
implementation 'com.github.bumptech.glide:glide:4.15.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
// AndroidX
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
@ -54,11 +50,6 @@ dependencies {
//
implementation project(':mainnavigatetabbar')
//
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.11.0'
//
configurations {
all {

@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.startsmake.llrisetabbardemo">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"

@ -12,8 +12,6 @@ import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.textfield.TextInputEditText;
import com.startsmake.llrisetabbardemo.R;
import com.startsmake.llrisetabbardemo.manager.SmsManager;
import com.startsmake.llrisetabbardemo.manager.UserManager;
public class ForgotPasswordActivity extends AppCompatActivity {
@ -24,23 +22,14 @@ public class ForgotPasswordActivity extends AppCompatActivity {
private CountDownTimer countDownTimer;
private boolean isCounting = false;
private String verificationCode = "";
private UserManager userManager;
private SmsManager smsManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forgot_password);
userManager = UserManager.getInstance(this);
smsManager = SmsManager.getInstance(this);
initViews();
setupClickListeners();
// 预填充手机号(如果从登录页传递过来)
handleIntentExtras();
}
private void initViews() {
@ -64,78 +53,31 @@ public class ForgotPasswordActivity extends AppCompatActivity {
btnResetPassword.setOnClickListener(v -> attemptResetPassword());
// 返回登录
tvLogin.setOnClickListener(v -> navigateToLogin());
}
private void handleIntentExtras() {
Intent intent = getIntent();
if (intent != null) {
String phone = intent.getStringExtra("phone");
if (phone != null && !phone.isEmpty()) {
etPhone.setText(phone);
etVerificationCode.requestFocus();
}
}
tvLogin.setOnClickListener(v -> {
Intent intent = new Intent(ForgotPasswordActivity.this, LoginActivity.class);
startActivity(intent);
finish();
});
}
private void sendVerificationCode() {
String phone = etPhone.getText().toString().trim();
if (!validatePhone(phone)) {
return;
}
// 检查用户是否存在
if (!userManager.isUserExists(phone)) {
etPhone.setError("该手机号未注册");
etPhone.requestFocus();
return;
}
if (!isCounting) {
startCountDown();
// 使用短信服务发送验证码
smsManager.sendVerificationCode(phone, new SmsManager.SmsSendCallback() {
@Override
public void onSuccess(String code) {
verificationCode = code;
Toast.makeText(ForgotPasswordActivity.this,
"验证码已发送到手机尾号" + phone.substring(7),
Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(String error) {
Toast.makeText(ForgotPasswordActivity.this,
"验证码发送失败: " + error,
Toast.LENGTH_SHORT).show();
resetCountDown();
}
});
}
}
private boolean validatePhone(String phone) {
if (phone.isEmpty()) {
etPhone.setError("请输入手机号");
etPhone.requestFocus();
return false;
return;
}
if (phone.length() != 11) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
return;
}
if (!phone.startsWith("1")) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
if (!isCounting) {
startCountDown();
Toast.makeText(this, "验证码已发送", Toast.LENGTH_SHORT).show();
// 这里应该调用后端API发送验证码
}
return true;
}
private void startCountDown() {
@ -157,111 +99,43 @@ public class ForgotPasswordActivity extends AppCompatActivity {
}.start();
}
private void resetCountDown() {
if (countDownTimer != null) {
countDownTimer.cancel();
}
isCounting = false;
btnSendCode.setEnabled(true);
btnSendCode.setText("发送验证码");
}
private void attemptResetPassword() {
String phone = etPhone.getText().toString().trim();
String code = etVerificationCode.getText().toString().trim();
String newPassword = etNewPassword.getText().toString().trim();
if (!validateResetInput(phone, code, newPassword)) {
return;
}
// 验证验证码
if (!code.equals(verificationCode)) {
etVerificationCode.setError("验证码错误");
etVerificationCode.requestFocus();
return;
}
// 重置密码
if (userManager.updatePassword(phone, newPassword)) {
performResetSuccess(phone);
} else {
Toast.makeText(this, "重置密码失败,请检查手机号是否正确", Toast.LENGTH_SHORT).show();
}
}
private boolean validateResetInput(String phone, String code, String newPassword) {
if (phone.isEmpty()) {
etPhone.setError("请输入手机号");
etPhone.requestFocus();
return false;
return;
}
if (code.isEmpty()) {
etVerificationCode.setError("请输入验证码");
etVerificationCode.requestFocus();
return false;
return;
}
if (newPassword.isEmpty()) {
etNewPassword.setError("请输入新密码");
etNewPassword.requestFocus();
return false;
return;
}
if (phone.length() != 11) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
return;
}
if (newPassword.length() < 6) {
etNewPassword.setError("密码至少6位");
etNewPassword.requestFocus();
return false;
}
// 检查密码强度(可选)
if (!isPasswordStrong(newPassword)) {
etNewPassword.setError("密码过于简单,建议包含字母和数字");
etNewPassword.requestFocus();
return false;
}
return true;
}
private boolean isPasswordStrong(String password) {
// 简单的密码强度检查:至少包含字母和数字
boolean hasLetter = false;
boolean hasDigit = false;
for (char c : password.toCharArray()) {
if (Character.isLetter(c)) {
hasLetter = true;
} else if (Character.isDigit(c)) {
hasDigit = true;
}
return;
}
return hasLetter && hasDigit;
// 模拟重置密码成功
performResetPassword();
}
private void performResetSuccess(String phone) {
private void performResetPassword() {
Toast.makeText(this, "密码重置成功!", Toast.LENGTH_SHORT).show();
// 重置成功后跳转到登录页面,并传递手机号
navigateToLoginWithPhone(phone);
}
private void navigateToLoginWithPhone(String phone) {
Intent intent = new Intent(ForgotPasswordActivity.this, LoginActivity.class);
intent.putExtra("phone", phone);
startActivity(intent);
finish();
}
private void navigateToLogin() {
// 重置成功后跳转到登录页面
Intent intent = new Intent(ForgotPasswordActivity.this, LoginActivity.class);
startActivity(intent);
finish();
@ -274,4 +148,4 @@ public class ForgotPasswordActivity extends AppCompatActivity {
countDownTimer.cancel();
}
}
}
}

@ -10,43 +10,20 @@ import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.textfield.TextInputEditText;
import com.startsmake.llrisetabbardemo.R;
import com.startsmake.llrisetabbardemo.manager.UserManager;
import com.startsmake.llrisetabbardemo.model.User;
public class LoginActivity extends AppCompatActivity {
private TextInputEditText etPhone, etPassword;
private Button btnLogin, btnSkipLogin;
private TextView tvForgotPassword, tvRegister;
private UserManager userManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// 初始化用户管理器
userManager = UserManager.getInstance(this);
// 临时注释掉自动跳转,便于测试登录流程
if (userManager.isLoggedIn()) {
navigateToMain();
return;
}
initViews();
setupClickListeners();
setupDemoUsers();
handleIntentExtras();
// 显示当前登录状态
if (userManager.isLoggedIn()) {
User currentUser = userManager.getCurrentUser();
etPhone.setText(currentUser.getPhone());
Toast.makeText(this, "已登录用户: " + currentUser.getPhone(), Toast.LENGTH_LONG).show();
}
}
private void initViews() {
@ -78,84 +55,36 @@ public class LoginActivity extends AppCompatActivity {
});
}
// 处理从其他页面传递过来的数据
private void handleIntentExtras() {
Intent intent = getIntent();
if (intent != null) {
String phone = intent.getStringExtra("phone");
if (phone != null && !phone.isEmpty()) {
etPhone.setText(phone);
etPassword.requestFocus(); // 自动聚焦到密码输入框
}
}
}
private void attemptLogin() {
String phone = etPhone.getText().toString().trim();
String password = etPassword.getText().toString().trim();
if (!validateInput(phone, password)) {
return;
}
// 验证用户登录
if (userManager.validateLogin(phone, password)) {
// 登录成功
userManager.saveUserLogin(phone, password);
performLoginSuccess();
} else {
// 登录失败
showLoginError();
}
}
private boolean validateInput(String phone, String password) {
if (phone.isEmpty()) {
etPhone.setError("请输入手机号");
etPhone.requestFocus();
return false;
return;
}
if (password.isEmpty()) {
etPassword.setError("请输入密码");
etPassword.requestFocus();
return false;
return;
}
if (phone.length() != 11) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
}
if (!phone.startsWith("1")) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
}
if (password.length() < 6) {
etPassword.setError("密码至少6位");
etPassword.requestFocus();
return false;
return;
}
return true;
// 模拟登录成功(因为没有后端)
performLogin();
}
private void performLoginSuccess() {
private void performLogin() {
Toast.makeText(this, "登录成功!", Toast.LENGTH_SHORT).show();
navigateToMain();
}
private void showLoginError() {
Toast.makeText(this, "手机号或密码错误", Toast.LENGTH_SHORT).show();
etPassword.setError("密码错误");
etPassword.requestFocus();
}
private void skipToMain() {
Toast.makeText(this, "游客模式进入", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "跳过登录,进入主界面", Toast.LENGTH_SHORT).show();
navigateToMain();
}
@ -164,18 +93,4 @@ public class LoginActivity extends AppCompatActivity {
startActivity(intent);
finish();
}
// 设置演示用户,便于测试
private void setupDemoUsers() {
// 注册几个演示用户
userManager.registerUser("13800138000", "123456");
userManager.registerUser("13900139000", "123456");
userManager.registerUser("15000150000", "123456");
// 可选:在控制台输出演示用户信息,便于测试
System.out.println("演示用户已创建:");
System.out.println("手机号13800138000密码123456");
System.out.println("手机号13900139000密码123456");
System.out.println("手机号15000150000密码123456");
}
}
}

@ -7,11 +7,6 @@ import android.widget.Toast;
// 改为 AndroidX
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;
import com.startsmake.llrisetabbardemo.fragment.PublishFragment;
import com.startsmake.llrisetabbardemo.fragment.HomeFragment;
import com.startsmake.llrisetabbardemo.R;
import com.startsmake.llrisetabbardemo.fragment.CityFragment;
import com.startsmake.llrisetabbardemo.fragment.HomeFragment;
@ -40,9 +35,6 @@ public class MainActivity extends AppCompatActivity {
mNavigateTabBar.addTab(HomeFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_home, R.mipmap.comui_tab_home_selected, TAG_PAGE_HOME));
mNavigateTabBar.addTab(CityFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_city, R.mipmap.comui_tab_city_selected, TAG_PAGE_CITY));
mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_post, R.mipmap.comui_tab_post, TAG_PAGE_PUBLISH));
mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(0, 0, TAG_PAGE_PUBLISH));
mNavigateTabBar.addTab(MessageFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_message, R.mipmap.comui_tab_message_selected, TAG_PAGE_MESSAGE));
mNavigateTabBar.addTab(PersonFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_person, R.mipmap.comui_tab_person_selected, TAG_PAGE_PERSON));
@ -54,31 +46,7 @@ public class MainActivity extends AppCompatActivity {
mNavigateTabBar.onSaveInstanceState(outState);
}
// 发布按钮点击事件
public void onClickPublish(View v) {
// 切换到发布Fragment
switchToPublishFragment();
}
// 切换到发布Fragment
public void switchToPublishFragment() {
PublishFragment publishFragment = new PublishFragment();
// 使用FragmentTransaction来显示发布页面
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// 替换当前显示的Fragment
transaction.replace(R.id.container, publishFragment, "PublishFragment");
transaction.addToBackStack("publish"); // 允许用户按返回键回到之前的Fragment
transaction.commit();
}
// 切换回首页Fragment
public void switchToHomeFragment() {
// 返回到首页
getSupportFragmentManager().popBackStackImmediate();
// 确保底部导航栏选中首页
mNavigateTabBar.setCurrentSelectedTab(0);
Toast.makeText(this, "发布", Toast.LENGTH_LONG).show();
}
}

@ -12,10 +12,6 @@ import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.textfield.TextInputEditText;
import com.startsmake.llrisetabbardemo.R;
import com.startsmake.llrisetabbardemo.manager.SmsManager;
import com.startsmake.llrisetabbardemo.manager.UserManager;
import java.util.Random;
public class RegisterActivity extends AppCompatActivity {
@ -26,18 +22,12 @@ public class RegisterActivity extends AppCompatActivity {
private CountDownTimer countDownTimer;
private boolean isCounting = false;
private String verificationCode = "";
private UserManager userManager;
private SmsManager smsManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
userManager = UserManager.getInstance(this);
smsManager = SmsManager.getInstance(this); // 初始化 SmsManager
initViews();
setupClickListeners();
}
@ -73,62 +63,21 @@ public class RegisterActivity extends AppCompatActivity {
private void sendVerificationCode() {
String phone = etPhone.getText().toString().trim();
if (!validatePhone(phone)) {
return;
}
// 检查用户是否已存在
if (userManager.isUserExists(phone)) {
etPhone.setError("该手机号已注册");
etPhone.requestFocus();
return;
}
if (!isCounting) {
startCountDown();
// 使用短信服务发送验证码
smsManager.sendVerificationCode(phone, new SmsManager.SmsSendCallback() {
@Override
public void onSuccess(String code) {
verificationCode = code;
Toast.makeText(RegisterActivity.this,
"验证码已发送到手机尾号" + phone.substring(7),
Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(String error) {
Toast.makeText(RegisterActivity.this,
"验证码发送失败: " + error,
Toast.LENGTH_SHORT).show();
// 重置倒计时
resetCountDown();
}
});
}
}
private boolean validatePhone(String phone) {
if (phone.isEmpty()) {
etPhone.setError("请输入手机号");
etPhone.requestFocus();
return false;
return;
}
if (phone.length() != 11) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
return;
}
if (!phone.startsWith("1")) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
if (!isCounting) {
startCountDown();
Toast.makeText(this, "验证码已发送", Toast.LENGTH_SHORT).show();
// 这里应该调用后端API发送验证码
}
return true;
}
private void startCountDown() {
@ -150,83 +99,44 @@ public class RegisterActivity extends AppCompatActivity {
}.start();
}
private void resetCountDown() {
if (countDownTimer != null) {
countDownTimer.cancel();
}
isCounting = false;
btnSendCode.setEnabled(true);
btnSendCode.setText("发送验证码");
}
private void attemptRegister() {
String phone = etPhone.getText().toString().trim();
String code = etVerificationCode.getText().toString().trim();
String password = etPassword.getText().toString().trim();
if (!validateRegisterInput(phone, code, password)) {
return;
}
// 验证验证码
if (!code.equals(verificationCode)) {
etVerificationCode.setError("验证码错误");
etVerificationCode.requestFocus();
return;
}
// 注册用户
if (userManager.registerUser(phone, password)) {
performRegisterSuccess();
} else {
Toast.makeText(this, "注册失败,用户已存在", Toast.LENGTH_SHORT).show();
}
}
private boolean validateRegisterInput(String phone, String code, String password) {
if (phone.isEmpty()) {
etPhone.setError("请输入手机号");
etPhone.requestFocus();
return false;
return;
}
if (code.isEmpty()) {
etVerificationCode.setError("请输入验证码");
etVerificationCode.requestFocus();
return false;
return;
}
if (password.isEmpty()) {
etPassword.setError("请输入密码");
etPassword.requestFocus();
return false;
return;
}
if (phone.length() != 11) {
etPhone.setError("手机号格式不正确");
etPhone.requestFocus();
return false;
return;
}
if (password.length() < 6) {
etPassword.setError("密码至少6位");
etPassword.requestFocus();
return false;
return;
}
return true;
// 模拟注册成功
performRegister();
}
private void performRegisterSuccess() {
private void performRegister() {
Toast.makeText(this, "注册成功!", Toast.LENGTH_SHORT).show();
// 自动登录
String phone = etPhone.getText().toString().trim();
String password = etPassword.getText().toString().trim();
userManager.saveUserLogin(phone, password);
// 跳转到主页面
Intent intent = new Intent(RegisterActivity.this, MainActivity.class);
// 注册成功后跳转到登录页面
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}

@ -5,8 +5,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
// 改为 AndroidX
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@ -23,8 +21,6 @@ public class HomeFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home, container, false);
}
}

@ -1,68 +1,26 @@
package com.startsmake.llrisetabbardemo.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
// 改为 AndroidX
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.startsmake.llrisetabbardemo.R;
import com.startsmake.llrisetabbardemo.activity.LoginActivity;
import com.startsmake.llrisetabbardemo.manager.UserManager;
import com.startsmake.llrisetabbardemo.model.User;
/**
* User:Shine
* Date:2015-10-20
* Description:
*/
public class PersonFragment extends Fragment {
private TextView tvUserInfo;
private Button btnLogout;
private UserManager userManager;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_person, container, false);
userManager = UserManager.getInstance(requireContext());
initViews(view);
setupUserInfo();
setupClickListeners();
return view;
}
private void initViews(View view) {
tvUserInfo = view.findViewById(R.id.tv_user_info);
btnLogout = view.findViewById(R.id.btn_logout);
}
private void setupUserInfo() {
if (userManager.isLoggedIn()) {
User user = userManager.getCurrentUser();
tvUserInfo.setText("欢迎," + user.getNickname() + "\n手机号: " + user.getPhone());
btnLogout.setVisibility(View.VISIBLE);
} else {
tvUserInfo.setText("游客模式");
btnLogout.setVisibility(View.GONE);
}
}
private void setupClickListeners() {
btnLogout.setOnClickListener(v -> logout());
}
private void logout() {
userManager.logout();
Toast.makeText(getContext(), "已登出", Toast.LENGTH_SHORT).show();
// 跳转回登录页面
Intent intent = new Intent(getActivity(), LoginActivity.class);
startActivity(intent);
getActivity().finish();
return inflater.inflate(R.layout.fragment_person, container, false);
}
}

@ -49,7 +49,7 @@
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="注册手机号"
android:hint="手机号"
android:inputType="phone"
android:maxLines="1"
android:padding="16dp"

@ -44,25 +44,4 @@
android:onClick="onClickPublish"
android:src="@mipmap/comui_tab_post"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- 如果您有顶部工具栏,可以保留或添加 -->
<!-- <include layout="@layout/toolbar" /> -->
<!-- Fragment 容器 -->
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<!-- 如果您有底部导航栏,可以保留 -->
<!-- 根据您的项目这里可能有自定义的底部TabBar -->
</LinearLayout>
</RelativeLayout>

@ -1,30 +1,14 @@
<FrameLayout 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:background="#fffaf0" android:orientation="vertical">
<!-- 顶部搜索栏区域 -->
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFDD59" android:orientation="vertical" android:padding="10dp">
<!-- 搜索框 -->
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:alpha="0.8" android:background="@drawable/rounded_background1" android:gravity="center_vertical" android:orientation="horizontal" android:padding="8dp">
<!-- 搜索图标 -->
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="1" android:text="🔍" android:textSize="16sp"/>
<!-- 搜索输入框 -->
<EditText android:id="@+id/search_edit_text" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:alpha="1" android:background="@null" android:focusable="true" android:focusableInTouchMode="true" android:hint="搜索教材、数码、生活用品..." android:imeOptions="actionSearch" android:inputType="text" android:maxLines="1" android:paddingStart="8dp" android:paddingEnd="8dp" android:singleLine="true" android:textColor="#333333" android:textColorHint="#999999" android:textSize="14sp"/>
<ImageButton android:id="@+id/camera_button" android:layout_width="23dp" android:layout_height="24dp" android:layout_marginStart="4dp" android:background="?android:attr/selectableItemBackgroundBorderless" android:padding="0.5dp" android:scaleType="centerInside" android:src="@android:drawable/ic_menu_camera" android:contentDescription="拍照搜索"/>
</LinearLayout>
</LinearLayout>
<!-- 导航标签区域 -->
<HorizontalScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="65dp" android:background="@android:color/white" android:paddingVertical="8dp">
<LinearLayout android:id="@+id/tab_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal">
<!-- 关注标签 -->
<RadioButton android:id="@+id/tab_follow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="关注" android:button="@null" android:textColor="#ff6b35" android:textSize="14sp" android:textStyle="bold" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
<!-- 推荐标签 -->
<TextView android:id="@+id/tab_recommend" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="推荐" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
<!-- 新发布标签 -->
<TextView android:id="@+id/tab_new" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="新发布" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
<!-- 学习资料标签 -->
<TextView android:id="@+id/tab_study" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="学习资料" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
<!-- 生活用品标签 -->
<TextView android:id="@+id/tab_living" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="生活用品" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
</LinearLayout>
</HorizontalScrollView>
<!-- 首页文字 -->
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="首页"/>
</FrameLayout>

@ -16,5 +16,8 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="gray">#FF9E9E9E</color>
<color name="green">#FF4CAF50</color>
<color name="logout_red">#FF5722</color>
<color name="comui_tab_text_color">#ff333333</color>
</resources>

Loading…
Cancel
Save