Skip to content

Commit 51aef17

Browse files
committed
Updata new some content
1 parent 59b45f2 commit 51aef17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1277
-24
lines changed

.gitignore

+15-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
# Compiled class file
2-
*.class
3-
4-
# Log file
5-
*.log
6-
7-
# BlueJ files
8-
*.ctxt
9-
10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
12-
13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
21-
22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
24-
replay_pid*
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/appInsightsSettings.xml

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/deploymentTargetDropDown.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/migrations.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
11
# AndroidProject-finalSchoolHomework
22
Android项目:主要是完成学校期末大作业需要,符合学校的要求,但是不符合商业要求,可以弃用
3+
4+
5+
6+
> 项目使用的IDE:Android studio最新版本,Gradle也是最新版本
7+
8+
学校期末大作业的要求是,实现对主布局页面如图片类似效果的,该部分源码在`activity_main.xml`里,主要是用上相对布局的方式,基本可用可看.然后在Java文件夹里,`MainActivity.java`主要放实现**Android SQLLite**的源码.
9+
10+
其余是用来连接等外部类,具体请自己分析
11+
12+
## 项目结构
13+
14+
```text
15+
/docs
16+
├── README.md # 主页及项目介绍
17+
├───android
18+
│ ├───app
19+
│ └───src
20+
└───gradle
21+
22+
```
23+
24+
## 项目展示
25+
26+
![](./active.png)
27+
28+
## 编译
29+
30+
本项目 Android 工程部分已编译为 apk 安装包,可直接在项目[发布页面](https://github.com/linyiLYi/pose-monitor/releases/tag/release)下载安装进行测试。如需进一步开发测试,可以在 Android Studio 中对安卓工程文件进行编译。
31+
32+
### 准备工作
33+
34+
- 安卓项目的编译需要 Android Studio,可以进入[官方网站](https://developer.android.com/studio/install?hl=zh-cn)按照说明进行下载安装。
35+
- 需要准备一部安卓手机。
36+
37+
### 编译程序
38+
39+
- 通过 `git clone` 克隆本项目,或者以压缩包形式下载项目文件并解压。
40+
- 打开 Android Studio,在初始的 `Welcome` 界面选择 `Open an existing Android Studio project`,打开项目中的安卓工程文件夹。
41+
- 安卓工程文件位于本项目的 `android/` 文件夹下。在 Android Studio 的提示窗口中选择该文件夹。项目打开后软件可能会提示需要进行 Gradle 同步,同意并等待同步完成即可。
42+
- 将处于开发者模式的手机通过 USB 线连接到电脑,具体连接方法可以参考[官方教程](https://developer.android.com/studio/run/device?hl=zh-cn)。如果程序顶部工具栏右侧正确显示了你的手机型号,说明设备连接成功。
43+
- 如果是首次安装 Android Studio,可能还需要安装一系列开发工具。点击软件界面右上角的绿色三角按钮`Run 'app'`直接运行程序。如果有需要安装的工具,系统会进行提示,按照提示依次安装即可。

active.png

119 KB
Loading

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle.kts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
plugins {
2+
alias(libs.plugins.androidApplication)
3+
}
4+
5+
android {
6+
namespace = "com.example.myapplication"
7+
compileSdk = 34
8+
9+
defaultConfig {
10+
applicationId = "com.example.myapplication"
11+
minSdk = 24
12+
targetSdk = 34
13+
versionCode = 1
14+
versionName = "1.0"
15+
16+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
isMinifyEnabled = false
22+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility = JavaVersion.VERSION_1_8
27+
targetCompatibility = JavaVersion.VERSION_1_8
28+
}
29+
}
30+
31+
dependencies {
32+
33+
implementation(libs.appcompat)
34+
implementation(libs.material)
35+
implementation(libs.activity)
36+
implementation(libs.constraintlayout)
37+
testImplementation(libs.junit)
38+
androidTestImplementation(libs.ext.junit)
39+
androidTestImplementation(libs.espresso.core)
40+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.myapplication;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("com.example.myapplication", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:dataExtractionRules="@xml/data_extraction_rules"
8+
android:fullBackupContent="@xml/backup_rules"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.MyApplication"
14+
tools:targetApi="31">
15+
<activity
16+
android:name=".MainActivity"
17+
android:exported="true">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
</application>
25+
26+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.example.myapplication;
2+
3+
import android.content.Context;
4+
import android.database.sqlite.SQLiteDatabase;
5+
import android.database.sqlite.SQLiteOpenHelper;
6+
7+
public class DBHelper extends SQLiteOpenHelper {
8+
9+
private static final String DATABASE_NAME = "StudentDB";
10+
private static final int DATABASE_VERSION = 1;
11+
12+
// 表名和列名
13+
public static final String TABLE_NAME = "students";
14+
public static final String COLUMN_ID = "id";
15+
public static final String COLUMN_NAME = "name";
16+
public static final String COLUMN_CLASS = "class";
17+
public static final String COLUMN_COURSE = "course";
18+
public static final String COLUMN_PHONE = "phone";
19+
20+
// 创建表的 SQL 语句
21+
private static final String CREATE_TABLE =
22+
"CREATE TABLE " + TABLE_NAME + " (" +
23+
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
24+
COLUMN_NAME + " TEXT," +
25+
COLUMN_CLASS + " TEXT," +
26+
COLUMN_COURSE + " TEXT," +
27+
COLUMN_PHONE + " TEXT)";
28+
29+
public DBHelper(Context context) {
30+
super(context, DATABASE_NAME, null, DATABASE_VERSION);
31+
}
32+
33+
@Override
34+
public void onCreate(SQLiteDatabase db) {
35+
db.execSQL(CREATE_TABLE);
36+
}
37+
38+
@Override
39+
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
40+
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
41+
onCreate(db);
42+
}
43+
}
44+
45+

0 commit comments

Comments
 (0)