+        registerReceiver(mUsbReceiver, filter);
154
+    }
155
+}

+ 67 - 0
app/src/main/java/com/ptplib/usbcamera/test/MyTestAdapter.java

@@ -0,0 +1,67 @@
1
+package com.ptplib.usbcamera.test;
2
+
3
+import android.content.Context;
4
+import android.view.LayoutInflater;
5
+import android.view.View;
6
+import android.view.ViewGroup;
7
+import android.widget.BaseAdapter;
8
+import android.widget.TextView;
9
+
10
+import com.strickling.usbcamera.R;
11
+
12
+import java.text.SimpleDateFormat;
13
+import java.util.ArrayList;
14
+import java.util.Date;
15
+
16
+public class MyTestAdapter extends BaseAdapter {
17
+
18
+    private ArrayList<String> infoList;
19
+    private Context context;
20
+    private LayoutInflater inflater;
21
+    private SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss\t");
22
+
23
+    public MyTestAdapter(Context context) {
24
+        this.context = context;
25
+        infoList = new ArrayList<>();
26
+        inflater = LayoutInflater.from(context);
27
+    }
28
+
29
+    @Override
30
+    public int getCount() {
31
+        return infoList.size();
32
+    }
33
+
34
+    @Override
35
+    public Object getItem(int position) {
36
+        return infoList.get(position);
37
+    }
38
+
39
+    @Override
40
+    public long getItemId(int position) {
41
+        return position;
42
+    }
43
+
44
+    public void addInfo(String info){
45
+        infoList.add(formatter.format(new Date())+info);
46
+        notifyDataSetChanged();
47
+    }
48
+
49
+    @Override
50
+    public View getView(int position, View convertView, ViewGroup parent) {
51
+        ViewHolder holder;
52
+        if (convertView == null) {
53
+            convertView = inflater.inflate(R.layout.item_test_info, null);
54
+            holder = new ViewHolder();
55
+            holder.info = (TextView) convertView.findViewById(R.id.tv_info);
56
+            convertView.setTag(holder);
57
+        } else {
58
+            holder = (ViewHolder) convertView.getTag();
59
+        }
60
+        holder.info.setText(infoList.get(position));
61
+        return convertView;
62
+    }
63
+
64
+    final class ViewHolder {
65
+        public TextView info;
66
+    }
67
+}

+ 34 - 0
app/src/main/res/layout/activity_my_test.xml

@@ -0,0 +1,34 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:orientation="vertical" android:layout_width="match_parent"
4
+    android:layout_height="match_parent">
5
+
6
+    <Button
7
+        android:id="@+id/btn_get_devece_info"
8
+        android:layout_width="match_parent"
9
+        android:layout_height="48dp"
10
+        android:layout_margin="4dp"
11
+        android:gravity="center"
12
+        android:text="获取设备信息"/>
13
+
14
+    <ListView
15
+        android:id="@+id/list_info"
16
+        android:layout_width="match_parent"
17
+        android:divider="@android:color/transparent"
18
+        android:layout_height="200dp" />
19
+    <Button
20
+        android:id="@+id/btn_get_photo"
21
+        android:layout_width="match_parent"
22
+        android:layout_height="48dp"
23
+        android:layout_margin="4dp"
24
+        android:gravity="center"
25
+        android:text="获取最新照片"/>
26
+
27
+
28
+    <ImageView
29
+        android:id="@+id/iv_latest_photo"
30
+        android:layout_width="match_parent"
31
+        android:layout_height="match_parent"
32
+        android:scaleType="centerInside"/>
33
+
34
+</LinearLayout>

+ 14 - 0
app/src/main/res/layout/item_test_info.xml

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
4
+    android:id="@+id/tv_info"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="wrap_content"
7
+    android:textSize="14sp"
8
+    android:textColor="@android:color/black"
9
+    android:gravity="center_vertical"
10
+    android:paddingLeft="8dp"
11
+    android:paddingTop="4dp"
12
+    android:paddingBottom="4dp"
13
+    android:paddingRight="8dp"
14
+    android:minHeight="20dp" />

+ 1 - 1
app/src/main/res/values/strings.xml

@@ -3,7 +3,7 @@
3 3
 
4 4
     <string name="desc">Description of an image</string>
5 5
     <string name="hello">Hello World, USBCamera Activity!</string>
6
-    <string name="app_name">USBCameraTest</string>
6
+    <string name="app_name">Test</string>
7 7
     <string name="Button1">Get DeviceInfo</string>
8 8
     <string name="Button2">Detailed get DeviceInfo</string>
9 9
     <string name="Button3">Take Picture</string>

thermometer - Gogs: Go Git Service

暂无描述

huangqimin001: db81686eda :art: Remove ThermometerMeasureInfo relative 4 年之前
..
migrations a6bdd3725f :tada: Initial 4 年之前
__init__.py a6bdd3725f :tada: Initial 4 年之前
admin.py a6bdd3725f :tada: Initial 4 年之前
admin_views.py c6838a7aad :art: Basic Realize 4 年之前
apps.py a6bdd3725f :tada: Initial 4 年之前
eqpt_views.py baf9134bc2 :art: Update temperature__max 4 年之前
field_views.py db63fb02fa :art: Field Pool 4 年之前
mini_views.py 0c4145c394 :art: Mini 4 年之前
models.py a6bdd3725f :tada: Initial 4 年之前
oauth_views.py a6bdd3725f :tada: Initial 4 年之前
point_views.py db81686eda :art: Remove ThermometerMeasureInfo relative 4 年之前
screen_views.py cba7cfb0ad :art: Return point info for screen 4 年之前
tests.py a6bdd3725f :tada: Initial 4 年之前
urls.py db81686eda :art: Remove ThermometerMeasureInfo relative 4 年之前
views.py a6bdd3725f :tada: Initial 4 年之前
wx_views.py db63fb02fa :art: Field Pool 4 年之前