Release 1.13.0

This commit is contained in:
Thomas 2021-01-16 18:25:59 +01:00
parent a7f9256947
commit d5a5fdf52e
9 changed files with 114 additions and 82 deletions

View File

@ -11,8 +11,8 @@ android {
minSdkVersion 21
targetSdkVersion 30
versionCode 37
versionName "1.12.1"
versionCode 38
versionName "1.13.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -11,6 +11,12 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".PeertubeActivity" />
</activity>
<activity
android:name=".expandedcontrols.ExpandedControlsActivity"
android:theme="@style/AppThemeNoActionBar"
/>
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="app.fedilab.fedilabtube.provider.CastOptionsProvider" />

View File

@ -99,7 +99,7 @@ public class BasePeertubeActivity extends AppCompatActivity {
@Override
public void onSessionStarted(CastSession castSession, String s) {
onApplicationConnected(castSession);
onApplicationConnected(castSession, true);
}
@Override
@ -123,7 +123,7 @@ public class BasePeertubeActivity extends AppCompatActivity {
@Override
public void onSessionResumed(CastSession castSession, boolean b) {
onApplicationConnected(castSession);
onApplicationConnected(castSession, false);
}
@Override
@ -136,16 +136,20 @@ public class BasePeertubeActivity extends AppCompatActivity {
onApplicationDisconnected();
}
private void onApplicationConnected(CastSession castSession) {
private void onApplicationConnected(CastSession castSession, boolean hide) {
mCastSession = castSession;
supportInvalidateOptionsMenu();
player.setPlayWhenReady(false);
binding.doubleTapPlayerView.setVisibility(View.INVISIBLE);
if (hide) {
binding.doubleTapPlayerView.setVisibility(View.INVISIBLE);
}
binding.minController.castMiniController.setVisibility(View.VISIBLE);
loadCast();
}
private void onApplicationDisconnected() {
binding.doubleTapPlayerView.setVisibility(View.VISIBLE);
binding.minController.castMiniController.setVisibility(View.GONE);
supportInvalidateOptionsMenu();
}
};

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/castMiniController"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone">
<fragment
class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1425,7 +1425,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
@Override
public void onConfigurationChanged(@NotNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (binding.castController.getVisibility() == View.VISIBLE) {
if (binding.minController.castMiniController.getVisibility() == View.VISIBLE) {
return;
}
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
@ -1478,7 +1478,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
public void onResume() {
super.onResume();
onStopCalled = false;
if (player != null && !player.isPlaying()) {
if (player != null && !player.isPlaying() && binding.minController.castMiniController.getVisibility() != View.VISIBLE) {
player.setPlayWhenReady(autoPlay);
if (autoPlay) {
binding.doubleTapPlayerView.hideController();
@ -1494,7 +1494,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
}
if (player != null && (!isPlayInMinimized || !playInMinimized)) {
player.setPlayWhenReady(false);
} else if (playInMinimized && binding.castController.getVisibility() != View.VISIBLE) {
} else if (playInMinimized && binding.minController.castMiniController.getVisibility() != View.VISIBLE) {
enterVideoMode();
}
}

View File

@ -259,11 +259,9 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
@Override
public void onPause() {
super.onPause();
if (binding.swipeContainer != null) {
binding.swipeContainer.setEnabled(false);
binding.swipeContainer.setRefreshing(false);
binding.swipeContainer.clearAnimation();
}
binding.swipeContainer.setEnabled(false);
binding.swipeContainer.setRefreshing(false);
binding.swipeContainer.clearAnimation();
if (getActivity() != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null && getView() != null) {
@ -431,7 +429,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
}
public void manageVIewRelationship(APIResponse apiResponse) {
if (apiResponse.getError() != null) {
if (apiResponse.getError() != null || apiResponse.getRelationships() == null) {
return;
}
if (relationship == null) {

View File

@ -75,58 +75,9 @@
android:scaleType="fitCenter"
android:visibility="gone" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cast_controller"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone">
<ImageView
android:id="@+id/cast_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/play"
android:src="@drawable/ic_baseline_play_arrow_32"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cast_loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/cast_loader_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/please_wait"
android:textColor="?colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/cast_loader_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.github.ybq.android.spinkit.SpinKitView
android:id="@+id/cast_loader_small"
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_gravity="center"
android:layout_marginStart="5dp"
app:SpinKit_Color="?colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cast_loader_text"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<include
android:id="@+id/min_controller"
layout="@layout/min_controller" />
<app.fedilab.fedilabtube.webview.CustomWebview
android:id="@+id/webview_video"

View File

@ -47,7 +47,6 @@ import static app.fedilab.fedilabtube.helper.Helper.CAST_ID;
public class BasePeertubeActivity extends AppCompatActivity {
protected ActivityPeertubeBinding binding;
private String chromeCastVideoURL;
protected VideoData.Video peertube;
protected SimpleExoPlayer player;
protected String videoURL;
@ -60,8 +59,8 @@ public class BasePeertubeActivity extends AppCompatActivity {
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
binding.castPlay.setOnClickListener(v -> {
binding.castLoader.setVisibility(View.VISIBLE);
binding.minController.castPlay.setOnClickListener(v -> {
binding.minController.castLoader.setVisibility(View.VISIBLE);
if (BaseMainActivity.chromeCast != null) {
new Thread(() -> {
try {
@ -76,11 +75,11 @@ public class BasePeertubeActivity extends AppCompatActivity {
if (icon != -1) {
Handler mainHandler = new Handler(Looper.getMainLooper());
int finalIcon = icon;
Runnable myRunnable = () -> binding.castPlay.setImageResource(finalIcon);
Runnable myRunnable = () -> binding.minController.castPlay.setImageResource(finalIcon);
mainHandler.post(myRunnable);
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> binding.castLoader.setVisibility(View.GONE);
Runnable myRunnable = () -> binding.minController.castLoader.setVisibility(View.GONE);
mainHandler.post(myRunnable);
} catch (IOException e) {
e.printStackTrace();
@ -123,7 +122,7 @@ public class BasePeertubeActivity extends AppCompatActivity {
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
binding.doubleTapPlayerView.setVisibility(View.VISIBLE);
binding.castController.setVisibility(View.GONE);
binding.minController.castMiniController.setVisibility(View.GONE);
};
mainHandler.post(myRunnable);
@ -136,14 +135,14 @@ public class BasePeertubeActivity extends AppCompatActivity {
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
invalidateOptionsMenu();
binding.castLoader.setVisibility(View.VISIBLE);
binding.minController.castLoader.setVisibility(View.VISIBLE);
player.setPlayWhenReady(false);
binding.doubleTapPlayerView.setVisibility(View.GONE);
binding.castController.setVisibility(View.VISIBLE);
binding.minController.castMiniController.setVisibility(View.VISIBLE);
dialog.dismiss();
if (chromeCastVideoURL != null) {
if (videoURL != null) {
if (player != null && player.getCurrentPosition() > 0) {
chromeCastVideoURL += "?start=" + (player.getCurrentPosition() / 1000);
videoURL += "?start=" + (player.getCurrentPosition() / 1000);
}
}
};
@ -157,14 +156,14 @@ public class BasePeertubeActivity extends AppCompatActivity {
if (BaseMainActivity.chromeCast.isAppAvailable(CAST_ID) && !status.isAppRunning(CAST_ID)) {
BaseMainActivity.chromeCast.launchApp(CAST_ID);
}
if (chromeCastVideoURL != null) {
String mime = MimeTypeMap.getFileExtensionFromUrl(chromeCastVideoURL);
if (videoURL != null) {
String mime = MimeTypeMap.getFileExtensionFromUrl(videoURL);
BaseMainActivity.chromeCast.setRequestTimeout(60000);
BaseMainActivity.chromeCast.load(peertube.getTitle(), null, chromeCastVideoURL, mime);
BaseMainActivity.chromeCast.load(peertube.getTitle(), null, videoURL, mime);
BaseMainActivity.chromeCast.play();
binding.castPlay.setImageResource(R.drawable.ic_baseline_pause_32);
binding.minController.castPlay.setImageResource(R.drawable.ic_baseline_pause_32);
}
myRunnable = () -> binding.castLoader.setVisibility(View.GONE);
myRunnable = () -> binding.minController.castLoader.setVisibility(View.GONE);
mainHandler.post(myRunnable);
} catch (IOException | GeneralSecurityException e) {
e.printStackTrace();

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/castMiniController"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone">
<ImageView
android:id="@+id/cast_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/play"
android:src="@drawable/ic_baseline_play_arrow_32"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cast_loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/cast_loader_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/please_wait"
android:textColor="?colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/cast_loader_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.github.ybq.android.spinkit.SpinKitView
android:id="@+id/cast_loader_small"
style="@style/progressBottom"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_gravity="center"
android:layout_marginStart="5dp"
app:SpinKit_Color="?colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cast_loader_text"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>