当前位置: 首页 > news >正文

一个网站域名ip丰台区网站建设

一个网站域名ip,丰台区网站建设,培训推广 seo,杭州平面设计公司排行文章目录 一、前言二、相关依赖二、具体代码三、参考链接 一、前言 本文简要记录下流程#xff0c;代码需要修改后才可以运行 二、相关依赖 project/build.gradle buildscript {ext {compose_version 1.5.4} }// Top-level build file where you can add configu… 文章目录 一、前言二、相关依赖二、具体代码三、参考链接 一、前言 本文简要记录下流程代码需要修改后才可以运行 二、相关依赖 project/build.gradle buildscript {ext {compose_version 1.5.4} }// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins {id com.android.application version 8.2.1 apply falseid com.android.library version 8.2.1 apply falseid org.jetbrains.kotlin.android version 1.9.22 apply false }app/build.gradle plugins {id com.android.applicationid org.jetbrains.kotlin.android }android {compileSdk 34defaultConfig {applicationId com.design.composeminSdk 21targetSdk 34versionCode 1versionName 1.0testInstrumentationRunner androidx.test.runner.AndroidJUnitRunnervectorDrawables {useSupportLibrary true}}buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile(proguard-android-optimize.txt), proguard-rules.pro}}compileOptions {sourceCompatibility JavaVersion.VERSION_18targetCompatibility JavaVersion.VERSION_18}kotlinOptions {jvmTarget JavaVersion.VERSION_18}buildFeatures {compose true}composeOptions {kotlinCompilerExtensionVersion 1.5.8kotlinCompilerVersion 1.9.22}packagingOptions {resources {excludes /META-INF/{AL2.0,LGPL2.1}}}namespace com.design.compose }dependencies {implementation androidx.core:core-ktx:1.12.0implementation androidx.compose.ui:ui:$compose_versionimplementation androidx.compose.material:material:$compose_versionimplementation androidx.compose.material3:material3implementation androidx.compose.ui:ui-tooling-preview:$compose_versionimplementation(androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2)implementation(androidx.activity:activity-compose:1.8.1)implementation(platform(androidx.compose:compose-bom:2023.03.00))implementation(androidx.compose.ui:ui)implementation(androidx.compose.ui:ui-graphics)implementation(androidx.compose.ui:ui-tooling-preview)implementation androidx.paging:paging-compose:3.2.1 // 该依赖需要target为34可以使用androidx.paging:paging-compose进行替代 // implementation androidx.paging:paging-compose-android:3.3.0-alpha02implementation androidx.paging:paging-runtime-ktx:3.2.1implementation androidx.paging:paging-common-ktx:3.2.1implementation androidx.room:room-paging:2.6.1implementation androidx.lifecycle:lifecycle-runtime-ktx:2.6.2implementation androidx.activity:activity-compose:1.8.1kapt(androidx.room:room-compiler:2.6.1)implementation(androidx.room:room-runtime:2.6.1)implementation(androidx.room:room-ktx:2.6.1)implementation(androidx.room:room-paging:2.4.2)testImplementation junit:junit:4.13.2androidTestImplementation androidx.test.ext:junit:1.1.5androidTestImplementation androidx.test.espresso:espresso-core:3.5.1androidTestImplementation androidx.compose.ui:ui-test-junit4:$compose_versiondebugImplementation androidx.compose.ui:ui-tooling:$compose_versiondebugImplementation androidx.compose.ui:ui-test-manifest:$compose_version }二、具体代码 Parcelize Entity(tableName user_table) data class UserInfo(PrimaryKey(autoGenerate true)ColumnInfo(name id)var id: Long 0L,ColumnInfo(name name)var name: String , ): ParcelableDao interface UserDao {Query(SELECT * FROM user_table)fun getAllPagingSource(): PagingSourceInt, UserInfoInsert(onConflict OnConflictStrategy.REPLACE)fun insertAll(list: ListUserInfo)Deletefun deleteAll(list: ListUserInfo) } Database(entities [UserInfo::class,], version 1, exportSchema true) abstract class DatabaseManager : RoomDatabase() {abstract fun getUserDao(): Usercompanion object {private const val DATABASE_NAME user.dbprivate val instance by lazy {Room.databaseBuilder(App.getInstance(), DatabaseManager::class.java, DATABASE_NAME).build()}private fun getUserDao(): AlertDao {return instance.getUserDao()}fun getUserAllPagingSource(): PagingSourceInt,UserInfo{return getAlertAreaDao().getAllPagingSource()}} }ViewModel class UserModel : ViewModel(){val action MutableLiveDataAction()val singlePageSize 10 //每页显示为10条fun loadRoomData(): PagingSourceInt, UserInfo {return DatabaseManager.getUserAllPagingSource()}fun sendAction(action: Action) {this.action.value action}sealed class Action {object BACK : Action()object ADD : Action()data class DETAILS(val info: UserInfo) : Action()} }UI ... Composablefun Center(modifier: Modifier Modifier, viewModel: UserModel viewModel()) {val pager remember {Pager(PagingConfig(pageSize viewModel.singlePageSize,enablePlaceholders true, // maxSize 200)) { viewModel.loadRoomData() }}val lazyPagingItems pager.flow.map {it.map { info -info.name ${info.name}--后缀 // Log.e(YM---, ---区域时间:${info.areaCreateTime})}it}.collectAsLazyPagingItems()LazyColumn(modifier modifier) {if (lazyPagingItems.itemCount 0) {item(key defaultItem, contentType defaultItem) {DefaultUserItem()}}items(count lazyPagingItems.itemCount) { index -val item lazyPagingItems[index]if (item ! null) {UserItem(modifier Modifier.clickable(// 去除点击效果indication null,interactionSource remember {MutableInteractionSource()}) {viewModel.sendAction(UserModel.Action.DETAILS(item))},info item)}}if (lazyPagingItems.loadState.append LoadState.Loading) {item(key loadItem, contentType loadItem) {CircularProgressIndicator(modifier Modifier.fillMaxWidth().wrapContentWidth(Alignment.CenterHorizontally))}}}}...三、参考链接 androidx.paging.composePaging 库概览
http://www.zqtcl.cn/news/149366/

相关文章:

  • 开设购物网站的方案网站免费seo
  • 免费手机h5模板网站模板下载wordpress所有插件
  • 北京做网站开发公司wordpress主题创建后门
  • 企业门户网站建设内容企业建设网站的功能是什么意思
  • 做a的网站有哪些在国外做网站推广
  • 做外贸网站设计上需要注意什么python做音乐网站
  • 英语门户网站织梦源码wordpress 推荐插件
  • 学做衣服网站有哪些网站建设算入会计分录
  • 京东网站开发技术织梦网站如何做404
  • 论坛类网站开发屏蔽wordpress缩略图
  • 南宁市两学一做网站logo设计网站官网
  • 中国建设工程造价管理协会网站查询网站开发者的设计构想
  • 华强北网站建设设计素材网站p开头的
  • 怎样让网站快速收录利用数据库修改wordpress密码
  • 网站建设群发广告词做网站首页多少钱
  • 黑彩网站建设中企动力 网站价格
  • 上海营销型网站报价深圳企业网站制作设计
  • 网站清理通知北京电商购物网站
  • 新开传奇网站180合击创建一个个人网站需要多少钱
  • 郑州建网站哪家好深圳企业网站制作公司介绍
  • 企业网站百度收录桂林网站建设价格
  • 砀山做网站的公司wordpress微视频主题
  • 免费的企业网站cms注册网站后邮箱收到邮件
  • 网站推广排名教程怀化职院网站
  • 房产门户网站模板新手做电商怎么起步
  • 成都网站建设科技公沈阳网站建设技术公司排名
  • 自建商城网站上海有哪些网络公司
  • 朋友 合同 网站制作手机网站建设服务商
  • 链接分析属于网站开发棋牌软件开发定制
  • top域名的网站搭建网站步骤