use of org.videolan.vlc.gui.MainActivity in project vlc-android by GeoffreyMetais.
the class VideoPlayerActivity method switchToAudioMode.
public void switchToAudioMode(boolean showUI) {
if (mService == null)
return;
mSwitchingView = true;
// Show the MainActivity if it is not in background.
if (showUI) {
Intent i = new Intent(this, VLCApplication.showTvUi() ? AudioPlayerActivity.class : MainActivity.class);
startActivity(i);
} else
mSettings.edit().putBoolean(PreferencesActivity.VIDEO_RESTORE, true).apply();
exitOK();
}
use of org.videolan.vlc.gui.MainActivity in project vlc-android by GeoffreyMetais.
the class BaseBrowserFragment method goBack.
public boolean goBack() {
final FragmentActivity activity = getActivity();
if (activity == null)
return false;
if (!mRoot) {
final FragmentManager fm = activity.getSupportFragmentManager();
final String tag = fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName();
if (!activity.getSupportFragmentManager().popBackStackImmediate() && activity instanceof MainActivity)
((MainActivity) activity).getNavigator().showFragment(this instanceof NetworkBrowserFragment ? R.id.nav_network : R.id.nav_directories);
final Fragment current = fm.findFragmentByTag(tag);
final View view = current != null ? current.getView() : null;
if (view != null)
view.setVisibility(View.VISIBLE);
}
return !mRoot;
}
use of org.videolan.vlc.gui.MainActivity in project vlc-android by GeoffreyMetais.
the class ExtensionsManager method updateAvailableExtensions.
private List<ExtensionListing> updateAvailableExtensions(Context context) {
androidAutoInstalled = isAndroidAutoInstalled(context);
PackageManager pm = context.getPackageManager();
List<ResolveInfo> resolveInfos = pm.queryIntentServices(new Intent(ACTION_EXTENSION), PackageManager.GET_META_DATA);
List<ExtensionListing> extensions = new ArrayList<>();
for (ResolveInfo resolveInfo : resolveInfos) {
ExtensionListing extension = new ExtensionListing();
extension.componentName(new ComponentName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name));
Bundle metaData = resolveInfo.serviceInfo.metaData;
if (metaData != null) {
extension.compatible(metaData.getInt(KEY_PROTOCOL_VERSION) == PROTOCOLE_VERSION);
if (!extension.compatible())
continue;
String title = metaData.getString(KEY_LISTING_TITLE);
extension.title(title != null ? title : resolveInfo.loadLabel(pm).toString());
extension.description(metaData.getString(KEY_DESCRIPTION));
String settingsActivity = metaData.getString(KEY_SETTINGS_ACTIVITY);
if (!TextUtils.isEmpty(settingsActivity)) {
extension.settingsActivity(ComponentName.unflattenFromString(resolveInfo.serviceInfo.packageName + "/" + settingsActivity));
}
extension.androidAutoEnabled(metaData.getBoolean(KEY_ANDROID_AUTO_ENABLED, false));
extension.menuIcon(metaData.getInt(KEY_MENU_ICON, 0));
extensions.add(extension);
}
}
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
deleteUnusedExtensionPreferences(extensions, settings);
if (context instanceof MainActivity && ((MainActivity) context).getNavigator().currentIdIsExtension()) {
if (previousExtensionIsEnabled(context)) {
String lastExtensionTitle = settings.getString("current_extension_name", null);
for (int i = 0; i < extensions.size(); ++i) {
if (TextUtils.equals(extensions.get(i).title(), lastExtensionTitle)) {
((MainActivity) context).getNavigator().setCurrentFragmentId(i);
settings.edit().putInt("fragment_id", i).apply();
break;
}
}
} else {
((MainActivity) context).getNavigator().setCurrentFragmentId(-1);
settings.edit().putInt("fragment_id", -1).apply();
}
}
synchronized (mExtensions) {
mExtensions.clear();
mExtensions.addAll(extensions);
}
return extensions;
}
Aggregations