Skip to content

Commit

Permalink
ui: Toolbar文字微调
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonLeeeaf committed Jan 13, 2025
1 parent b45ca8b commit 5bdb6a2
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 70 deletions.
68 changes: 4 additions & 64 deletions .androidide/editor/openedFiles.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,16 @@
{
"allFiles": [
{
"file": "/storage/emulated/0/MoonLeaf/Projects/MndroLua/moon3/src/main/java/moon3/app/Activity.java",
"selection": {
"end": {
"column": 23,
"index": 4991,
"line": 159
},
"start": {
"column": 23,
"index": 4991,
"line": 159
}
}
},
{
"file": "/storage/emulated/0/MoonLeaf/Projects/MndroLua/app/src/main/java/com/androlua/LuaActivity.java",
"selection": {
"end": {
"column": 32,
"index": 11613,
"line": 325
},
"start": {
"column": 32,
"index": 11613,
"line": 325
}
}
},
{
"file": "/storage/emulated/0/MoonLeaf/Projects/MndroLua/readme.md",
"selection": {
"end": {
"column": 10,
"index": 761,
"line": 27
},
"start": {
"column": 10,
"index": 761,
"line": 27
}
}
},
{
"file": "/storage/emulated/0/MoonLeaf/Projects/MndroLua/moon3/build.gradle",
"selection": {
"end": {
"column": 22,
"index": 216,
"line": 13
},
"start": {
"column": 22,
"index": 216,
"line": 13
}
}
},
{
"file": "/storage/emulated/0/MoonLeaf/Projects/MndroLua/app/build.gradle",
"selection": {
"end": {
"column": 21,
"index": 389,
"column": 23,
"index": 391,
"line": 15
},
"start": {
"column": 21,
"index": 389,
"column": 23,
"index": 391,
"line": 15
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
// 然而我需要最低兼容 sdk21, Shizuku并非必须
// 本程序所生成的软件将不能提交给 Google play(至少和我没任何关系)
targetSdk 30
versionCode 30000
versionName "3.0.0"
versionCode 30100
versionName "3.0.1"

vectorDrawables {
useSupportLibrary true
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/assets/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ function onVersionChanged(n, o)
local dlg = MaterialDialog(activity)
local title = "欢迎回家~"
local msg = [[
MndroLua 3.0.1
UI调整: moon3.widget.Toolbar 使用更加接近 android.widget.Toolbar 的文字样式 :)
MndroLua 3.0.0
破坏性修改: 本项目迁移 AndroidX, 所有的旧方法应该被修改 例如 getActionBar -> getSupportActionBar
Expand Down
4 changes: 2 additions & 2 deletions moon3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
// applicationId "moon3"
minSdk 21
targetSdk 34
versionCode 20000
versionName "2.0.0"
versionCode 20100
versionName "2.0.1"

vectorDrawables {
useSupportLibrary true
Expand Down
4 changes: 2 additions & 2 deletions moon3/src/main/java/moon3/app/Activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.appcompat.widget.Toolbar;
import moon3.widget.Toolbar;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.color.DynamicColorsOptions;
import com.google.android.material.color.MaterialColors;
Expand Down Expand Up @@ -157,7 +157,7 @@ public boolean onMenuOpened(int featureId, Menu menu) {
}

@Override
public void setSupportActionBar(Toolbar newToolbar) {
public void setSupportActionBar(androidx.appcompat.widget.Toolbar newToolbar) {
// throw new UnsupportedOperationException("You needn't use a new Toolbar, please use getToolbar().");
if (newToolbar == toolbar) toolbar.setVisibility(View.VISIBLE);
else {
Expand Down
32 changes: 32 additions & 0 deletions moon3/src/main/java/moon3/widget/Toolbar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package moon3.widget;
import android.content.Context;
import android.util.AttributeSet;

public class Toolbar extends androidx.appcompat.widget.Toolbar {
protected Context mContext;

public Toolbar(Context c) {
super(c);
mContext = c;
_moon3InitToolbar();
}

public Toolbar(Context c, AttributeSet attrs) {
super(c, attrs);
mContext = c;
_moon3InitToolbar();
}

public Toolbar(Context c, AttributeSet attrs, int def) {
super(c, attrs, def);
mContext = c;
_moon3InitToolbar();
}

protected void _moon3InitToolbar() {
// http://aospxref.com/android-14.0.0_r2/xref/frameworks/base/core/res/res/values/styles.xml#1303
setTitleTextAppearance(mContext, moon3.R.style.Moon3_TextAppearance_ToolbarTitle);
setSubtitleTextAppearance(mContext, moon3.R.style.Moon3_TextAppearance_ToolbarSubTitle);
}

}
14 changes: 14 additions & 0 deletions moon3/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,18 @@
<item name="android:navigationBarColor">?android:attr/colorBackground</item>
</style>

<style name="Moon3.TextAppearance">
</style>

<style name="Moon3.TextAppearance.ToolbarTitle">
<!-- Medium: 18sp -->
<item name="android:textSize">20sp</item>
</style>

<style name="Moon3.TextAppearance.ToolbarSubTitle">
<!-- Small: 14sp -->
<item name="android:textSize">15.5sp</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>

</resources>

0 comments on commit 5bdb6a2

Please sign in to comment.