mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
优化分屏下的布局适配
This commit is contained in:
parent
457a55bf74
commit
0cda246799
@ -15,7 +15,7 @@ public class Console implements QuickJSContext.Console {
|
|||||||
|
|
||||||
private void sendLog(String type, String log) {
|
private void sendLog(String type, String log) {
|
||||||
Message message = this.eventHandler.obtainMessage();
|
Message message = this.eventHandler.obtainMessage();
|
||||||
message.what = 1001;
|
message.what = HandlerWhat.LOG;
|
||||||
message.obj = new Object[]{type, log};
|
message.obj = new Object[]{type, log};
|
||||||
Log.d("UserApi Log", "[" + type + "]" + log);
|
Log.d("UserApi Log", "[" + type + "]" + log);
|
||||||
this.eventHandler.sendMessage(message);
|
this.eventHandler.sendMessage(message);
|
||||||
|
@ -2,7 +2,7 @@ import { memo, useCallback, useEffect, useMemo, useRef } from 'react'
|
|||||||
import { View, PanResponder } from 'react-native'
|
import { View, PanResponder } from 'react-native'
|
||||||
import { createStyle } from '@/utils/tools'
|
import { createStyle } from '@/utils/tools'
|
||||||
import { useTheme } from '@/store/theme/hook'
|
import { useTheme } from '@/store/theme/hook'
|
||||||
import { scaleSizeW } from '@/utils/pixelRatio'
|
import { scaleSizeW, scaleSizeH } from '@/utils/pixelRatio'
|
||||||
import { useDrag } from '@/utils/hooks'
|
import { useDrag } from '@/utils/hooks'
|
||||||
// import { AppColors } from '@/theme'
|
// import { AppColors } from '@/theme'
|
||||||
|
|
||||||
@ -95,11 +95,9 @@ const Progress = ({ progress, duration }: {
|
|||||||
width: progressDotSize,
|
width: progressDotSize,
|
||||||
height: progressDotSize,
|
height: progressDotSize,
|
||||||
borderRadius: progressDotSize,
|
borderRadius: progressDotSize,
|
||||||
position: 'absolute',
|
|
||||||
right: -progressDotSize / 2,
|
right: -progressDotSize / 2,
|
||||||
top: -(progressDotSize - progressHeight) / 2,
|
top: -(progressDotSize - progressHeightSize) / 2,
|
||||||
backgroundColor: theme['c-primary-light-100'],
|
backgroundColor: theme['c-primary-light-100'],
|
||||||
zIndex: 9,
|
|
||||||
} as const
|
} as const
|
||||||
}, [theme])
|
}, [theme])
|
||||||
|
|
||||||
@ -121,6 +119,7 @@ const Progress = ({ progress, duration }: {
|
|||||||
|
|
||||||
const progressContentPadding = 10
|
const progressContentPadding = 10
|
||||||
const progressHeight = 3.6
|
const progressHeight = 3.6
|
||||||
|
const progressHeightSize = scaleSizeH(progressHeight)
|
||||||
let progressDotSize = Math.round(scaleSizeW(12))
|
let progressDotSize = Math.round(scaleSizeW(12))
|
||||||
if (progressDotSize % 2 != 0) progressDotSize += 1
|
if (progressDotSize % 2 != 0) progressDotSize += 1
|
||||||
const styles = createStyle({
|
const styles = createStyle({
|
||||||
@ -137,12 +136,12 @@ const styles = createStyle({
|
|||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
},
|
},
|
||||||
progressDot: {
|
progressDot: {
|
||||||
width: progressDotSize,
|
// width: progressDotSize,
|
||||||
height: progressDotSize,
|
// height: progressDotSize,
|
||||||
borderRadius: progressDotSize,
|
// borderRadius: progressDotSize,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
right: -progressDotSize / 2,
|
// right: -progressDotSize / 2,
|
||||||
top: -(progressDotSize - progressHeight) / 2,
|
// top: -(progressDotSize - progressHeight) / 2,
|
||||||
zIndex: 9,
|
zIndex: 9,
|
||||||
},
|
},
|
||||||
pressBar: {
|
pressBar: {
|
||||||
|
@ -61,10 +61,12 @@ export default memo(({ componentId }: { componentId: string }) => {
|
|||||||
|
|
||||||
const styles = createStyle({
|
const styles = createStyle({
|
||||||
container: {
|
container: {
|
||||||
flex: 0,
|
flexShrink: 1,
|
||||||
|
flexGrow: 0,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
// elevation: 3,
|
// elevation: 3,
|
||||||
|
@ -7,6 +7,7 @@ import { playNext, playPrev, togglePlay } from '@/core/player/player'
|
|||||||
import { useIsPlay } from '@/store/player/hook'
|
import { useIsPlay } from '@/store/player/hook'
|
||||||
import { useLayout } from '@/utils/hooks'
|
import { useLayout } from '@/utils/hooks'
|
||||||
import { marginLeft } from '../constant'
|
import { marginLeft } from '../constant'
|
||||||
|
import { BTN_WIDTH } from '../MoreBtn/Btn'
|
||||||
|
|
||||||
// const WIDTH = scaleSizeW(48)
|
// const WIDTH = scaleSizeW(48)
|
||||||
|
|
||||||
@ -43,9 +44,10 @@ const TogglePlayBtn = ({ size }: { size: number }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MIN_SIZE = BTN_WIDTH * 1.1
|
||||||
export default () => {
|
export default () => {
|
||||||
const { onLayout, height, width } = useLayout()
|
const { onLayout, height, width } = useLayout()
|
||||||
const size = Math.min(height * 0.65, (width - marginLeft) * 0.52 * 0.3) * global.lx.fontSize
|
const size = Math.max(Math.min(height * 0.65, (width - marginLeft) * 0.52 * 0.3) * global.lx.fontSize, MIN_SIZE)
|
||||||
return (
|
return (
|
||||||
<View style={{ ...styles.content, gap: size * 0.5 }} onLayout={onLayout}>
|
<View style={{ ...styles.content, gap: size * 0.5 }} onLayout={onLayout}>
|
||||||
<PrevBtn size={size} />
|
<PrevBtn size={size} />
|
||||||
@ -58,7 +60,8 @@ export default () => {
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
content: {
|
content: {
|
||||||
flex: 1,
|
flexGrow: 1,
|
||||||
|
flexShrink: 1,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
// paddingVertical: 8,
|
// paddingVertical: 8,
|
||||||
gap: 22,
|
gap: 22,
|
||||||
|
@ -20,9 +20,8 @@ export default memo(() => {
|
|||||||
|
|
||||||
const styles = createStyle({
|
const styles = createStyle({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flexShrink: 0,
|
||||||
// flexShrink: 0,
|
flexGrow: 1,
|
||||||
// flexGrow: 1,
|
|
||||||
marginLeft: marginLeftRaw,
|
marginLeft: marginLeftRaw,
|
||||||
// paddingRight: 15,
|
// paddingRight: 15,
|
||||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
|
@ -84,7 +84,8 @@ const styles = createStyle({
|
|||||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
},
|
},
|
||||||
leftContent: {
|
leftContent: {
|
||||||
flex: 0,
|
flexShrink: 1,
|
||||||
|
flexGrow: 0,
|
||||||
marginLeft: marginLeftRaw,
|
marginLeft: marginLeftRaw,
|
||||||
// flexDirection: 'row',
|
// flexDirection: 'row',
|
||||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
// backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
|
@ -6,9 +6,7 @@ import { playNext, playPrev, togglePlay } from '@/core/player/player'
|
|||||||
import { useIsPlay } from '@/store/player/hook'
|
import { useIsPlay } from '@/store/player/hook'
|
||||||
import { createStyle } from '@/utils/tools'
|
import { createStyle } from '@/utils/tools'
|
||||||
import { useLayout } from '@/utils/hooks'
|
import { useLayout } from '@/utils/hooks'
|
||||||
// import { scaleSizeW } from '@/utils/pixelRatio'
|
import { BTN_WIDTH } from './MoreBtn/Btn'
|
||||||
|
|
||||||
// const WIDTH = scaleSizeW(50)
|
|
||||||
|
|
||||||
const PrevBtn = ({ size }: { size: number }) => {
|
const PrevBtn = ({ size }: { size: number }) => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
@ -43,9 +41,11 @@ const TogglePlayBtn = ({ size }: { size: number }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MIN_SIZE = BTN_WIDTH * 1.2
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { onLayout, height, width } = useLayout()
|
const { onLayout, height, width } = useLayout()
|
||||||
const size = Math.min(height * 0.5, width * 0.4 * 0.33) * global.lx.fontSize
|
const size = Math.max(Math.min(height * 0.5, width * 0.4 * 0.33) * global.lx.fontSize, MIN_SIZE)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.conatiner} onLayout={onLayout}>
|
<View style={styles.conatiner} onLayout={onLayout}>
|
||||||
@ -62,11 +62,10 @@ const styles = createStyle({
|
|||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-evenly',
|
justifyContent: 'space-evenly',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
flex: 1,
|
flexGrow: 1,
|
||||||
paddingLeft: '4%',
|
flexShrink: 1,
|
||||||
paddingRight: '4%',
|
paddingHorizontal: '4%',
|
||||||
// paddingTop: '8.6%',
|
paddingVertical: 6,
|
||||||
// paddingBottom: '8.6%',
|
|
||||||
// backgroundColor: 'rgba(0, 0, 0, .1)',
|
// backgroundColor: 'rgba(0, 0, 0, .1)',
|
||||||
},
|
},
|
||||||
cotrolBtn: {
|
cotrolBtn: {
|
||||||
|
@ -25,7 +25,8 @@ export default memo(() => {
|
|||||||
|
|
||||||
const styles = createStyle({
|
const styles = createStyle({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flexShrink: 1,
|
||||||
|
flexGrow: 1,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
// paddingTop: progressContentPadding,
|
// paddingTop: progressContentPadding,
|
||||||
// marginTop: -progressContentPadding,
|
// marginTop: -progressContentPadding,
|
||||||
@ -38,7 +39,7 @@ const styles = createStyle({
|
|||||||
info: {
|
info: {
|
||||||
flex: 0,
|
flex: 0,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
paddingBottom: 5,
|
// paddingBottom: 5,
|
||||||
// justifyContent: 'flex-end',
|
// justifyContent: 'flex-end',
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { memo, useState, useRef, useMemo, useEffect } from 'react'
|
import { memo, useState, useRef, useMemo, useEffect } from 'react'
|
||||||
import { View, StyleSheet, AppState } from 'react-native'
|
import { View, AppState } from 'react-native'
|
||||||
|
|
||||||
import Header from './components/Header'
|
import Header from './components/Header'
|
||||||
// import Aside from './components/Aside'
|
// import Aside from './components/Aside'
|
||||||
@ -76,7 +76,7 @@ export default memo(({ componentId }: { componentId: string }) => {
|
|||||||
<PagerView
|
<PagerView
|
||||||
onPageSelected={onPageSelected}
|
onPageSelected={onPageSelected}
|
||||||
// onPageScrollStateChanged={onPageScrollStateChanged}
|
// onPageScrollStateChanged={onPageScrollStateChanged}
|
||||||
style={styles.pagerView}
|
style={{ flexGrow: 0, flexShrink: 1, height: `${64 * global.lx.fontSize}%` }}
|
||||||
>
|
>
|
||||||
<View collapsable={false}>
|
<View collapsable={false}>
|
||||||
<Pic componentId={componentId} />
|
<Pic componentId={componentId} />
|
||||||
@ -89,7 +89,7 @@ export default memo(({ componentId }: { componentId: string }) => {
|
|||||||
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 0 ? theme.secondary20 : theme.normal60 }}></View>
|
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 0 ? theme.secondary20 : theme.normal60 }}></View>
|
||||||
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 1 ? theme.secondary20 : theme.normal60 }}></View>
|
<View style={{ ...styles.pageIndicatorItem, backgroundColor: pageIndex == 1 ? theme.secondary20 : theme.normal60 }}></View>
|
||||||
</View> */}
|
</View> */}
|
||||||
<View style={{ flex: 0, height: `${36 * global.lx.fontSize}%` }} nativeID={NAV_SHEAR_NATIVE_IDS.playDetail_player}>
|
<View style={{ flexGrow: 1, flexShrink: 0 }} nativeID={NAV_SHEAR_NATIVE_IDS.playDetail_player}>
|
||||||
<Player />
|
<Player />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@ -97,32 +97,32 @@ export default memo(({ componentId }: { componentId: string }) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
// const styles = StyleSheet.create({
|
||||||
container: {
|
// // container: {
|
||||||
flexGrow: 1,
|
// // flexGrow: 1,
|
||||||
flexShrink: 1,
|
// // flexShrink: 0,
|
||||||
backgroundColor: '#fff',
|
// // backgroundColor: '#fff',
|
||||||
},
|
// // },
|
||||||
pagerView: {
|
// pagerView: {
|
||||||
flex: 1,
|
// flex: 1,
|
||||||
},
|
// },
|
||||||
pageIndicator: {
|
// pageIndicator: {
|
||||||
flex: 0,
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'center',
|
|
||||||
paddingTop: 10,
|
|
||||||
// backgroundColor: 'rgba(0,0,0,0.1)',
|
|
||||||
},
|
|
||||||
pageIndicatorItem: {
|
|
||||||
height: 3,
|
|
||||||
width: '5%',
|
|
||||||
marginLeft: 2,
|
|
||||||
marginRight: 2,
|
|
||||||
borderRadius: 2,
|
|
||||||
},
|
|
||||||
// player: {
|
|
||||||
// flex: 0,
|
// flex: 0,
|
||||||
// height: '36%',
|
// flexDirection: 'row',
|
||||||
|
// justifyContent: 'center',
|
||||||
|
// paddingTop: 10,
|
||||||
// // backgroundColor: 'rgba(0,0,0,0.1)',
|
// // backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
// },
|
// },
|
||||||
})
|
// pageIndicatorItem: {
|
||||||
|
// height: 3,
|
||||||
|
// width: '5%',
|
||||||
|
// marginLeft: 2,
|
||||||
|
// marginRight: 2,
|
||||||
|
// borderRadius: 2,
|
||||||
|
// },
|
||||||
|
// // player: {
|
||||||
|
// // flex: 0,
|
||||||
|
// // height: '36%',
|
||||||
|
// // // backgroundColor: 'rgba(0,0,0,0.1)',
|
||||||
|
// // },
|
||||||
|
// })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user