mirror of
https://github.com/yuliskov/SmartTube.git
synced 2025-05-17 03:15:56 +08:00
npe fixes
This commit is contained in:
@ -619,6 +619,10 @@ public class PlayerUIController extends BasePlayerController {
|
||||
}
|
||||
|
||||
private boolean handleConfirmKey(int keyCode) {
|
||||
if (getPlayer() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean controlsShown = getPlayer().isOverlayShown();
|
||||
|
||||
if (KeyHelpers.isConfirmKey(keyCode) && !controlsShown) {
|
||||
|
@ -56,9 +56,16 @@ public class FileUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static File getFile(Context context, String path) {
|
||||
File filesDir = ContextCompat.getExternalFilesDirs(context, null)[0];
|
||||
|
||||
if (filesDir == null) { // storage device is unavailable
|
||||
return null;
|
||||
}
|
||||
|
||||
String npath = path == null ? "" : path;
|
||||
String absolutePath = ContextCompat.getExternalFilesDirs(context, null)[0].getPath();
|
||||
String absolutePath = filesDir.getPath();
|
||||
if (absolutePath.contains("/Android/data")) {
|
||||
int index = absolutePath.indexOf("/Android/data");
|
||||
String storage = absolutePath.substring(0, index).concat(npath.length() > 0 ? FILE_PATH_SEPARATOR : "");
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.liskovsoft.smartyoutubetv2.tv.ui.webbrowser;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.R;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.ui.common.LeanbackActivity;
|
||||
@ -11,11 +10,7 @@ public class WebBrowserActivity extends LeanbackActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
try {
|
||||
setContentView(R.layout.fragment_webbrowser);
|
||||
} catch (ClassCastException | Fragment.InstantiationException e) { // WebBrowserFragment is not a Fragment
|
||||
e.printStackTrace();
|
||||
finishReally();
|
||||
}
|
||||
// WebBrowserFragment is not a Fragment: ClassCastException or Fragment.InstantiationException
|
||||
setContentView(R.layout.fragment_webbrowser);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user