switch to fullscreen mode on rotate when viewing media
This commit is contained in:
parent
d5b4e6990f
commit
de4e6eee25
4 changed files with 137 additions and 68 deletions
|
@ -52,7 +52,7 @@ task printVersionName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0-rc01'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.2.0-alpha06'
|
implementation 'com.google.android.material:material:1.2.0-alpha06'
|
||||||
implementation "androidx.cardview:cardview:1.0.0"
|
implementation "androidx.cardview:cardview:1.0.0"
|
||||||
|
|
|
@ -111,6 +111,7 @@ import io.lbry.browser.listener.DownloadActionListener;
|
||||||
import io.lbry.browser.listener.FetchChannelsListener;
|
import io.lbry.browser.listener.FetchChannelsListener;
|
||||||
import io.lbry.browser.listener.FetchClaimsListener;
|
import io.lbry.browser.listener.FetchClaimsListener;
|
||||||
import io.lbry.browser.listener.FilePickerListener;
|
import io.lbry.browser.listener.FilePickerListener;
|
||||||
|
import io.lbry.browser.listener.ScreenOrientationListener;
|
||||||
import io.lbry.browser.listener.SdkStatusListener;
|
import io.lbry.browser.listener.SdkStatusListener;
|
||||||
import io.lbry.browser.listener.StoragePermissionListener;
|
import io.lbry.browser.listener.StoragePermissionListener;
|
||||||
import io.lbry.browser.listener.WalletBalanceListener;
|
import io.lbry.browser.listener.WalletBalanceListener;
|
||||||
|
@ -173,6 +174,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
|
|
||||||
private Map<String, Class> specialRouteFragmentClassMap;
|
private Map<String, Class> specialRouteFragmentClassMap;
|
||||||
private boolean inPictureInPictureMode;
|
private boolean inPictureInPictureMode;
|
||||||
|
@Getter
|
||||||
|
private boolean inFullscreenMode;
|
||||||
public static SimpleExoPlayer appPlayer;
|
public static SimpleExoPlayer appPlayer;
|
||||||
public static Cache playerCache;
|
public static Cache playerCache;
|
||||||
public static boolean playerReassigned;
|
public static boolean playerReassigned;
|
||||||
|
@ -300,6 +303,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
private List<CameraPermissionListener> cameraPermissionListeners;
|
private List<CameraPermissionListener> cameraPermissionListeners;
|
||||||
private List<DownloadActionListener> downloadActionListeners;
|
private List<DownloadActionListener> downloadActionListeners;
|
||||||
private List<FilePickerListener> filePickerListeners;
|
private List<FilePickerListener> filePickerListeners;
|
||||||
|
private List<ScreenOrientationListener> screenOrientationListeners;
|
||||||
private List<SdkStatusListener> sdkStatusListeners;
|
private List<SdkStatusListener> sdkStatusListeners;
|
||||||
private List<StoragePermissionListener> storagePermissionListeners;
|
private List<StoragePermissionListener> storagePermissionListeners;
|
||||||
private List<WalletBalanceListener> walletBalanceListeners;
|
private List<WalletBalanceListener> walletBalanceListeners;
|
||||||
|
@ -394,31 +398,19 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
// setup uri bar
|
// setup uri bar
|
||||||
setupUriBar();
|
setupUriBar();
|
||||||
|
|
||||||
/*View decorView = getWindow().getDecorView();
|
|
||||||
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onSystemUiVisibilityChange(int visibility) {
|
|
||||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
|
||||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
|
|
||||||
findViewById(R.id.drawer_layout).setFitsSystemWindows(false);
|
|
||||||
} else {
|
|
||||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(true);
|
|
||||||
findViewById(R.id.drawer_layout).setFitsSystemWindows(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
// other
|
// other
|
||||||
pendingSyncSetQueue = new ArrayList<>();
|
pendingSyncSetQueue = new ArrayList<>();
|
||||||
openNavFragments = new HashMap<>();
|
openNavFragments = new HashMap<>();
|
||||||
|
|
||||||
cameraPermissionListeners = new ArrayList<>();
|
cameraPermissionListeners = new ArrayList<>();
|
||||||
downloadActionListeners = new ArrayList<>();
|
downloadActionListeners = new ArrayList<>();
|
||||||
|
fetchChannelsListeners = new ArrayList<>();
|
||||||
|
fetchClaimsListeners = new ArrayList<>();
|
||||||
filePickerListeners = new ArrayList<>();
|
filePickerListeners = new ArrayList<>();
|
||||||
|
screenOrientationListeners = new ArrayList<>();
|
||||||
sdkStatusListeners = new ArrayList<>();
|
sdkStatusListeners = new ArrayList<>();
|
||||||
storagePermissionListeners = new ArrayList<>();
|
storagePermissionListeners = new ArrayList<>();
|
||||||
walletBalanceListeners = new ArrayList<>();
|
walletBalanceListeners = new ArrayList<>();
|
||||||
fetchClaimsListeners = new ArrayList<>();
|
|
||||||
fetchChannelsListeners = new ArrayList<>();
|
|
||||||
|
|
||||||
sdkStatusListeners.add(this);
|
sdkStatusListeners.add(this);
|
||||||
|
|
||||||
|
@ -531,14 +523,30 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
checkNotificationOpenIntent(intent);
|
checkNotificationOpenIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCameraPermissionListener(CameraPermissionListener listener) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
if (!cameraPermissionListeners.contains(listener)) {
|
super.onConfigurationChanged(newConfig);
|
||||||
cameraPermissionListeners.add(listener);
|
switch (newConfig.orientation) {
|
||||||
|
case Configuration.ORIENTATION_PORTRAIT:
|
||||||
|
for (ScreenOrientationListener listener : screenOrientationListeners) {
|
||||||
|
listener.onPortraitOrientationEntered();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Configuration.ORIENTATION_LANDSCAPE:
|
||||||
|
for (ScreenOrientationListener listener : screenOrientationListeners) {
|
||||||
|
listener.onLandscapeOrientationEntered();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCameraPermissionListener(CameraPermissionListener listener) {
|
public void addScreenOrientationListener(ScreenOrientationListener listener) {
|
||||||
cameraPermissionListeners.remove(listener);
|
if (!screenOrientationListeners.contains(listener)) {
|
||||||
|
screenOrientationListeners.add(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeScreenOrientationListener(ScreenOrientationListener listener) {
|
||||||
|
screenOrientationListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDownloadActionListener(DownloadActionListener listener) {
|
public void addDownloadActionListener(DownloadActionListener listener) {
|
||||||
|
@ -561,6 +569,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
filePickerListeners.remove(listener);
|
filePickerListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addCameraPermissionListener(CameraPermissionListener listener) {
|
||||||
|
if (!cameraPermissionListeners.contains(listener)) {
|
||||||
|
cameraPermissionListeners.add(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeCameraPermissionListener(CameraPermissionListener listener) {
|
||||||
|
cameraPermissionListeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addSdkStatusListener(SdkStatusListener listener) {
|
public void addSdkStatusListener(SdkStatusListener listener) {
|
||||||
if (!sdkStatusListeners.contains(listener)) {
|
if (!sdkStatusListeners.contains(listener)) {
|
||||||
sdkStatusListeners.add(listener);
|
sdkStatusListeners.add(listener);
|
||||||
|
@ -764,7 +783,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
private void renderFullMode() {
|
private void renderFullMode() {
|
||||||
getSupportActionBar().show();
|
getSupportActionBar().show();
|
||||||
findViewById(R.id.content_main).setVisibility(View.VISIBLE);
|
findViewById(R.id.content_main).setVisibility(View.VISIBLE);
|
||||||
findViewById(R.id.floating_balance_main_container).setVisibility(View.VISIBLE);
|
findViewById(R.id.floating_balance_main_container).setVisibility(inFullscreenMode ? View.INVISIBLE : View.VISIBLE);
|
||||||
Fragment fragment = getCurrentFragment();
|
Fragment fragment = getCurrentFragment();
|
||||||
if (!(fragment instanceof FileViewFragment)) {
|
if (!(fragment instanceof FileViewFragment)) {
|
||||||
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
|
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
|
||||||
|
@ -1294,6 +1313,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enterFullScreenMode() {
|
public void enterFullScreenMode() {
|
||||||
|
inFullscreenMode = true;
|
||||||
hideFloatingWalletBalance();
|
hideFloatingWalletBalance();
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
|
@ -1337,6 +1357,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
actionBar.show();
|
actionBar.show();
|
||||||
}
|
}
|
||||||
|
inFullscreenMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initKeyStore() {
|
private void initKeyStore() {
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package io.lbry.browser.listener;
|
||||||
|
|
||||||
|
public interface ScreenOrientationListener {
|
||||||
|
void onPortraitOrientationEntered();
|
||||||
|
void onLandscapeOrientationEntered();
|
||||||
|
}
|
|
@ -94,6 +94,7 @@ import io.lbry.browser.dialog.SendTipDialogFragment;
|
||||||
import io.lbry.browser.exceptions.LbryUriException;
|
import io.lbry.browser.exceptions.LbryUriException;
|
||||||
import io.lbry.browser.listener.DownloadActionListener;
|
import io.lbry.browser.listener.DownloadActionListener;
|
||||||
import io.lbry.browser.listener.FetchClaimsListener;
|
import io.lbry.browser.listener.FetchClaimsListener;
|
||||||
|
import io.lbry.browser.listener.ScreenOrientationListener;
|
||||||
import io.lbry.browser.listener.SdkStatusListener;
|
import io.lbry.browser.listener.SdkStatusListener;
|
||||||
import io.lbry.browser.listener.StoragePermissionListener;
|
import io.lbry.browser.listener.StoragePermissionListener;
|
||||||
import io.lbry.browser.model.Claim;
|
import io.lbry.browser.model.Claim;
|
||||||
|
@ -135,7 +136,11 @@ import io.lbry.lbrysdk.LbrynetService;
|
||||||
import io.lbry.lbrysdk.Utils;
|
import io.lbry.lbrysdk.Utils;
|
||||||
|
|
||||||
public class FileViewFragment extends BaseFragment implements
|
public class FileViewFragment extends BaseFragment implements
|
||||||
MainActivity.BackPressInterceptor, DownloadActionListener, FetchClaimsListener, SdkStatusListener, StoragePermissionListener {
|
MainActivity.BackPressInterceptor, DownloadActionListener,
|
||||||
|
FetchClaimsListener,
|
||||||
|
ScreenOrientationListener,
|
||||||
|
SdkStatusListener,
|
||||||
|
StoragePermissionListener {
|
||||||
private static final int RELATED_CONTENT_SIZE = 16;
|
private static final int RELATED_CONTENT_SIZE = 16;
|
||||||
private static final String DEFAULT_PLAYBACK_SPEED = "1x";
|
private static final String DEFAULT_PLAYBACK_SPEED = "1x";
|
||||||
|
|
||||||
|
@ -218,6 +223,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
MainActivity activity = (MainActivity) context;
|
MainActivity activity = (MainActivity) context;
|
||||||
activity.setBackPressInterceptor(this);
|
activity.setBackPressInterceptor(this);
|
||||||
activity.addDownloadActionListener(this);
|
activity.addDownloadActionListener(this);
|
||||||
|
activity.addScreenOrientationListener(this);
|
||||||
activity.addFetchClaimsListener(this);
|
activity.addFetchClaimsListener(this);
|
||||||
if (!MainActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, context)) {
|
if (!MainActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, context)) {
|
||||||
activity.addStoragePermissionListener(this);
|
activity.addStoragePermissionListener(this);
|
||||||
|
@ -290,6 +296,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
|
|
||||||
if (claim != null) {
|
if (claim != null) {
|
||||||
Helper.saveViewHistory(currentUrl, claim);
|
Helper.saveViewHistory(currentUrl, claim);
|
||||||
|
checkAndLoadRelatedContent();
|
||||||
renderClaim();
|
renderClaim();
|
||||||
if (claim.getFile() == null) {
|
if (claim.getFile() == null) {
|
||||||
loadFile();
|
loadFile();
|
||||||
|
@ -352,8 +359,8 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initWebView(View view) {
|
private void initWebView(View root) {
|
||||||
WebView webView = view.findViewById(R.id.file_view_webview);
|
WebView webView = root.findViewById(R.id.file_view_webview);
|
||||||
webView.setWebViewClient(new LbryWebViewClient(getContext()));
|
webView.setWebViewClient(new LbryWebViewClient(getContext()));
|
||||||
WebSettings webSettings = webView.getSettings();
|
WebSettings webSettings = webView.getSettings();
|
||||||
webSettings.setAllowFileAccess(true);
|
webSettings.setAllowFileAccess(true);
|
||||||
|
@ -389,6 +396,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
logUrlEvent(url);
|
logUrlEvent(url);
|
||||||
resetViewCount();
|
resetViewCount();
|
||||||
resetFee();
|
resetFee();
|
||||||
|
|
||||||
View root = getView();
|
View root = getView();
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
((RecyclerView) root.findViewById(R.id.file_view_related_content_list)).setAdapter(null);
|
((RecyclerView) root.findViewById(R.id.file_view_related_content_list)).setAdapter(null);
|
||||||
|
@ -480,6 +488,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
|
|
||||||
if (claim != null) {
|
if (claim != null) {
|
||||||
Helper.saveViewHistory(url, claim);
|
Helper.saveViewHistory(url, claim);
|
||||||
|
checkAndLoadRelatedContent();
|
||||||
renderClaim();
|
renderClaim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,8 +540,10 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
MainActivity activity = (MainActivity) context;
|
MainActivity activity = (MainActivity) context;
|
||||||
activity.removeDownloadActionListener(this);
|
activity.removeDownloadActionListener(this);
|
||||||
activity.removeFetchClaimsListener(this);
|
activity.removeFetchClaimsListener(this);
|
||||||
|
activity.removeScreenOrientationListener(this);
|
||||||
activity.removeSdkStatusListener(this);
|
activity.removeSdkStatusListener(this);
|
||||||
activity.removeStoragePermissionListener(this);
|
activity.removeStoragePermissionListener(this);
|
||||||
|
//activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,6 +589,8 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
|
|
||||||
checkAndResetNowPlayingClaim();
|
checkAndResetNowPlayingClaim();
|
||||||
loadFile();
|
loadFile();
|
||||||
|
|
||||||
|
checkAndLoadRelatedContent();
|
||||||
renderClaim();
|
renderClaim();
|
||||||
} else {
|
} else {
|
||||||
// render nothing at location
|
// render nothing at location
|
||||||
|
@ -594,8 +607,6 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initUi(View root) {
|
private void initUi(View root) {
|
||||||
initWebView(root);
|
|
||||||
|
|
||||||
buttonPublishSomething.setOnClickListener(new View.OnClickListener() {
|
buttonPublishSomething.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -1189,13 +1200,18 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
} else {
|
} else {
|
||||||
restoreMainActionButton();
|
restoreMainActionButton();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
checkOwnClaim();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkAndLoadRelatedContent() {
|
||||||
|
View root = getView();
|
||||||
|
if (root != null) {
|
||||||
RecyclerView relatedContentList = root.findViewById(R.id.file_view_related_content_list);
|
RecyclerView relatedContentList = root.findViewById(R.id.file_view_related_content_list);
|
||||||
if (relatedContentList == null || relatedContentList.getAdapter() == null || relatedContentList.getAdapter().getItemCount() == 0) {
|
if (relatedContentList == null || relatedContentList.getAdapter() == null || relatedContentList.getAdapter().getItemCount() == 0) {
|
||||||
loadRelatedContent();
|
loadRelatedContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkOwnClaim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showUnsupportedView() {
|
private void showUnsupportedView() {
|
||||||
|
@ -1553,18 +1569,23 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
if (!fileExists) {
|
if (!fileExists) {
|
||||||
showError(getString(R.string.claim_file_not_found, claimFile != null ? claimFile.getDownloadPath() : ""));
|
showError(getString(R.string.claim_file_not_found, claimFile != null ? claimFile.getDownloadPath() : ""));
|
||||||
} else if (fileUri != null) {
|
} else if (fileUri != null) {
|
||||||
|
View root = getView();
|
||||||
|
Context context = getContext();
|
||||||
|
if (root != null) {
|
||||||
if (mediaType.startsWith("image")) {
|
if (mediaType.startsWith("image")) {
|
||||||
// display the image
|
// display the image
|
||||||
View container = getView().findViewById(R.id.file_view_imageviewer_container);
|
View container = root.findViewById(R.id.file_view_imageviewer_container);
|
||||||
PhotoView photoView = getView().findViewById(R.id.file_view_imageviewer);
|
PhotoView photoView = root.findViewById(R.id.file_view_imageviewer);
|
||||||
|
|
||||||
Glide.with(getContext().getApplicationContext()).load(fileUri).centerInside().into(photoView);
|
if (context != null) {
|
||||||
|
Glide.with(context.getApplicationContext()).load(fileUri).centerInside().into(photoView);
|
||||||
|
}
|
||||||
hideFloatingWalletBalance();
|
hideFloatingWalletBalance();
|
||||||
container.setVisibility(View.VISIBLE);
|
container.setVisibility(View.VISIBLE);
|
||||||
} else if (mediaType.startsWith("text")) {
|
} else if (mediaType.startsWith("text")) {
|
||||||
// show web view (and parse markdown too)
|
// show web view (and parse markdown too)
|
||||||
View container = getView().findViewById(R.id.file_view_webview_container);
|
View container = root.findViewById(R.id.file_view_webview_container);
|
||||||
WebView webView = getView().findViewById(R.id.file_view_webview);
|
WebView webView = root.findViewById(R.id.file_view_webview);
|
||||||
if (Arrays.asList("text/markdown", "text/md").contains(mediaType.toLowerCase())) {
|
if (Arrays.asList("text/markdown", "text/md").contains(mediaType.toLowerCase())) {
|
||||||
loadMarkdownFromFile(claimFile.getDownloadPath());
|
loadMarkdownFromFile(claimFile.getDownloadPath());
|
||||||
} else {
|
} else {
|
||||||
|
@ -1573,6 +1594,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
hideFloatingWalletBalance();
|
hideFloatingWalletBalance();
|
||||||
container.setVisibility(View.VISIBLE);
|
container.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1644,6 +1666,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false);
|
canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LighthouseSearchTask relatedTask = new LighthouseSearchTask(
|
LighthouseSearchTask relatedTask = new LighthouseSearchTask(
|
||||||
title, RELATED_CONTENT_SIZE, 0, canShowMatureContent, claimId, relatedLoading, new ClaimSearchResultHandler() {
|
title, RELATED_CONTENT_SIZE, 0, canShowMatureContent, claimId, relatedLoading, new ClaimSearchResultHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1655,7 +1678,9 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
relatedContentAdapter = new ClaimListAdapter(filteredClaims, context);
|
Context ctx = getContext();
|
||||||
|
if (ctx != null) {
|
||||||
|
relatedContentAdapter = new ClaimListAdapter(filteredClaims, ctx);
|
||||||
relatedContentAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
relatedContentAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClaimClicked(Claim claim) {
|
public void onClaimClicked(Claim claim) {
|
||||||
|
@ -1681,6 +1706,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
relatedContentAdapter == null || relatedContentAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
relatedContentAdapter == null || relatedContentAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception error) {
|
public void onError(Exception error) {
|
||||||
|
@ -1748,12 +1774,12 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SourceLockedOrientationActivity")
|
||||||
private void disableFullScreenMode() {
|
private void disableFullScreenMode() {
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
MainActivity activity = (MainActivity) context;
|
MainActivity activity = (MainActivity) context;
|
||||||
View root = getView();
|
View root = getView();
|
||||||
|
|
||||||
RelativeLayout mediaContainer = root.findViewById(R.id.file_view_media_container);
|
RelativeLayout mediaContainer = root.findViewById(R.id.file_view_media_container);
|
||||||
View exoplayerContainer = root.findViewById(R.id.file_view_exoplayer_container);
|
View exoplayerContainer = root.findViewById(R.id.file_view_exoplayer_container);
|
||||||
((ViewGroup) exoplayerContainer.getParent()).removeView(exoplayerContainer);
|
((ViewGroup) exoplayerContainer.getParent()).removeView(exoplayerContainer);
|
||||||
|
@ -2055,6 +2081,22 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
checkOwnClaim();
|
checkOwnClaim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPortraitOrientationEntered() {
|
||||||
|
Context context = getContext();
|
||||||
|
if (context instanceof MainActivity && ((MainActivity) context).isInFullscreenMode()) {
|
||||||
|
disableFullScreenMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLandscapeOrientationEntered() {
|
||||||
|
Context context = getContext();
|
||||||
|
if (claim != null && claim.isPlayable() && context instanceof MainActivity && !((MainActivity) context).isInFullscreenMode()) {
|
||||||
|
enableFullScreenMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class LbryWebViewClient extends WebViewClient {
|
private static class LbryWebViewClient extends WebViewClient {
|
||||||
private Context context;
|
private Context context;
|
||||||
public LbryWebViewClient(Context context) {
|
public LbryWebViewClient(Context context) {
|
||||||
|
|
Loading…
Reference in a new issue