feat: 添加幻灯片播放功能
- 新增幻灯片 Tab 到底部导航(第5个导航项) - 实现 SlideshowFragment 数量选择页(10/20/50/全部) - 实现 SlideshowPlayerActivity 全屏播放器 - 支持播放/暂停、上一张/下一张控制 - 支持实时调整播放间隔(3-15秒) - 控制面板自动隐藏功能(3秒后隐藏) - 播放结束后显示重播/退出选项 - 从当前激活相册随机选择图片播放 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e1f8265636
commit
b805abd153
9 files changed
+939
-9
No files matched your search
@@ -81,5 +81,13 @@
|
||||
android:theme="@style/Theme.BzForGk2"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
|
||||
<!-- Slideshow Player Activity -->
|
||||
<activity
|
||||
android:name=".ui.SlideshowPlayerActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -171,6 +171,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
int[] navContainerIds = {
|
||||
R.id.navHome,
|
||||
R.id.navAlbum,
|
||||
R.id.navSlideshow,
|
||||
R.id.navHistory,
|
||||
R.id.navSettings
|
||||
};
|
||||
@@ -179,6 +180,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
int[] navTextIds = {
|
||||
R.id.tvNavHome,
|
||||
R.id.tvNavAlbum,
|
||||
R.id.tvNavSlideshow,
|
||||
R.id.tvNavHistory,
|
||||
R.id.tvNavSettings
|
||||
};
|
||||
@@ -187,16 +189,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
int[] navIconIds = {
|
||||
R.id.ivNavHome,
|
||||
R.id.ivNavAlbum,
|
||||
R.id.ivNavSlideshow,
|
||||
R.id.ivNavHistory,
|
||||
R.id.ivNavSettings
|
||||
};
|
||||
|
||||
// 初始化导航项和图标数组
|
||||
navContainers = new LinearLayout[4];
|
||||
navItems = new TextView[4];
|
||||
navIcons = new ImageView[4];
|
||||
navContainers = new LinearLayout[5];
|
||||
navItems = new TextView[5];
|
||||
navIcons = new ImageView[5];
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
navContainers[i] = findViewById(navContainerIds[i]);
|
||||
navItems[i] = findViewById(navTextIds[i]);
|
||||
navIcons[i] = findViewById(navIconIds[i]);
|
||||
@@ -251,10 +254,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* 切换到指定的页面
|
||||
* @param position 页面索引(0=主页,1=相册,2=历史,3=设置)
|
||||
* @param position 页面索引(0=主页,1=相册,2=幻灯片,3=历史,4=设置)
|
||||
*/
|
||||
public void switchToPage(int position) {
|
||||
if (viewPager != null && position >= 0 && position < 4) {
|
||||
if (viewPager != null && position >= 0 && position < 5) {
|
||||
viewPager.setCurrentItem(position, false);
|
||||
// 更新底部导航选中状态
|
||||
updateNavSelection(position);
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
package cn.hugh.bz.gk2.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hugh.bz.gk2.R;
|
||||
import cn.hugh.bz.gk2.model.Album;
|
||||
import cn.hugh.bz.gk2.utils.MediaScanner;
|
||||
import cn.hugh.bz.gk2.wallpaper.AlbumPreferences;
|
||||
|
||||
/**
|
||||
* 幻灯片 Fragment
|
||||
* 显示数量选择界面,从当前激活相册随机选择图片
|
||||
*/
|
||||
public class SlideshowFragment extends Fragment {
|
||||
private static final String TAG = "SlideshowFragment";
|
||||
|
||||
private TextView tvAlbumName;
|
||||
private TextView tvImageCount;
|
||||
private MaterialButton btn10;
|
||||
private MaterialButton btn20;
|
||||
private MaterialButton btn50;
|
||||
private MaterialButton btnAll;
|
||||
|
||||
private AlbumPreferences albumPrefs;
|
||||
private MediaScanner mediaScanner;
|
||||
private Album activeAlbum;
|
||||
private List<String> allImages;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_slideshow, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
albumPrefs = new AlbumPreferences(requireContext());
|
||||
mediaScanner = new MediaScanner(requireContext());
|
||||
|
||||
initViews(view);
|
||||
loadAlbumData();
|
||||
setupButtons();
|
||||
}
|
||||
|
||||
private void initViews(View view) {
|
||||
tvAlbumName = view.findViewById(R.id.tvAlbumName);
|
||||
tvImageCount = view.findViewById(R.id.tvImageCount);
|
||||
btn10 = view.findViewById(R.id.btn10);
|
||||
btn20 = view.findViewById(R.id.btn20);
|
||||
btn50 = view.findViewById(R.id.btn50);
|
||||
btnAll = view.findViewById(R.id.btnAll);
|
||||
}
|
||||
|
||||
private void loadAlbumData() {
|
||||
// 获取激活相册
|
||||
String activeAlbumId = albumPrefs.getActiveAlbumId();
|
||||
List<Album> albums = albumPrefs.loadAlbums();
|
||||
|
||||
for (Album album : albums) {
|
||||
if (album.getId().equals(activeAlbumId)) {
|
||||
activeAlbum = album;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeAlbum == null) {
|
||||
tvAlbumName.setText("未找到激活相册");
|
||||
tvImageCount.setText("0 张图片");
|
||||
disableAllButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
// 扫描相册图片
|
||||
allImages = new ArrayList<>();
|
||||
|
||||
// 扫描文件夹
|
||||
for (String folderUri : activeAlbum.getFolders()) {
|
||||
List<cn.hugh.bz.gk2.model.WallpaperMedia> mediaList = mediaScanner.scanFolder(folderUri);
|
||||
// 只添加图片,过滤掉视频
|
||||
for (cn.hugh.bz.gk2.model.WallpaperMedia media : mediaList) {
|
||||
if (!media.isVideo()) {
|
||||
allImages.add(media.getUri());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加单独选择的图片
|
||||
if (activeAlbum.getImageUris() != null) {
|
||||
allImages.addAll(activeAlbum.getImageUris());
|
||||
}
|
||||
|
||||
// 更新UI
|
||||
tvAlbumName.setText(activeAlbum.getName());
|
||||
tvImageCount.setText(allImages.size() + " 张图片");
|
||||
|
||||
// 根据图片数量调整按钮
|
||||
updateButtonStates();
|
||||
}
|
||||
|
||||
private void updateButtonStates() {
|
||||
int count = allImages.size();
|
||||
|
||||
if (count == 0) {
|
||||
disableAllButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
// 10张按钮
|
||||
if (count >= 10) {
|
||||
btn10.setEnabled(true);
|
||||
btn10.setText("10 张");
|
||||
} else {
|
||||
btn10.setEnabled(true);
|
||||
btn10.setText(count + " 张");
|
||||
}
|
||||
|
||||
// 20张按钮
|
||||
if (count >= 20) {
|
||||
btn20.setEnabled(true);
|
||||
btn20.setText("20 张");
|
||||
} else if (count > 10) {
|
||||
btn20.setEnabled(true);
|
||||
btn20.setText(count + " 张");
|
||||
} else {
|
||||
btn20.setEnabled(false);
|
||||
btn20.setText("20 张");
|
||||
}
|
||||
|
||||
// 50张按钮
|
||||
if (count >= 50) {
|
||||
btn50.setEnabled(true);
|
||||
btn50.setText("50 张");
|
||||
} else if (count > 20) {
|
||||
btn50.setEnabled(true);
|
||||
btn50.setText(count + " 张");
|
||||
} else {
|
||||
btn50.setEnabled(false);
|
||||
btn50.setText("50 张");
|
||||
}
|
||||
|
||||
// 全部按钮
|
||||
btnAll.setEnabled(true);
|
||||
btnAll.setText("全部 (" + count + " 张)");
|
||||
}
|
||||
|
||||
private void disableAllButtons() {
|
||||
btn10.setEnabled(false);
|
||||
btn20.setEnabled(false);
|
||||
btn50.setEnabled(false);
|
||||
btnAll.setEnabled(false);
|
||||
}
|
||||
|
||||
private void setupButtons() {
|
||||
btn10.setOnClickListener(v -> startSlideshow(Math.min(10, allImages.size())));
|
||||
btn20.setOnClickListener(v -> startSlideshow(Math.min(20, allImages.size())));
|
||||
btn50.setOnClickListener(v -> startSlideshow(Math.min(50, allImages.size())));
|
||||
btnAll.setOnClickListener(v -> startSlideshow(allImages.size()));
|
||||
}
|
||||
|
||||
private void startSlideshow(int count) {
|
||||
if (allImages == null || allImages.isEmpty()) {
|
||||
Toast.makeText(requireContext(), "没有可用的图片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// 随机选择图片
|
||||
List<String> selectedImages = new ArrayList<>(allImages);
|
||||
Collections.shuffle(selectedImages);
|
||||
|
||||
if (count < selectedImages.size()) {
|
||||
selectedImages = selectedImages.subList(0, count);
|
||||
}
|
||||
|
||||
// 启动播放器
|
||||
Intent intent = new Intent(requireContext(), SlideshowPlayerActivity.class);
|
||||
intent.putStringArrayListExtra("image_uris", new ArrayList<>(selectedImages));
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// 重新加载数据,以防相册内容有变化
|
||||
loadAlbumData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
package cn.hugh.bz.gk2.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.hugh.bz.gk2.R;
|
||||
|
||||
/**
|
||||
* 幻灯片播放器 Activity
|
||||
* 全屏播放图片,支持播放控制和间隔调整
|
||||
*/
|
||||
public class SlideshowPlayerActivity extends AppCompatActivity {
|
||||
private static final String TAG = "SlideshowPlayerActivity";
|
||||
private static final int MIN_INTERVAL = 3000; // 3秒
|
||||
private static final int MAX_INTERVAL = 15000; // 15秒
|
||||
private static final int CONTROL_HIDE_DELAY = 3000; // 3秒后隐藏控制面板
|
||||
|
||||
private ImageView ivSlideshow;
|
||||
private View controlPanel;
|
||||
private TextView tvProgress;
|
||||
private SeekBar seekBarInterval;
|
||||
private TextView tvIntervalLabel;
|
||||
private MaterialButton btnPrevious;
|
||||
private MaterialButton btnPlayPause;
|
||||
private MaterialButton btnNext;
|
||||
private MaterialButton btnExit;
|
||||
private View endScreen;
|
||||
private MaterialButton btnReplay;
|
||||
private MaterialButton btnExitEnd;
|
||||
|
||||
private ArrayList<String> imageUris;
|
||||
private int currentIndex = 0;
|
||||
private boolean isPlaying = true;
|
||||
private int currentInterval = 5000; // 默认5秒
|
||||
|
||||
private Handler playHandler;
|
||||
private Runnable playRunnable;
|
||||
private Handler hideHandler;
|
||||
private Runnable hideRunnable;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// 设置全屏
|
||||
getWindow().setFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
);
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
);
|
||||
|
||||
setContentView(R.layout.activity_slideshow_player);
|
||||
|
||||
// 获取图片列表
|
||||
imageUris = getIntent().getStringArrayListExtra("image_uris");
|
||||
if (imageUris == null || imageUris.isEmpty()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
initViews();
|
||||
setupHandlers();
|
||||
setupControls();
|
||||
loadImage(currentIndex);
|
||||
startAutoPlay();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
ivSlideshow = findViewById(R.id.ivSlideshow);
|
||||
controlPanel = findViewById(R.id.controlPanel);
|
||||
tvProgress = findViewById(R.id.tvProgress);
|
||||
seekBarInterval = findViewById(R.id.seekBarInterval);
|
||||
tvIntervalLabel = findViewById(R.id.tvIntervalLabel);
|
||||
btnPrevious = findViewById(R.id.btnPrevious);
|
||||
btnPlayPause = findViewById(R.id.btnPlayPause);
|
||||
btnNext = findViewById(R.id.btnNext);
|
||||
btnExit = findViewById(R.id.btnExit);
|
||||
endScreen = findViewById(R.id.endScreen);
|
||||
btnReplay = findViewById(R.id.btnReplay);
|
||||
btnExitEnd = findViewById(R.id.btnExitEnd);
|
||||
|
||||
// 点击屏幕显示/隐藏控制面板
|
||||
ivSlideshow.setOnClickListener(v -> toggleControlPanel());
|
||||
}
|
||||
|
||||
private void setupHandlers() {
|
||||
playHandler = new Handler(Looper.getMainLooper());
|
||||
playRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isPlaying) {
|
||||
showNext();
|
||||
playHandler.postDelayed(this, currentInterval);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
hideHandler = new Handler(Looper.getMainLooper());
|
||||
hideRunnable = () -> hideControlPanel();
|
||||
}
|
||||
|
||||
private void setupControls() {
|
||||
// 间隔滑块
|
||||
seekBarInterval.setMax((MAX_INTERVAL - MIN_INTERVAL) / 1000);
|
||||
seekBarInterval.setProgress((currentInterval - MIN_INTERVAL) / 1000);
|
||||
updateIntervalLabel();
|
||||
|
||||
seekBarInterval.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
currentInterval = MIN_INTERVAL + (progress * 1000);
|
||||
updateIntervalLabel();
|
||||
resetHideTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
resetHideTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
resetHideTimer();
|
||||
// 重启自动播放
|
||||
if (isPlaying) {
|
||||
stopAutoPlay();
|
||||
startAutoPlay();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 控制按钮
|
||||
btnPrevious.setOnClickListener(v -> {
|
||||
showPrevious();
|
||||
resetHideTimer();
|
||||
});
|
||||
|
||||
btnPlayPause.setOnClickListener(v -> {
|
||||
togglePlayPause();
|
||||
resetHideTimer();
|
||||
});
|
||||
|
||||
btnNext.setOnClickListener(v -> {
|
||||
showNext();
|
||||
resetHideTimer();
|
||||
});
|
||||
|
||||
btnExit.setOnClickListener(v -> finish());
|
||||
|
||||
// 播放结束按钮
|
||||
btnReplay.setOnClickListener(v -> replay());
|
||||
btnExitEnd.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
private void loadImage(int index) {
|
||||
if (index < 0 || index >= imageUris.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String uri = imageUris.get(index);
|
||||
Glide.with(this)
|
||||
.load(uri)
|
||||
.centerInside()
|
||||
.into(ivSlideshow);
|
||||
|
||||
updateProgress();
|
||||
}
|
||||
|
||||
private void updateProgress() {
|
||||
tvProgress.setText((currentIndex + 1) + " / " + imageUris.size());
|
||||
}
|
||||
|
||||
private void updateIntervalLabel() {
|
||||
int seconds = currentInterval / 1000;
|
||||
tvIntervalLabel.setText(seconds + " 秒");
|
||||
}
|
||||
|
||||
private void showNext() {
|
||||
currentIndex++;
|
||||
if (currentIndex >= imageUris.size()) {
|
||||
// 播放结束
|
||||
stopAutoPlay();
|
||||
showEndScreen();
|
||||
return;
|
||||
}
|
||||
loadImage(currentIndex);
|
||||
}
|
||||
|
||||
private void showPrevious() {
|
||||
if (currentIndex > 0) {
|
||||
currentIndex--;
|
||||
loadImage(currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void togglePlayPause() {
|
||||
if (isPlaying) {
|
||||
pause();
|
||||
} else {
|
||||
resume();
|
||||
}
|
||||
}
|
||||
|
||||
private void pause() {
|
||||
isPlaying = false;
|
||||
stopAutoPlay();
|
||||
btnPlayPause.setIcon(getDrawable(android.R.drawable.ic_media_play));
|
||||
// 暂停时不隐藏控制面板
|
||||
hideHandler.removeCallbacks(hideRunnable);
|
||||
}
|
||||
|
||||
private void resume() {
|
||||
isPlaying = true;
|
||||
startAutoPlay();
|
||||
btnPlayPause.setIcon(getDrawable(android.R.drawable.ic_media_pause));
|
||||
resetHideTimer();
|
||||
}
|
||||
|
||||
private void startAutoPlay() {
|
||||
playHandler.postDelayed(playRunnable, currentInterval);
|
||||
}
|
||||
|
||||
private void stopAutoPlay() {
|
||||
playHandler.removeCallbacks(playRunnable);
|
||||
}
|
||||
|
||||
private void toggleControlPanel() {
|
||||
if (controlPanel.getVisibility() == View.VISIBLE) {
|
||||
hideControlPanel();
|
||||
} else {
|
||||
showControlPanel();
|
||||
}
|
||||
}
|
||||
|
||||
private void showControlPanel() {
|
||||
controlPanel.setVisibility(View.VISIBLE);
|
||||
controlPanel.setAlpha(0f);
|
||||
controlPanel.setTranslationY(100f);
|
||||
controlPanel.animate()
|
||||
.alpha(1f)
|
||||
.translationY(0f)
|
||||
.setDuration(300)
|
||||
.start();
|
||||
|
||||
if (isPlaying) {
|
||||
resetHideTimer();
|
||||
}
|
||||
}
|
||||
|
||||
private void hideControlPanel() {
|
||||
controlPanel.animate()
|
||||
.alpha(0f)
|
||||
.translationY(100f)
|
||||
.setDuration(300)
|
||||
.withEndAction(() -> controlPanel.setVisibility(View.GONE))
|
||||
.start();
|
||||
}
|
||||
|
||||
private void resetHideTimer() {
|
||||
hideHandler.removeCallbacks(hideRunnable);
|
||||
if (isPlaying) {
|
||||
hideHandler.postDelayed(hideRunnable, CONTROL_HIDE_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
private void showEndScreen() {
|
||||
endScreen.setVisibility(View.VISIBLE);
|
||||
endScreen.setAlpha(0f);
|
||||
endScreen.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(300)
|
||||
.start();
|
||||
}
|
||||
|
||||
private void replay() {
|
||||
currentIndex = 0;
|
||||
loadImage(currentIndex);
|
||||
endScreen.setVisibility(View.GONE);
|
||||
isPlaying = true;
|
||||
btnPlayPause.setIcon(getDrawable(android.R.drawable.ic_media_pause));
|
||||
startAutoPlay();
|
||||
resetHideTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
stopAutoPlay();
|
||||
hideHandler.removeCallbacks(hideRunnable);
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
/**
|
||||
* ViewPager2 适配器,用于管理四个 Fragment 页面
|
||||
* ViewPager2 适配器,用于管理五个 Fragment 页面
|
||||
*/
|
||||
public class ViewPagerAdapter extends FragmentStateAdapter {
|
||||
private static final int NUM_PAGES = 4;
|
||||
private static final int NUM_PAGES = 5;
|
||||
|
||||
public ViewPagerAdapter(FragmentActivity fa) {
|
||||
super(fa);
|
||||
@@ -24,8 +24,10 @@ public class ViewPagerAdapter extends FragmentStateAdapter {
|
||||
case 1:
|
||||
return new AlbumManagementFragment();
|
||||
case 2:
|
||||
return new WallpaperHistoryFragment();
|
||||
return new SlideshowFragment();
|
||||
case 3:
|
||||
return new WallpaperHistoryFragment();
|
||||
case 4:
|
||||
return new SettingsFragment();
|
||||
default:
|
||||
return new HomeFragment();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M10,8v8l5,-4 -5,-4zM19,3H5C3.9,3 3,3.9 3,5v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5C21,3.9 20.1,3 19,3zM19,19H5V5h14V19z"/>
|
||||
</vector>
|
||||
@@ -105,6 +105,38 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 幻灯片 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/navSlideshow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="@drawable/selector_nav_item_bg"
|
||||
android:layout_marginEnd="4dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivNavSlideshow"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_slideshow"
|
||||
app:tint="@color/selector_nav_item_icon_color" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvNavSlideshow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="幻灯片"
|
||||
android:textSize="10sp"
|
||||
android:textColor="@color/selector_nav_item_text_color"
|
||||
android:layout_marginTop="2dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 历史 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/navHistory"
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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="@android:color/black">
|
||||
|
||||
<!-- 全屏图片 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivSlideshow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="幻灯片图片" />
|
||||
|
||||
<!-- 控制面板 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/controlPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:background="#CC000000"
|
||||
android:padding="24dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<!-- 进度显示 -->
|
||||
<TextView
|
||||
android:id="@+id/tvProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1 / 20"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<!-- 间隔滑块 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="间隔:"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/seekBarInterval"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:max="12"
|
||||
android:progress="2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIntervalLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5 秒"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="48dp"
|
||||
android:gravity="end" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 控制按钮 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- 上一张 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnPrevious"
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
app:icon="@android:drawable/ic_media_previous"
|
||||
app:iconSize="32dp"
|
||||
app:iconTint="@android:color/white"
|
||||
app:backgroundTint="#40FFFFFF"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
<!-- 播放/暂停 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnPlayPause"
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
app:icon="@android:drawable/ic_media_pause"
|
||||
app:iconSize="36dp"
|
||||
app:iconTint="@android:color/white"
|
||||
app:backgroundTint="#60FFFFFF"
|
||||
android:layout_marginHorizontal="8dp" />
|
||||
|
||||
<!-- 下一张 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnNext"
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
app:icon="@android:drawable/ic_media_next"
|
||||
app:iconSize="32dp"
|
||||
app:iconTint="@android:color/white"
|
||||
app:backgroundTint="#40FFFFFF"
|
||||
android:layout_marginStart="8dp" />
|
||||
|
||||
<!-- 退出 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnExit"
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
app:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||
app:iconSize="28dp"
|
||||
app:iconTint="@android:color/white"
|
||||
app:backgroundTint="#40FF0000"
|
||||
android:layout_marginStart="16dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 播放结束界面 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/endScreen"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:background="#CC000000"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="播放结束"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_marginBottom="32dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 重新播放 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnReplay"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:text="重新播放"
|
||||
android:textSize="16sp"
|
||||
app:backgroundTint="@color/sky_blue_primary"
|
||||
android:textColor="@android:color/white"
|
||||
app:cornerRadius="28dp"
|
||||
android:paddingHorizontal="32dp"
|
||||
android:layout_marginEnd="16dp" />
|
||||
|
||||
<!-- 退出 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnExitEnd"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:text="退出"
|
||||
android:textSize="16sp"
|
||||
app:strokeColor="@android:color/white"
|
||||
android:textColor="@android:color/white"
|
||||
app:cornerRadius="28dp"
|
||||
android:paddingHorizontal="32dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
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="@color/bg_primary">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp"
|
||||
android:paddingBottom="100dp"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<!-- Title -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="幻灯片播放"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="从当前相册随机选择图片"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:layout_marginBottom="32dp" />
|
||||
|
||||
<!-- Album Info Card -->
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="32dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/bg_secondary_modern"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前相册"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/text_hint"
|
||||
android:textAllCaps="true"
|
||||
android:letterSpacing="0.1"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAlbumName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="默认相册"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary"
|
||||
android:layout_marginBottom="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvImageCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0 张图片"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_secondary" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<!-- Selection Title -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="选择播放数量"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<!-- Option Buttons -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- 10 张 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn10"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:text="10 张"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:cornerRadius="16dp"
|
||||
app:strokeWidth="2dp"
|
||||
app:strokeColor="@color/sky_blue_primary"
|
||||
android:textColor="@color/sky_blue_primary"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<!-- 20 张 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn20"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:text="20 张"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:cornerRadius="16dp"
|
||||
app:strokeWidth="2dp"
|
||||
app:strokeColor="@color/sky_blue_primary"
|
||||
android:textColor="@color/sky_blue_primary"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<!-- 50 张 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn50"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:text="50 张"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:cornerRadius="16dp"
|
||||
app:strokeWidth="2dp"
|
||||
app:strokeColor="@color/sky_blue_primary"
|
||||
android:textColor="@color/sky_blue_primary"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<!-- 全部 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnAll"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:text="全部"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:cornerRadius="16dp"
|
||||
app:backgroundTint="@color/sky_blue_primary"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
Reference in new issue
Block a user