王士厅

多图(图集)详情页评论、点赞增加角标,返回上一页,输入法开发部分

... ... @@ -23,7 +23,7 @@ export { Pic } from './src/main/ets/bean/content/Pic'
export { InteractDataDTO } from './src/main/ets/bean/content/InteractDataDTO';
export { InteractDataStatusBean, PhotoListBean } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
export { InteractDataStatusBean, PhotoListBean, InputMethodProperty } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
... ...
... ... @@ -17,4 +17,84 @@ export interface PhotoListBean {
width: number;
picPath: string;
picDesc: string;
}
export interface InputMethodProperty {
/**
* The name of input method
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodProperty#name
*/
readonly packageName: string;
/**
* The id of input method
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodProperty#id
*/
readonly methodId: string;
/**
* The name of input method
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly name: string;
/**
* The id of input method
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly id: string;
/**
* The label of input method
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly label?: string;
/**
* The label id of input method
*
* @type { ?number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
readonly labelId?: number;
/**
* The icon of input method
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly icon?: string;
/**
* The icon id of input method
*
* @type { ?number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly iconId?: number;
/**
* The extra info of input method
*
* @type { object }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* The extra info of input method
*
* @type { ?object }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
extra?: object;
}
\ No newline at end of file
... ...
import { ToastUtils, Logger } from 'wdKit';
import { InputMethodProperty } from 'wdBean';
import router from '@ohos.router';
import inputMethod from '@ohos.inputMethod';
export interface OperationItem {
icon: Resource;
... ... @@ -25,7 +28,6 @@ export struct OperRowListView {
{
icon: $r('app.media.ic_collect_uncheck'),
text: "收藏",
num: 662,
},
{
icon: $r('app.media.ic_share'),
... ... @@ -54,8 +56,8 @@ export struct OperRowListView {
})
.alignItems(HorizontalAlign.Center)
.hoverEffect(HoverEffect.Scale)
.onClick((event: ClickEvent) => {
ToastUtils.showToast('体验版,本功能暂未开发', 1000);
.onClick(() => {
router.back();
})
TextInput({placeholder:'说两句...'})
.placeholderColor('#999999')
... ... @@ -71,6 +73,9 @@ export struct OperRowListView {
.width('61.5%')
.height(30)
.borderRadius(0)
.onClick(() => {
this.buildInputMethod()
})
}
.width('45.5%')
.alignItems(VerticalAlign.Center)
... ... @@ -78,7 +83,7 @@ export struct OperRowListView {
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems:ItemAlign.Center }) {
ForEach(this.operationList, (item: OperationItem, index: number) => {
this.buildOperationItem(item, index)
}, (item: OperationItem, index: number) => JSON.stringify(item))
}, (item: OperationItem) => JSON.stringify(item))
}
.width('54.5%')
}
... ... @@ -95,18 +100,84 @@ export struct OperRowListView {
@Builder
buildOperationItem(item: OperationItem, index: number) {
Column() {
Image(item.icon)
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
RelativeContainer() {
Row() {
Image(item.icon)
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
}
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id(`e_row1_${index}`)
if(item.num) {
Row() {
Image($r('app.media.corner_mark'))
.width(25)
.height(12)
.interpolation(ImageInterpolation.High)
}
.alignRules({
top: { anchor: `e_row1_${index}`, align: VerticalAlign.Top },
left: { anchor: `e_row1_${index}`, align: HorizontalAlign.Center }
})
.id(`e_row2_${index}`)
Row() {
Text('99+')
.fontSize(8)
.textAlign(TextAlign.Center)
.fontColor(Color.White)
.lineHeight(12)
}
.alignRules({
top: { anchor: `e_row2_${index}`, align: VerticalAlign.Top },
middle: { anchor: `e_row2_${index}`, align: HorizontalAlign.Center }
})
.id(`e_row3_${index}`)
}
}
.id(`e_icon_${index}`)
}
.margin(5)
.alignItems(HorizontalAlign.Center)
.hoverEffect(HoverEffect.Scale)
.onClick((event: ClickEvent) => {
.onClick(() => {
Logger.info(TAG, `buildOperationItem onClick event index: ${index}`);
ToastUtils.showToast('体验版,本功能暂未开发', 1000);
})
}
/**
* 输入法
*/
private buildInputMethod() {
let im = inputMethod.getCurrentInputMethod();
let prop: InputMethodProperty = {
packageName: im.packageName,
methodId: im.methodId,
name: im.name,
id: im.id,
extra: {}
}
try{
inputMethod.switchInputMethod(prop, (err, result) => {
if (err !== undefined) {
console.error('Failed to switchInputMethod: ' + JSON.stringify(err));
return;
}
if (result) {
console.info('Succeeded in switching inputmethod.');
} else {
console.error('Failed to switchInputMethod.');
}
});
} catch(err) {
console.error('Failed to switchInputMethod: ' + JSON.stringify(err));
}
}
}
\ No newline at end of file
... ...