└── HandControlLongBtn
├── .gitignore
├── .idea
├── caches
│ └── build_file_checksums.ser
├── codeStyles
│ └── Project.xml
├── dictionaries
│ └── dadachenchen.xml
├── gradle.xml
├── misc.xml
└── runConfigurations.xml
├── app
├── .gitignore
├── build.gradle
├── libs
│ ├── eventbus.jar
│ ├── fastjson-1.2.45.jar
│ ├── java_websocket.jar
│ └── json-simple-1.1.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── dadac
│ │ └── sqlitesavaname
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ ├── com
│ │ │ ├── example
│ │ │ │ └── dadac
│ │ │ │ │ ├── RCApplication.java
│ │ │ │ │ ├── savenavigationinfo
│ │ │ │ │ ├── NavigationInfo.java
│ │ │ │ │ ├── SaveData.java
│ │ │ │ │ └── SetNavigationActivity.java
│ │ │ │ │ └── sqlitesavaname
│ │ │ │ │ ├── IStatus.java
│ │ │ │ │ ├── LoginActivity.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── PublishEvent.java
│ │ │ ├── fragment
│ │ │ │ ├── SetNavigationFragemnt.java
│ │ │ │ └── ShowRobotLocationFragment.java
│ │ │ └── jilk
│ │ │ │ └── ros
│ │ │ │ ├── Example.java
│ │ │ │ ├── MessageHandler.java
│ │ │ │ ├── ROSClient.java
│ │ │ │ ├── Service.java
│ │ │ │ ├── Topic.java
│ │ │ │ ├── message
│ │ │ │ ├── AudioMsg.java
│ │ │ │ ├── Clock.java
│ │ │ │ ├── Duration.java
│ │ │ │ ├── DurationPrimitive.java
│ │ │ │ ├── Empty.java
│ │ │ │ ├── Header.java
│ │ │ │ ├── Log.java
│ │ │ │ ├── Message.java
│ │ │ │ ├── MessageException.java
│ │ │ │ ├── MessageType.java
│ │ │ │ ├── SemanticRequest.java
│ │ │ │ ├── SemanticResponse.java
│ │ │ │ ├── StdMsg.java
│ │ │ │ ├── Time.java
│ │ │ │ └── TimePrimitive.java
│ │ │ │ ├── rosapi
│ │ │ │ └── message
│ │ │ │ │ ├── Empty.java
│ │ │ │ │ ├── GetTime.java
│ │ │ │ │ ├── MessageDetails.java
│ │ │ │ │ ├── Nodes.java
│ │ │ │ │ ├── Service.java
│ │ │ │ │ ├── Services.java
│ │ │ │ │ ├── Topic.java
│ │ │ │ │ ├── Topics.java
│ │ │ │ │ ├── Type.java
│ │ │ │ │ └── TypeDef.java
│ │ │ │ └── rosbridge
│ │ │ │ ├── FullMessageHandler.java
│ │ │ │ ├── ROSBridgeClient.java
│ │ │ │ ├── implementation
│ │ │ │ ├── Base64.java
│ │ │ │ ├── JSON.java
│ │ │ │ ├── ROSBridgeWebSocketClient.java
│ │ │ │ └── Registry.java
│ │ │ │ ├── indication
│ │ │ │ ├── AsArray.java
│ │ │ │ ├── Base64Encoded.java
│ │ │ │ ├── Indicate.java
│ │ │ │ ├── Indicated.java
│ │ │ │ ├── Indication.java
│ │ │ │ └── Indicator.java
│ │ │ │ └── operation
│ │ │ │ ├── Advertise.java
│ │ │ │ ├── Authenticate.java
│ │ │ │ ├── CallService.java
│ │ │ │ ├── Fragment.java
│ │ │ │ ├── Operation.java
│ │ │ │ ├── PNG.java
│ │ │ │ ├── Publish.java
│ │ │ │ ├── ServiceResponse.java
│ │ │ │ ├── SetStatusLevel.java
│ │ │ │ ├── Status.java
│ │ │ │ ├── Subscribe.java
│ │ │ │ ├── Unadvertise.java
│ │ │ │ ├── Unsubscribe.java
│ │ │ │ └── Wrapper.java
│ │ ├── customView
│ │ │ ├── BatteryView.java
│ │ │ ├── DialogActivity.java
│ │ │ └── PopupView.java
│ │ └── utils
│ │ │ ├── BroadCastTemplate.java
│ │ │ └── SerialUtils.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── background.jpg
│ │ ├── first.png
│ │ ├── ic_launcher_background.xml
│ │ ├── ico_robot.png
│ │ ├── move_down.png
│ │ ├── move_down_press.png
│ │ ├── move_left.png
│ │ ├── move_left_press.png
│ │ ├── move_right.png
│ │ ├── move_right_press.png
│ │ ├── move_up.png
│ │ ├── move_up_press.png
│ │ ├── xml_move_down.xml
│ │ ├── xml_move_left.xml
│ │ ├── xml_move_right.xml
│ │ └── xml_move_up.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_welcome.xml
│ │ ├── activitydialog.xml
│ │ ├── fragemnt_showrobot.xml
│ │ ├── fragment_setnavi.xml
│ │ ├── passworddialog.xml
│ │ ├── popupdialog.xml
│ │ └── rowshow_navlist.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── dadac
│ └── sqlitesavaname
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/HandControlLongBtn/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/HandControlLongBtn/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KEYD111/RemoteControlAndroidROS/79b8096874227aaa248fe07b04da8a2fae9ebe4e/HandControlLongBtn/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/HandControlLongBtn/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/HandControlLongBtn/.idea/dictionaries/dadachenchen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/HandControlLongBtn/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/HandControlLongBtn/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/HandControlLongBtn/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.example.dadac.sqlitesavaname"
7 | minSdkVersion 15
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(include: ['*.jar'], dir: 'libs')
23 | implementation 'com.android.support:appcompat-v7:28.0.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | implementation 'org.xutils:xutils:3.3.22'
29 | implementation files('libs/fastjson-1.2.45.jar')
30 | implementation files('libs/eventbus.jar')
31 | implementation files('libs/java_websocket.jar')
32 | implementation files('libs/json-simple-1.1.jar')
33 | }
34 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/libs/eventbus.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KEYD111/RemoteControlAndroidROS/79b8096874227aaa248fe07b04da8a2fae9ebe4e/HandControlLongBtn/app/libs/eventbus.jar
--------------------------------------------------------------------------------
/HandControlLongBtn/app/libs/fastjson-1.2.45.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KEYD111/RemoteControlAndroidROS/79b8096874227aaa248fe07b04da8a2fae9ebe4e/HandControlLongBtn/app/libs/fastjson-1.2.45.jar
--------------------------------------------------------------------------------
/HandControlLongBtn/app/libs/java_websocket.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KEYD111/RemoteControlAndroidROS/79b8096874227aaa248fe07b04da8a2fae9ebe4e/HandControlLongBtn/app/libs/java_websocket.jar
--------------------------------------------------------------------------------
/HandControlLongBtn/app/libs/json-simple-1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KEYD111/RemoteControlAndroidROS/79b8096874227aaa248fe07b04da8a2fae9ebe4e/HandControlLongBtn/app/libs/json-simple-1.1.jar
--------------------------------------------------------------------------------
/HandControlLongBtn/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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
22 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/src/androidTest/java/com/example/dadac/sqlitesavaname/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.dadac.sqlitesavaname;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.dadac.sqlitesavaname", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
13 |
14 |
15 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/src/main/java/com/example/dadac/RCApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.dadac;
2 |
3 | import android.app.Application;
4 |
5 | import com.jilk.ros.rosbridge.ROSBridgeClient;
6 |
7 | import org.xutils.x;
8 |
9 |
10 | /**
11 | * @ Create by dadac on 2018/9/27.
12 | * @Function: 供给SQLite使用
13 | * @Return:
14 | */
15 | public class RCApplication extends Application {
16 | //ROS
17 | ROSBridgeClient client;
18 | @Override
19 | public void onCreate() {
20 | super.onCreate();
21 | //EventBus xUtils
22 | x.Ext.init(this);
23 | x.Ext.setDebug(false); //输出debug日志,开启会影响性能
24 | }
25 |
26 | @Override //ROS
27 | public void onTerminate() {
28 | if(client != null)
29 | client.disconnect();
30 | super.onTerminate();
31 | }
32 |
33 | public ROSBridgeClient getRosClient() {
34 | return client;
35 | }
36 |
37 | public void setRosClient(ROSBridgeClient client) {
38 | this.client = client;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/src/main/java/com/example/dadac/savenavigationinfo/NavigationInfo.java:
--------------------------------------------------------------------------------
1 | package com.example.dadac.savenavigationinfo;
2 |
3 |
4 | import org.xutils.db.annotation.Column;
5 | import org.xutils.db.annotation.Table;
6 |
7 | /**
8 | * @ Create by dadac on 2018/10/29.
9 | * @Function: 保存导航点的信息 当第一次创建表格需要插入数据时,在此写 sql 语句
10 | * @Return:
11 | */
12 |
13 | @Table(name = "navigation_info", onCreated = "")
14 | public class NavigationInfo {
15 |
16 | /**
17 | * id: 序列号
18 | * name: 名称
19 | * x_position: 位置信息 x
20 | * y_position: y
21 | * z_position: z
22 | * w_position: w
23 | */
24 | /**
25 | * name = "_id"; 数据库表中的第一个字段
26 | * isId = true ; 是否主键
27 | * autoGen = true; 自动增长
28 | * property = "NOTNULL"; 不为空
29 | */
30 | @Column(name = "_id", isId = true, autoGen = true, property = "NOT NULL")
31 | private int _id;
32 | @Column(name = "u_name", property = "NOT NULL")
33 | private String u_name;
34 | @Column(name = "x_position", property = "NOT NULL")
35 | private double x_position;
36 | @Column(name = "y_position", property = "NOT NULL")
37 | private double y_position;
38 | @Column(name = "z_orientation", property = "NOT NULL")
39 | private double z_orientation;
40 | @Column(name = "w_orientation", property = "NOT NULL")
41 | private double w_orientation;
42 |
43 | public NavigationInfo() {
44 | }
45 |
46 | public NavigationInfo(int _id, String u_name, double x_position, double y_position, double z_orientation, double w_orientation) {
47 | this._id = _id;
48 | this.u_name = u_name;
49 | this.x_position = x_position;
50 | this.y_position = y_position;
51 | this.z_orientation = z_orientation;
52 | this.w_orientation = w_orientation;
53 | }
54 |
55 | public NavigationInfo(String u_name, double x_position, double y_position, double z_orientation, double w_orientation) {
56 | this.u_name = u_name;
57 | this.x_position = x_position;
58 | this.y_position = y_position;
59 | this.z_orientation = z_orientation;
60 | this.w_orientation = w_orientation;
61 | }
62 |
63 | @Override
64 | public String toString() {
65 | return "navigation_Info{" + "_id" + _id + " u_name" + u_name + " x_position" + x_position + " y_position" + y_position + " " +
66 | "z_orientation" + z_orientation + " " + "w_orientation" + w_orientation;
67 | }
68 |
69 | public int get_id() {
70 | return _id;
71 | }
72 |
73 | public void set_id(int _id) {
74 | this._id = _id;
75 | }
76 |
77 | public String getU_name() {
78 | return u_name;
79 | }
80 |
81 | public void setU_name(String u_name) {
82 | this.u_name = u_name;
83 | }
84 |
85 | public double getX_position() {
86 | return x_position;
87 | }
88 |
89 | public void setX_position(double x_position) {
90 | this.x_position = x_position;
91 | }
92 |
93 | public double getY_position() {
94 | return y_position;
95 | }
96 |
97 | public void setY_position(double y_position) {
98 | this.y_position = y_position;
99 | }
100 |
101 | public double getZ_orientation() {
102 | return z_orientation;
103 | }
104 |
105 | public void setZ_orientation(double z_orientation) {
106 | this.z_orientation = z_orientation;
107 | }
108 |
109 | public double getW_orientation() {
110 | return w_orientation;
111 | }
112 |
113 | public void setW_orientation(double w_orientation) {
114 | this.w_orientation = w_orientation;
115 | }
116 | }
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/src/main/java/com/example/dadac/savenavigationinfo/SaveData.java:
--------------------------------------------------------------------------------
1 | package com.example.dadac.savenavigationinfo;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.util.Log;
6 |
7 | import com.alibaba.fastjson.JSON;
8 | import com.alibaba.fastjson.JSONObject;
9 |
10 | import org.xutils.DbManager;
11 |
12 | import org.xutils.db.sqlite.SqlInfo;
13 | import org.xutils.db.table.DbModel;
14 | import org.xutils.db.table.TableEntity;
15 | import org.xutils.ex.DbException;
16 | import org.xutils.x;
17 |
18 | import java.io.File;
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | /**
23 | * @ Create by dadac on 2018/10/29.
24 | * @Function: 使用SQLite来存储数据
25 | * @Return:
26 | */
27 | public class SaveData {
28 |
29 | //新建数据库
30 | DbManager dbManager;
31 | DbManager.DaoConfig daoConfig = new DbManager.DaoConfig();
32 |
33 | /**
34 | * @Function: 初始化 DaoConfig 配置
35 | * @Return:
36 | * @attention: 不管什么使用 SaveData saveData = new SavaData() 都
37 | * 必须使用初始化的函数 即: saveData.InitDaoConfig()
38 | */
39 | public void InitDaoConfig(Context context) {
40 | String path = context.getExternalFilesDir("Documents").getPath(); //平板路径
41 | //平板存放SQL的路径
42 | daoConfig.setDbName("navigation_info.db")
43 | //设置数据库的名字 默认的是 xutils.db
44 | .setDbDir(new File("/mnt/sdcard/SQLite")) //设置数据库路径,默认存储在 app 的私有目录 RK
45 | //.setDbDir(new File(path + "/SQLite")) //平板的路径
46 | .setDbVersion(1) //设置当前的版本号
47 | .setDbOpenListener(new DbManager.DbOpenListener() { //设置数据库打开的监听
48 | @Override
49 | public void onDbOpened(DbManager db) {
50 | //适用于大量数据写的时候 开启数据库支持多线程的操作
51 | db.getDatabase().enableWriteAheadLogging();
52 | }
53 | }).setDbUpgradeListener(new DbManager.DbUpgradeListener() { //设置数据库更新的监听
54 | @Override
55 | public void onUpgrade(DbManager db, int oldVersion, int newVersion) {
56 | Log.i("dachenSQLite", "数据库已经更新了 oldversion: " + oldVersion + " newversion" + newVersion);
57 | }
58 | }).setTableCreateListener(new DbManager.TableCreateListener() { //设置表创建的监听
59 | @Override
60 | public void onTableCreated(DbManager db, TableEntity> table) {
61 | Log.i("dachenSQLite", "表已经被创建了" + table.getName());
62 | }
63 | }).setAllowTransaction(true); //设置是否允许事务 默认为 true
64 | dbManager = x.getDb(daoConfig);
65 | }
66 |
67 | /*创建数据库*/
68 | public void CreateSQLData(int count) {
69 | ArrayList navigationInfos = new ArrayList<>();
70 | for (int i = 1; i <= count; i++) {
71 | navigationInfos.add(new NavigationInfo("导航点" + i, 0.0, 0.0, 0.0, 0.0));
72 | }
73 | try {
74 | dbManager.save(navigationInfos);
75 | Log.i("dachenSQLite", "数据库已经创建成功");
76 | } catch (DbException e) {
77 | e.printStackTrace();
78 | Log.e("dachenSQLite", e.getMessage() + "数据库创建失败");
79 | }
80 | }
81 |
82 |
83 | /**
84 | * @Function: 查询表中的指定的数据 都是保存为 JSON 的格式
85 | * @Return:
86 | * @attention: 数据库索引没有 0
87 | */
88 | public String QuerySQLData(@Nullable int Index) {
89 | NavigationInfo navigationIndex = null;
90 | String jsonObject = "Error";
91 | try {
92 | navigationIndex = dbManager.findById(NavigationInfo.class, Index);
93 | // javaToJson 将 Java 对象转换成 JSON 对象扔出去
94 | jsonObject = JSON.toJSONString(navigationIndex);
95 | } catch (DbException e) {
96 | e.printStackTrace();
97 | Log.e("dachenSQLite", "找不到指定的数据");
98 | }
99 | return jsonObject;
100 | }
101 |
102 | /**
103 | * @Function: 删除数据库指定的内容
104 | * @Return:
105 | */
106 | public void DeleteSQLIndex(int index) {
107 | try {
108 | dbManager.deleteById(NavigationInfo.class, index);
109 | } catch (DbException e) {
110 | e.printStackTrace();
111 | }
112 | }
113 |
114 | /**
115 | * @Function: 删除数据库
116 | * @Return:
117 | */
118 | public void deleteSQL() {
119 | try {
120 | dbManager.dropDb();
121 | } catch (DbException e) {
122 | e.printStackTrace();
123 | }
124 | }
125 |
126 | /**
127 | * @Function: 删除表
128 | * @Return:
129 | */
130 | public void deletetable() {
131 | try {
132 | dbManager.dropTable(NavigationInfo.class);
133 | } catch (DbException e) {
134 | e.printStackTrace();
135 | }
136 | }
137 |
138 | /**
139 | * @Function: 新增表中的数据
140 | * @Return:
141 | */
142 | public void newSQLData(int id, String name, double x, double y, double z, double w) {
143 | try {
144 | NavigationInfo navigationInfo = new NavigationInfo(id, name, x, y, z, w);
145 | dbManager.save(navigationInfo);
146 | } catch (DbException e) {
147 | e.printStackTrace();
148 | }
149 | }
150 |
151 | /**
152 | * @Function: 修改表中的数据
153 | * @Return:
154 | */
155 | public void updateSQLData(int Index, String name, double x, double y, double z, double w) {
156 | try {
157 | //第一种写法
158 | NavigationInfo navigationInfo = dbManager.findById(NavigationInfo.class, Index);
159 | navigationInfo.setU_name(name);
160 | navigationInfo.setX_position(x);
161 | navigationInfo.setY_position(y);
162 | navigationInfo.setZ_orientation(z);
163 | navigationInfo.setW_orientation(w);
164 | dbManager.update(navigationInfo, "u_name"); // u_name 表中的字段名
165 | dbManager.update(navigationInfo, "x_position"); // x_position 表中的字段名
166 | dbManager.update(navigationInfo, "y_position"); // y_position 表中的字段名
167 | dbManager.update(navigationInfo, "z_orientation"); // z_position 表中的字段名
168 | dbManager.update(navigationInfo, "w_orientation"); // w_position 表中的字段名
169 | } catch (DbException e) {
170 | e.printStackTrace();
171 | }
172 | }
173 |
174 | /**
175 | * @Function: 返回 sql 语句的长度
176 | * @Return:
177 | */
178 | public int GetTheTableSize() {
179 | DbManager dbManager = x.getDb(daoConfig);
180 | try {
181 | List ed = dbManager.findDbModelAll(new SqlInfo("select * from navigation_info"));
182 | return ed.size();
183 | } catch (DbException e) {
184 | e.printStackTrace();
185 | }
186 | return 1;
187 | }
188 |
189 |
190 | /**
191 | * @Function: UI 异步执行
192 | * @Return:
193 | */
194 | public void AsyUISQL() {
195 | x.task().run(new Runnable() {
196 | @Override
197 | public void run() {
198 | //异步代码
199 | }
200 | });
201 | }
202 |
203 | /**
204 | * @Function: 同步代码
205 | * @Return:
206 | */
207 | public void TogetherUISQL() {
208 | x.task().post(new Runnable() {
209 | @Override
210 | public void run() {
211 | //同步代码
212 |
213 | }
214 | });
215 | }
216 |
217 | /**
218 | * @Function: 获取 数据库中所有的的名字
219 | * @Return:
220 | */
221 | public String[] GetSQLALLName() {
222 | //获取长度
223 | int size = GetTheTableSize();
224 | String[] contents = new String[size];
225 | for (int i = 1; i <= size; i++) {
226 | contents[i - 1] = (String) (JSONObject.parseObject(QuerySQLData(i))).get("u_name");
227 | }
228 | return contents;
229 | }
230 |
231 | /**
232 | * @Function: 获取 数据库中所有的的ID
233 | * @Return:
234 | */
235 | public String[] GetSQLALLID() {
236 | //获取长度
237 | int size = GetTheTableSize();
238 | String[] contents = new String[size];
239 | for (int i = 1; i <= size; i++) {
240 | contents[i - 1] = i + "";
241 | }
242 | return contents;
243 | }
244 |
245 |
246 | }
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
--------------------------------------------------------------------------------
/HandControlLongBtn/app/src/main/java/com/example/dadac/savenavigationinfo/SetNavigationActivity.java:
--------------------------------------------------------------------------------
1 | //package com.example.dadac.savenavigationinfo;
2 | //
3 | //import android.app.AlertDialog;
4 | //import android.app.ListActivity;
5 | //import android.content.DialogInterface;
6 | //import android.os.Bundle;
7 | //import android.util.Log;
8 | //import android.view.LayoutInflater;
9 | //import android.view.MotionEvent;
10 | //import android.view.View;
11 | //import android.view.ViewGroup;
12 | //import android.widget.AdapterView;
13 | //import android.widget.BaseAdapter;
14 | //import android.widget.Button;
15 | //import android.widget.EditText;
16 | //import android.widget.TextView;
17 | //import android.widget.Toast;
18 | //
19 | //import com.example.dadac.sqlitesavaname.R;
20 | //
21 | //import java.util.ArrayList;
22 | //import java.util.HashMap;
23 | //import java.util.List;
24 | //import java.util.Map;
25 | //
26 | //
27 | ///**
28 | // * @ Create by dadac on 2018/10/29.
29 | // * @Function: 设置导航点 Activity 不用了
30 | // * @Return:
31 | // */
32 | //public class SetNavigationActivity extends ListActivity implements View.OnClickListener {
33 | //
34 | // private String[] IdString = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
35 | // private String[] ShowString = {"导航点1", "导航点2", "导航点3", "导航点4", "导航点5", "导航点6", "导航点7",
36 | // "导航点8", "导航点9", "导航点10", "导航点11", "导航点12", "导航点13", "导航点14"};
37 | // private List