7.5 C
New York
Friday, March 21, 2025
Home Blog Page 3774

Constructing Jetcaster on all Type Components | by Chris Arriola | Android Builders


12 min learn

Jun 13, 2024

Written by: Chris Arriola, Chiara Chiappini, and Chiko Shimizu

Do you know that you could not solely construct cellular apps with Jetpack Compose but additionally TV apps, Put on apps, and in addition Widgets? We advocate that you simply use Compose to construct UI for all these type components.

On this weblog submit, we’ll go over the work that we did to replace certainly one of our samples — Jetcaster — to help further type components. We’ll focus on the strategy we took so as to add help for different type components in a means that promotes code sharing and reusability so to do the identical in your software.

Jetcaster is a pattern podcast app which lets you view podcasts, subscribe to a couple, and play an episode from a podcast. Like lots of our different Compose samples, the first objective of Jetcaster is to exhibit the capabilities of constructing UI with Compose. So, something non-UI associated, akin to taking part in audio, is solely mocked.

Jetcaster was chosen out of the ten Compose pattern apps on GitHub to increase to further type components as media apps are usually helpful not simply on telephones, however on TV and Put on, too.

You should utilize Jetpack Compose to construct apps on cellular, TV, and Put on. You may as well use Jetpack Look to construct widgets with Compose-like syntax.

When constructing for a particular type issue, it’s essential to differentiate which precise Compose dependencies are vital. Use the checklist beneath as a information to widespread dependencies you want for a given type issue:

Cellular (Telephones, Giant Screens, Foldables, and Chrome OS)

  • androidx.compose.material3:material3 — Dependency offering Materials Design 3 parts
  • androidx.navigation:navigation-compose — Dependency for dealing with navigation between screen-level composables (additionally can be utilized by TV)
  • androidx.compose.ui:ui-tooling — Dependency for Compose previews (additionally can be utilized by TV)
  • androidx.compose.material3.adaptive:adaptive — Dependency offering layouts for creating adaptive UIs

TV

  • androidx.television:tv-material — TV dependency offering Materials Design 3 parts. This ought to be used as an alternative of the cellular dependency
  • androidx.television:tv-foundation — TV dependency offering extensions to the Basis library. This ought to be used as well as to the Compose Basis library

Put on OS

  • androidx.put on.compose:compose-material — Put on OS dependency offering Materials Design 2.5 parts. This ought to be used as an alternative of the cellular dependency
  • androidx.put on.compose:compose-navigation — Put on OS dependency for navigation. This ought to be used as an alternative of the cellular Navigation Compose library
  • androidx.put on.compose:compose-foundation — Put on OS dependency offering extensions to the Basis library. This ought to be used as well as to the Compose Basis library
  • androidx.put on.compose:compose-ui-tooling — Put on OS dependency for previews

Widgets (Look)

  • androidx.look:glance-appwidget — Dependency offering core Look composables

Jetpack Compose consists of a variety of layers, offering totally different performance. For instance, UI parts tailor-made to totally different type components are offered by the Materials libraries for Cellular, TV, and Put on OS. These Materials libraries share the Compose basis layer and layers beneath. Compose basis gives the constructing blocks for setting up extra opinionated UI parts discovered within the Materials Compose libraries. However, Look relies on a decrease layer, the runtime layer, and gives a very totally different set of parts.

Compose on all Type Components libraries

Understanding how these dependencies are associated is essential for understanding the Compose code you’ll be able to share throughout totally different type components and what ought to be particular to a single type issue. Subsequent, let’s look into the challenge and module structure of Jetcaster.

Jetcaster initially had a single-module structure that solely focused cellular gadgets (a facet be aware: Jetcaster was optimized for foldables and even had customized logic for tabletop mode, however extra on that later). Step one was to interrupt this single-module structure into a number of modules to advertise code sharing (earlier than and after).

Jetcaster was modularized in order that core elements of the cellular app such because the area, knowledge, and design system layer, will be shared. Doing so avoids any duplication and in addition allows consistency throughout type components.

Finally, we determined to create 3 library modules which are shared by the applying (:cellular, :television and :put on) modules:

  • :core:knowledge — this module represents the knowledge layer containing repositories and networking and native persistence knowledge sources
  • :core:area — this module represents the area layer containing use instances and area objects
  • :core:designsystem — this module accommodates the design system together with colours, typographies, shapes, and shared composables

In addition to 2 testing-specific modules:

  • :core:data-testing— this module gives mock implementations for interfaces outlined within the knowledge layer
  • :core:domain-testing — this module gives mock knowledge for area fashions which have been useful to make use of in composable previews

The dependency graph for Jetcaster appears one thing like this:

Jetcaster dependency graph

Including new app modules

As soon as we had the library and testing modules arrange, including app modules akin to TV and Put on OS have been merely a matter of:

  1. Creating a brand new module,
  2. Including the shape factor-specific dependencies as talked about above, and
  3. Creating the mandatory screens and flows for that particular type issue.

With this construction, Jetcaster can reuse the info layer and customary design components which made it quick to help an extra type issue. You confer with the pull requests that added Put on OS help, and TV help, to dive deeper.

Type factor-specific nuances

Whereas reusing as a lot code as doable is fascinating, most composables within the UI layer weren’t shared. As a substitute, every type issue might present a form-factor particular element which was used as an alternative. Taking lazy lists for example, cellular makes use of LazyColumn/LazyRow, whereas Put on makes use of ScalingLazyColumn (no equal lazy row is offered on Put on). Equally, TV additionally gives a handful of TV-specific parts within the tv-material library.

One query you would possibly then ask is that this: why was it vital to offer a special composable as an alternative of utilizing the identical composable all all through?

The reason being as a result of every type issue has particular UX and UI nuances.

For instance, on cellular UI interactions are generally completed by faucets and gestures. However, TV interactions are generally completed with a controller (utilizing a directional pad or arrow keys). As a result of these enter variations, the scrolling conduct when navigating with gestures versus utilizing a controller can be totally different (i.e. quick scrolling vs. center-focused scrolling). To account for this, TV provides TV-specific Materials parts which are optimized for controller-driven navigation.

Equally, Put on provides ScalingLazyColumn to extend the visibility of things on spherical screens by scaling and fading as gadgets enter/exit the display. Moreover, Put on helps rotary enter which may occur from a special supply relying on the machine: a rotating facet button, a bodily bezel, or a contact bezel.

It’s for this exact motive that totally different type components might have a special composable implementation of a UI idea.

There are, nonetheless, some situations the place UI parts will be shared. For Jetcaster, the parts which are shared throughout cellular, TV and Put on need to do with loading photographs over the community and dealing with HTML formatted textual content. In these use instances, the implementation is precisely the identical for all type components and thus could possibly be shared. Moreover, the parts wanted to implement these use instances solely rely on androidx.compose.basis, and layers beneath it, which all type factor-specific Compose APIs already rely on.

Jetcaster optimizes for giant screens within the following methods:

  1. Through the use of a lazy grid as an alternative of a lazy column when displaying a listing of things, like within the house and podcast particulars display,
  2. By adopting the supporting pane canonical structure to show 2 panes (main and secondary) when operating Jetcaster in expanded layouts.

Be aware that :cellular helps massive screens.

Utilizing grids

Displaying a grid as an alternative of a column is good for expanded screens. Doing so takes benefit of the extra display actual property permitting customers to view extra info and decreasing the variety of interactions required to make use of the app.

HTML popover Attribute


HTML popover Attribute

Modals have been an vital a part of web sites for 20 years. Stacking contents and utilizing fetch to perform duties are an effective way to enhance UX on each desktop and cell. Sadly most builders do not know that the HTML and JavaScript specs have applied a local modal system through the popover attribute — let’s test it out!

The HTML

Making a native HTML modal consists of utilizing the popovertarget attribute because the set off and the popover attribute, paired with an id, to determine the content material ingredient:



That is the contents of the popover

Upon clicking the button, the popover will open. The popover, nevertheless, won’t have a conventional background layer shade so we’ll must implement that on our personal with some CSS magic.

The CSS

Styling the contents of the popover content material is fairly commonplace however we are able to use the browser stylesheet selector’s pseudo-selector to fashion the “background” of the modal:

/* contents of the popover */
[popover] {
  background: lightblue;
  padding: 20px;
}

/* the dialog's "modal" background */
[popover]:-internal-popover-in-top-layer::backdrop {
  background: rgba(0, 0, 0, .5);  
}

:-internal-popover-in-top-layer::backdrop represents the “background” of the modal. Historically that UI has been a component with opacity such to point out the stacking relationship.

  • Welcome to My New Office

    My first skilled net improvement was at a small print store the place I sat in a windowless cubical all day. I suffered that boxed in atmosphere for nearly 5 years earlier than I used to be capable of finding a distant job the place I labored from dwelling. The primary…

  • JavaScript Promise API

    Whereas synchronous code is less complicated to comply with and debug, async is usually higher for efficiency and adaptability. Why “maintain up the present” when you’ll be able to set off quite a few requests without delay after which deal with them when every is prepared?  Guarantees are turning into an enormous a part of the JavaScript world…

  • CSS pointer-events

    The obligations taken on by CSS appears to be more and more blurring with JavaScript. Take into account the -webkit-touch-callout CSS property, which prevents iOS’s hyperlink dialog menu once you faucet and maintain a clickable ingredient. The pointer-events property is much more JavaScript-like, stopping: click on actions from doing…

  • CSS Selection Styling

    The objective of CSS is to permit styling of content material and construction inside an internet web page.  Everyone knows that, proper?  As CSS revisions arrive, we’re supplied extra alternative to regulate.  One of many little recognized styling choice obtainable inside the browser is textual content choice styling.


Preventing for a future past the local weather disaster


Much less making and unmaking are additionally the answer—much less making of what we don’t want and extra unmaking of dangerous machines and concepts. The sprawling patrimony of unhealthy concepts—that Homo sapiens reigns supreme over nature and so is miraculously unbiased of it, in defiance of ecology and physics; that market capitalism is the unassailable apogee of civilization and ongoing enlargement the proper communal aim, together with infinite human procreation cheered on by neoliberal economists who complain over declining delivery charges in industrialized nations—ought to be dismantled as steadily because the harmful machines. 

Neither the US nor the world group has mechanisms in place to adequately curb doubtlessly catastrophic enterprise, both when that enterprise is demonstrably inflicting local weather chaos or when it purports to satisfy the demand for fixes. Treaties made underneath worldwide legislation have been famously toothless so far, whereas the US authorized system, which does possess sharp enamel, defers to the legislative bounds established by a Congress deeply beholden to fossil fuels and associated industries bent on sustaining the established order. And that authorized system, removed from being disposed to handle the exceptionally excessive public well being and safety dangers posed by local weather change and extinction, is clearly, by the current stacking of courts with antigovernment and antiscience jurists, within the enterprise of radically growing its deference to non-public actors because it erodes the rights of the dispossessed and the facility of federal oversight. 

If we on this nation can’t depend on the legislative or judicial branches of our central authorities to sort out the crises of their very own volition, whereas the manager department directs, at greatest, motion towards renewables with out motion away from fossils; if we will’t depend on the myopic and nihilistic firms dominating the power sector to pivot anytime quickly; then who stays to assist us? To whom can we flip, we who exist, at all times and solely, right here and nowhere else, on this walled metropolis of the Earth underneath such horrible siege? 

The reply could also be, for now, solely ourselves. These of us who’ve language and imagine within the knowledge science can supply. Who know the surpassing vulnerability of the rivers and prairies, the jungles and wetlands, the cypress swamps of South Florida, the Cape Floristic Area of South Africa, the Siberian taiga, the Tropical Andes, Madagascar, the island Caribbean. Who can gaze into the long run and, beholding the prospect of a daunting and emptier world for our descendants, really feel compelled to battle on behalf of the one we’ve got. 

Lydia Millet is the creator of greater than a dozen novels, together with A Youngsters’s Bible; her most up-to-date e-book, We Liked It All: A Reminiscence of Life, is her first work of nonfiction.

Robots-Weblog | Vention demokratisiert die industrielle Automatisierung  mithilfe von NVIDIA-KI-Technologien

0


MONTREAL/BERLIN, Juni 2024 – Vention, das Unternehmen hinter der  cloudbasierten Manufacturing Automation Platform (MAP), gibt eine Zusammenarbeit  mit NVIDIA bekannt. Das Ziel ist, kleinen und mittleren Unternehmen (KMU) industrielle Automatisierungstechnologie zugänglich zu machen. Um die Cloud Robotik voranzutreiben, sollen KI-Technologien von NVIDIA und beschleunigtes  Computing genutzt werden.  

Robots-Weblog | Vention demokratisiert die industrielle Automatisierung  mithilfe von NVIDIA-KI-Technologien

Die Ankündigung markiert ein Jahr gemeinsamer Bemühungen, künstliche Intelligenz (KI) zu  nutzen, um die Realisierung von industriellen Automatisierungs- und Robotikprojekten – vom  Design bis zum Betrieb – zu vereinfachen.  

Die Vention Plattform ist KI-fähig und basiert auf einem proprietären Datensatz mit mehreren  hunderttausend Roboterzellendesigns, die seit der Gründung des Unternehmens 2016  erstellt wurden. Vention beabsichtigt, dieses einzigartige Potenzial zu nutzen, um das  Benutzererlebnis in der Cloud und beim Edge Computing zu vereinfachen. Die  Zusammenarbeit mit NVIDIA konzentriert sich darauf, mithilfe von KI digitale Zwillinge  deutlich schneller und effizienter zu erstellen, damit Unternehmen ihre Projekte testen  können, bevor sie investieren. Zu den Entwicklungsbereichen gehören generative Designs  für Roboterzellen, Co-Pilot-Programmierung, physikbasierte Simulation und autonome  Roboter.  

In Kombination mit Ventions modularer {Hardware} und Plug-and-Play  Bewegungssteuerungstechnologie wird die Zusammenarbeit mit NVIDIA modernste KI in  den Vordergrund der Fertigung rücken und darauf abzielen, KMU den Zugang zu industrieller  Automatisierungstechnologie zu erleichtern. Vention ist bereits für seine  benutzerfreundlichen Softwareprodukte und -schnittstellen bekannt und möchte KMU auch  weiterhin Lösungen anbieten, die es ermöglichen, die Automatisierung schneller und  effizienter umzusetzen.  

Eine Reihe neuer Vention-Produkte, die aus dieser Zusammenarbeit hervorgehen, wird voraussichtlich im dritten Quartal 2024 angekündigt. 

„Das Vention Ökosystem wird zusammen mit NVIDIAs Robotertechnologie und KI-Experience  dazu beitragen, Innovationen in der Fertigungsindustrie entscheidend voranzubringen. Jetzt  können selbst die komplexesten Anwendungsfälle für kleine und mittlere Hersteller  umgesetzt werden.“ – Etienne Lacroix, Gründer und CEO von Vention.  

„Ventions cloudbasierte Roboterplattform, die von NVIDIA KI angetrieben wird, wird es  Herstellern von Industrieanlagen überall ermöglichen, Roboterzellen nahtlos zu entwerfen,  einzusetzen und zu betreiben und so die Branche voranzubringen.“ – Deepu Talla,  Vizepräsident für Robotik und Edge Computing bei NVIDIA. 



Direct remark of electron switch in solids achieved


Direct remark of electron switch in solids achieved

by Riko Seibo

Tokyo, Japan (SPX) Jun 05, 2024






Electron switch (ET) is a course of the place an electron strikes from one atom or molecule to a different, basic to electrochemical reactions with purposes throughout numerous fields. Nanoscale ET, involving electron switch within the 1-100 nanometer vary inside solids, is essential for designing multifunctional supplies however stays not absolutely understood.



Nanotubes, with distinctive cylindrical nanostructures, exhibit various ET properties by electron and gap injections, making them very best for learning nanoscale ET. Nevertheless, carbon-based nanotubes current challenges in controlling form and measurement as a consequence of excessive synthesis circumstances.



A bottom-up fabrication method for non-covalent nanotubes, generally leading to crystalline types, presents an answer. Non-covalent nanotubes, fashioned by engaging non-covalent interactions, will not be sturdy sufficient to face up to electron and gap injections, which may break their construction.



Researchers from the Division of Utilized Chemistry at Tokyo College of Science, led by Professor Junpei Yuasa and together with Dr. Daiji Ogata, Mr. Shota Koide, and Mr. Hiroyuki Kishi, have developed a novel method to straight observe solid-state ET. Prof. Yuasa acknowledged, “We have now developed crystalline nanotubes with a particular double-walled construction.



By incorporating electron donor molecules into the pores of those crystalline nanotubes by a solid-state oxidation response, we succeeded in straight observing the electron switch response within the stable utilizing X-ray crystal construction evaluation.” Their findings had been revealed within the journal Nature Communications on Might 23, 2024.



The workforce employed a novel supramolecular crystallization methodology, involving oxidation-based crystallization, to manufacture zinc-based double-walled crystalline nanotubes. This construction, with giant home windows within the nanotube partitions, is powerful and versatile sufficient to keep up its crystalline state throughout ET oxidation processes.



The nanotubes absorbed electron donor molecules, corresponding to ferrocene and tetrathiafulvalene, by these home windows, facilitating solid-state ET oxidation reactions and creating holes within the donors throughout the nanotube. The robustness of the crystals allowed direct remark of this ET oxidation course of utilizing X-ray crystal construction evaluation, revealing key insights.



This method is efficacious for straight observing ET in stable nanomaterials. Prof. Yuasa emphasised, “Understanding ET can result in the event of novel useful supplies, which in flip can result in the design of extra environment friendly semiconductors, transistors, and different digital units. Optoelectronic units, corresponding to photo voltaic cells, rely closely on ET. Therefore, direct remark of ET might help enhance these units’ efficiency. Moreover, this method can result in developments in vitality storage, nanotechnology, and supplies science analysis.”



This examine exemplifies the direct remark of solid-state ET, doubtlessly increasing to watch ET and associated phenomena in different nanomaterials.



Analysis Report:Direct remark of electron switch in solids by X-ray crystallography


Associated Hyperlinks

Tokyo College of Science

Understanding Time and Area