frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

HarmonyOS5-NewsAPP-NewsDetailPage

3•zhousg•4h ago
HarmonyOS 5 News Application - News Detail Page Implementation Case Summary This article details the implementation of the news detail page in a HarmonyOS 5.0 news application using the ArkTS language. By defining the BarButton and NewDetailPage components, it implements the interface layout, status bar color setting, and page navigation of the news detail page.

@Component struct BarButton { icon: ResourceStr = ''

  build() { 
    Row() { 
      Image(this.icon) 
        .width(24) 
        .height(24) 
        .fillColor(Color.White) 
    } 
    .justifyContent(FlexAlign.Center) 
    .width(40) 
    .aspectRatio(1) 
    .borderRadius(22) 
    .backgroundColor('#45FFFFFF') 
  } 
}

@Component struct NewDetailPage { news: NewsModel = {} as NewsModel

  async setStatusBarContentColor(color: string) { 
    const ctx = this.getUIContext() 
      .getHostContext()! 
    const win = await window.getLastWindow(ctx) 
    win.setWindowSystemBarProperties({ 
      statusBarContentColor: color 
    }) 
  } 

  @Builder 
  CustomBarBuilder() { 
    Row({ space: 10 }) { 
      BarButton({ icon: $r('sys.media.ohos_ic_public_arrow_left') }) 
        .onClick(() => pathStack.pop()) 
      Blank() 
      BarButton({ icon: $r('sys.media.ohos_ic_public_share') }) 
      BarButton({ icon: $r('sys.media.ohos_ic_public_more') }) 
    } 
    .padding(15) 
    .width('100%') 
  } 

  @Builder 
  TitleBuilder () { 
    Column({ space: 12 }){ 
      Button(this.news.category) 
        .size({ height: 36 }) 
      Text(this.news.title) 
        .fontSize(24) 
        .fontWeight(FontWeight.Medium) 
        .fontColor(Color.White) 
      Text() { 
        Span(this.news.author) 
        Span('·') 
        Span(this.news.time) 
      } 
      .fontSize(14) 
      .fontColor(Color.White) 
    } 
    .padding(15) 
    .height(300) 
    .width('100%') 
    .justifyContent(FlexAlign.End) 
    .alignItems(HorizontalAlign.Start) 
  } 

  @Builder 
  ContentBuilder () { 
    Column(){ 
      Row({ space: 10 }){ 
        Image(this.news.companyLogo) 
          .width(40) 
          .aspectRatio(1) 
          .borderRadius(20) 
        Text(this.news.company) 
          .fontSize(18) 
          .fontWeight(FontWeight.Bold) 
      } 
      .width('100%') 
      .height(60) 
      Text(` 
      At the newly expanded FIFA Club World Cup on 
      `) 
        .fontSize(16) 
        .lineHeight(24) 

    } 
    .borderRadius({ topLeft: 30, topRight: 30 }) 
    .backgroundColor(Color.White) 
    .padding(15) 
  } 

  build() { 
    NavDestination() { 
      List(){ 
        ListItem(){ 
          this.CustomBarBuilder() 
        } 
        ListItem(){ 
          this.TitleBuilder() 
        } 
        ListItem(){ 
          this.ContentBuilder() 
        } 
      } 
      .width('100%') 
      .height('100%') 
      .layoutWeight(1) 
    } 
    .hideTitleBar(true) 
    .backgroundImage($r('app.media.news01')) 
    .backgroundImageSize({ height: '60%', width: 'auto' }) 
    .backgroundImagePosition(Alignment.Top) 
    .onShown(() => this.setStatusBarContentColor('#FFFFFF')) 
    .onHidden(() => this.setStatusBarContentColor('#000000')) 
    .onReady((ctx) => { 
      this.news = ctx.pathInfo.param as NewsModel 
    }) 
  } 
}

New Tires Could End Up Ten Times Tougher with Harvard's Crack-Resistant Rubber

https://www.jalopnik.com/1896687/new-tires-ten-times-tougher-harvard-rubber/
1•greesil•38s ago•0 comments

Restoring a ZX Spectrum+ Toastrack

https://celso.io/posts/2025/06/28/toastrack/
1•rcarmo•1m ago•0 comments

Why Tech Billionaires Want Bots to Be Your BFF

https://www.wsj.com/tech/ai/why-tech-billionaires-want-bots-to-be-your-bff-0c0e531b
1•sandwichsphinx•2m ago•0 comments

Security Advisory: Anthropic's Slack MCP Server Vulnerable to Data Exfiltration

https://embracethered.com/blog/posts/2025/security-advisory-anthropic-slack-mcp-server-data-leakage/
1•wendythehacker•4m ago•0 comments

Show HN: Natrul AI – An API for autocomplete, search, and content enhancement

https://www.natrul.ai:443/
1•jroseborough•6m ago•0 comments

How Muppets break free from their Puppeteers [video]

https://www.youtube.com/watch?v=t86ZjhGxwAY
1•jenoer•6m ago•0 comments

Electron Speech-to-Speech App for Voice Chats

1•Kutalia•10m ago•0 comments

Are LLM AIs making people dumber?

https://skeptics.stackexchange.com/q/58996/69248
1•lr0•11m ago•0 comments

Parsing JSON in Forty Lines of Awk

https://akr.am/blog/posts/parsing-json-in-forty-lines-of-awk
2•thefilmore•11m ago•0 comments

Senate Republicans make steep cuts to wind and solar in updated megabill text

https://www.politico.com/live-updates/2025/06/28/congress/senate-republicans-make-steep-cuts-to-wind-and-solar-in-updated-megabill-text-00430686
2•MilnerRoute•11m ago•0 comments

Linus Tech Tips: Companies Are Suing Honest Reviewers [video]

https://www.youtube.com/watch?v=RNonfByE9xc
1•bundie•11m ago•0 comments

QCReport – Predict the quality of every image in any dataset, automatically

https://qcreportai.netlify.app
1•ViktorOsadsky•13m ago•0 comments

A TypeScript Implementation of Rust's Option and Result Types

https://github.com/hnatiukr/unwrap-or
1•hnatiukr•15m ago•1 comments

The New Yorker Cartoon Bank

https://cartoonbank.com
2•LouisLazaris•19m ago•0 comments

Potentially habitable worlds may be especially common around low-mass stars

https://phys.org/news/2025-06-tiny-stars-earths-potentially-habitable.html
1•Brajeshwar•19m ago•0 comments

Can AI build a virtual cell? Scientists race to model life's smallest unit

https://www.nature.com/articles/d41586-025-02011-0
1•Brajeshwar•20m ago•0 comments

Skype Is Gone: The FOSS Alternative

https://boilingsteam.com/skype-shuts-down-some-good-foss-alternatives/
3•ekianjo•24m ago•0 comments

Devin-like startup for replacing managers

https://aimanagers.app/
3•pacificat0r•24m ago•1 comments

Ask HN: Would interactive TV commercials be acceptable with privacy safeguards?

1•amichail•26m ago•1 comments

We Found a Heap Overflow in Llama.cpp's Tokenizer

https://pwno.io/blog/prompt-to-heap-overflow
3•retr0reg•27m ago•0 comments

ICE arrested a 6-year-old boy with leukemia at immigration court

https://www.tpr.org/border-immigration/2025-06-25/ice-arrested-a-6-year-old-boy-with-leukemia-at-immigration-court-his-family-is-suing
7•cempaka•27m ago•3 comments

Wrote a Playbook for College

https://vardhanmahajan.gumroad.com/l/the-unofficial-college-playbook
1•MahajanVardhan•27m ago•0 comments

The 50 Best Airports in America, Ranked

https://www.washingtonpost.com/travel/interactive/2025/best-airports-us-ranking/
1•bookofjoe•29m ago•1 comments

AMD Keeps Building Momentum in AI, with Plenty of Work Still to Do

https://www.forbes.com/sites/patrickmoorhead/2025/06/27/amd-keeps-building-momentum-in-ai-with-plenty-of-work-still-to-do/
1•radialstub•30m ago•0 comments

Ex-NATO hacker: 'In the cyber world, there's no such thing as a ceasefire'

https://www.theregister.com/2025/06/28/exnato_hacker_ceasefire_iran/
1•rntn•33m ago•0 comments

ResupplyFi old-school ERC4626 donation attack

https://rekt.news/resupplyfi-rekt
1•aberoham•38m ago•0 comments

Sean Parker: Facebook was designed to exploit human "vulnerability" (2017)

https://www.axios.com/2017/12/15/sean-parker-facebook-was-designed-to-exploit-human-vulnerability-1513306782
2•andrewstetsenko•39m ago•0 comments

Data centers could bring alternative battery types into the mainstream

https://www.utilitydive.com/news/data-center-flow-zinc-battery-xl-eos-prometheus/751144/
1•jorgen123•40m ago•0 comments

Iapetus – A fast, pluggable open-source workflow engine for CI/CD and DevOps

https://github.com/yindia/iapetus
2•evalsocket•45m ago•0 comments

Show HN: I use OpenAIs structured outputs to generate bike workouts

https://planned-workouts.com/
1•potofski•46m ago•0 comments