|
|
@@ -136,7 +136,7 @@ const ITEM_HEIGHT: number = 58; // 列表项高度
|
|
|
@Preview
|
|
|
@Component
|
|
|
export struct LocalMusic {
|
|
|
- @StorageProp('themeColor') themeColor: string = PreferencesUtil.getStringSync('THEME_COLOR', '#FF4081');
|
|
|
+ @StorageProp('themeColor') themeColor: string = PreferencesUtil.getStringSync('THEME_COLOR', CommonConstants.DEFAULT_THEME_COLOR);
|
|
|
themeMode: number=0;
|
|
|
@State titleName: string = '首页'
|
|
|
@State textStr: string = ''
|
|
|
@@ -471,7 +471,7 @@ export struct LocalMusic {
|
|
|
// 读取 themeMode 并同步 currentColorMode
|
|
|
this.themeMode = PreferencesUtil.getNumberSync(SettingPage.THEME_MODE, 0)
|
|
|
this.applyThemeMode(this.themeMode)
|
|
|
- let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', '#FF4081');
|
|
|
+ let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', CommonConstants.DEFAULT_THEME_COLOR);
|
|
|
AppStorage.setOrCreate('themeColor', themeColor);
|
|
|
this.themeColor = themeColor;
|
|
|
this.doChangeSetting()
|
|
|
@@ -481,11 +481,11 @@ export struct LocalMusic {
|
|
|
let viewWidth = px2vp(size.width);
|
|
|
let viewHeight = px2vp(size.height);
|
|
|
if (viewWidth > viewHeight) {
|
|
|
- // this.isLandscape = true;
|
|
|
+ this.isLandscape = true;
|
|
|
this.startAutoHide()
|
|
|
// Logger.info('onecold 横屏 windowSizeChange isLandscape = ' + this.isLandscape)
|
|
|
}else{
|
|
|
- // this.isLandscape = false;
|
|
|
+ this.isLandscape = false;
|
|
|
this.isAutoHide = false
|
|
|
// Logger.info('onecold 竖屏 windowSizeChange isLandscape = ' + this.isLandscape)
|
|
|
}
|
|
|
@@ -5696,7 +5696,7 @@ export struct LocalMusic {
|
|
|
.width('18%')
|
|
|
|
|
|
}
|
|
|
- .width(this.isLandscape ? '50%' : '82%')
|
|
|
+ .width('82%')
|
|
|
.height(58)
|
|
|
.justifyContent(FlexAlign.SpaceBetween)
|
|
|
}
|
|
|
@@ -6101,7 +6101,6 @@ export struct LocalMusic {
|
|
|
Image($r('app.media.ic_back_down'))
|
|
|
.width($r('app.float.title_image_size'))// .aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
.hitTestBehavior(HitTestMode.Transparent)
|
|
|
- // .visibility(this.isLandscape?Visibility.None:Visibility.Visible)
|
|
|
|
|
|
Text(this.name + ' ' + this.artist)
|
|
|
.fontColor(Color.White)
|
|
|
@@ -7242,7 +7241,7 @@ export struct LocalMusic {
|
|
|
|
|
|
this.doMore(more.id)
|
|
|
})
|
|
|
- Text(more.title)
|
|
|
+ Text(more.id==17?(this.isLandscape?'竖屏模式':'横屏模式'):more.title)
|
|
|
.fontSize(16)
|
|
|
|
|
|
.fontColor(Color.White)
|
|
|
@@ -7415,11 +7414,7 @@ export struct LocalMusic {
|
|
|
|
|
|
{ id: 2, image: $r('app.media.lyric'), title: '歌词' },
|
|
|
|
|
|
- { id: 3, image: $r('app.media.hua_zhong_hua'), title: '详情' },
|
|
|
-
|
|
|
- { id: 12, image: $r('app.media.toubo'), title: '投播' },
|
|
|
-
|
|
|
- { id: 4, image: $r('app.media.share2'), title: '分享' },
|
|
|
+ { id: 17, image: $r('app.media.full_4'), title: '横屏模式' },
|
|
|
|
|
|
{ id: 16, image: $r('app.media.hua_zhong_hua'), title: '悬浮歌词' },
|
|
|
|
|
|
@@ -7433,6 +7428,12 @@ export struct LocalMusic {
|
|
|
|
|
|
{ id: 11, image: $r('app.media.time_close'), title: '跳过头尾' },
|
|
|
|
|
|
+ { id: 12, image: $r('app.media.toubo'), title: '投播' },
|
|
|
+
|
|
|
+ { id: 3, image: $r('app.media.hua_zhong_hua'), title: '详情' },
|
|
|
+
|
|
|
+ { id: 4, image: $r('app.media.share2'), title: '分享' },
|
|
|
+
|
|
|
{ id: 9, image: $r('app.media.volume_white'), title: '调整音量' },
|
|
|
|
|
|
{ id: 6, image: $r('app.media.memory'), title: '记忆播放' },
|
|
|
@@ -7516,9 +7517,28 @@ export struct LocalMusic {
|
|
|
case 16: //悬浮歌词
|
|
|
this.showPipLyric = !this.showPipLyric;
|
|
|
break;
|
|
|
+ case 17: //横屏模式
|
|
|
+ if (this.isLandscape) {
|
|
|
+ this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT);
|
|
|
+ } else {
|
|
|
+ this.setOrientation(window.Orientation.USER_ROTATION_LANDSCAPE);
|
|
|
+ }
|
|
|
+ this.isShowMoreView = false
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 切换横竖屏
|
|
|
+ *
|
|
|
+ */
|
|
|
+ setOrientation(orientation: number) {
|
|
|
+ this.windowClass.setPreferredOrientation(orientation).then(() => {
|
|
|
+ Logger.info('setWindowOrientation: ' + orientation + ' Succeeded.');
|
|
|
+ }).catch((err: BusinessError) => {
|
|
|
+ Logger.info('setWindowOrientation: ' + orientation + ' Failed. Cause: ' + JSON.stringify(err));
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 画中画功能(悬浮歌词功能)
|