Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Casanowow Life for love
VLC-Android
Commits
55382eda
Commit
55382eda
authored
Aug 23, 2017
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use onStart/onStop instead of onResume/onPause
parent
41f0e080
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
43 deletions
+26
-43
vlc-android/src/org/videolan/vlc/gui/MainActivity.java
vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+26
-43
No files found.
vlc-android/src/org/videolan/vlc/gui/MainActivity.java
View file @
55382eda
...
...
@@ -251,11 +251,37 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
@Override
protected
void
onStart
()
{
super
.
onStart
();
mCurrentFragmentId
=
mSettings
.
getInt
(
"fragment_id"
,
R
.
id
.
nav_video
);
if
(
mMediaLibrary
.
isInitiated
())
{
/* Load media items from database and storage */
if
(
mScanNeeded
&&
Permissions
.
canReadStorage
())
startService
(
new
Intent
(
MediaParsingService
.
ACTION_RELOAD
,
null
,
this
,
MediaParsingService
.
class
));
else
if
(!
currentIdIsExtension
())
restoreCurrentList
();
}
mNavigationView
.
setNavigationItemSelectedListener
(
this
);
if
(
BuildConfig
.
DEBUG
)
createExtensionServiceConnection
();
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
mNavigationView
.
setNavigationItemSelectedListener
(
null
);
if
(
getChangingConfigurations
()
==
0
)
{
/* Check for an ongoing scan that needs to be resumed during onResume */
mScanNeeded
=
mMediaLibrary
.
isWorking
();
}
/* Save the tab status in pref */
mSettings
.
edit
().
putInt
(
"fragment_id"
,
mCurrentFragmentId
).
apply
();
if
(
mExtensionServiceConnection
!=
null
)
{
unbindService
(
mExtensionServiceConnection
);
mExtensionServiceConnection
=
null
;
}
if
(
currentIdIsExtension
())
mSettings
.
edit
()
.
putString
(
"current_extension_name"
,
mExtensionsManager
.
getExtensions
(
getApplication
(),
false
).
get
(
mCurrentFragmentId
).
componentName
().
getPackageName
())
.
apply
();
}
private
void
loadPlugins
()
{
...
...
@@ -293,14 +319,12 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
private
void
createExtensionServiceConnection
()
{
mExtensionServiceConnection
=
new
ServiceConnection
()
{
@Override
public
void
onServiceConnected
(
ComponentName
name
,
IBinder
service
)
{
mExtensionManagerService
=
((
ExtensionManagerService
.
LocalBinder
)
service
).
getService
();
mExtensionManagerService
.
setExtensionManagerActivity
(
MainActivity
.
this
);
loadPlugins
();
}
@Override
public
void
onServiceDisconnected
(
ComponentName
name
)
{}
};
...
...
@@ -310,23 +334,6 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
mExtensionServiceConnection
=
null
;
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(
BuildConfig
.
DEBUG
)
createExtensionServiceConnection
();
mCurrentFragmentId
=
mSettings
.
getInt
(
"fragment_id"
,
R
.
id
.
nav_video
);
if
(
mMediaLibrary
.
isInitiated
())
{
/* Load media items from database and storage */
if
(
mScanNeeded
&&
Permissions
.
canReadStorage
())
startService
(
new
Intent
(
MediaParsingService
.
ACTION_RELOAD
,
null
,
this
,
MediaParsingService
.
class
));
else
if
(!
currentIdIsExtension
())
restoreCurrentList
();
}
mNavigationView
.
setNavigationItemSelectedListener
(
this
);
}
@Override
protected
void
onResumeFragments
()
{
super
.
onResumeFragments
();
...
...
@@ -335,30 +342,6 @@ public class MainActivity extends ContentActivity implements FilterQueryProvider
showFragment
(
mCurrentFragmentId
);
}
/**
* Stop audio player and save opened tab
*/
@Override
protected
void
onPause
()
{
super
.
onPause
();
mNavigationView
.
setNavigationItemSelectedListener
(
null
);
if
(
getChangingConfigurations
()
==
0
)
{
/* Check for an ongoing scan that needs to be resumed during onResume */
mScanNeeded
=
mMediaLibrary
.
isWorking
();
}
/* Save the tab status in pref */
mSettings
.
edit
().
putInt
(
"fragment_id"
,
mCurrentFragmentId
).
apply
();
if
(
mExtensionServiceConnection
!=
null
)
{
unbindService
(
mExtensionServiceConnection
);
mExtensionServiceConnection
=
null
;
}
if
(
currentIdIsExtension
())
mSettings
.
edit
()
.
putString
(
"current_extension_name"
,
mExtensionsManager
.
getExtensions
(
getApplication
(),
false
).
get
(
mCurrentFragmentId
).
componentName
().
getPackageName
())
.
apply
();
}
protected
void
onSaveInstanceState
(
Bundle
outState
)
{
if
(
mCurrentFragment
instanceof
ExtensionBrowser
)
mCurrentFragment
=
null
;
...
...
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