跳转至

需求文档

移动应用开发实验期末技术报告

选题建议

  • 在线音乐播放APP
  • 在线预告片播放APP
  • 在线天气预报APP
  • 在线新冠肺炎疫情播报APP
  • 在线电视节目预告APP
  • 在线电影播放APP
  • 在线新闻APP
  • 在线旅游路线规划APP
  • 基于互联网的联网游戏APP
  • 在线智能聊天APP

功能要求

  • 用户的登入和注册
  • 可以自定义用户信息
  • 可以修改App的主题样式
  • 能够访问网络
  • 使用数据库
  • 使用并发处理

设计思路

设计阶段

prerequest 1. finish proj for room and navigation and viewModel 2. take a look at injection and

  1. 利用Room 实现用户登入,登入界面显示偏好菜单,程序可以记录每一个用户所选择的偏好 并且能更具用户的选择调整界面
    1. 实现歌单功能

安装环境

  1. Android Studio 总是默认gradle 的位置在 C 盘下

  2. fixed by adding Environment Variable GRADLE_USER_HOME in windows user path

  3. 下载包的速度很慢

  4. fixed by add proxy configration in ${GRADLE_USER_HOME}/gradle.properties (没有就 自己创建一个)

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=7890
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7890
  • 也可以切换镜像

  • setup for firebase

we should only add buildscript in the top of buidl.gradle for project

// added  只需要加这么多就够了
buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.3.14'
    }
}
// added

plugins {
    id 'com.android.application' version '7.3.0' apply false
    id 'com.android.library' version '7.3.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}

```xml
// Retrofit 
implementation "com.squareup.retrofit2:retrofit:2.9.0"
// Retrofit with Scalar Converter
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
// Kotlin serialization 
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0"
// Retrofit with Kotlin serialization Converter
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
 // Room
add room_ver
implementation "androidx.room:room-runtime:$room_version"
ksp "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"

preference
implementation "androidx.datastore:datastore-preferences:1.0.0"

notes

random

  1. mutableListOf is a function, it returns MutableList. do not mixed method and type
  2. inline function reduce the overhead for creating object for every time lambda is called
  3. about lambda functions. The type of lambda function is something like (Int) -> Unit and if you want to write a lambda fucntion, it is {(a:Int, b:Int -> {})}

val demo1 = {a:Int, b:Int -> {var c = a + b; println(c) }}
val north = {game: Game -> game.path.add(Directions.NORTH)}
val south = {game: Game -> game.path.add(Directions.SOUTH)}
val west = {game: Game -> game.path.add(Directions.WEST)}
val east = {game: Game -> game.path.add(Directions.EAST)}

val end = {
    game:Game -> game.apply {
        path.add(Directions.END)
        println(path.joinToString { it.name + " " })
        println("Game Over")
}
}
EditorChooseLookupItemReplace

  • import android.compose.runtime.* if mutableState function have some problem.

  • why this is work

     gameViewModel: GameViewModel = viewModel()) { // gameViewModel extends viewModel, how can we assign to it
    

  • put attribute initilization before init function you can review that by watching viedo afterwards

be calm , you can never achieve if you stop meaningless comparsion

JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

when you retrieve item from flow type - lifecycle events changes like rotatation or quitting from the app

  • cached data
  • properly canceled flows

In this step, you'll retrieve all items in the Room database as a StateFlow observable API for UI state. When the Room Inventory data changes, the UI updates automatically.

  • aspectRatio 是长宽比, \(\frac{length}{width}\) = aspectRatio

  • preference for simple, proto for user-defined

\[ \begin{align*} 1 + 2 = 3 \end{align*} \]

<++>

import math

print("World")

<++>

dependencies and usage

颜色主题调整

评论区~