Compare commits
No commits in common. "c680b15eeb83d1454e7ae483ff0ba5e96c0f05b2" and "406685b399096590574a1645b7b859cada1c435a" have entirely different histories.
c680b15eeb
...
406685b399
|
@ -1,20 +1,6 @@
|
||||||
{
|
{
|
||||||
"app": {
|
"app": {
|
||||||
"signingConfigs": [
|
"signingConfigs": [],
|
||||||
{
|
|
||||||
"name": "default",
|
|
||||||
"type": "HarmonyOS",
|
|
||||||
"material": {
|
|
||||||
"certpath": "C:\\Users\\wps\\.ohos\\config\\default_himi_ZikZBgBxljB_K_Bxk-D2cAAnn7PtvbqmLsGmCt8Tywc=.cer",
|
|
||||||
"storePassword": "0000001A324907DCD55F55682629687D2AECF782CD5EE7AFB5FD4E1CE3F410EBB601D67AC641B4072B46",
|
|
||||||
"keyAlias": "debugKey",
|
|
||||||
"keyPassword": "0000001A8EDEBEC4585D89D8F1A91107E51ECAE951E2849CB803CBA06C9E49A8A59CCB6CECAF7EA5DADA",
|
|
||||||
"profile": "C:\\Users\\wps\\.ohos\\config\\default_himi_ZikZBgBxljB_K_Bxk-D2cAAnn7PtvbqmLsGmCt8Tywc=.p7b",
|
|
||||||
"signAlg": "SHA256withECDSA",
|
|
||||||
"storeFile": "C:\\Users\\wps\\.ohos\\config\\default_himi_ZikZBgBxljB_K_Bxk-D2cAAnn7PtvbqmLsGmCt8Tywc=.p12"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"products": [
|
"products": [
|
||||||
{
|
{
|
||||||
"name": "default",
|
"name": "default",
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
/**
|
|
||||||
* Created on 2024/9/10
|
|
||||||
*/
|
|
||||||
package ohos_app_cangjie_entry.components.chat
|
|
||||||
|
|
||||||
internal import ohos.component.*
|
|
||||||
internal import ohos.state_manage.*
|
|
||||||
internal import ohos.base.*
|
|
||||||
import ohos.state_macro_manage.*
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class ChatList {
|
|
||||||
let array: Array<String> = Array<String>(20, item: "teststesstasdasdasdadasdasdsaesrfsfdfsfdsf")
|
|
||||||
func build() {
|
|
||||||
Column {
|
|
||||||
List(space: 20, initialIndex: 0) {
|
|
||||||
ForEach(
|
|
||||||
this.array,
|
|
||||||
itemGeneratorFunc: {
|
|
||||||
item: String, index: Int64 => ListItem {
|
|
||||||
ChatMessage(
|
|
||||||
message: item,
|
|
||||||
source: if (index % 2 == 0) {
|
|
||||||
EChatSource.ME
|
|
||||||
} else {
|
|
||||||
EChatSource.YOU
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}.height(100.percent).width(100.percent).padding(top: 5.vp)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
/**
|
|
||||||
* Created on 2024/9/10
|
|
||||||
*/
|
|
||||||
package ohos_app_cangjie_entry.components.chat
|
|
||||||
|
|
||||||
import std.collection.*
|
|
||||||
import ohos.component.*
|
|
||||||
import ohos.state_macro_manage.*
|
|
||||||
import ohos.state_manage.*
|
|
||||||
import ohos.base.*
|
|
||||||
|
|
||||||
public enum EChatSource {
|
|
||||||
| ME
|
|
||||||
| YOU
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class ChatMessage {
|
|
||||||
@Prop
|
|
||||||
var message: String
|
|
||||||
@Prop
|
|
||||||
var source: EChatSource
|
|
||||||
|
|
||||||
@State
|
|
||||||
var radiusMap: HashMap<String, Length> = HashMap<String, Length>()
|
|
||||||
|
|
||||||
protected func aboutToAppear() {
|
|
||||||
this.radiusMap = this.messageRadius()
|
|
||||||
}
|
|
||||||
|
|
||||||
func fontColor() {
|
|
||||||
match (this.source) {
|
|
||||||
case EChatSource.ME => Color.WHITE
|
|
||||||
case EChatSource.YOU => Color.BLACK
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func bgColor() {
|
|
||||||
match (this.source) {
|
|
||||||
case EChatSource.YOU => Color.WHITE
|
|
||||||
case EChatSource.ME => Color.BLUE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func orient() {
|
|
||||||
match (this.source) {
|
|
||||||
case EChatSource.YOU => FlexAlign.Start
|
|
||||||
case EChatSource.ME => FlexAlign.End
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func messageRadius(): HashMap<String, Length> {
|
|
||||||
match (this.source) {
|
|
||||||
case EChatSource.YOU => HashMap<String, Length>(
|
|
||||||
[
|
|
||||||
("topLeft", 12.vp),
|
|
||||||
("topRight", 12.vp),
|
|
||||||
("bottomLeft", 0.vp),
|
|
||||||
("bottomRight", 12.vp)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
case EChatSource.ME => HashMap<String, Length>(
|
|
||||||
[
|
|
||||||
("topLeft", 12.vp),
|
|
||||||
("topRight", 12.vp),
|
|
||||||
("bottomLeft", 12.vp),
|
|
||||||
("bottomRight", 0.vp)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func build() {
|
|
||||||
Row() {
|
|
||||||
Row() {
|
|
||||||
Text(message)
|
|
||||||
.fontColor(this.fontColor())
|
|
||||||
.backgroundColor(this.bgColor())
|
|
||||||
.padding(top: 8, right: 16,bottom: 8, left: 16)
|
|
||||||
.borderRadius(
|
|
||||||
topLeft: this.radiusMap['topLeft'],
|
|
||||||
topRight: this.radiusMap['topRight'],
|
|
||||||
bottomLeft: this.radiusMap['bottomLeft'],
|
|
||||||
bottomRight: this.radiusMap['bottomRight'],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.width(60.percent)
|
|
||||||
.justifyContent(this.orient())
|
|
||||||
}
|
|
||||||
.width(100.percent)
|
|
||||||
.justifyContent(this.orient())
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,13 +9,9 @@ import ohos_app_cangjie_entry.pages.*
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
class MyView {
|
class MyView {
|
||||||
let TAG = "MyView"
|
|
||||||
@State
|
@State
|
||||||
var message: String = "Hello Cangjie"
|
var message: String = "Hello Cangjie"
|
||||||
|
|
||||||
protected func aboutToAppear() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func build() {
|
func build() {
|
||||||
Row {
|
Row {
|
||||||
HomePage()
|
HomePage()
|
||||||
|
|
|
@ -7,11 +7,13 @@ internal import ohos.base.*
|
||||||
internal import ohos.component.*
|
internal import ohos.component.*
|
||||||
internal import ohos.state_manage.*
|
internal import ohos.state_manage.*
|
||||||
import ohos.state_macro_manage.*
|
import ohos.state_macro_manage.*
|
||||||
|
import ohos_app_cangjie_entry.utils.Logger
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class HomePage {
|
public class HomePage {
|
||||||
private let TAG = "HomePage"
|
private let TAG = "HomePage"
|
||||||
protected func aboutToAppear() {
|
protected func aboutToAppear() {
|
||||||
|
Logger(TAG).info("aboutToAppear")
|
||||||
}
|
}
|
||||||
func build() {
|
func build() {
|
||||||
Row()
|
Row()
|
||||||
|
|
|
@ -7,11 +7,13 @@ internal import ohos.base.*
|
||||||
internal import ohos.component.*
|
internal import ohos.component.*
|
||||||
internal import ohos.state_manage.*
|
internal import ohos.state_manage.*
|
||||||
import ohos.state_macro_manage.*
|
import ohos.state_macro_manage.*
|
||||||
|
import ohos_app_cangjie_entry.utils.Logger
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class SidePage {
|
public class SidePage {
|
||||||
private let TAG: String = "SidePage"
|
private let TAG: String = "SidePage"
|
||||||
protected func aboutToAppear() {
|
protected func aboutToAppear() {
|
||||||
|
Logger(this.TAG).info("aboutToAppear")
|
||||||
}
|
}
|
||||||
func build() {
|
func build() {
|
||||||
Row()
|
Row()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user