Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AndiovisualRecord
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yu_Tung
AndiovisualRecord
Commits
6789352e
Commit
6789352e
authored
Jun 29, 2020
by
Yu-Tung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6/28修改問題
parent
cac9468f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
21 deletions
+100
-21
LoginActivity.java
...com/example/audiovisualrecord/ui/login/LoginActivity.java
+6
-2
LoginPresenter.java
...om/example/audiovisualrecord/ui/login/LoginPresenter.java
+2
-1
MainActivity.java
...a/com/example/audiovisualrecord/ui/main/MainActivity.java
+38
-8
MainPresenter.java
.../com/example/audiovisualrecord/ui/main/MainPresenter.java
+29
-9
ApiService.java
...a/com/example/audiovisualrecord/utils/api/ApiService.java
+3
-1
LogoutSidRequest.java
...lrecord/utils/api/apidata/logoutsid/LogoutSidRequest.java
+22
-0
No files found.
app/src/main/java/com/example/audiovisualrecord/ui/login/LoginActivity.java
View file @
6789352e
...
...
@@ -64,8 +64,12 @@ public class LoginActivity extends BaseActivity implements LoginContract.View, V
switch
(
v
.
getId
())
{
case
R
.
id
.
btn_login
:
btnLogin
.
setEnabled
(
false
);
presenter
.
onLogin
(
""
,
""
);
if
(
onCheckUserisEmpty
())
{
showProgressDialog
(
"登入中"
);
presenter
.
onLogin
(
editAccount
.
getText
().
toString
(),
editPassword
.
getText
().
toString
());
}
else
{
btnLogin
.
setEnabled
(
true
);
}
break
;
}
}
...
...
app/src/main/java/com/example/audiovisualrecord/ui/login/LoginPresenter.java
View file @
6789352e
...
...
@@ -33,7 +33,8 @@ public class LoginPresenter<V extends LoginContract.View> implements LoginContra
@Override
public
void
onLogin
(
String
account
,
String
password
)
{
String
url
=
view
.
getResourceString
(
R
.
string
.
api_on_Login
);
LoginRequest
mLoginRequest
=
new
LoginRequest
(
LOGIN_AUTHORIZED_ID
,
"N000158385"
,
"781122222"
);
// LoginRequest mLoginRequest = new LoginRequest(LOGIN_AUTHORIZED_ID, "N000158385", "781122222");
LoginRequest
mLoginRequest
=
new
LoginRequest
(
LOGIN_AUTHORIZED_ID
,
account
,
password
);
compositeDisposable
.
add
(
api
.
onLogin
(
url
,
mLoginRequest
)
.
subscribeOn
(
schedulerProviderImp
.
io
())
.
observeOn
(
schedulerProviderImp
.
ui
())
...
...
app/src/main/java/com/example/audiovisualrecord/ui/main/MainActivity.java
View file @
6789352e
...
...
@@ -72,7 +72,7 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
private
String
pathShootType
=
""
;
private
String
uploadPath
=
""
;
//
Bundle bag;
Bundle
bag
;
String
token
,
imageFilePath
;
int
countFile
=
0
;
...
...
@@ -92,13 +92,27 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
// bag = getIntent().getExtras();
// token = bag.getString("token");
dismissProgressDialog
();
bag
=
getIntent
().
getExtras
();
token
=
bag
.
getString
(
"token"
);
init
();
mPresenter
=
new
MainPresenter
(
this
);
mPresenter
=
new
MainPresenter
(
this
,
token
);
mMainData
=
new
MainData
();
mChooseDeviceItemData
=
new
ChooseDeviceItemData
();
// mPresenter.onGetSid();
createSegVideoFolder
();
}
private
void
createSegVideoFolder
()
{
File
folder
=
new
File
(
Environment
.
getExternalStorageDirectory
()
+
File
.
separator
+
"Seg_Video"
);
boolean
success
=
true
;
if
(!
folder
.
exists
())
{
success
=
folder
.
mkdirs
();
}
else
{
Log
.
e
(
"wer"
,
"folder exists"
);
}
}
@Override
...
...
@@ -201,10 +215,12 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
storageDir
/* directory */
);
imageFilePath
=
image
.
getAbsolutePath
();
return
image
;
}
private
void
settingSystemCamera
(
Intent
intent
)
{
PackageManager
packageManager
=
MainActivity
.
this
.
getPackageManager
();
List
<
ResolveInfo
>
listCam
=
packageManager
.
queryIntentActivities
(
intent
,
0
);
...
...
@@ -228,7 +244,10 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
MediaStore
.
Images
.
Media
.
insertImage
(
getContentResolver
(),
myBitmap
,
imgFile
.
getName
(),
"description"
);
sendBroadcast
(
new
Intent
(
Intent
.
ACTION_MEDIA_SCANNER_SCAN_FILE
,
Uri
.
fromFile
(
new
File
(
Environment
.
getExternalStorageDirectory
().
getPath
()))));
// Intent it = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
// Uri uri = Uri.fromFile(imgFile);
// it.setData(uri);
// this.sendBroadcast(it);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -482,8 +501,9 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
for
(
String
path
:
uriList
)
{
File
uploadFile
=
new
File
(
path
);
Log
.
e
(
"file5555555"
,
uploadFile
.
length
()/
1024
/
1024
+
"mb"
);
buildernew
.
addFormDataPart
(
"file"
,
uploadFile
.
getName
(),
RequestBody
.
create
(
MediaType
.
parse
(
"
multiparty/form-data
"
),
path
));
RequestBody
.
create
(
MediaType
.
parse
(
"
application/octet-stream
"
),
path
));
}
RequestBody
body
=
buildernew
.
build
();
...
...
@@ -506,15 +526,25 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
Log
.
e
(
"response"
,
responsebody
);
// dismissProgressDialog();
if
(
json
.
get
(
"success"
).
equals
(
"true"
))
if
(
json
.
get
(
"success"
).
equals
(
"true"
))
{
MainActivity
.
this
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dismissProgressDialog
();
showDialogMessage
(
"上傳完成"
);
}
});
}
else
{
MainActivity
.
this
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
dismissProgressDialog
();
showDialogMessage
(
"上傳失敗"
);
}
});
}
// Log.e("isSuccess",json.get("IsSuccess").toString());
mPresenter
.
onLogoutSid
(
sidData
);
//登出sid
}
catch
(
final
IOException
|
JSONException
e
)
{
...
...
app/src/main/java/com/example/audiovisualrecord/ui/main/MainPresenter.java
View file @
6789352e
...
...
@@ -10,6 +10,7 @@ import com.example.audiovisualrecord.R;
import
com.example.audiovisualrecord.utils.api.ApiService
;
import
com.example.audiovisualrecord.utils.api.HttpMethods
;
import
com.example.audiovisualrecord.utils.api.apidata.logoutsid.LogoutSidRequest
;
import
com.example.audiovisualrecord.utils.api.apidata.searchco.CORequest
;
import
com.example.audiovisualrecord.utils.api.apidata.searchco.COResultList
;
import
com.example.audiovisualrecord.utils.api.apidata.logoutsid.LogoutSidResponse
;
...
...
@@ -41,7 +42,7 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
private
String
KEY_SEARCH_DP
=
"1c76477f-1fb0-49fb-a5bd-e75311bbe691"
;
private
String
KEY_SEARCH_SHIFT
=
"3e161e49-30d5-44ce-bbc4-3bcff49f7c37"
;
private
String
KEY_SEARCH_TYPE
=
"145ce81d-7bae-4848-a38a-e0e738385681"
;
private
String
USER_ID
=
"
N000158385
"
;
private
String
USER_ID
=
""
;
private
V
view
;
private
String
LOGIN_AUTHORIZED_ID
=
"acd9be92-46bf-4185-8721-5b60c67f0742"
;
...
...
@@ -49,8 +50,9 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
SchedulerProviderImp
schedulerProviderImp
=
new
SchedulerProviderImp
();
private
CompositeDisposable
compositeDisposable
;
public
MainPresenter
(
V
view
)
{
public
MainPresenter
(
V
view
,
String
userId
)
{
this
.
view
=
view
;
USER_ID
=
userId
;
api
=
HttpMethods
.
getInstance
().
getApi
();
compositeDisposable
=
new
CompositeDisposable
();
...
...
@@ -216,7 +218,7 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
.
subscribeWith
(
new
DisposableObserver
<
SIDDataList
>()
{
@Override
public
void
onNext
(
SIDDataList
mSIDDataList
)
{
view
.
onUploadFile
(
uriList
,
type
,
mSIDDataList
.
getsIdDataList
().
getSid
());
view
.
onUploadFile
(
uriList
,
type
,
mSIDDataList
.
getsIdDataList
().
getSid
());
// Log.e("sss", mSIDDataList.getSuccess());
}
...
...
@@ -235,8 +237,9 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
@Override
public
void
onLogoutSid
(
String
sid
)
{
String
url
=
"https://webapp.fpcitc.com.tw/SOP/api/FileUpload/PostLogout?sid="
+
sid
;
compositeDisposable
.
add
(
api
.
onLogoutSid
(
url
)
String
url
=
"https://webapp.fpcitc.com.tw/SOP/api/FileUpload/PostLogout"
;
LogoutSidRequest
mLogoutSidRequest
=
new
LogoutSidRequest
(
sid
);
compositeDisposable
.
add
(
api
.
onLogoutSid
(
url
,
mLogoutSidRequest
)
.
subscribeOn
(
schedulerProviderImp
.
io
())
.
observeOn
(
schedulerProviderImp
.
ui
())
.
subscribeWith
(
new
DisposableObserver
<
LogoutSidResponse
>()
{
...
...
@@ -276,6 +279,7 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
File
video
=
new
File
(
path
);
int
sizeLimit
=
50
*
1024
*
1024
;
Log
.
e
(
"size"
,
video
.
length
()
+
""
);
...
...
@@ -283,16 +287,20 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
int
startTime
=
0
;
int
segTime
=
30
;
//分割秒數
int
loop
=
0
;
if
(
duration
%
segTime
!=
0
)
{
loop
=
duration
/
segTime
+
1
;
}
else
{
loop
=
duration
/
segTime
;
}
if
(
video
.
length
()
>
sizeLimit
)
{
if
(
duration
<
30
)
{
segTime
=
segTime
/
2
;
}
for
(
int
i
=
0
;
i
<
loop
;
i
++)
{
int
rc
=
FFmpeg
.
execute
(
"-ss "
+
startTime
+
" -i "
+
path
+
" -t "
+
segTime
+
" "
+
Environment
.
getExternalStorageDirectory
().
toString
()
+
"/
seg_"
+
i
+
"_"
+
video
.
getName
().
replace
(
".mp4"
,
""
)
+
".mp4"
);
segVideoList
.
add
(
Environment
.
getExternalStorageDirectory
().
toString
()
+
"/seg_"
+
i
+
"_"
+
video
.
getName
());
int
rc
=
FFmpeg
.
execute
(
"-ss "
+
startTime
+
" -i "
+
path
+
" -t "
+
segTime
+
" "
+
Environment
.
getExternalStorageDirectory
().
toString
()
+
"/
Seg_Video"
+
"/seg_"
+
i
+
"_"
+
video
.
getName
().
replace
(
".mp4"
,
""
)
+
".mp4"
);
segVideoList
.
add
(
Environment
.
getExternalStorageDirectory
().
toString
()
+
"/seg_"
+
i
+
"_"
+
video
.
getName
());
if
(
rc
==
RETURN_CODE_SUCCESS
)
{
...
...
@@ -307,12 +315,12 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
startTime
+=
segTime
;
}
view
.
dismissProgressDialog
();
onGetSid
(
segVideoList
,
"video"
);
onGetSid
(
segVideoList
,
name
);
}
else
{
//沒超過
segVideoList
.
add
(
path
);
view
.
dismissProgressDialog
();
onGetSid
(
segVideoList
,
"video"
);
onGetSid
(
segVideoList
,
name
);
}
}
}).
start
();
...
...
@@ -333,6 +341,18 @@ public class MainPresenter<V extends MainContract.View> implements MainContract.
path
=
"/仁武氯乙烯廠製造一課/3_SOP落實度查核/DC"
;
}
else
if
(
"仁武氯乙烯廠製造一課"
.
equals
(
pathFactoryClass
)
&&
"落實度查核"
.
equals
(
pathShootType
)
&&
"DD"
.
equals
(
pathClass
))
{
path
=
"/仁武氯乙烯廠製造一課/3_SOP落實度查核/DD"
;
}
else
if
(
"仁武氯乙烯廠製造二課"
.
equals
(
pathFactoryClass
)
&&
"SOP導讀"
.
equals
(
pathShootType
))
{
path
=
"/仁武氯乙烯廠製造二課/1_SOP導讀"
;
}
else
if
(
"仁武氯乙烯廠製造二課"
.
equals
(
pathFactoryClass
)
&&
"SOP審視會議"
.
equals
(
pathShootType
))
{
path
=
"/仁武氯乙烯廠製造二課/2_SOP審視修訂"
;
}
else
if
(
"仁武氯乙烯廠製造二課"
.
equals
(
pathFactoryClass
)
&&
"落實度查核"
.
equals
(
pathShootType
)
&&
"DA"
.
equals
(
pathClass
))
{
path
=
"/仁武氯乙烯廠製造二課/3_SOP落實度查核/DA"
;
}
else
if
(
"仁武氯乙烯廠製造二課"
.
equals
(
pathFactoryClass
)
&&
"落實度查核"
.
equals
(
pathShootType
)
&&
"DB"
.
equals
(
pathClass
))
{
path
=
"/仁武氯乙烯廠製造二課/3_SOP落實度查核/DB"
;
}
else
if
(
"仁武氯乙烯廠製造二課"
.
equals
(
pathFactoryClass
)
&&
"落實度查核"
.
equals
(
pathShootType
)
&&
"DC"
.
equals
(
pathClass
))
{
path
=
"/仁武氯乙烯廠製造二課/3_SOP落實度查核/DC"
;
}
else
if
(
"仁武氯乙烯廠製造二課"
.
equals
(
pathFactoryClass
)
&&
"落實度查核"
.
equals
(
pathShootType
)
&&
"DD"
.
equals
(
pathClass
))
{
path
=
"/仁武氯乙烯廠製造二課/3_SOP落實度查核/DD"
;
}
return
path
;
}
...
...
app/src/main/java/com/example/audiovisualrecord/utils/api/ApiService.java
View file @
6789352e
package
com
.
example
.
audiovisualrecord
.
utils
.
api
;
import
com.example.audiovisualrecord.utils.api.apidata.logoutsid.LogoutSidRequest
;
import
com.example.audiovisualrecord.utils.api.apidata.searchco.CORequest
;
import
com.example.audiovisualrecord.utils.api.apidata.searchco.COResultList
;
import
com.example.audiovisualrecord.utils.api.apidata.login.LoginRequest
;
...
...
@@ -37,5 +38,6 @@ public interface ApiService {
@GET
Observable
<
SIDDataList
>
getSID
(
@Url
String
url
);
@POST
Observable
<
LogoutSidResponse
>
onLogoutSid
(
@Url
String
url
);
Observable
<
LogoutSidResponse
>
onLogoutSid
(
@Url
String
url
,
@Body
LogoutSidRequest
mLogoutSidRequest
);
}
app/src/main/java/com/example/audiovisualrecord/utils/api/apidata/logoutsid/LogoutSidRequest.java
0 → 100644
View file @
6789352e
package
com
.
example
.
audiovisualrecord
.
utils
.
api
.
apidata
.
logoutsid
;
import
com.google.gson.annotations.Expose
;
import
com.google.gson.annotations.SerializedName
;
public
class
LogoutSidRequest
{
@SerializedName
(
"sid"
)
@Expose
private
String
sid
;
public
LogoutSidRequest
(
String
sid
)
{
this
.
sid
=
sid
;
}
public
String
getSid
()
{
return
sid
;
}
public
void
setSid
(
String
sid
)
{
this
.
sid
=
sid
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment