添加主窗口关于菜单和刷新封面功能
- 主窗口添加工具栏关于应用菜单 - AboutActivity使用AppBarLayout与主窗口一致 - 添加返回按钮到AboutActivity工具栏 - 去掉主窗口刷新菜单 - onResume时刷新相册集封面
This commit is contained in:
@@ -47,6 +47,14 @@
|
|||||||
android:name=".TrashActivity"
|
android:name=".TrashActivity"
|
||||||
android:label="@string/trash"/>
|
android:label="@string/trash"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".CropActivity"
|
||||||
|
android:label="调整封面"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".AboutActivity"
|
||||||
|
android:label="@string/about"/>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="4.0"/>
|
android:value="4.0"/>
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
package cc.winboll.studio.gallery;
|
package cc.winboll.studio.gallery;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toolbar;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.models.APPInfo;
|
import cc.winboll.studio.libappbase.models.APPInfo;
|
||||||
import cc.winboll.studio.libappbase.views.AboutView;
|
import cc.winboll.studio.libappbase.views.AboutView;
|
||||||
|
|
||||||
/**
|
public class AboutActivity extends AppCompatActivity {
|
||||||
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
|
|
||||||
* @Date 2026/01/11 12:55
|
|
||||||
* @Describe AboutActivity
|
|
||||||
*/
|
|
||||||
public class AboutActivity extends Activity {
|
|
||||||
|
|
||||||
public static final String TAG = "AboutActivity";
|
public static final String TAG = "AboutActivity";
|
||||||
|
|
||||||
@@ -22,15 +17,13 @@ public class AboutActivity extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_about);
|
setContentView(R.layout.activity_about);
|
||||||
|
|
||||||
// 设置工具栏
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getActionBar().setSubtitle(TAG);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finish(); // 点击导航栏返回按钮,触发 finish()
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -281,18 +281,14 @@ private void loadAlbums() {
|
|||||||
if (id == R.id.action_settings) {
|
if (id == R.id.action_settings) {
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
startActivity(new Intent(this, SettingsActivity.class));
|
||||||
return true;
|
return true;
|
||||||
|
} else if (id == R.id.action_about) {
|
||||||
|
startActivity(new Intent(this, AboutActivity.class));
|
||||||
|
return true;
|
||||||
} else if (id == R.id.action_trash) {
|
} else if (id == R.id.action_trash) {
|
||||||
startActivity(new Intent(this, TrashActivity.class));
|
startActivity(new Intent(this, TrashActivity.class));
|
||||||
return true;
|
return true;
|
||||||
} else if (id == R.id.action_refresh) {
|
|
||||||
if (checkPermission()) {
|
|
||||||
loadAlbums();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else if (id == R.id.action_debug) {
|
} else if (id == R.id.action_debug) {
|
||||||
LogActivity.startLogActivity(this);
|
LogActivity.startLogActivity(this);
|
||||||
// Log.d("Gallery", "Debug log message");
|
|
||||||
// Toast.makeText(this, R.string.debug_message, Toast.LENGTH_SHORT).show();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@@ -308,6 +304,7 @@ private void loadAlbums() {
|
|||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
adapter.refreshBg();
|
adapter.refreshBg();
|
||||||
adapter.refreshPinned();
|
adapter.refreshPinned();
|
||||||
|
adapter.refreshCover();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<android.widget.Toolbar
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/toolbar"/>
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<cc.winboll.studio.libappbase.views.AboutView
|
<cc.winboll.studio.libappbase.views.AboutView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/aboutview"/>
|
android:id="@+id/aboutview"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_refresh"
|
android:id="@+id/action_about"
|
||||||
android:title="@string/refresh"
|
android:title="@string/about"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<string name="refresh">Refresh</string>
|
<string name="refresh">Refresh</string>
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
<string name="settings_title">Settings</string>
|
<string name="settings_title">Settings</string>
|
||||||
|
<string name="about">About</string>
|
||||||
<string name="folder_path">Folder Path</string>
|
<string name="folder_path">Folder Path</string>
|
||||||
<string name="enter_folder_path">Enter folder path</string>
|
<string name="enter_folder_path">Enter folder path</string>
|
||||||
<string name="save">Save</string>
|
<string name="save">Save</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user