BLE通信を行うためのアプリ。
Révision | 96bc728f4dcc67fd3e8a49bfe046cf871b188ba7 (tree) |
---|---|
l'heure | 2020-04-02 00:28:46 |
Auteur | MRSa <mrsa@myad...> |
Commiter | MRSa |
グラフの表示エリアを確保。
@@ -0,0 +1,79 @@ | ||
1 | +package net.osdn.gokigen.blecontrol.lib.ui.brainwave; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.graphics.Canvas; | |
5 | +import android.util.AttributeSet; | |
6 | +import android.util.Log; | |
7 | +import android.view.View; | |
8 | + | |
9 | +import androidx.annotation.NonNull; | |
10 | + | |
11 | +public class BrainwaveRawGraphView extends View | |
12 | +{ | |
13 | + private final String TAG = this.toString(); | |
14 | + | |
15 | + public BrainwaveRawGraphView(@NonNull Context context) | |
16 | + { | |
17 | + super(context); | |
18 | + initComponent(context); | |
19 | + } | |
20 | + | |
21 | + public BrainwaveRawGraphView(@NonNull Context context, AttributeSet attrs) | |
22 | + { | |
23 | + super(context, attrs); | |
24 | + initComponent(context); | |
25 | + } | |
26 | + | |
27 | + public BrainwaveRawGraphView(@NonNull Context context, AttributeSet attrs, int defStyleAttr) | |
28 | + { | |
29 | + super(context, attrs, defStyleAttr); | |
30 | + initComponent(context); | |
31 | + } | |
32 | + | |
33 | + private void initComponent(@NonNull Context context) | |
34 | + { | |
35 | + try | |
36 | + { | |
37 | + | |
38 | + } | |
39 | + catch (Exception e) | |
40 | + { | |
41 | + e.printStackTrace(); | |
42 | + } | |
43 | + } | |
44 | + | |
45 | + @Override | |
46 | + protected void onDraw(Canvas canvas) | |
47 | + { | |
48 | + super.onDraw(canvas); | |
49 | + drawCanvas(canvas); | |
50 | + | |
51 | + // Show Message(Overwrite) | |
52 | + drawInformationMessages(canvas); | |
53 | + | |
54 | + | |
55 | + } | |
56 | + | |
57 | + | |
58 | + private void drawCanvas(Canvas canvas) | |
59 | + { | |
60 | + //int centerX = canvas.getWidth() / 2; | |
61 | + //int centerY = canvas.getHeight() / 2; | |
62 | + | |
63 | + Log.v(TAG, " Canvas SIZE : (" + canvas.getWidth() + "," + canvas.getHeight() +" )"); | |
64 | + | |
65 | + // Clears the canvas. | |
66 | + canvas.drawARGB(255, 0, 0, 0); | |
67 | + } | |
68 | + | |
69 | + | |
70 | + /** | |
71 | + * 画面にメッセージを表示する | |
72 | + */ | |
73 | + private void drawInformationMessages(Canvas canvas) | |
74 | + { | |
75 | + | |
76 | + } | |
77 | + | |
78 | +} | |
79 | + |
@@ -1,99 +1,122 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | - android:orientation="vertical" | |
5 | 4 | android:layout_width="match_parent" |
6 | 5 | android:layout_height="match_parent"> |
7 | - | |
8 | - <TextView | |
9 | - android:id="@+id/label_device" | |
6 | + <LinearLayout | |
7 | + android:orientation="vertical" | |
10 | 8 | android:layout_width="match_parent" |
11 | - android:layout_height="wrap_content" | |
12 | - android:layout_marginStart="8dp" | |
13 | - android:layout_marginTop="8dp" | |
14 | - android:layout_marginEnd="8dp" | |
15 | - android:layout_gravity="start" | |
16 | - android:textAlignment="textStart" | |
17 | - android:text="@string/label_device" | |
18 | - android:textSize="12sp" /> | |
9 | + android:layout_height="match_parent"> | |
19 | 10 | |
20 | - <Spinner | |
21 | - android:id="@+id/spinner_selection_eeg_device" | |
22 | - android:layout_width="fill_parent" | |
23 | - android:layout_height="wrap_content" | |
24 | - android:text="@string/blank" | |
25 | - android:textSize="8pt" | |
26 | - android:visibility="visible" /> | |
11 | + <TextView | |
12 | + android:id="@+id/label_device" | |
13 | + android:layout_width="match_parent" | |
14 | + android:layout_height="wrap_content" | |
15 | + android:layout_marginStart="8dp" | |
16 | + android:layout_marginTop="8dp" | |
17 | + android:layout_marginEnd="8dp" | |
18 | + android:layout_gravity="start" | |
19 | + android:textAlignment="textStart" | |
20 | + android:text="@string/label_device" | |
21 | + android:textSize="12sp" /> | |
27 | 22 | |
28 | - <View | |
29 | - android:layout_width="match_parent" | |
30 | - android:layout_height="1dp" | |
31 | - android:background="@android:color/darker_gray"/> | |
23 | + <Spinner | |
24 | + android:id="@+id/spinner_selection_eeg_device" | |
25 | + android:layout_width="fill_parent" | |
26 | + android:layout_height="wrap_content" | |
27 | + android:text="@string/blank" | |
28 | + android:textSize="8pt" | |
29 | + android:visibility="visible" /> | |
32 | 30 | |
33 | - <View | |
34 | - android:layout_width="match_parent" | |
35 | - android:layout_height="6dp" /> | |
31 | + <View | |
32 | + android:layout_width="match_parent" | |
33 | + android:layout_height="1dp" | |
34 | + android:background="@android:color/darker_gray"/> | |
36 | 35 | |
37 | - <LinearLayout | |
38 | - android:layout_width="fill_parent" | |
39 | - android:layout_height="wrap_content" | |
40 | - android:padding="6dp"> | |
36 | + <View | |
37 | + android:layout_width="match_parent" | |
38 | + android:layout_height="6dp" /> | |
41 | 39 | |
42 | - <Button | |
43 | - android:layout_width="wrap_content" | |
40 | + <LinearLayout | |
41 | + android:layout_width="fill_parent" | |
44 | 42 | android:layout_height="wrap_content" |
45 | - android:tag="button" | |
46 | - android:id="@+id/connect_to_eeg" | |
47 | - android:text="@string/connect_device" | |
48 | - android:layout_gravity="center" | |
49 | - android:textSize="8pt" /> | |
43 | + android:padding="6dp"> | |
50 | 44 | |
51 | - <ImageButton | |
52 | - android:id="@+id/dummy_button0" | |
53 | - android:layout_width="wrap_content" | |
54 | - android:layout_height="match_parent" | |
55 | - android:clickable="true" | |
56 | - android:focusable="true" | |
57 | - android:gravity="center" | |
58 | - android:scaleType="fitCenter" | |
59 | - android:contentDescription="@string/blank" | |
60 | - app:srcCompat="@drawable/ic_replay_black_24dp" | |
61 | - android:visibility="invisible" /> | |
45 | + <Button | |
46 | + android:layout_width="wrap_content" | |
47 | + android:layout_height="wrap_content" | |
48 | + android:tag="button" | |
49 | + android:id="@+id/connect_to_eeg" | |
50 | + android:text="@string/connect_device" | |
51 | + android:layout_gravity="center" | |
52 | + android:textSize="8pt" /> | |
53 | + | |
54 | + <ImageButton | |
55 | + android:id="@+id/dummy_button0" | |
56 | + android:layout_width="wrap_content" | |
57 | + android:layout_height="match_parent" | |
58 | + android:clickable="true" | |
59 | + android:focusable="true" | |
60 | + android:gravity="center" | |
61 | + android:scaleType="fitCenter" | |
62 | + android:contentDescription="@string/blank" | |
63 | + app:srcCompat="@drawable/ic_replay_black_24dp" | |
64 | + android:visibility="invisible" /> | |
65 | + | |
66 | + <ImageButton | |
67 | + android:id="@+id/dummy_button1" | |
68 | + android:layout_width="wrap_content" | |
69 | + android:layout_height="match_parent" | |
70 | + android:clickable="true" | |
71 | + android:focusable="true" | |
72 | + android:gravity="center" | |
73 | + android:scaleType="fitCenter" | |
74 | + android:contentDescription="@string/blank" | |
75 | + app:srcCompat="@drawable/ic_texture_black_24dp" | |
76 | + android:visibility="invisible" /> | |
62 | 77 | |
63 | - <ImageButton | |
64 | - android:id="@+id/dummy_button1" | |
65 | - android:layout_width="wrap_content" | |
66 | - android:layout_height="match_parent" | |
67 | - android:clickable="true" | |
68 | - android:focusable="true" | |
78 | + </LinearLayout> | |
79 | + | |
80 | + <View | |
81 | + android:layout_width="match_parent" | |
82 | + android:layout_height="1dp" | |
83 | + android:background="@android:color/darker_gray"/> | |
84 | + | |
85 | + <View | |
86 | + android:layout_width="match_parent" | |
87 | + android:layout_height="6dp" /> | |
88 | + | |
89 | + <view | |
90 | + android:id="@+id/cameraLiveImageView" | |
91 | + class="net.osdn.gokigen.blecontrol.lib.ui.brainwave.BrainwaveRawGraphView" | |
92 | + android:layout_width="fill_parent" | |
93 | + android:layout_height="0dip" | |
94 | + android:layout_weight="1" | |
69 | 95 | android:gravity="center" |
70 | 96 | android:scaleType="fitCenter" |
71 | - android:contentDescription="@string/blank" | |
72 | - app:srcCompat="@drawable/ic_texture_black_24dp" | |
73 | - android:visibility="invisible" /> | |
74 | - | |
75 | - </LinearLayout> | |
97 | + android:visibility="visible" /> | |
76 | 98 | |
77 | - <View | |
78 | - android:layout_width="match_parent" | |
79 | - android:layout_height="1dp" | |
80 | - android:background="@android:color/darker_gray"/> | |
99 | + <View | |
100 | + android:layout_width="match_parent" | |
101 | + android:layout_height="1dp" | |
102 | + android:background="@android:color/darker_gray"/> | |
81 | 103 | |
82 | - <View | |
83 | - android:layout_width="match_parent" | |
84 | - android:layout_height="6dp" /> | |
104 | + <View | |
105 | + android:layout_width="match_parent" | |
106 | + android:layout_height="6dp" /> | |
85 | 107 | |
86 | - <TextView | |
87 | - android:id="@+id/text_brainwave" | |
88 | - android:layout_width="match_parent" | |
89 | - android:layout_height="wrap_content" | |
90 | - android:layout_marginStart="8dp" | |
91 | - android:layout_marginTop="8dp" | |
92 | - android:layout_marginEnd="8dp" | |
93 | - android:layout_gravity="start" | |
94 | - android:textAlignment="textStart" | |
95 | - android:textIsSelectable="true" | |
96 | - android:scrollbars="vertical" | |
97 | - android:textSize="20sp" | |
98 | - /> | |
99 | -</LinearLayout> | |
\ No newline at end of file | ||
108 | + <TextView | |
109 | + android:id="@+id/text_brainwave" | |
110 | + android:layout_width="match_parent" | |
111 | + android:layout_height="wrap_content" | |
112 | + android:layout_marginStart="8dp" | |
113 | + android:layout_marginTop="8dp" | |
114 | + android:layout_marginEnd="8dp" | |
115 | + android:layout_gravity="start" | |
116 | + android:textAlignment="textStart" | |
117 | + android:textIsSelectable="true" | |
118 | + android:scrollbars="vertical" | |
119 | + android:textSize="20sp" | |
120 | + /> | |
121 | + </LinearLayout> | |
122 | +</androidx.constraintlayout.widget.ConstraintLayout> |