e741e32957b1959a285aL136">136
|
- sql.append(PHOTO_INFO_COLUMNS.COMMENT_NUM).append(" INTEGER, ");
|
137
|
|
- sql.append(PHOTO_INFO_COLUMNS.THUMBUP_NUM).append(" INTEGER, ");
|
138
|
|
- sql.append(PHOTO_INFO_COLUMNS.GROUP_FROM).append(" INTEGER, ");
|
139
|
|
- sql.append(PHOTO_INFO_COLUMNS.THUMB_UP).append(" INTEGER, ");
|
140
|
|
- sql.append(PHOTO_INFO_COLUMNS.PHOTO_FROM).append(" INTEGER, ");
|
141
|
|
- sql.append(PHOTO_INFO_COLUMNS.THUMBNAIL_WIDTH).append(" SHORT, ");
|
142
|
|
- sql.append(PHOTO_INFO_COLUMNS.THUMBNAIL_HEIGHT).append(" SHORT, ");
|
143
|
|
- sql.append(PHOTO_INFO_COLUMNS.BIG_THUMBNAIL_URL).append(" VARCHAR, ");
|
144
|
|
- sql.append(PHOTO_INFO_COLUMNS.MEDIUM_PHOTO_URL).append(" VARCHAR, ");
|
145
|
|
- sql.append(PHOTO_INFO_COLUMNS.RAW_PHOTO_URL).append(" VARCHAR, ");
|
146
|
|
- sql.append(PHOTO_INFO_COLUMNS.SHARE_PHOTO_URL).append(" VARCHAR, ");
|
147
|
|
- sql.append(PHOTO_INFO_COLUMNS.THUMBNAIL_URL).append(" VARCHAR ");
|
148
|
|
- sql.append(")");
|
149
|
|
- db.execSQL(sql.toString());
|
150
|
|
- }
|
151
|
|
-
|
152
|
|
-
|
153
|
|
- private void createUploadTable(SQLiteDatabase db){
|
154
|
|
- StringBuilder sql = new StringBuilder();
|
155
|
|
- sql.append("CREATE TABLE IF NOT EXISTS ");
|
156
|
|
- sql.append(UPLOAD_PHOTO_TABLE).append("(");
|
157
|
|
- sql.append(UPLOAD_PHOTO_COLUMNS.PHOTO_PATH).append(" VARCHAR PRIMARY KEY, ");
|
158
|
|
- sql.append(UPLOAD_PHOTO_COLUMNS.GROUP_ID).append(" VARCHAR, ");
|
159
|
|
- sql.append(UPLOAD_PHOTO_COLUMNS.USER_ID).append(" VARCHAR, ");
|
160
|
|
- sql.append(UPLOAD_PHOTO_COLUMNS.CREATE_TIME).append(" LONG, ");
|
161
|
|
- sql.append(UPLOAD_PHOTO_COLUMNS.NICK_NAME).append(" VARCHAR ");
|
|
60
|
+ sql.append(PHOTO_INFO_COLUMNS.PHOTO_PATH).append(" VARCHAR, ");
|
|
61
|
+ sql.append(PHOTO_INFO_COLUMNS.LENSMAN_ID).append(" VARCHAR, ");
|
|
62
|
+ sql.append(PHOTO_INFO_COLUMNS.SESSION_ID).append(" VARCHAR, ");
|
|
63
|
+ sql.append(PHOTO_INFO_COLUMNS.IS_RAW_PHOTO).append(" INTEGER, ");
|
|
64
|
+ sql.append(PHOTO_INFO_COLUMNS.IS_UPLOADED).append(" INTEGER, ");
|
|
65
|
+ sql.append(PHOTO_INFO_COLUMNS.CAPTURE_TIME).append(" LONG ");
|
162
|
66
|
sql.append(")");
|
163
|
67
|
db.execSQL(sql.toString());
|
164
|
68
|
}
|
165
|
69
|
|
166
|
|
-
|
167
|
70
|
}
|
|
|
@@ -1,9 +1,12 @@
|
1
|
1
|
package ai.pai.lensman.db;
|
2
|
2
|
|
|
3
|
+import android.content.ContentValues;
|
3
|
4
|
import android.content.Context;
|
4
|
5
|
import android.database.Cursor;
|
5
|
6
|
import android.database.sqlite.SQLiteDatabase;
|
6
|
7
|
|
|
8
|
+import ai.pai.lensman.bean.PhotoBean;
|
|
9
|
+
|
7
|
10
|
|
8
|
11
|
public class DBService {
|
9
|
12
|
|
|
|
@@ -11,7 +14,7 @@ public class DBService {
|
11
|
14
|
private static Object DB_LOCK = new Object();
|
12
|
15
|
private DBHelper dbHelper;
|
13
|
16
|
|
14
|
|
- private static final String TAG = "czy";
|
|
17
|
+ private static final String TAG = "DBService";
|
15
|
18
|
|
16
|
19
|
private DBService(Context context) {
|
17
|
20
|
dbHelper = DBHelper.getInstance(context);
|
|
|
@@ -39,4 +42,43 @@ public class DBService {
|
39
|
42
|
}
|
40
|
43
|
}
|
41
|
44
|
|
|
45
|
+
|
|
46
|
+ private PhotoBean cursor2PhotoBean(Cursor c) {
|
|
47
|
+ PhotoBean item = new PhotoBean();
|
|
48
|
+ item.lensmanId = c.getString(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.LENSMAN_ID));
|
|
49
|
+ item.sessionId = c.getString(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.SESSION_ID));
|
|
50
|
+ item.isRawPhoto =(c.getInt(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.IS_RAW_PHOTO))>0);
|
|
51
|
+ item.isUploaded = (c.getInt(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.IS_UPLOADED))>0);
|
|
52
|
+ item.captureTime = c.getLong(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.CAPTURE_TIME));
|
|
53
|
+ item.photoId = c.getLong(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.PHOTO_ID));
|
|
54
|
+ item.photoName = c.getString(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.PHOTO_NAME));
|
|
55
|
+ item.photoPath = c.getString(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.PHOTO_PATH));
|
|
56
|
+ return item;
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ private ContentValues photoBean2ContentValues(PhotoBean item) {
|
|
60
|
+ ContentValues cv = new ContentValues();
|
|
61
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.CAPTURE_TIME, item.captureTime);
|
|
62
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.IS_RAW_PHOTO, item.isRawPhoto ? 1: 0);
|
|
63
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.PHOTO_ID, item.photoId);
|
|
64
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.PHOTO_NAME, item.photoName);
|
|
65
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.PHOTO_PATH, item.photoPath);
|
|
66
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.SESSION_ID, item.sessionId);
|
|
67
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.LENSMAN_ID,item.lensmanId);
|
|
68
|
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.IS_UPLOADED,item.isUploaded);
|
|
69
|
+ return cv;
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+ public void addPhotoBean(PhotoBean bean){
|
|
73
|
+
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ public void updatePhotoBean(PhotoBean bean){
|
|
77
|
+
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ public void deletePhotoBean(PhotoBean bean){
|
|
81
|
+
|
|
82
|
+ }
|
|
83
|
+
|
42
|
84
|
}
|
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+package ai.pai.lensman.service;
|
|
2
|
+
|
|
3
|
+import android.app.IntentService;
|
|
4
|
+import android.content.Intent;
|
|
5
|
+
|
|
6
|
+public class UploadService extends IntentService {
|
|
7
|
+
|
|
8
|
+ private static final String TAG = "UploadService";
|
|
9
|
+
|
|
10
|
+ public UploadService(){
|
|
11
|
+ super(TAG);
|
|
12
|
+ }
|
|
13
|
+
|
|
14
|
+ @Override
|
|
15
|
+ protected void onHandleIntent(Intent intent) {
|
|
16
|
+
|
|
17
|
+ }
|
|
18
|
+
|
|
19
|
+}
|
|
|
@@ -1,10 +0,0 @@
|
1
|
|
-package ai.pai.lensman.session;
|
2
|
|
-
|
3
|
|
-
|
4
|
|
-import java.io.Serializable;
|
5
|
|
-
|
6
|
|
-public class PhotoBean implements Serializable{
|
7
|
|
-
|
8
|
|
- public String photoPath;
|
9
|
|
-
|
10
|
|
-}
|
|
|
@@ -12,6 +12,7 @@ import com.android.common.utils.DeviceUtils;
|
12
|
12
|
import java.util.ArrayList;
|
13
|
13
|
|
14
|
14
|
import ai.pai.lensman.R;
|
|
15
|
+import ai.pai.lensman.bean.PhotoBean;
|
15
|
16
|
import butterknife.BindView;
|
16
|
17
|
import butterknife.ButterKnife;
|
17
|
18
|
|
|
|
@@ -10,8 +10,9 @@ import android.widget.TextView;
|
10
|
10
|
|
11
|
11
|
import ai.pai.lensman.R;
|
12
|
12
|
import ai.pai.lensman.base.BaseActivity;
|
|
13
|
+import ai.pai.lensman.bean.PhotoBean;
|
13
|
14
|
import ai.pai.lensman.qrcode.QRCaptureActivity;
|
14
|
|
-import ai.pai.lensman.upload.SessionBean;
|
|
15
|
+import ai.pai.lensman.bean.SessionBean;
|
15
|
16
|
import butterknife.BindView;
|
16
|
17
|
import butterknife.ButterKnife;
|
17
|
18
|
import butterknife.OnClick;
|
|
|
@@ -1,5 +1,7 @@
|
1
|
1
|
package ai.pai.lensman.session;
|
2
|
2
|
|
|
3
|
+import ai.pai.lensman.bean.PhotoBean;
|
|
4
|
+
|
3
|
5
|
/**
|
4
|
6
|
* Created by chengzhenyu on 2016/7/7.
|
5
|
7
|
*/
|
|
|
@@ -6,6 +6,7 @@ import java.util.List;
|
6
|
6
|
import java.util.Timer;
|
7
|
7
|
import java.util.TimerTask;
|
8
|
8
|
|
|
9
|
+import ai.pai.lensman.bean.PhotoBean;
|
9
|
10
|
import ai.pai.lensman.box.ApiClient;
|
10
|
11
|
import ai.pai.lensman.db.Preferences;
|
11
|
12
|
import retrofit2.Call;
|
|
|
@@ -4,6 +4,8 @@ import android.content.Context;
|
4
|
4
|
|
5
|
5
|
import java.util.ArrayList;
|
6
|
6
|
|
|
7
|
+import ai.pai.lensman.bean.PhotoBean;
|
|
8
|
+
|
7
|
9
|
public class SessionPresenterImpl implements SessionContract.SessionPresenter ,SessionInteractor.SessionListener{
|
8
|
10
|
|
9
|
11
|
private Context context;
|
|
|
@@ -13,6 +13,7 @@ import com.android.common.utils.DeviceUtils;
|
13
|
13
|
import java.util.ArrayList;
|
14
|
14
|
|
15
|
15
|
import ai.pai.lensman.R;
|
|
16
|
+import ai.pai.lensman.bean.SessionBean;
|
16
|
17
|
import butterknife.BindView;
|
17
|
18
|
import butterknife.ButterKnife;
|
18
|
19
|
|
|
|
@@ -13,6 +13,7 @@ import java.util.ArrayList;
|
13
|
13
|
|
14
|
14
|
import ai.pai.lensman.R;
|
15
|
15
|
import ai.pai.lensman.base.BaseActivity;
|
|
16
|
+import ai.pai.lensman.bean.SessionBean;
|
16
|
17
|
import ai.pai.lensman.briefs.BriefsActivity;
|
17
|
18
|
import butterknife.BindView;
|
18
|
19
|
import butterknife.ButterKnife;
|
|
|
@@ -2,6 +2,8 @@ package ai.pai.lensman.upload;
|
2
|
2
|
|
3
|
3
|
import java.util.ArrayList;
|
4
|
4
|
|
|
5
|
+import ai.pai.lensman.bean.SessionBean;
|
|
6
|
+
|
5
|
7
|
/**
|
6
|
8
|
* Created by chengzhenyu on 2016/7/7.
|
7
|
9
|
*/
|
|
|
@@ -5,6 +5,7 @@ import android.content.Intent;
|
5
|
5
|
|
6
|
6
|
import java.util.ArrayList;
|
7
|
7
|
|
|
8
|
+import ai.pai.lensman.bean.SessionBean;
|
8
|
9
|
import ai.pai.lensman.session.SessionActivity;
|
9
|
10
|
|
10
|
11
|
public class UploadPresenterImpl implements UploadContract.UploadPresenter {
|