Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
eDrive
Commits
a8941f28
Commit
a8941f28
authored
Sep 01, 2021
by
narinder Rana
Browse files
intent put extra bundle value File ObserverService to ObserverService
parent
fe90bc08
Pipeline
#132995
failed with stage
in 7 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/drive/models/SyncedFileState.java
View file @
a8941f28
...
...
@@ -11,12 +11,14 @@ package foundation.e.drive.models;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
java.io.Serializable
;
/**
* @author Vincent Bourgmayer
* Describe a file state which will be Synchronized (= Synced) or which has already been synced one times
*/
public
class
SyncedFileState
implements
Parcelable
{
public
class
SyncedFileState
implements
Parcelable
,
Serializable
{
protected
SyncedFileState
(){};
//@ToRemove. Test Only. It's to allow to make a mock SyncedFileState Class in test.
...
...
app/src/main/java/foundation/e/drive/services/FileObserverService.java
View file @
a8941f28
...
...
@@ -5,6 +5,7 @@ import android.app.Service;
import
android.content.Intent
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.FileObserver
;
...
...
@@ -130,28 +131,34 @@ public class FileObserverService extends Service {
super
.
onPostExecute
(
s
);
// Log.d("onPostExecute", "...ObserverService Intent...post Execute " );
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
// Log.e("onPostExecute", "...ObserverService Intent..." );
// Do something after 20s = 20000ms
try
{
Log
.
e
(
"TAG"
,
"========================================="
);
Log
.
e
(
"TAG"
,
"File Observer to Observer services....."
);
Intent
observersServiceIntent
=
new
Intent
(
getApplicationContext
(),
foundation
.
e
.
drive
.
services
.
ObserverService
.
class
);
observersServiceIntent
.
putExtra
(
"isFileObserverService"
,
true
);
observersServiceIntent
.
putExtra
(
"fileObserverObject"
,
CommonUtils
.
convertToBytes
(
new
foundation
.
e
.
drive
.
models
.
FileObserver
(
files
,
syncedFileStatesList
)));
startService
(
observersServiceIntent
);
}
catch
(
Exception
exception
){
exception
.
printStackTrace
();
}
observerFlag
=-
1
;
}
},
20000
);
try
{
Log
.
e
(
"TAG"
,
"========================================="
);
Log
.
e
(
"TAG"
,
"File Observer to Observer services....."
);
Intent
observersServiceIntent
=
new
Intent
(
getApplicationContext
(),
foundation
.
e
.
drive
.
services
.
ObserverService
.
class
);
Bundle
mBundle
=
new
Bundle
();
mBundle
.
putBoolean
(
"isFileObserverService"
,
true
);
mBundle
.
putByteArray
(
"fileObserverObject"
,
CommonUtils
.
convertToBytes
(
new
foundation
.
e
.
drive
.
models
.
FileObserver
(
files
,
syncedFileStatesList
)));
observersServiceIntent
.
putExtras
(
mBundle
);
startService
(
observersServiceIntent
);
}
catch
(
Exception
exception
){
exception
.
printStackTrace
();
}
observerFlag
=-
1
;
// final Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// // Log.e("onPostExecute", "...ObserverService Intent..." );
// // Do something after 20s = 20000ms
//
//
//
//
//
// }
// }, 20000);
}
...
...
app/src/main/java/foundation/e/drive/services/ObserverService.java
View file @
a8941f28
...
...
@@ -91,8 +91,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene
isFileObserverService
=
bundle
.
getBoolean
(
"isFileObserverService"
);
fileObserverObject
=
(
foundation
.
e
.
drive
.
models
.
FileObserver
)
CommonUtils
.
convertFromBytes
(
bundle
.
getByteArray
(
"fileObserverObject"
));
}
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
...
...
@@ -255,7 +253,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
}
}
else
{
if
(
isFileObserverService
){
Log
.
e
(
"TAG"
,
"isFileObserverService................"
+
isFileObserverService
);
handleLocalFiles
(
fileObserverObject
.
getFiles
(),
fileObserverObject
.
getSyncedFileStatesList
());
}
else
{
...
...
Write
Preview
Supports
Markdown
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