mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-06-05 21:09:11 +02:00
Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5a5fdf52e | |||
a7f9256947 | |||
d769729901 | |||
b2026c8784 | |||
b29de141ef | |||
6d4772da75 | |||
2344fe0942 | |||
7c309b68b8 | |||
c8c5e56a17 | |||
cef227ba42 | |||
02296b038a | |||
b76a4cfcf5 | |||
f168f101bc | |||
2e8a86fe20 | |||
fe0d2fe726 | |||
9b322cc922 | |||
346656e53d | |||
6e6187175a | |||
5e832fa046 | |||
34007d4507 | |||
fd400f025e | |||
f3f474ee13 | |||
d971032d52 | |||
961c77103e | |||
b22b21c47a | |||
6d70bd758a | |||
087ac92f15 | |||
99fe789f30 | |||
10892f92f1 | |||
0a919c85ab | |||
761abc013f |
@ -1,6 +1,8 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: "androidx.navigation.safeargs"
|
||||
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.2"
|
||||
@ -9,8 +11,8 @@ android {
|
||||
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 34
|
||||
versionName "1.11.0"
|
||||
versionCode 38
|
||||
versionName "1.13.0"
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -51,6 +53,9 @@ android {
|
||||
buildConfigField "boolean", "sepia_search", "false"
|
||||
buildConfigField "boolean", "instance_switcher", "true"
|
||||
buildConfigField "boolean", "allow_remote_connections", "false"
|
||||
buildConfigField "boolean", "google_cast_lib", "false"
|
||||
buildConfigField "int", "cast_enabled", "0"
|
||||
buildConfigField "int", "default_theme", "2"
|
||||
}
|
||||
google_peertube_apps_educ {
|
||||
applicationId "app.fedilab.fedilabtube"
|
||||
@ -63,6 +68,9 @@ android {
|
||||
buildConfigField "boolean", "sepia_search", "false"
|
||||
buildConfigField "boolean", "instance_switcher", "true"
|
||||
buildConfigField "boolean", "allow_remote_connections", "false"
|
||||
buildConfigField "boolean", "google_cast_lib", "false"
|
||||
buildConfigField "int", "cast_enabled", "0"
|
||||
buildConfigField "int", "default_theme", "2"
|
||||
}
|
||||
fdroid_full {
|
||||
applicationId "app.fedilab.tubelab"
|
||||
@ -75,6 +83,9 @@ android {
|
||||
buildConfigField "boolean", "sepia_search", "true"
|
||||
buildConfigField "boolean", "instance_switcher", "true"
|
||||
buildConfigField "boolean", "allow_remote_connections", "true"
|
||||
buildConfigField "boolean", "google_cast_lib", "false"
|
||||
buildConfigField "int", "cast_enabled", "0"
|
||||
buildConfigField "int", "default_theme", "2"
|
||||
}
|
||||
google_full {
|
||||
applicationId "app.fedilab.tubelab"
|
||||
@ -87,6 +98,9 @@ android {
|
||||
buildConfigField "boolean", "sepia_search", "true"
|
||||
buildConfigField "boolean", "instance_switcher", "true"
|
||||
buildConfigField "boolean", "allow_remote_connections", "true"
|
||||
buildConfigField "boolean", "google_cast_lib", "true"
|
||||
buildConfigField "int", "cast_enabled", "1"
|
||||
buildConfigField "int", "default_theme", "2"
|
||||
}
|
||||
queermotion {
|
||||
applicationId "org.queermotion.peertube"
|
||||
@ -99,6 +113,9 @@ android {
|
||||
buildConfigField "boolean", "sepia_search", "false"
|
||||
buildConfigField "boolean", "instance_switcher", "false"
|
||||
buildConfigField "boolean", "allow_remote_connections", "false"
|
||||
buildConfigField "boolean", "google_cast_lib", "false"
|
||||
buildConfigField "int", "cast_enabled", "0"
|
||||
buildConfigField "int", "default_theme", "2"
|
||||
}
|
||||
bittube {
|
||||
applicationId "app.fedilab.bittube"
|
||||
@ -111,33 +128,38 @@ android {
|
||||
buildConfigField "boolean", "sepia_search", "false"
|
||||
buildConfigField "boolean", "instance_switcher", "true"
|
||||
buildConfigField "boolean", "allow_remote_connections", "false"
|
||||
buildConfigField "boolean", "google_cast_lib", "true"
|
||||
buildConfigField "int", "cast_enabled", "1"
|
||||
buildConfigField "int", "default_theme", "1"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
fdroid_peertube_apps_educ {
|
||||
res.srcDirs = ['src/main/res', 'src/acad/res']
|
||||
java.srcDirs = ['src/main/java', 'src/acad/java']
|
||||
res.srcDirs = ['src/main/res', 'src/acad/res', 'src/no_google_cast_lib/res']
|
||||
java.srcDirs = ['src/main/java', 'src/acad/java', 'src/no_google_donation/java', 'src/no_google_cast_lib/java']
|
||||
}
|
||||
google_peertube_apps_educ {
|
||||
res.srcDirs = ['src/main/res', 'src/acad/res']
|
||||
java.srcDirs = ['src/main/java', 'src/acad/java']
|
||||
res.srcDirs = ['src/main/res', 'src/acad/res', 'src/no_google_cast_lib/res']
|
||||
java.srcDirs = ['src/main/java', 'src/acad/java', 'src/no_google_donation/java', 'src/no_google_cast_lib/java']
|
||||
}
|
||||
fdroid_full {
|
||||
res.srcDirs = ['src/main/res', 'src/full/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java']
|
||||
res.srcDirs = ['src/main/res', 'src/full/res', 'src/no_google_cast_lib/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java', 'src/no_google_donation/java', 'src/no_google_cast_lib/java']
|
||||
}
|
||||
google_full {
|
||||
res.srcDirs = ['src/main/res', 'src/full/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java']
|
||||
res.srcDirs = ['src/main/res', 'src/full/res', 'src/google_donation/res', 'src/google_cast_lib/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java', 'src/google_donation/java', 'src/google_cast_lib/java']
|
||||
manifest.srcFile "src/google_cast_lib/AndroidManifest.xml"
|
||||
}
|
||||
queermotion {
|
||||
res.srcDirs = ['src/main/res', 'src/queermotion/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java']
|
||||
res.srcDirs = ['src/main/res', 'src/queermotion/res', 'src/no_google_cast_lib/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java', 'src/no_google_donation/java', 'src/no_google_cast_lib/java']
|
||||
}
|
||||
bittube {
|
||||
res.srcDirs = ['src/main/res', 'src/bittube/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java']
|
||||
res.srcDirs = ['src/main/res', 'src/bittube/res', 'src/google_cast_lib/res']
|
||||
java.srcDirs = ['src/main/java', 'src/full/java', 'src/no_google_donation/java', 'src/google_cast_lib/java']
|
||||
manifest.srcFile "src/google_cast_lib/AndroidManifest.xml"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,6 +199,7 @@ dependencies {
|
||||
implementation "com.github.mabbas007:TagsEditText:1.0.5"
|
||||
implementation "com.github.bumptech.glide:glide:4.11.0"
|
||||
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
|
||||
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
implementation "net.gotev:uploadservice:4.5.1"
|
||||
implementation "net.gotev:uploadservice-okhttp:4.5.1"
|
||||
@ -194,15 +217,34 @@ dependencies {
|
||||
implementation "androidx.work:work-runtime:2.4.0"
|
||||
implementation "androidx.work:work-runtime-ktx:2.4.0"
|
||||
|
||||
//custom cast feature
|
||||
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
||||
implementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||
implementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||
|
||||
//************ DONATION GOOGLE ONLY **************//
|
||||
google_fullImplementation "com.android.billingclient:billing:3.0.2"
|
||||
|
||||
//************ MATOMO --> acad instances only **************//
|
||||
|
||||
fdroid_peertube_apps_educImplementation 'org.matomo.sdk:tracker:4.1.2'
|
||||
google_peertube_apps_educImplementation 'org.matomo.sdk:tracker:4.1.2'
|
||||
|
||||
//************ CAST **************///
|
||||
|
||||
//---> Google libs (google_full + bittube)
|
||||
google_fullImplementation "androidx.mediarouter:mediarouter:1.2.1"
|
||||
google_fullImplementation 'com.google.android.gms:play-services-cast-framework:19.0.0'
|
||||
bittubeImplementation "androidx.mediarouter:mediarouter:1.2.1"
|
||||
bittubeImplementation 'com.google.android.gms:play-services-cast-framework:19.0.0'
|
||||
//----> Other flavors
|
||||
fdroid_peertube_apps_educImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||
fdroid_peertube_apps_educImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||
fdroid_peertube_apps_educImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||
google_peertube_apps_educImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||
google_peertube_apps_educImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||
google_peertube_apps_educImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||
fdroid_fullImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||
fdroid_fullImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||
fdroid_fullImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||
queermotionImplementation 'su.litvak.chromecast:api-v2:0.11.3'
|
||||
queermotionImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0'
|
||||
queermotionImplementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||
|
||||
}
|
24
app/src/google_cast_lib/AndroidManifest.xml
Normal file
24
app/src/google_cast_lib/AndroidManifest.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="app.fedilab.fedilabtube">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".PeertubeActivity"
|
||||
tools:node="merge">
|
||||
<meta-data
|
||||
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" />
|
||||
</application>
|
||||
</manifest>
|
@ -0,0 +1,41 @@
|
||||
package app.fedilab.fedilabtube;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import app.fedilab.fedilabtube.databinding.ActivityMainBinding;
|
||||
|
||||
public class BaseMainActivity extends AppCompatActivity {
|
||||
|
||||
protected ActivityMainBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
setContentView(view);
|
||||
}
|
||||
|
||||
//Method for discovering cast devices
|
||||
public void discoverCast() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package app.fedilab.fedilabtube;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.gms.cast.MediaInfo;
|
||||
import com.google.android.gms.cast.MediaMetadata;
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||
import com.google.android.gms.cast.framework.CastContext;
|
||||
import com.google.android.gms.cast.framework.CastSession;
|
||||
import com.google.android.gms.cast.framework.SessionManagerListener;
|
||||
import com.google.android.gms.cast.framework.media.RemoteMediaClient;
|
||||
import com.google.android.gms.common.images.WebImage;
|
||||
|
||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||
import app.fedilab.fedilabtube.databinding.ActivityPeertubeBinding;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
public class BasePeertubeActivity extends AppCompatActivity {
|
||||
|
||||
protected ActivityPeertubeBinding binding;
|
||||
protected VideoData.Video peertube;
|
||||
protected SimpleExoPlayer player;
|
||||
protected String videoURL;
|
||||
protected String subtitlesStr;
|
||||
|
||||
private CastContext mCastContext;
|
||||
private CastSession mCastSession;
|
||||
private SessionManagerListener<CastSession> mSessionManagerListener;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
setContentView(view);
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
||||
int search_cast = sharedpreferences.getInt(getString(R.string.set_cast_choice), BuildConfig.cast_enabled);
|
||||
if (search_cast == 1) {
|
||||
setupCastListener();
|
||||
mCastContext = CastContext.getSharedInstance(this);
|
||||
mCastSession = mCastContext.getSessionManager().getCurrentCastSession();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void loadCast() {
|
||||
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
|
||||
|
||||
movieMetadata.putString(MediaMetadata.KEY_TITLE, peertube.getTitle());
|
||||
movieMetadata.putString(MediaMetadata.KEY_ARTIST, peertube.getAccount().getDisplayName());
|
||||
if (subtitlesStr != null) {
|
||||
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subtitlesStr);
|
||||
}
|
||||
movieMetadata.addImage(new WebImage(Uri.parse("https://" + peertube.getChannel().getHost() + peertube.getPreviewPath())));
|
||||
MediaInfo mediaInfo = new MediaInfo.Builder(videoURL)
|
||||
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
|
||||
.setMetadata(movieMetadata)
|
||||
.setStreamDuration(peertube.getDuration() * 1000)
|
||||
.build();
|
||||
if (mCastSession != null) {
|
||||
RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
|
||||
remoteMediaClient.load(mediaInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setupCastListener() {
|
||||
mSessionManagerListener = new SessionManagerListener<CastSession>() {
|
||||
@Override
|
||||
public void onSessionStarting(CastSession castSession) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionStarted(CastSession castSession, String s) {
|
||||
onApplicationConnected(castSession, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionStartFailed(CastSession castSession, int i) {
|
||||
onApplicationDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionEnding(CastSession castSession) {
|
||||
onApplicationDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionEnded(CastSession castSession, int i) {
|
||||
onApplicationDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionResuming(CastSession castSession, String s) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionResumed(CastSession castSession, boolean b) {
|
||||
onApplicationConnected(castSession, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionResumeFailed(CastSession castSession, int i) {
|
||||
onApplicationDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionSuspended(CastSession castSession, int i) {
|
||||
onApplicationDisconnected();
|
||||
}
|
||||
|
||||
private void onApplicationConnected(CastSession castSession, boolean hide) {
|
||||
mCastSession = castSession;
|
||||
supportInvalidateOptionsMenu();
|
||||
player.setPlayWhenReady(false);
|
||||
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();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
mCastContext.getSessionManager().addSessionManagerListener(
|
||||
mSessionManagerListener, CastSession.class);
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
mCastContext.getSessionManager().removeSessionManagerListener(
|
||||
mSessionManagerListener, CastSession.class);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
getMenuInflater().inflate(R.menu.video_menu, menu);
|
||||
CastButtonFactory.setUpMediaRouteButton(getApplicationContext(),
|
||||
menu,
|
||||
R.id.media_route_button);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Google LLC. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package app.fedilab.fedilabtube.expandedcontrols;
|
||||
|
||||
import android.view.Menu;
|
||||
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity;
|
||||
|
||||
import app.fedilab.fedilabtube.R;
|
||||
|
||||
|
||||
public class ExpandedControlsActivity extends ExpandedControllerActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
getMenuInflater().inflate(R.menu.video_menu, menu);
|
||||
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_button);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package app.fedilab.fedilabtube.provider;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.android.gms.cast.framework.CastOptions;
|
||||
import com.google.android.gms.cast.framework.OptionsProvider;
|
||||
import com.google.android.gms.cast.framework.SessionProvider;
|
||||
import com.google.android.gms.cast.framework.media.CastMediaOptions;
|
||||
import com.google.android.gms.cast.framework.media.NotificationOptions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.BuildConfig;
|
||||
import app.fedilab.fedilabtube.expandedcontrols.ExpandedControlsActivity;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
||||
|
||||
public class CastOptionsProvider implements OptionsProvider {
|
||||
|
||||
|
||||
@Override
|
||||
public CastOptions getCastOptions(Context context) {
|
||||
NotificationOptions notificationOptions = new NotificationOptions.Builder()
|
||||
.setTargetActivityClassName(ExpandedControlsActivity.class.getName())
|
||||
.build();
|
||||
CastMediaOptions mediaOptions = new CastMediaOptions.Builder()
|
||||
.setNotificationOptions(notificationOptions)
|
||||
.setExpandedControllerActivityClassName(ExpandedControlsActivity.class.getName())
|
||||
.build();
|
||||
return new CastOptions.Builder()
|
||||
.setReceiverApplicationId(BuildConfig.FLAVOR.compareTo("bittube") == 0 ? Helper.CAST_ID_BITTUBE : Helper.CAST_ID)
|
||||
.setCastMediaOptions(mediaOptions)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
|
||||
return null;
|
||||
}
|
||||
}
|
20
app/src/google_cast_lib/res/layout/min_controller.xml
Normal file
20
app/src/google_cast_lib/res/layout/min_controller.xml
Normal 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>
|
9
app/src/google_cast_lib/res/menu/video_menu.xml
Normal file
9
app/src/google_cast_lib/res/menu/video_menu.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/media_route_button"
|
||||
android:title="@string/cast"
|
||||
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
@ -0,0 +1,278 @@
|
||||
package app.fedilab.fedilabtube;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.android.billingclient.api.AcknowledgePurchaseParams;
|
||||
import com.android.billingclient.api.BillingClient;
|
||||
import com.android.billingclient.api.BillingClientStateListener;
|
||||
import com.android.billingclient.api.BillingResult;
|
||||
import com.android.billingclient.api.ConsumeParams;
|
||||
import com.android.billingclient.api.ConsumeResponseListener;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.PurchasesUpdatedListener;
|
||||
import com.android.billingclient.api.SkuDetailsParams;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.databinding.ActivityDonationBinding;
|
||||
|
||||
import app.fedilab.fedilabtube.fragment.MySubscriptionDonationsFragment;
|
||||
import app.fedilab.fedilabtube.fragment.DonationsFragment;
|
||||
|
||||
|
||||
public class DonationActivity extends AppCompatActivity implements PurchasesUpdatedListener {
|
||||
|
||||
|
||||
DonationsFragment donationsFragment;
|
||||
DonationsFragment subscriptionDonationsFragment;
|
||||
MySubscriptionDonationsFragment mySubscriptionDonationsFragment;
|
||||
private ActivityDonationBinding binding;
|
||||
private BillingClient billingClient;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityDonationBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
setContentView(view);
|
||||
billingClient = BillingClient.newBuilder(this)
|
||||
.setListener(this)
|
||||
.enablePendingPurchases()
|
||||
.build();
|
||||
billingClient.startConnection(new BillingClientStateListener() {
|
||||
@Override
|
||||
public void onBillingSetupFinished(@NotNull BillingResult billingResult) {
|
||||
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
||||
// The BillingClient is ready. You can query purchases here.
|
||||
donationsFragment.initialized(billingClient);
|
||||
subscriptionDonationsFragment.initialized(billingClient);
|
||||
|
||||
List<Purchase> purchases = queryPurchases();
|
||||
if (purchases != null) {
|
||||
for (Purchase purchase : purchases) {
|
||||
if (!purchase.isAutoRenewing()) {
|
||||
ConsumeParams consumeParams =
|
||||
ConsumeParams.newBuilder()
|
||||
.setPurchaseToken(purchase.getPurchaseToken())
|
||||
.build();
|
||||
|
||||
ConsumeResponseListener listener = (billingResult1, purchaseToken) -> {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (billingResult1.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
||||
// Handle the success of the consume operation.
|
||||
}
|
||||
};
|
||||
billingClient.consumeAsync(consumeParams, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBillingServiceDisconnected() {
|
||||
// Try to restart the connection on the next request to
|
||||
// Google Play by calling the startConnection() method.
|
||||
}
|
||||
});
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
donationsFragment = new DonationsFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putSerializable("isSubscriptions", false);
|
||||
donationsFragment.setArguments(bundle1);
|
||||
|
||||
|
||||
subscriptionDonationsFragment = new DonationsFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putSerializable("isSubscriptions", true);
|
||||
subscriptionDonationsFragment.setArguments(bundle2);
|
||||
|
||||
mySubscriptionDonationsFragment = new MySubscriptionDonationsFragment();
|
||||
|
||||
binding.tablayout.addTab(binding.tablayout.newTab().setText(getString(R.string.one_time)));
|
||||
binding.tablayout.addTab(binding.tablayout.newTab().setText(getString(R.string.subscriptions)));
|
||||
binding.tablayout.addTab(binding.tablayout.newTab().setText(getString(R.string.my_subscriptions)));
|
||||
binding.viewpager.setOffscreenPageLimit(3);
|
||||
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
binding.viewpager.setAdapter(mPagerAdapter);
|
||||
binding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
TabLayout.Tab tab = binding.tablayout.getTabAt(position);
|
||||
if (tab != null)
|
||||
tab.select();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
binding.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
binding.viewpager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private List<Purchase> queryPurchases() {
|
||||
Purchase.PurchasesResult purchasesResult = billingClient.queryPurchases(BillingClient.SkuType.SUBS);
|
||||
List<Purchase> purchases = purchasesResult.getPurchasesList();
|
||||
List<String> isSubscriptions = new ArrayList<>();
|
||||
HashMap<String, Purchase> map = new HashMap<>();
|
||||
if (purchases != null) {
|
||||
for (Purchase purchase : purchases) {
|
||||
try {
|
||||
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||
JSONObject purchaseJson = new JSONObject(purchase.getOriginalJson());
|
||||
String productId = purchaseJson.getString("productId");
|
||||
isSubscriptions.add(productId);
|
||||
map.put(productId, purchase);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
SkuDetailsParams.Builder paramsSub = SkuDetailsParams.newBuilder();
|
||||
paramsSub.setSkusList(isSubscriptions).setType(BillingClient.SkuType.SUBS);
|
||||
billingClient.querySkuDetailsAsync(paramsSub.build(),
|
||||
(billingResult2, skuDetailsList) -> mySubscriptionDonationsFragment.initialized(skuDetailsList, map, billingClient));
|
||||
} else {
|
||||
mySubscriptionDonationsFragment.initialized(new ArrayList<>(), map, billingClient);
|
||||
}
|
||||
return purchases;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> purchases) {
|
||||
String message;
|
||||
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK
|
||||
&& purchases != null) {
|
||||
for (Purchase purchase : purchases) {
|
||||
if (!purchase.isAutoRenewing()) {
|
||||
ConsumeParams consumeParams =
|
||||
ConsumeParams.newBuilder()
|
||||
.setPurchaseToken(purchase.getPurchaseToken())
|
||||
.build();
|
||||
|
||||
ConsumeResponseListener listener = (billingResult1, purchaseToken) -> {
|
||||
};
|
||||
billingClient.consumeAsync(consumeParams, listener);
|
||||
} else {
|
||||
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||
if (!purchase.isAcknowledged()) {
|
||||
AcknowledgePurchaseParams acknowledgePurchaseParams =
|
||||
AcknowledgePurchaseParams.newBuilder()
|
||||
.setPurchaseToken(purchase.getPurchaseToken())
|
||||
.build();
|
||||
billingClient.acknowledgePurchase(acknowledgePurchaseParams, b -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
queryPurchases();
|
||||
}
|
||||
}
|
||||
message = getString(R.string.donation_succeeded_null);
|
||||
} else if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED) {
|
||||
message = getString(R.string.donation_cancelled);
|
||||
} else {
|
||||
message = getString(R.string.toast_error);
|
||||
}
|
||||
View parentLayout = findViewById(android.R.id.content);
|
||||
Snackbar snackbar = Snackbar.make(parentLayout, message, Snackbar.LENGTH_INDEFINITE);
|
||||
snackbar.setAction(R.string.close, view -> snackbar.dismiss());
|
||||
snackbar.show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pager adapter for the 2 fragments
|
||||
*/
|
||||
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
ScreenSlidePagerAdapter(FragmentManager fm) {
|
||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
if (position == 0) {
|
||||
return donationsFragment;
|
||||
} else if (position == 1) {
|
||||
return subscriptionDonationsFragment;
|
||||
} else {
|
||||
return mySubscriptionDonationsFragment;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package app.fedilab.fedilabtube.drawable;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.billingclient.api.BillingClient;
|
||||
import com.android.billingclient.api.BillingFlowParams;
|
||||
import com.android.billingclient.api.SkuDetails;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import app.fedilab.fedilabtube.DonationActivity;
|
||||
import app.fedilab.fedilabtube.R;
|
||||
import app.fedilab.fedilabtube.databinding.DrawerDonationBinding;
|
||||
|
||||
|
||||
public class DonationButtonAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final List<SkuDetails> skuDetails;
|
||||
private final BillingClient billingClient;
|
||||
private Context context;
|
||||
private final boolean isSubscription;
|
||||
|
||||
public DonationButtonAdapter(List<SkuDetails> skuDetails, BillingClient billingClient, boolean subscription) {
|
||||
this.isSubscription = subscription;
|
||||
this.skuDetails = skuDetails;
|
||||
this.billingClient = billingClient;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
context = parent.getContext();
|
||||
DrawerDonationBinding itemBinding = DrawerDonationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
return new ViewHolder(itemBinding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||
SkuDetails skuDetail = skuDetails.get(position);
|
||||
String currency = skuDetail.getPriceCurrencyCode();
|
||||
String price = skuDetail.getPrice();
|
||||
if (isSubscription) {
|
||||
holder.binding.buttonDonation.setText(String.format(Locale.getDefault(), "%s %s / %s", price, currency, context.getString(R.string.month)));
|
||||
} else {
|
||||
holder.binding.buttonDonation.setText(String.format(Locale.getDefault(), "%s %s", price, currency));
|
||||
}
|
||||
|
||||
holder.binding.buttonDonation.setOnClickListener(v -> {
|
||||
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
|
||||
.setSkuDetails(skuDetail)
|
||||
.build();
|
||||
billingClient.launchBillingFlow((DonationActivity) context, billingFlowParams);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return skuDetails.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
DrawerDonationBinding binding;
|
||||
|
||||
ViewHolder(DrawerDonationBinding itemView) {
|
||||
super(itemView.getRoot());
|
||||
binding = itemView;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package app.fedilab.fedilabtube.drawable;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.billingclient.api.BillingClient;
|
||||
import com.android.billingclient.api.ConsumeParams;
|
||||
import com.android.billingclient.api.ConsumeResponseListener;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.SkuDetails;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import app.fedilab.fedilabtube.R;
|
||||
import app.fedilab.fedilabtube.databinding.DrawerMyDonationBinding;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
|
||||
public class DonationHistoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final List<SkuDetails> skuDetailsList;
|
||||
private final BillingClient billingClient;
|
||||
private Context context;
|
||||
private final HashMap<String, Purchase> map;
|
||||
|
||||
public DonationHistoryAdapter(List<SkuDetails> SkuDetailsList, HashMap<String, Purchase> map, BillingClient billingClient) {
|
||||
this.skuDetailsList = SkuDetailsList;
|
||||
this.billingClient = billingClient;
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
context = parent.getContext();
|
||||
DrawerMyDonationBinding itemBinding = DrawerMyDonationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
return new ViewHolder(itemBinding);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||
SkuDetails skuDetails = skuDetailsList.get(position);
|
||||
holder.binding.productTitle.setText(skuDetails.getTitle());
|
||||
holder.binding.productName.setText(skuDetails.getDescription());
|
||||
holder.binding.productInfo.setText(skuDetails.getOriginalPrice());
|
||||
|
||||
holder.binding.cancelDonation.setOnClickListener(v -> {
|
||||
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
|
||||
dialogBuilder.setMessage(R.string.cancel_subscription_confirm);
|
||||
|
||||
dialogBuilder.setPositiveButton(R.string.cancel_subscription, (dialog, id) -> {
|
||||
JSONObject skudetailsJson;
|
||||
try {
|
||||
skudetailsJson = new JSONObject(skuDetails.getOriginalJson());
|
||||
String productId = skudetailsJson.getString("productId");
|
||||
if (map.containsKey(productId)) {
|
||||
Purchase purchase = map.get(productId);
|
||||
if (purchase != null) {
|
||||
ConsumeParams consumeParams =
|
||||
ConsumeParams.newBuilder()
|
||||
.setPurchaseToken(purchase.getPurchaseToken())
|
||||
.build();
|
||||
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||
ConsumeResponseListener listener = (billingResult1, purchaseToken) -> {
|
||||
if (billingResult1.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
||||
Toasty.success(context, context.getString(R.string.subscription_cancelled), Toasty.LENGTH_LONG).show();
|
||||
}
|
||||
skuDetailsList.remove(skuDetails);
|
||||
notifyDataSetChanged();
|
||||
};
|
||||
billingClient.consumeAsync(consumeParams, listener);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||
AlertDialog alertDialogLogoutAccount = dialogBuilder.create();
|
||||
alertDialogLogoutAccount.show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return skuDetailsList.size();
|
||||
}
|
||||
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
DrawerMyDonationBinding binding;
|
||||
|
||||
ViewHolder(DrawerMyDonationBinding itemView) {
|
||||
super(itemView.getRoot());
|
||||
binding = itemView;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package app.fedilab.fedilabtube.fragment;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.android.billingclient.api.BillingClient;
|
||||
import com.android.billingclient.api.SkuDetailsParams;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.R;
|
||||
import app.fedilab.fedilabtube.databinding.FragmentDonationsBinding;
|
||||
import app.fedilab.fedilabtube.drawable.DonationButtonAdapter;
|
||||
|
||||
|
||||
public class DonationsFragment extends Fragment {
|
||||
|
||||
public static final String[] donations = {"1", "2", "5", "10"};
|
||||
private FragmentDonationsBinding binding;
|
||||
private View rootView;
|
||||
private Context context;
|
||||
private boolean isSubscriptions;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
binding = FragmentDonationsBinding.inflate(LayoutInflater.from(context));
|
||||
rootView = binding.getRoot();
|
||||
context = getContext();
|
||||
Bundle bundle = this.getArguments();
|
||||
if (bundle != null) {
|
||||
isSubscriptions = bundle.getBoolean("isSubscriptions", false);
|
||||
}
|
||||
int donationText;
|
||||
if (isSubscriptions) {
|
||||
donationText = R.string.recurrent_donation_text;
|
||||
} else {
|
||||
donationText = R.string.one_time_donation_text;
|
||||
}
|
||||
binding.donationText.setText(donationText);
|
||||
binding.loader.setVisibility(View.VISIBLE);
|
||||
binding.lvProducts.setVisibility(View.GONE);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
public void initialized(BillingClient bc) {
|
||||
|
||||
|
||||
List<String> donationsList = new ArrayList<>();
|
||||
for (String val : donations) {
|
||||
donationsList.add("tubelab_donation_" + val + (isSubscriptions ? "_s" : ""));
|
||||
}
|
||||
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
|
||||
if (isSubscriptions) {
|
||||
params.setSkusList(donationsList).setType(BillingClient.SkuType.SUBS);
|
||||
} else {
|
||||
params.setSkusList(donationsList).setType(BillingClient.SkuType.INAPP);
|
||||
}
|
||||
bc.querySkuDetailsAsync(params.build(),
|
||||
(billingResult, skuDetailsList) -> {
|
||||
binding.loader.setVisibility(View.GONE);
|
||||
binding.lvProducts.setVisibility(View.VISIBLE);
|
||||
if (skuDetailsList != null) {
|
||||
Collections.sort(skuDetailsList, (obj1, obj2) -> obj1.getPrice().compareTo(obj2.getPrice()));
|
||||
}
|
||||
DonationButtonAdapter donationButtonAdapter = new DonationButtonAdapter(skuDetailsList, bc, isSubscriptions);
|
||||
binding.lvProducts.setAdapter(donationButtonAdapter);
|
||||
binding.lvProducts.setLayoutManager(new LinearLayoutManager(context));
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
rootView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle saveInstance) {
|
||||
super.onCreate(saveInstance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
this.context = context;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package app.fedilab.fedilabtube.fragment;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.android.billingclient.api.BillingClient;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.SkuDetails;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.databinding.FragmentMyDonationsBinding;
|
||||
import app.fedilab.fedilabtube.drawable.DonationHistoryAdapter;
|
||||
|
||||
public class MySubscriptionDonationsFragment extends Fragment {
|
||||
|
||||
private FragmentMyDonationsBinding binding;
|
||||
private View rootView;
|
||||
private Context context;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
binding = FragmentMyDonationsBinding.inflate(LayoutInflater.from(context));
|
||||
rootView = binding.getRoot();
|
||||
context = getContext();
|
||||
binding.loader.setVisibility(View.VISIBLE);
|
||||
binding.lvPurchases.setVisibility(View.GONE);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
public void initialized(List<SkuDetails> skuDetailsList, HashMap<String, Purchase> map, BillingClient bc) {
|
||||
binding.loader.setVisibility(View.GONE);
|
||||
binding.lvPurchases.setVisibility(View.VISIBLE);
|
||||
|
||||
DonationHistoryAdapter donationHistoryAdapter = new DonationHistoryAdapter(skuDetailsList, map, bc);
|
||||
binding.lvPurchases.setAdapter(donationHistoryAdapter);
|
||||
binding.lvPurchases.setLayoutManager(new LinearLayoutManager(context));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
rootView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle saveInstance) {
|
||||
super.onCreate(saveInstance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
this.context = context;
|
||||
}
|
||||
}
|
60
app/src/google_donation/res/layout/activity_donation.xml
Normal file
60
app/src/google_donation/res/layout/activity_donation.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2021 Thomas Schneider
|
||||
|
||||
This file is a part of TubeLab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".ShowChannelActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
app:contentScrim="?attr/colorPrimary"
|
||||
app:expandedTitleMarginEnd="64dp"
|
||||
app:expandedTitleMarginStart="48dp"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tablayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
app:tabSelectedTextColor="?colorAccent"
|
||||
app:tabTextColor="@android:color/white" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
23
app/src/google_donation/res/layout/drawer_donation.xml
Normal file
23
app/src/google_donation/res/layout/drawer_donation.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_donation"
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingStart="40dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingEnd="40dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:textSize="25sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
54
app/src/google_donation/res/layout/drawer_my_donation.xml
Normal file
54
app/src/google_donation/res/layout/drawer_my_donation.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/product_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cancel_donation"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/product_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cancel_donation"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/product_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/product_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cancel_donation"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/product_name" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/cancel_donation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/cancel"
|
||||
android:src="@drawable/ic_baseline_delete_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
59
app/src/google_donation/res/layout/fragment_donations.xml
Normal file
59
app/src/google_donation/res/layout/fragment_donations.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2021 Thomas Schneider
|
||||
|
||||
This file is a part of TubeLab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:id="@+id/donation_text" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lv_products"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"
|
||||
android:scrollbars="none" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Main Loader -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/loader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
style="@style/progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:SpinKit_Color="?colorAccent" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
59
app/src/google_donation/res/layout/fragment_my_donations.xml
Normal file
59
app/src/google_donation/res/layout/fragment_my_donations.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2021 Thomas Schneider
|
||||
|
||||
This file is a part of TubeLab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/donations_description" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lv_purchases"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@null"
|
||||
android:scrollbars="none" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Main Loader -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/loader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
style="@style/progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:SpinKit_Color="?colorAccent" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="app.fedilab.fedilabtube">
|
||||
|
||||
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
<application
|
||||
android:name=".FedilabTube"
|
||||
android:allowBackup="false"
|
||||
@ -30,5 +30,10 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".DonationActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/support_the_app"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
</application>
|
||||
</manifest>
|
@ -19,6 +19,8 @@ import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
@ -52,6 +54,8 @@ import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||
|
||||
import static app.fedilab.fedilabtube.MainActivity.badgeCount;
|
||||
|
||||
|
||||
public class AccountActivity extends AppCompatActivity {
|
||||
|
||||
@ -112,9 +116,13 @@ public class AccountActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
|
||||
|
||||
TabLayout.Tab notificationTab = binding.accountTabLayout.newTab();
|
||||
if (Helper.isLoggedIn(AccountActivity.this)) {
|
||||
binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.title_notifications)));
|
||||
if (badgeCount > 0) {
|
||||
binding.accountTabLayout.addTab(notificationTab.setText(getString(R.string.title_notifications) + " (" + badgeCount + ")"));
|
||||
} else {
|
||||
binding.accountTabLayout.addTab(notificationTab.setText(getString(R.string.title_notifications)));
|
||||
}
|
||||
binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.title_muted)));
|
||||
binding.accountTabLayout.addTab(binding.accountTabLayout.newTab().setText(getString(R.string.title_channel)));
|
||||
|
||||
@ -159,9 +167,29 @@ public class AccountActivity extends AppCompatActivity {
|
||||
fragment = (Fragment) binding.accountViewpager.getAdapter().instantiateItem(binding.accountViewpager, tab.getPosition());
|
||||
switch (tab.getPosition()) {
|
||||
case 0:
|
||||
if (fragment != null) {
|
||||
DisplayNotificationsFragment displayNotificationsFragment = ((DisplayNotificationsFragment) fragment);
|
||||
displayNotificationsFragment.scrollToTop();
|
||||
if (badgeCount > 0) {
|
||||
android.app.AlertDialog.Builder builder;
|
||||
builder = new android.app.AlertDialog.Builder(AccountActivity.this);
|
||||
builder.setMessage(R.string.mark_all_notifications_as_read_confirm);
|
||||
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setPositiveButton(R.string.mark_all_as_read, (dialog, which) -> {
|
||||
new Thread(() -> {
|
||||
new RetrofitPeertubeAPI(AccountActivity.this).markAllAsRead();
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
badgeCount = 0;
|
||||
Runnable myRunnable = () -> binding.accountTabLayout.getTabAt(0).setText(getString(R.string.title_notifications));
|
||||
mainHandler.post(myRunnable);
|
||||
}).start();
|
||||
|
||||
dialog.dismiss();
|
||||
})
|
||||
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||
.show();
|
||||
} else {
|
||||
if (fragment != null) {
|
||||
DisplayNotificationsFragment displayNotificationsFragment = ((DisplayNotificationsFragment) fragment);
|
||||
displayNotificationsFragment.scrollToTop();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@ -195,6 +223,14 @@ public class AccountActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateCounter() {
|
||||
if (badgeCount > 0) {
|
||||
binding.accountTabLayout.getTabAt(0).setText(getString(R.string.title_notifications) + " (" + badgeCount + ")");
|
||||
} else {
|
||||
binding.accountTabLayout.getTabAt(0).setText(getString(R.string.title_notifications));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@ -210,6 +246,7 @@ public class AccountActivity extends AppCompatActivity {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.action_add_account) {
|
||||
SwitchAccountHelper.switchDialog(AccountActivity.this, true);
|
||||
@ -255,5 +292,11 @@ public class AccountActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -65,7 +65,7 @@ public class BaseFedilabTube extends MultiDexApplication {
|
||||
|
||||
MultiDex.install(BaseFedilabTube.this);
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int themePref = sharedpreferences.getInt(Helper.SET_THEME, Helper.DEFAULT_MODE);
|
||||
int themePref = sharedpreferences.getInt(Helper.SET_THEME, BuildConfig.default_theme);
|
||||
ThemeHelper.switchTo(themePref);
|
||||
|
||||
|
||||
|
@ -175,7 +175,10 @@ public class LoginActivity extends AppCompatActivity {
|
||||
if (!hasFocus) {
|
||||
if (binding.loginInstance.getText() != null) {
|
||||
new Thread(() -> {
|
||||
String testInstance = binding.loginInstance.getText().toString();
|
||||
String testInstance = binding.loginInstance.getText().toString().trim();
|
||||
if (testInstance.length() == 0) {
|
||||
return;
|
||||
}
|
||||
WellKnownNodeinfo.NodeInfo instanceNodeInfo = null;
|
||||
if (BuildConfig.allow_remote_connections) {
|
||||
instanceNodeInfo = new RetrofitPeertubeAPI(LoginActivity.this, testInstance, null).getNodeInfo();
|
||||
|
@ -16,33 +16,30 @@ package app.fedilab.fedilabtube;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.appcompat.widget.TooltipCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
@ -51,13 +48,7 @@ import com.kobakei.ratethisapp.RateThisApp;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -71,7 +62,6 @@ import java.util.regex.Pattern;
|
||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.data.AccountData.Account;
|
||||
import app.fedilab.fedilabtube.client.data.InstanceData;
|
||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||
import app.fedilab.fedilabtube.client.entities.Error;
|
||||
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
||||
import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
|
||||
@ -93,18 +83,13 @@ import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||
import su.litvak.chromecast.api.v2.ChromeCasts;
|
||||
import su.litvak.chromecast.api.v2.ChromeCastsListener;
|
||||
import su.litvak.chromecast.api.v2.MediaStatus;
|
||||
|
||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.NORMAL;
|
||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedInType;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements ChromeCastsListener {
|
||||
public class MainActivity extends BaseMainActivity {
|
||||
|
||||
|
||||
public static int PICK_INSTANCE = 5641;
|
||||
@ -112,12 +97,12 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
public static UserMe userMe;
|
||||
public static InstanceData.InstanceConfig instanceConfig;
|
||||
public static TypeOfConnection typeOfConnection;
|
||||
public static List<ChromeCast> chromeCasts;
|
||||
public static ChromeCast chromeCast;
|
||||
public static boolean chromecastActivated = false;
|
||||
|
||||
|
||||
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
||||
private DisplayOverviewFragment overviewFragment;
|
||||
private ActivityMainBinding binding;
|
||||
public static int badgeCount;
|
||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||
= item -> {
|
||||
int itemId = item.getItemId();
|
||||
@ -156,8 +141,7 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
}
|
||||
return true;
|
||||
};
|
||||
private BroadcastReceiver manage_chromecast;
|
||||
private VideoData.Video castedTube;
|
||||
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
|
||||
@ -232,129 +216,26 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newChromeCastDiscovered(ChromeCast chromeCast) {
|
||||
if (chromeCasts == null) {
|
||||
chromeCasts = new ArrayList<>();
|
||||
chromeCasts.add(chromeCast);
|
||||
} else {
|
||||
boolean canBeAdded = true;
|
||||
for (ChromeCast cast : chromeCasts) {
|
||||
if (cast.getName().compareTo(chromeCast.getName()) == 0) {
|
||||
canBeAdded = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (canBeAdded) {
|
||||
chromeCasts.add(chromeCast);
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (chromeCast.isAppRunning(Helper.CAST_ID) && chromeCast.getMediaStatus() != null && chromeCast.getMediaStatus().playerState != null) {
|
||||
if (binding.castInfo.getVisibility() == View.GONE) {
|
||||
binding.castInfo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chromeCastRemoved(ChromeCast chromeCast) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
ChromeCasts.unregisterListener(this);
|
||||
if (manage_chromecast != null) {
|
||||
LocalBroadcastManager.getInstance(MainActivity.this).unregisterReceiver(manage_chromecast);
|
||||
|
||||
new Thread(() -> {
|
||||
if (chromeCasts != null && chromeCasts.size() > 0) {
|
||||
for (ChromeCast cast : chromeCasts) {
|
||||
try {
|
||||
cast.stopApp();
|
||||
cast.disconnect();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
if (chromeCasts != null) {
|
||||
chromeCasts = null;
|
||||
}
|
||||
if (chromeCast != null) {
|
||||
chromeCast = null;
|
||||
}
|
||||
}
|
||||
|
||||
//Method for discovering cast devices
|
||||
public void discoverCast() {
|
||||
new Thread(() -> {
|
||||
if (chromeCasts != null) {
|
||||
for (ChromeCast cast : chromeCasts) {
|
||||
try {
|
||||
cast.disconnect();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
chromeCasts = null;
|
||||
}
|
||||
chromeCasts = new ArrayList<>();
|
||||
try {
|
||||
List<NetworkInterface> interfaces;
|
||||
interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
||||
for (NetworkInterface ni : interfaces) {
|
||||
if ((!ni.isLoopback()) && ni.isUp() && (ni.getName().equals("wlan0"))) {
|
||||
Enumeration<InetAddress> inetAddressEnumeration = ni.getInetAddresses();
|
||||
while (inetAddressEnumeration.hasMoreElements()) {
|
||||
InetAddress inetAddress = inetAddressEnumeration.nextElement();
|
||||
ChromeCasts.restartDiscovery(inetAddress);
|
||||
int tryFind = 0;
|
||||
while (ChromeCasts.get().isEmpty() && tryFind < 5) {
|
||||
try {
|
||||
//noinspection BusyWait
|
||||
Thread.sleep(1000);
|
||||
tryFind++;
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ChromeCasts.stopDiscovery();
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = this::invalidateOptionsMenu;
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
setContentView(view);
|
||||
ChromeCastsListener chromeCastsListener = this;
|
||||
ChromeCasts.registerListener(chromeCastsListener);
|
||||
binding = super.binding;
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
typeOfConnection = TypeOfConnection.UNKNOWN;
|
||||
|
||||
badgeCount = 0;
|
||||
|
||||
binding.navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||
|
||||
@ -392,6 +273,11 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
if (!Helper.isLoggedIn(MainActivity.this)) {
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
binding.viewpager.setAdapter(mPagerAdapter);
|
||||
} else {
|
||||
new Thread(() -> {
|
||||
badgeCount = new RetrofitPeertubeAPI(MainActivity.this).unreadNotifications();
|
||||
invalidateOptionsMenu();
|
||||
}).start();
|
||||
}
|
||||
binding.viewpager.setOffscreenPageLimit(5);
|
||||
|
||||
@ -454,92 +340,11 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
PlaylistExportHelper.manageIntentUrl(MainActivity.this, getIntent());
|
||||
}
|
||||
|
||||
binding.castClose.setOnClickListener(v -> {
|
||||
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt("displayed", 0);
|
||||
intentBC.putExtras(b);
|
||||
LocalBroadcastManager.getInstance(MainActivity.this).sendBroadcast(intentBC);
|
||||
});
|
||||
|
||||
binding.castTogglePlay.setOnClickListener(v -> {
|
||||
if (chromeCast != null) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> binding.castTogglePlay.setVisibility(View.GONE);
|
||||
mainHandler.post(myRunnable);
|
||||
int icon = -1;
|
||||
if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
||||
chromeCast.pause();
|
||||
icon = R.drawable.ic_baseline_play_arrow_32;
|
||||
} else if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PAUSED) {
|
||||
chromeCast.play();
|
||||
icon = R.drawable.ic_baseline_pause_32;
|
||||
}
|
||||
if (icon != -1) {
|
||||
int finalIcon = icon;
|
||||
myRunnable = () -> binding.castTogglePlay.setImageResource(finalIcon);
|
||||
mainHandler.post(myRunnable);
|
||||
}
|
||||
myRunnable = () -> binding.castTogglePlay.setVisibility(View.VISIBLE);
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
manage_chromecast = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Bundle b = intent.getExtras();
|
||||
assert b != null;
|
||||
int state = b.getInt("state_asked", -1);
|
||||
int displayed = b.getInt("displayed", -1);
|
||||
castedTube = b.getParcelable("castedTube");
|
||||
|
||||
if (state == 1) {
|
||||
discoverCast();
|
||||
} else if (state == 0) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (chromeCast != null) {
|
||||
chromeCast.stopApp();
|
||||
chromeCast.disconnect();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
if (displayed == 1) {
|
||||
chromecastActivated = true;
|
||||
if (castedTube != null) {
|
||||
binding.castInfo.setVisibility(View.VISIBLE);
|
||||
Helper.loadGiF(MainActivity.this, castedTube.getThumbnailPath(), binding.castView);
|
||||
binding.castTitle.setText(castedTube.getTitle());
|
||||
binding.castDescription.setText(castedTube.getDescription());
|
||||
}
|
||||
} else if (displayed == 0) {
|
||||
chromecastActivated = false;
|
||||
binding.castInfo.setVisibility(View.GONE);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (chromeCast != null) {
|
||||
chromeCast.stopApp();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
};
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
||||
LocalBroadcastManager.getInstance(MainActivity.this).registerReceiver(manage_chromecast, new IntentFilter(Helper.RECEIVE_CAST_SETTINGS));
|
||||
int search_cast = sharedpreferences.getInt(getString(R.string.set_cast_choice), 0);
|
||||
|
||||
int search_cast = sharedpreferences.getInt(getString(R.string.set_cast_choice), BuildConfig.cast_enabled);
|
||||
if (search_cast == 1) {
|
||||
discoverCast();
|
||||
}
|
||||
@ -558,6 +363,12 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private void refreshToken() {
|
||||
new Thread(() -> {
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
@ -687,7 +498,23 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
MenuItem incognitoItem = menu.findItem(R.id.action_incognito);
|
||||
MenuItem instanceItem = menu.findItem(R.id.action_change_instance);
|
||||
MenuItem accountItem = menu.findItem(R.id.action_account);
|
||||
MenuItem donateItem = menu.findItem(R.id.action_donate);
|
||||
|
||||
FrameLayout rootView = (FrameLayout) accountItem.getActionView();
|
||||
|
||||
FrameLayout redCircle = rootView.findViewById(R.id.view_alert_red_circle);
|
||||
TextView countTextView = rootView.findViewById(R.id.view_alert_count_textview);
|
||||
//change counter for notifications
|
||||
if (badgeCount > 0) {
|
||||
countTextView.setText(String.valueOf(badgeCount));
|
||||
redCircle.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
redCircle.setVisibility(View.GONE);
|
||||
}
|
||||
TooltipCompat.setTooltipText(accountItem.getActionView(), getText(R.string.account));
|
||||
if (BuildConfig.full_instances && BuildConfig.google_restriction) {
|
||||
donateItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (BuildConfig.surfing_mode && ((Helper.isLoggedIn(MainActivity.this) && typeOfConnection == NORMAL) || typeOfConnection == SURFING)) {
|
||||
binding.instances.setVisibility(View.VISIBLE);
|
||||
@ -782,6 +609,15 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
final MenuItem accountItem = menu.findItem(R.id.action_account);
|
||||
FrameLayout rootView = (FrameLayout) accountItem.getActionView();
|
||||
rootView.setOnClickListener(v -> onOptionsItemSelected(accountItem));
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
String type = null;
|
||||
@ -804,10 +640,13 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
} else {
|
||||
if (Helper.canMakeAction(MainActivity.this)) {
|
||||
intent = new Intent(MainActivity.this, AccountActivity.class);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
|
||||
} else {
|
||||
intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
} else if (item.getItemId() == R.id.action_upload) {
|
||||
Intent intent = new Intent(MainActivity.this, PeertubeUploadActivity.class);
|
||||
@ -847,6 +686,9 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
||||
} else if (item.getItemId() == R.id.action_about) {
|
||||
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (item.getItemId() == R.id.action_donate) {
|
||||
Intent intent = new Intent(MainActivity.this, DonationActivity.class);
|
||||
startActivity(intent);
|
||||
} else if (item.getItemId() == R.id.action_incognito) {
|
||||
item.setChecked(!item.isChecked());
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
@ -134,6 +134,9 @@ public class MastodonWebviewConnectActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
String code = val[1];
|
||||
if (code.contains("&")) {
|
||||
code = code.split("&")[0];
|
||||
}
|
||||
OauthParams oauthParams = new OauthParams();
|
||||
oauthParams.setClient_id(clientId);
|
||||
oauthParams.setClient_secret(clientSecret);
|
||||
|
@ -44,7 +44,6 @@ import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@ -52,7 +51,6 @@ import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
@ -63,14 +61,12 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@ -111,8 +107,6 @@ import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -163,19 +157,12 @@ import app.fedilab.fedilabtube.webview.CustomWebview;
|
||||
import app.fedilab.fedilabtube.webview.MastalabWebChromeClient;
|
||||
import app.fedilab.fedilabtube.webview.MastalabWebViewClient;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||
import su.litvak.chromecast.api.v2.MediaStatus;
|
||||
import su.litvak.chromecast.api.v2.Status;
|
||||
|
||||
import static app.fedilab.fedilabtube.MainActivity.chromeCast;
|
||||
import static app.fedilab.fedilabtube.MainActivity.chromeCasts;
|
||||
import static app.fedilab.fedilabtube.MainActivity.chromecastActivated;
|
||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.ADD_COMMENT;
|
||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.RATEVIDEO;
|
||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_VIDEO;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.CAST_ID;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.canMakeAction;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.getAttColor;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||
@ -184,15 +171,13 @@ import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
|
||||
|
||||
|
||||
public class PeertubeActivity extends AppCompatActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener, MenuAdapter.ItemClicked, MenuItemAdapter.ItemAction {
|
||||
public class PeertubeActivity extends BasePeertubeActivity implements CommentListAdapter.AllCommentRemoved, Player.EventListener, VideoListener, TorrentListener, MenuAdapter.ItemClicked, MenuItemAdapter.ItemAction {
|
||||
|
||||
public static String video_id;
|
||||
public static List<String> playedVideos = new ArrayList<>();
|
||||
private String peertubeInstance, videoUuid;
|
||||
private ImageView fullScreenIcon;
|
||||
private SimpleExoPlayer player;
|
||||
private boolean fullScreenMode;
|
||||
private VideoData.Video peertube;
|
||||
private int mode;
|
||||
private Map<String, List<PlaylistExist>> playlists;
|
||||
private boolean playInMinimized, autoPlay, autoFullscreen;
|
||||
@ -218,8 +203,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
private String currentCaption;
|
||||
private boolean isRemote;
|
||||
private boolean willPlayFromIntent;
|
||||
private String chromeCastVideoURL;
|
||||
|
||||
private app.fedilab.fedilabtube.client.mastodon.Status status;
|
||||
Uri captionURI;
|
||||
String captionLang;
|
||||
|
||||
public static void hideKeyboard(Activity activity) {
|
||||
if (activity != null && activity.getWindow() != null) {
|
||||
@ -305,10 +292,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
setContentView(view);
|
||||
binding = super.binding;
|
||||
videoOrientationType = videoOrientation.LANDSCAPE;
|
||||
max_id = "0";
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
@ -510,34 +494,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
});
|
||||
|
||||
binding.castPlay.setOnClickListener(v -> {
|
||||
binding.castLoader.setVisibility(View.VISIBLE);
|
||||
if (chromeCast != null) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
int icon = -1;
|
||||
if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
||||
chromeCast.pause();
|
||||
icon = R.drawable.ic_baseline_play_arrow_32;
|
||||
} else if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PAUSED) {
|
||||
chromeCast.play();
|
||||
icon = R.drawable.ic_baseline_pause_32;
|
||||
}
|
||||
if (icon != -1) {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
int finalIcon = icon;
|
||||
Runnable myRunnable = () -> binding.castPlay.setImageResource(finalIcon);
|
||||
mainHandler.post(myRunnable);
|
||||
}
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> binding.castLoader.setVisibility(View.GONE);
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -664,7 +621,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
secInt = Integer.parseInt(sec.replace("s", ""));
|
||||
totalSeconds += secInt;
|
||||
}
|
||||
|
||||
captionURI = null;
|
||||
captionLang = null;
|
||||
if (instance != null && uuid != null) {
|
||||
peertubeInstance = instance.replace("https://", "").replace("http://", "");
|
||||
sepiaSearch = true; // Sepia search flag is used because, at this time we don't know if the video is federated.
|
||||
@ -795,20 +753,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.video_menu, menu);
|
||||
MenuItem castItem = menu.findItem(R.id.action_cast);
|
||||
if (chromeCasts != null && chromeCasts.size() > 0) {
|
||||
castItem.setVisible(true);
|
||||
if (chromeCast != null && chromeCast.isConnected()) {
|
||||
castItem.setIcon(R.drawable.ic_baseline_cast_connected_24);
|
||||
} else {
|
||||
castItem.setIcon(R.drawable.ic_baseline_cast_24);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
@ -818,101 +762,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
finish();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.action_cast) {
|
||||
if (chromeCasts != null && chromeCasts.size() > 0) {
|
||||
String[] chromecast_choice = new String[chromeCasts.size()];
|
||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
|
||||
alt_bld.setTitle(R.string.chromecast_choice);
|
||||
int i = 0;
|
||||
for (ChromeCast cc : chromeCasts) {
|
||||
chromecast_choice[i] = cc.getTitle();
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
for (ChromeCast cc : chromeCasts) {
|
||||
if (chromecastActivated && cc.isConnected()) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
alt_bld.setSingleChoiceItems(chromecast_choice, i, (dialog, position) -> {
|
||||
chromeCast = chromeCasts.get(position);
|
||||
new Thread(() -> {
|
||||
if (chromeCast != null) {
|
||||
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
||||
Bundle b = new Bundle();
|
||||
if (chromecastActivated) {
|
||||
b.putInt("displayed", 0);
|
||||
intentBC.putExtras(b);
|
||||
LocalBroadcastManager.getInstance(PeertubeActivity.this).sendBroadcast(intentBC);
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
binding.doubleTapPlayerView.setVisibility(View.VISIBLE);
|
||||
binding.castController.setVisibility(View.GONE);
|
||||
};
|
||||
mainHandler.post(myRunnable);
|
||||
|
||||
} else {
|
||||
b.putInt("displayed", 1);
|
||||
b.putParcelable("castedTube", peertube);
|
||||
intentBC.putExtras(b);
|
||||
LocalBroadcastManager.getInstance(PeertubeActivity.this).sendBroadcast(intentBC);
|
||||
try {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
invalidateOptionsMenu();
|
||||
binding.castLoader.setVisibility(View.VISIBLE);
|
||||
player.setPlayWhenReady(false);
|
||||
binding.doubleTapPlayerView.setVisibility(View.GONE);
|
||||
binding.castController.setVisibility(View.VISIBLE);
|
||||
dialog.dismiss();
|
||||
if (chromeCastVideoURL != null) {
|
||||
if (player != null && player.getCurrentPosition() > 0) {
|
||||
chromeCastVideoURL += "?start=" + (player.getCurrentPosition() / 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
mainHandler.post(myRunnable);
|
||||
if (!chromeCast.isConnected()) {
|
||||
chromeCast.connect();
|
||||
}
|
||||
myRunnable = this::invalidateOptionsMenu;
|
||||
mainHandler.post(myRunnable);
|
||||
Status status = chromeCast.getStatus();
|
||||
if (chromeCast.isAppAvailable(CAST_ID) && !status.isAppRunning(CAST_ID)) {
|
||||
chromeCast.launchApp(CAST_ID);
|
||||
}
|
||||
|
||||
if (chromeCastVideoURL != null) {
|
||||
String mime = MimeTypeMap.getFileExtensionFromUrl(chromeCastVideoURL);
|
||||
chromeCast.setRequestTimeout(60000);
|
||||
chromeCast.load(peertube.getTitle(), null, chromeCastVideoURL, mime);
|
||||
chromeCast.play();
|
||||
binding.castPlay.setImageResource(R.drawable.ic_baseline_pause_32);
|
||||
}
|
||||
myRunnable = () -> binding.castLoader.setVisibility(View.GONE);
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException | GeneralSecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
invalidateOptionsMenu();
|
||||
dialog.dismiss();
|
||||
};
|
||||
mainHandler.post(myRunnable);
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
});
|
||||
alt_bld.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
|
||||
AlertDialog alert = alt_bld.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
@ -1018,7 +867,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
secInt = Integer.parseInt(sec.replace("strue", ""));
|
||||
totalSeconds += secInt;
|
||||
}
|
||||
|
||||
captionURI = null;
|
||||
captionLang = null;
|
||||
if (instance != null && uuid != null) {
|
||||
peertubeInstance = instance.replace("https://", "").replace("http://", "");
|
||||
sepiaSearch = true; // Sepia search flag is used because, at this time we don't know if the video is federated.
|
||||
@ -1069,6 +919,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
||||
DefaultTimeBar exo_progress = controlView.findViewById(R.id.exo_progress);
|
||||
TextView exo_duration = controlView.findViewById(R.id.exo_duration);
|
||||
TextView exo_position = controlView.findViewById(R.id.exo_position);
|
||||
TextView exo_live_badge = controlView.findViewById(R.id.exo_live_badge);
|
||||
if (peertube.isLive()) {
|
||||
exo_progress.setVisibility(View.INVISIBLE);
|
||||
@ -1076,9 +927,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
exo_live_badge.setVisibility(View.VISIBLE);
|
||||
exo_live_badge.setText(R.string.live);
|
||||
exo_live_badge.setBackgroundResource(R.drawable.rounded_live);
|
||||
exo_position.setVisibility(View.GONE);
|
||||
} else {
|
||||
exo_progress.setVisibility(View.VISIBLE);
|
||||
exo_live_badge.setVisibility(View.GONE);
|
||||
exo_position.setVisibility(View.VISIBLE);
|
||||
exo_duration.setBackground(null);
|
||||
}
|
||||
|
||||
@ -1137,6 +990,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
if (peertube.isLive()) {
|
||||
info_duration.setText(R.string.live);
|
||||
info_duration.setBackgroundResource(R.drawable.rounded_live);
|
||||
info_duration.setBackgroundResource(R.drawable.rounded_live);
|
||||
} else {
|
||||
info_duration.setText(Helper.secondsToString(peertube.getDuration()));
|
||||
}
|
||||
@ -1409,6 +1263,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage video to play with different factors
|
||||
*
|
||||
@ -1421,7 +1276,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
* @param lang String ("en","fr", etc.)
|
||||
*/
|
||||
private void stream(VideoData.Video video, String localTorrentUrl, String resolution, boolean autoPlay, long position, Uri subtitles, String lang) {
|
||||
String videoURL = localTorrentUrl == null ? video.getFileUrl(resolution, PeertubeActivity.this) : localTorrentUrl;
|
||||
videoURL = localTorrentUrl == null ? video.getFileUrl(resolution, PeertubeActivity.this) : localTorrentUrl;
|
||||
if (subtitles != null) {
|
||||
subtitlesStr = subtitles.toString();
|
||||
}
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
|
||||
if (videoURL != null && (videoURL.endsWith(".torrent") || videoURL.startsWith("magnet"))) {
|
||||
@ -1442,7 +1300,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (video_cache == 0 || dataSourceFactory != null) {
|
||||
if (video_cache == 0 || dataSourceFactory != null || video.isLive()) {
|
||||
if (dataSourceFactory == null) {
|
||||
dataSourceFactory = new DefaultDataSourceFactory(PeertubeActivity.this,
|
||||
Util.getUserAgent(PeertubeActivity.this, null), null);
|
||||
@ -1462,8 +1320,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
} else {
|
||||
CacheDataSourceFactory cacheDataSourceFactory = new CacheDataSourceFactory(PeertubeActivity.this);
|
||||
MediaItem mediaItem = new MediaItem.Builder().setUri(videoURL).build();
|
||||
videoSource = new ProgressiveMediaSource.Factory(cacheDataSourceFactory)
|
||||
.createMediaSource(mediaItem);
|
||||
if (subtitles != null) {
|
||||
MediaItem.Subtitle mediaSubtitle = new MediaItem.Subtitle(subtitles, MimeTypes.TEXT_VTT, lang, Format.NO_VALUE);
|
||||
subtitleSource = new SingleSampleMediaSource.Factory(cacheDataSourceFactory).createMediaSource(mediaSubtitle, C.TIME_UNSET);
|
||||
@ -1497,6 +1353,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
if (autoPlay) {
|
||||
binding.doubleTapPlayerView.hideController();
|
||||
}
|
||||
// loadCast(video, videoURL, subtitles!=null?subtitles.toString():null);
|
||||
}
|
||||
|
||||
private void fetchComments() {
|
||||
@ -1531,14 +1388,14 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
} else {
|
||||
videoURL = peertube.getFileUrl(resolution, PeertubeActivity.this);
|
||||
}
|
||||
if (peertube != null && peertube.isWaitTranscoding() && peertube.isLive()) {
|
||||
if (peertube != null && peertube.isLive() && videoURL == null) {
|
||||
View parentLayout = findViewById(android.R.id.content);
|
||||
Snackbar snackbar = Snackbar.make(parentLayout, R.string.live_not_started, Snackbar.LENGTH_INDEFINITE);
|
||||
snackbar.setAction(R.string.close, view -> finish());
|
||||
snackbar.show();
|
||||
return;
|
||||
}
|
||||
chromeCastVideoURL = videoURL;
|
||||
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
String nsfwAction = sharedpreferences.getString(getString(R.string.set_video_sensitive_choice), Helper.BLUR);
|
||||
if (promptNSFW && peertube != null && peertube.isNsfw() && (nsfwAction.compareTo(Helper.BLUR) == 0 || nsfwAction.compareTo(Helper.DO_NOT_LIST) == 0)) {
|
||||
@ -1568,7 +1425,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
@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) {
|
||||
@ -1621,7 +1478,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
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();
|
||||
@ -1637,7 +1494,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -1652,7 +1509,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String strAction = intent.getAction();
|
||||
if (strAction.equals(Intent.ACTION_SCREEN_OFF)) {
|
||||
if (player != null && isPlayInMinimized) {
|
||||
if (player != null) {
|
||||
if (!sharedpreferences.getBoolean(getString(R.string.set_play_screen_lock_choice), false)) {
|
||||
player.setPlayWhenReady(false);
|
||||
} else {
|
||||
@ -1939,11 +1796,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
binding.mediaVideo.player(player);
|
||||
binding.doubleTapPlayerView.setPlayer(player);
|
||||
binding.loader.setVisibility(View.GONE);
|
||||
|
||||
startStream(
|
||||
peertube,
|
||||
null,
|
||||
res,
|
||||
true, position, null, null, false);
|
||||
true, position, captionURI, captionLang, false);
|
||||
}
|
||||
break;
|
||||
case SPEED:
|
||||
@ -1955,7 +1813,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
break;
|
||||
case CAPTION:
|
||||
Uri uri = null;
|
||||
Caption captionToUse = null;
|
||||
for (Caption caption : captions) {
|
||||
if (caption.getLanguage().getId().compareTo(item.getStrId()) == 0) {
|
||||
@ -1965,10 +1822,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
if (captionToUse != null) {
|
||||
if (!sepiaSearch) {
|
||||
uri = Uri.parse("https://" + HelperInstance.getLiveInstance(PeertubeActivity.this) + captionToUse.getCaptionPath());
|
||||
captionURI = Uri.parse("https://" + HelperInstance.getLiveInstance(PeertubeActivity.this) + captionToUse.getCaptionPath());
|
||||
} else {
|
||||
uri = Uri.parse("https://" + peertubeInstance + captionToUse.getCaptionPath());
|
||||
captionURI = Uri.parse("https://" + peertubeInstance + captionToUse.getCaptionPath());
|
||||
}
|
||||
} else {
|
||||
captionURI = null;
|
||||
}
|
||||
currentCaption = item.getStrId();
|
||||
long newPosition = player.getCurrentPosition();
|
||||
@ -1980,14 +1839,15 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
player = new SimpleExoPlayer.Builder(PeertubeActivity.this).setTrackSelector(trackSelector).build();
|
||||
binding.mediaVideo.player(player);
|
||||
binding.doubleTapPlayerView.setPlayer(player);
|
||||
captionLang = item.getStrId();
|
||||
startStream(
|
||||
peertube,
|
||||
null,
|
||||
null,
|
||||
true,
|
||||
newPosition,
|
||||
uri,
|
||||
item.getStrId(),
|
||||
captionURI,
|
||||
captionLang,
|
||||
false
|
||||
);
|
||||
break;
|
||||
@ -2360,16 +2220,16 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
DrawableCompat.setTint(bookmark, color);
|
||||
}
|
||||
|
||||
if (status.isReblogged()) {
|
||||
if (reblog != null && status.isReblogged()) {
|
||||
reblog.setColorFilter(getResources().getColor(R.color.positive_thumbs), PorterDuff.Mode.SRC_ATOP);
|
||||
DrawableCompat.setTint(reblog, getResources().getColor(R.color.positive_thumbs));
|
||||
}
|
||||
if (status.isFavourited()) {
|
||||
if (favorite != null && status.isFavourited()) {
|
||||
favorite.setColorFilter(getResources().getColor(R.color.favorite), PorterDuff.Mode.SRC_ATOP);
|
||||
DrawableCompat.setTint(favorite, getResources().getColor(R.color.favorite));
|
||||
}
|
||||
|
||||
if (status.isBookmarked()) {
|
||||
if (bookmark != null && status.isBookmarked()) {
|
||||
bookmark.setColorFilter(getResources().getColor(R.color.bookmark), PorterDuff.Mode.SRC_ATOP);
|
||||
DrawableCompat.setTint(bookmark, getResources().getColor(R.color.bookmark));
|
||||
}
|
||||
|
@ -284,6 +284,16 @@ public interface PeertubeService {
|
||||
@GET("users/me/notifications")
|
||||
Call<NotificationData> getNotifications(@Header("Authorization") String credentials, @Query("start") String maxId, @Query("count") String count, @Query("since_id") String sinceId);
|
||||
|
||||
@GET("users/me/notifications?start=0&count=0&unread=true")
|
||||
Call<NotificationData> countNotifications(@Header("Authorization") String credentials);
|
||||
|
||||
@POST("users/me/notifications/read-all")
|
||||
Call<String> markAllAsRead(@Header("Authorization") String credentials);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("users/me/notifications/read")
|
||||
Call<String> markAsRead(@Header("Authorization") String credentials, @Field("ids[]") List<String> ids);
|
||||
|
||||
//Update Notification settings
|
||||
@PUT("users/me/notification-settings")
|
||||
Call<String> updateNotifications(@Header("Authorization") String credentials, @Body NotificationSettings notificationSettings);
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.fedilab.fedilabtube.BuildConfig;
|
||||
import app.fedilab.fedilabtube.MainActivity;
|
||||
@ -85,6 +86,7 @@ import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
@ -103,6 +105,13 @@ public class RetrofitPeertubeAPI {
|
||||
private String token;
|
||||
private Set<String> selection;
|
||||
|
||||
|
||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
|
||||
public RetrofitPeertubeAPI(Context context) {
|
||||
_context = context;
|
||||
instance = HelperInstance.getLiveInstance(context);
|
||||
@ -199,6 +208,7 @@ public class RetrofitPeertubeAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(finalUrl)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
@ -215,6 +225,7 @@ public class RetrofitPeertubeAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(PeertubeService.class);
|
||||
}
|
||||
@ -283,6 +294,50 @@ public class RetrofitPeertubeAPI {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve notifications
|
||||
*
|
||||
* @return APIResponse
|
||||
*/
|
||||
public int unreadNotifications() {
|
||||
PeertubeService peertubeService = init();
|
||||
Call<NotificationData> notificationsCall = peertubeService.countNotifications("Bearer " + token);
|
||||
try {
|
||||
Response<NotificationData> response = notificationsCall.execute();
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
return response.body().total;
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark all notifications as read
|
||||
*/
|
||||
public void markAllAsRead() {
|
||||
PeertubeService peertubeService = init();
|
||||
Call<String> notificationsCall = peertubeService.markAllAsRead("Bearer " + token);
|
||||
try {
|
||||
Response<String> response = notificationsCall.execute();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a notification as read
|
||||
*/
|
||||
public void markAsRead(String id) {
|
||||
PeertubeService peertubeService = init();
|
||||
ArrayList<String> ids = new ArrayList<>();
|
||||
ids.add(id);
|
||||
Call<String> notificationsCall = peertubeService.markAsRead("Bearer " + token, ids);
|
||||
try {
|
||||
Response<String> response = notificationsCall.execute();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve notifications
|
||||
*
|
||||
@ -1525,7 +1580,10 @@ public class RetrofitPeertubeAPI {
|
||||
}
|
||||
try {
|
||||
RequestBody displayName = RequestBody.create(playlistParams.getDisplayName(), MediaType.parse("text/plain"));
|
||||
RequestBody description = RequestBody.create(playlistParams.getDescription(), MediaType.parse("text/plain"));
|
||||
RequestBody description = null;
|
||||
if (playlistParams.getDescription() != null) {
|
||||
description = RequestBody.create(playlistParams.getDescription(), MediaType.parse("text/plain"));
|
||||
}
|
||||
RequestBody channelId = RequestBody.create(playlistParams.getVideoChannelId(), MediaType.parse("text/plain"));
|
||||
if (apiAction == PlaylistsVM.action.CREATE_PLAYLIST) {
|
||||
Call<VideoPlaylistData.VideoPlaylistCreation> stringCall = peertubeService.addPlaylist(getToken(), displayName, description, playlistParams.getPrivacy(), channelId, bodyThumbnail);
|
||||
|
@ -205,14 +205,19 @@ public class VideoData {
|
||||
}
|
||||
|
||||
public List<File> getAllFile(Context context) {
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int mode = sharedpreferences.getInt(Helper.SET_VIDEO_MODE, Helper.VIDEO_MODE_NORMAL);
|
||||
if (files != null && files.size() > 0) {
|
||||
return files;
|
||||
} else if (streamingPlaylists != null) {
|
||||
List<File> files = new ArrayList<>();
|
||||
for (StreamingPlaylists streamingPlaylists : streamingPlaylists) {
|
||||
files.addAll(streamingPlaylists.getFiles());
|
||||
if (streamingPlaylists.getFiles().size() > 0) {
|
||||
files.addAll(streamingPlaylists.getFiles());
|
||||
} else {
|
||||
File file = new File();
|
||||
file.setFileUrl(streamingPlaylists.getPlaylistUrl());
|
||||
file.setFileDownloadUrl(streamingPlaylists.getPlaylistUrl());
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
@ -225,9 +230,17 @@ public class VideoData {
|
||||
for (File file : files) {
|
||||
if (file.getResolutions().getLabel().compareTo(resolution) == 0) {
|
||||
if (mode == Helper.VIDEO_MODE_MAGNET) {
|
||||
return file.getMagnetUri();
|
||||
if (file.getMagnetUri() != null) {
|
||||
return file.getMagnetUri();
|
||||
} else {
|
||||
return file.getFileUrl();
|
||||
}
|
||||
} else if (mode == Helper.VIDEO_MODE_TORRENT) {
|
||||
return file.getTorrentUrl();
|
||||
if (file.getTorrentUrl() != null) {
|
||||
return file.getTorrentUrl();
|
||||
} else {
|
||||
return file.getFileUrl();
|
||||
}
|
||||
} else {
|
||||
return file.getFileUrl();
|
||||
}
|
||||
@ -237,9 +250,17 @@ public class VideoData {
|
||||
File file = Helper.defaultFile(context, files);
|
||||
if (file != null) {
|
||||
if (mode == Helper.VIDEO_MODE_MAGNET) {
|
||||
return file.getMagnetUri();
|
||||
if (file.getMagnetUri() != null) {
|
||||
return file.getMagnetUri();
|
||||
} else {
|
||||
return file.getFileUrl();
|
||||
}
|
||||
} else if (mode == Helper.VIDEO_MODE_TORRENT) {
|
||||
return file.getTorrentUrl();
|
||||
if (file.getTorrentUrl() != null) {
|
||||
return file.getTorrentUrl();
|
||||
} else {
|
||||
return file.getFileUrl();
|
||||
}
|
||||
} else {
|
||||
return file.getFileUrl();
|
||||
}
|
||||
|
@ -28,15 +28,16 @@ import retrofit2.http.Query;
|
||||
|
||||
interface MastodonService {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("apps")
|
||||
Call<Oauth> getOauth(
|
||||
@Query("client_name") String client_name,
|
||||
@Query("redirect_uris") String redirect_uris,
|
||||
@Query("scopes") String scopes,
|
||||
@Query("website") String website);
|
||||
@Field("client_name") String client_name,
|
||||
@Field("redirect_uris") String redirect_uris,
|
||||
@Field("scopes") String scopes,
|
||||
@Field("website") String website);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/oauth/token")
|
||||
@POST("oauth/token")
|
||||
Call<Token> createToken(
|
||||
@Field("grant_type") String grant_type,
|
||||
@Field("client_id") String client_id,
|
||||
@ -53,12 +54,13 @@ interface MastodonService {
|
||||
@Query("q") String messageURL
|
||||
);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("statuses")
|
||||
Call<Status> postReply(
|
||||
@Header("Authorization") String credentials,
|
||||
@Query("in_reply_to_id") String inReplyToId,
|
||||
@Query("status") String content,
|
||||
@Query("visibility") String visibility
|
||||
@Field("in_reply_to_id") String inReplyToId,
|
||||
@Field("status") String content,
|
||||
@Field("visibility") String visibility
|
||||
);
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@ import android.os.Looper;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.fedilab.fedilabtube.MainActivity;
|
||||
import app.fedilab.fedilabtube.R;
|
||||
@ -36,6 +37,7 @@ import app.fedilab.fedilabtube.client.entities.Token;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import app.fedilab.fedilabtube.sqlite.MastodonAccountDAO;
|
||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
@ -49,6 +51,12 @@ public class RetrofitMastodonAPI {
|
||||
private String instance;
|
||||
private String token;
|
||||
|
||||
|
||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
public Status search(String url) throws Error {
|
||||
MastodonService mastodonService2 = init2();
|
||||
Call<Results> statusCall = mastodonService2.searchMessage(getToken(), url);
|
||||
@ -142,10 +150,25 @@ public class RetrofitMastodonAPI {
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
private MastodonService init_no_api() {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||
}
|
||||
return retrofit.create(MastodonService.class);
|
||||
}
|
||||
|
||||
private MastodonService init() {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(finalUrl)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
@ -158,6 +181,7 @@ public class RetrofitMastodonAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(finalUrl2)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
@ -223,7 +247,7 @@ public class RetrofitMastodonAPI {
|
||||
* @return Account
|
||||
*/
|
||||
public Token manageToken(OauthParams oauthParams) throws Error {
|
||||
MastodonService mastodonService = init();
|
||||
MastodonService mastodonService = init_no_api();
|
||||
Call<Token> createToken = mastodonService.createToken(
|
||||
oauthParams.getGrant_type(),
|
||||
oauthParams.getClient_id(),
|
||||
@ -274,7 +298,7 @@ public class RetrofitMastodonAPI {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Status postAction(actionType type, Status status) throws Error {
|
||||
public Status postAction(actionType type, Status status) {
|
||||
MastodonService mastodonService = init();
|
||||
Call<Status> postAction = null;
|
||||
if (status != null) {
|
||||
|
@ -31,10 +31,12 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.AccountActivity;
|
||||
import app.fedilab.fedilabtube.PeertubeActivity;
|
||||
import app.fedilab.fedilabtube.R;
|
||||
import app.fedilab.fedilabtube.ShowAccountActivity;
|
||||
import app.fedilab.fedilabtube.ShowChannelActivity;
|
||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||
import app.fedilab.fedilabtube.client.data.NotificationData.Notification;
|
||||
@ -43,6 +45,8 @@ import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||
|
||||
import static app.fedilab.fedilabtube.MainActivity.badgeCount;
|
||||
|
||||
|
||||
public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
@ -72,6 +76,11 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
holder.peertube_notif_pp.setVisibility(View.VISIBLE);
|
||||
AccountData.Account accountAction = null;
|
||||
ChannelData.Channel channelAction = null;
|
||||
if (notification.isRead()) {
|
||||
holder.unread.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
holder.unread.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (notification.getActorFollow() != null) {
|
||||
String profileUrl = notification.getActorFollow().getFollower().getAvatar() != null ? notification.getActorFollow().getFollower().getAvatar().getPath() : null;
|
||||
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
||||
@ -93,6 +102,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
accountAction.setDisplayName(actor.getDisplayName());
|
||||
accountAction.setHost(actor.getHost());
|
||||
accountAction.setUsername(actor.getName());
|
||||
holder.peertube_notif_message.setOnClickListener(v -> markAsRead(notification, position));
|
||||
} else if (notification.getComment() != null) { //Comment Notification
|
||||
String profileUrl = notification.getComment().getAccount().getAvatar() != null ? notification.getComment().getAccount().getAvatar().getPath() : null;
|
||||
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
||||
@ -112,6 +122,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
b.putString("video_id", notification.getComment().getVideo().getId());
|
||||
b.putString("video_uuid", notification.getComment().getVideo().getUuid());
|
||||
intent.putExtras(b);
|
||||
markAsRead(notification, position);
|
||||
context.startActivity(intent);
|
||||
});
|
||||
} else {
|
||||
@ -155,6 +166,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
b.putString("video_uuid", notification.getVideo().getUuid());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
markAsRead(notification, position);
|
||||
});
|
||||
} else if (notification.getVideoAbuse() != null && notification.getVideoAbuse().getVideo() != null) {
|
||||
message = context.getString(R.string.peertube_video_abuse, notification.getVideoAbuse().getVideo().getName());
|
||||
@ -163,6 +175,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
holder.peertube_notif_message.setText(Html.fromHtml(message));
|
||||
holder.peertube_notif_message.setOnClickListener(v -> markAsRead(notification, position));
|
||||
} else if (notification.getAbuse() != null) {
|
||||
clickableNotification = false;
|
||||
if (notification.getType() == DisplayNotificationsFragment.MY_VIDEO_REPPORT_SUCCESS) {
|
||||
@ -172,6 +185,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
holder.peertube_notif_message.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
holder.peertube_notif_message.setText(Html.fromHtml(message));
|
||||
holder.peertube_notif_message.setOnClickListener(v -> markAsRead(notification, position));
|
||||
}
|
||||
}
|
||||
holder.peertube_notif_date.setText(Helper.dateDiff(context, notification.getCreatedAt()));
|
||||
@ -197,6 +211,17 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
}
|
||||
}
|
||||
|
||||
private void markAsRead(Notification notification, int position) {
|
||||
if (!notification.isRead()) {
|
||||
notification.setRead(true);
|
||||
badgeCount--;
|
||||
if (context instanceof AccountActivity) {
|
||||
((AccountActivity) context).updateCounter();
|
||||
}
|
||||
notifyItemChanged(position);
|
||||
new Thread(() -> new RetrofitPeertubeAPI(context).markAsRead(notification.getId())).start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
@ -212,7 +237,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView peertube_notif_pp;
|
||||
TextView peertube_notif_message, peertube_notif_date;
|
||||
TextView peertube_notif_message, peertube_notif_date, unread;
|
||||
RelativeLayout main_container_trans;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
@ -221,6 +246,8 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<Recyc
|
||||
peertube_notif_message = itemView.findViewById(R.id.peertube_notif_message);
|
||||
peertube_notif_date = itemView.findViewById(R.id.peertube_notif_date);
|
||||
main_container_trans = itemView.findViewById(R.id.container_trans);
|
||||
unread = itemView.findViewById(R.id.unread);
|
||||
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
|
@ -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) {
|
||||
|
@ -34,6 +34,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import app.fedilab.fedilabtube.BuildConfig;
|
||||
import app.fedilab.fedilabtube.MainActivity;
|
||||
import app.fedilab.fedilabtube.R;
|
||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||
@ -315,7 +316,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||
CharSequence[] entriesTheme = arrayTheme.toArray(new CharSequence[0]);
|
||||
CharSequence[] entryValuesTheme = new CharSequence[3];
|
||||
final SharedPreferences sharedpref = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int currentTheme = sharedpref.getInt(Helper.SET_THEME, Helper.DEFAULT_MODE);
|
||||
int currentTheme = sharedpref.getInt(Helper.SET_THEME, BuildConfig.default_theme);
|
||||
entryValuesTheme[0] = String.valueOf(Helper.LIGHT_MODE);
|
||||
entryValuesTheme[1] = String.valueOf(Helper.DARK_MODE);
|
||||
entryValuesTheme[2] = String.valueOf(Helper.DEFAULT_MODE);
|
||||
@ -407,7 +408,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||
set_video_in_list_choice.setChecked(videosInList);
|
||||
|
||||
//****** Allow Chromecast *******
|
||||
int cast = sharedpref.getInt(getString(R.string.set_cast_choice), 0);
|
||||
int cast = sharedpref.getInt(getString(R.string.set_cast_choice), BuildConfig.cast_enabled);
|
||||
SwitchPreference set_cast_choice = findPreference(getString(R.string.set_cast_choice));
|
||||
assert set_cast_choice != null;
|
||||
set_cast_choice.setChecked(cast == 1);
|
||||
|
@ -135,6 +135,7 @@ public class Helper {
|
||||
public static final String VIDEO_ID = "video_id_update";
|
||||
public static final String APP_PREFS = "app_prefs";
|
||||
public static final String CAST_ID = "D402501A";
|
||||
public static final String CAST_ID_BITTUBE = "CBA4A31D";
|
||||
public static final int VIDEOS_PER_PAGE = 10;
|
||||
public static final String RECEIVE_ACTION = "receive_action";
|
||||
public static final String SET_UNFOLLOW_VALIDATION = "set_unfollow_validation";
|
||||
@ -691,4 +692,6 @@ public class Helper {
|
||||
return String.format(Locale.getDefault(), "%s%s", df.format(rounded), context.getString(R.string.b));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class AccountDAO {
|
||||
public List<Account> getAllPeertubeAccount() {
|
||||
|
||||
try {
|
||||
Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, Sqlite.COL_SOFTWARE + "=? OR " + Sqlite.COL_SOFTWARE + "is null", new String[]{"PEERTUBE"}, null, null, Sqlite.COL_INSTANCE + " ASC", null);
|
||||
Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, Sqlite.COL_SOFTWARE + "=? OR " + Sqlite.COL_SOFTWARE + " is null", new String[]{"PEERTUBE"}, null, null, Sqlite.COL_INSTANCE + " ASC", null);
|
||||
return cursorToListUser(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -107,7 +107,7 @@ public class MastodonPostActionsVM extends AndroidViewModel {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> statusMutableLiveData.setValue(statusReply);
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (Exception | Error e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
8
app/src/main/res/drawable/circle_red.xml
Normal file
8
app/src/main/res/drawable/circle_red.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@android:color/holo_red_dark" />
|
||||
<size
|
||||
android:width="10dp"
|
||||
android:height="10dp" />
|
||||
</shape>
|
10
app/src/main/res/drawable/ic_baseline_attach_money_24.xml
Normal file
10
app/src/main/res/drawable/ic_baseline_attach_money_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M11.8,10.9c-2.27,-0.59 -3,-1.2 -3,-2.15 0,-1.09 1.01,-1.85 2.7,-1.85 1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-1.94,0.42 -3.5,1.68 -3.5,3.61 0,2.31 1.91,3.46 4.7,4.13 2.5,0.6 3,1.48 3,2.41 0,0.69 -0.49,1.79 -2.7,1.79 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c1.95,-0.37 3.5,-1.5 3.5,-3.55 0,-2.84 -2.43,-3.81 -4.7,-4.4z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/ic_baseline_fiber_new_24.xml
Normal file
10
app/src/main/res/drawable/ic_baseline_fiber_new_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="@color/colorAccent"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,4H4C2.89,4 2.01,4.89 2.01,6L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2V6C22,4.89 21.11,4 20,4zM8.5,15H7.3l-2.55,-3.5V15H3.5V9h1.25l2.5,3.5V9H8.5V15zM13.5,10.26H11v1.12h2.5v1.26H11v1.11h2.5V15h-4V9h4V10.26zM20.5,14c0,0.55 -0.45,1 -1,1h-4c-0.55,0 -1,-0.45 -1,-1V9h1.25v4.51h1.13V9.99h1.25v3.51h1.12V9h1.25V14z" />
|
||||
</vector>
|
@ -46,7 +46,7 @@
|
||||
android:id="@+id/instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18sp"
|
||||
|
@ -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"
|
||||
@ -689,6 +640,5 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="30dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
35
app/src/main/res/layout/counter_account_icon.xml
Normal file
35
app/src/main/res/layout/counter_account_icon.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/account"
|
||||
android:src="@drawable/ic_outline_account_circle_24" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/view_alert_red_circle"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_gravity="top|end"
|
||||
android:background="@drawable/circle_red"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_alert_count_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
tools:text="3" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
@ -15,6 +15,7 @@
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@ -38,13 +39,27 @@
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/peertube_notif_date"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="end"
|
||||
android:textAlignment="viewEnd" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unread"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="invisible"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_fiber_new_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/peertube_notif_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="end"
|
||||
android:textAlignment="viewEnd" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/peertube_notif_message"
|
||||
|
@ -15,16 +15,16 @@
|
||||
android:title="@string/change_instance"
|
||||
android:visible="false"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_account"
|
||||
app:actionLayout="@layout/counter_account_icon"
|
||||
android:title="@string/account"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_playlist"
|
||||
android:icon="@drawable/ic_baseline_playlist_play_24"
|
||||
android:title="@string/playlists"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_account"
|
||||
android:icon="@drawable/ic_outline_account_circle_24"
|
||||
android:title="@string/account"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_upload"
|
||||
android:icon="@drawable/ic_baseline_cloud_upload_24"
|
||||
@ -67,4 +67,10 @@
|
||||
android:icon="@drawable/ic_baseline_info_24"
|
||||
android:title="@string/about_the_app"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_donate"
|
||||
android:icon="@drawable/ic_baseline_attach_money_24"
|
||||
android:title="@string/make_a_donation"
|
||||
android:visible="false"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
|
@ -361,4 +361,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -357,4 +357,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -356,4 +356,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -357,4 +357,20 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
</resources>
|
||||
|
@ -357,4 +357,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -357,4 +357,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -356,4 +356,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -356,4 +356,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -357,4 +357,22 @@
|
||||
<string name="watermark">Watermerk</string>
|
||||
<string name="toast_code_error">Er is een fout opgetreden! De instantie gaf geen autorisatiecode terug!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> extern account verbonden met de app.\n\nU kunt doorgaan naar bepaalde acties.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -359,4 +359,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -357,4 +357,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -358,4 +358,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -133,9 +133,9 @@
|
||||
<string name="action_follow">Подписка</string>
|
||||
<string name="action_mute">Игнорировать</string>
|
||||
<string name="unlimited">Без ограничений</string>
|
||||
<string name="peers">%1$d Peers</string>
|
||||
<string name="b">B</string>
|
||||
<string name="kb">KB</string>
|
||||
<string name="peers">%1$d пиров</string>
|
||||
<string name="b">Б</string>
|
||||
<string name="kb">КБ</string>
|
||||
<string name="mb">МБ</string>
|
||||
<string name="gb">ГБ</string>
|
||||
<string name="total_video_quota">Общая квота видео</string>
|
||||
@ -357,6 +357,24 @@
|
||||
<string name="instance_not_availabe">Экземпляр недоступен!</string>
|
||||
<string name="max_tag_size">На видео не должно быть более 5 тегов!</string>
|
||||
<string name="watermark">Водяной знак</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="toast_code_error">Произошла ошибка! Экземпляр не вернул код авторизации!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> удаленная учетная запись, связанная с приложением.\n\nВы можете перейти к некоторым ограниченным действиям.</string>
|
||||
<string name="donate">Пожертвование</string>
|
||||
<string name="my_donations">Мои пожертвования</string>
|
||||
<string name="one_time_donation_text">Здесь вы можете сделать единовременное пожертвование для поддержки разработки приложения. Это действие не принесет дополнительных возможностей!</string>
|
||||
<string name="recurrent_donation_text">Здесь вы можете сделать единовременное пожертвование для поддержки разработки приложения. Это действие не принесет дополнительных возможностей!</string>
|
||||
<string name="make_a_donation">Сделать пожертвование</string>
|
||||
<string name="donations_description">Здесь вы найдете список ваших периодических пожертвований, сделанных для поддержки разработки приложения! Спасибо!</string>
|
||||
<string name="support_the_app">Поддержка приложения</string>
|
||||
<string name="donation_cancelled">Пожертвование было отменено!</string>
|
||||
<string name="donation_succeeded_null">Благодарим Вас за ваше пожертвование!</string>
|
||||
<string name="donation_succeeded">Спасибо за пожертвование в %1$s!</string>
|
||||
<string name="one_time">Один раз</string>
|
||||
<string name="my_subscriptions">Моя подписка</string>
|
||||
<string name="month">Месяц</string>
|
||||
<string name="subscription_cancelled">Подписка отменена!</string>
|
||||
<string name="cancel_subscription">Отменить подписку</string>
|
||||
<string name="cancel_subscription_confirm">Вы уверены, что хотите отменить эту подписку?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Вы уверены, что хотите отметить все уведомления как прочитанные?</string>
|
||||
<string name="mark_all_as_read">Отметить все как прочитанные</string>
|
||||
</resources>
|
||||
|
@ -357,4 +357,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -355,4 +355,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -356,4 +356,22 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
</resources>
|
||||
|
@ -455,5 +455,23 @@
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="toast_code_error">An error occurred! The instance did not return an authorisation code!</string>
|
||||
<string name="remote_account_from"><b>%1$s</b> remote account connected with the app.\n\nYou can proceed to some limited actions.</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="my_donations">My donations</string>
|
||||
<string name="one_time_donation_text">Here, you can make a one time donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="recurrent_donation_text">Here, you can make a recurrent donation for supporting the development of the app. This action will not bring extra features!</string>
|
||||
<string name="make_a_donation">Make a donation</string>
|
||||
<string name="donations_description">Here you will find the list of your recurrent donations made to support the development of the app! Thank you!</string>
|
||||
<string name="support_the_app">Support the app</string>
|
||||
<string name="donation_cancelled">Donation has been cancelled!</string>
|
||||
<string name="donation_succeeded_null">Thank you for your donation!</string>
|
||||
<string name="donation_succeeded">Thank you for your donation of %1$s!</string>
|
||||
<string name="one_time">One time</string>
|
||||
<string name="my_subscriptions">My subscription</string>
|
||||
<string name="month">Month</string>
|
||||
<string name="subscription_cancelled">Subscription cancelled!</string>
|
||||
<string name="cancel_subscription">Cancel subscription</string>
|
||||
<string name="cancel_subscription_confirm">Are you sure, you want to cancel that subscription?</string>
|
||||
<string name="mark_all_notifications_as_read_confirm">Are you sure you want to mark all notifications as read?</string>
|
||||
<string name="mark_all_as_read">Mark all as read</string>
|
||||
|
||||
</resources>
|
@ -0,0 +1,261 @@
|
||||
package app.fedilab.fedilabtube;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||
import app.fedilab.fedilabtube.databinding.ActivityMainBinding;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||
import su.litvak.chromecast.api.v2.ChromeCasts;
|
||||
import su.litvak.chromecast.api.v2.ChromeCastsListener;
|
||||
import su.litvak.chromecast.api.v2.MediaStatus;
|
||||
|
||||
public abstract class BaseMainActivity extends AppCompatActivity implements ChromeCastsListener {
|
||||
|
||||
public static List<ChromeCast> chromeCasts;
|
||||
public static ChromeCast chromeCast;
|
||||
public static boolean chromecastActivated = false;
|
||||
protected ActivityMainBinding binding;
|
||||
private BroadcastReceiver manage_chromecast;
|
||||
private VideoData.Video castedTube;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
setContentView(view);
|
||||
ChromeCastsListener chromeCastsListener = this;
|
||||
ChromeCasts.registerListener(chromeCastsListener);
|
||||
|
||||
|
||||
binding.castClose.setOnClickListener(v -> {
|
||||
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt("displayed", 0);
|
||||
intentBC.putExtras(b);
|
||||
LocalBroadcastManager.getInstance(BaseMainActivity.this).sendBroadcast(intentBC);
|
||||
});
|
||||
|
||||
binding.castTogglePlay.setOnClickListener(v -> {
|
||||
if (chromeCast != null) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> binding.castTogglePlay.setVisibility(View.GONE);
|
||||
mainHandler.post(myRunnable);
|
||||
int icon = -1;
|
||||
if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
||||
chromeCast.pause();
|
||||
icon = R.drawable.ic_baseline_play_arrow_32;
|
||||
} else if (chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PAUSED) {
|
||||
chromeCast.play();
|
||||
icon = R.drawable.ic_baseline_pause_32;
|
||||
}
|
||||
if (icon != -1) {
|
||||
int finalIcon = icon;
|
||||
myRunnable = () -> binding.castTogglePlay.setImageResource(finalIcon);
|
||||
mainHandler.post(myRunnable);
|
||||
}
|
||||
myRunnable = () -> binding.castTogglePlay.setVisibility(View.VISIBLE);
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
manage_chromecast = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Bundle b = intent.getExtras();
|
||||
assert b != null;
|
||||
int state = b.getInt("state_asked", -1);
|
||||
int displayed = b.getInt("displayed", -1);
|
||||
castedTube = b.getParcelable("castedTube");
|
||||
|
||||
if (state == 1) {
|
||||
discoverCast();
|
||||
} else if (state == 0) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (chromeCast != null) {
|
||||
chromeCast.stopApp();
|
||||
chromeCast.disconnect();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
if (displayed == 1) {
|
||||
chromecastActivated = true;
|
||||
if (castedTube != null) {
|
||||
binding.castInfo.setVisibility(View.VISIBLE);
|
||||
Helper.loadGiF(BaseMainActivity.this, castedTube.getThumbnailPath(), binding.castView);
|
||||
binding.castTitle.setText(castedTube.getTitle());
|
||||
binding.castDescription.setText(castedTube.getDescription());
|
||||
}
|
||||
} else if (displayed == 0) {
|
||||
chromecastActivated = false;
|
||||
binding.castInfo.setVisibility(View.GONE);
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (chromeCast != null) {
|
||||
chromeCast.stopApp();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
};
|
||||
LocalBroadcastManager.getInstance(BaseMainActivity.this).registerReceiver(manage_chromecast, new IntentFilter(Helper.RECEIVE_CAST_SETTINGS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newChromeCastDiscovered(ChromeCast chromeCast) {
|
||||
if (chromeCasts == null) {
|
||||
chromeCasts = new ArrayList<>();
|
||||
chromeCasts.add(chromeCast);
|
||||
} else {
|
||||
boolean canBeAdded = true;
|
||||
for (ChromeCast cast : chromeCasts) {
|
||||
if (cast.getName().compareTo(chromeCast.getName()) == 0) {
|
||||
canBeAdded = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (canBeAdded) {
|
||||
chromeCasts.add(chromeCast);
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (chromeCast.isAppRunning(Helper.CAST_ID) && chromeCast.getMediaStatus() != null && chromeCast.getMediaStatus().playerState != null) {
|
||||
if (binding.castInfo.getVisibility() == View.GONE) {
|
||||
binding.castInfo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chromeCastRemoved(ChromeCast chromeCast) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
ChromeCasts.unregisterListener(this);
|
||||
if (manage_chromecast != null) {
|
||||
LocalBroadcastManager.getInstance(BaseMainActivity.this).unregisterReceiver(manage_chromecast);
|
||||
|
||||
new Thread(() -> {
|
||||
if (chromeCasts != null && chromeCasts.size() > 0) {
|
||||
for (ChromeCast cast : chromeCasts) {
|
||||
try {
|
||||
cast.stopApp();
|
||||
cast.disconnect();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
if (chromeCasts != null) {
|
||||
chromeCasts = null;
|
||||
}
|
||||
if (chromeCast != null) {
|
||||
chromeCast = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Method for discovering cast devices
|
||||
public void discoverCast() {
|
||||
|
||||
new Thread(() -> {
|
||||
if (chromeCasts != null) {
|
||||
for (ChromeCast cast : chromeCasts) {
|
||||
try {
|
||||
cast.disconnect();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
chromeCasts = null;
|
||||
}
|
||||
chromeCasts = new ArrayList<>();
|
||||
try {
|
||||
List<NetworkInterface> interfaces;
|
||||
interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
||||
for (NetworkInterface ni : interfaces) {
|
||||
if ((!ni.isLoopback()) && ni.isUp() && (ni.getName().equals("wlan0"))) {
|
||||
Enumeration<InetAddress> inetAddressEnumeration = ni.getInetAddresses();
|
||||
while (inetAddressEnumeration.hasMoreElements()) {
|
||||
InetAddress inetAddress = inetAddressEnumeration.nextElement();
|
||||
ChromeCasts.restartDiscovery(inetAddress);
|
||||
int tryFind = 0;
|
||||
while (ChromeCasts.get().isEmpty() && tryFind < 5) {
|
||||
try {
|
||||
//noinspection BusyWait
|
||||
Thread.sleep(1000);
|
||||
tryFind++;
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ChromeCasts.stopDiscovery();
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = this::invalidateOptionsMenu;
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
package app.fedilab.fedilabtube;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
|
||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||
import app.fedilab.fedilabtube.databinding.ActivityPeertubeBinding;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||
import su.litvak.chromecast.api.v2.MediaStatus;
|
||||
import su.litvak.chromecast.api.v2.Status;
|
||||
|
||||
import static app.fedilab.fedilabtube.helper.Helper.CAST_ID;
|
||||
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
public class BasePeertubeActivity extends AppCompatActivity {
|
||||
|
||||
protected ActivityPeertubeBinding binding;
|
||||
protected VideoData.Video peertube;
|
||||
protected SimpleExoPlayer player;
|
||||
protected String videoURL;
|
||||
protected String subtitlesStr;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityPeertubeBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
setContentView(view);
|
||||
binding.minController.castPlay.setOnClickListener(v -> {
|
||||
binding.minController.castLoader.setVisibility(View.VISIBLE);
|
||||
if (BaseMainActivity.chromeCast != null) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
int icon = -1;
|
||||
if (BaseMainActivity.chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PLAYING) {
|
||||
BaseMainActivity.chromeCast.pause();
|
||||
icon = R.drawable.ic_baseline_play_arrow_32;
|
||||
} else if (BaseMainActivity.chromeCast.getMediaStatus().playerState == MediaStatus.PlayerState.PAUSED) {
|
||||
BaseMainActivity.chromeCast.play();
|
||||
icon = R.drawable.ic_baseline_pause_32;
|
||||
}
|
||||
if (icon != -1) {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
int finalIcon = icon;
|
||||
Runnable myRunnable = () -> binding.minController.castPlay.setImageResource(finalIcon);
|
||||
mainHandler.post(myRunnable);
|
||||
}
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> binding.minController.castLoader.setVisibility(View.GONE);
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_cast) {
|
||||
if (BaseMainActivity.chromeCasts != null && BaseMainActivity.chromeCasts.size() > 0) {
|
||||
String[] chromecast_choice = new String[BaseMainActivity.chromeCasts.size()];
|
||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
|
||||
alt_bld.setTitle(R.string.chromecast_choice);
|
||||
int i = 0;
|
||||
for (ChromeCast cc : BaseMainActivity.chromeCasts) {
|
||||
chromecast_choice[i] = cc.getTitle();
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
for (ChromeCast cc : BaseMainActivity.chromeCasts) {
|
||||
if (BaseMainActivity.chromecastActivated && cc.isConnected()) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
alt_bld.setSingleChoiceItems(chromecast_choice, i, (dialog, position) -> {
|
||||
BaseMainActivity.chromeCast = BaseMainActivity.chromeCasts.get(position);
|
||||
new Thread(() -> {
|
||||
if (BaseMainActivity.chromeCast != null) {
|
||||
Intent intentBC = new Intent(Helper.RECEIVE_CAST_SETTINGS);
|
||||
Bundle b = new Bundle();
|
||||
if (BaseMainActivity.chromecastActivated) {
|
||||
b.putInt("displayed", 0);
|
||||
intentBC.putExtras(b);
|
||||
LocalBroadcastManager.getInstance(BasePeertubeActivity.this).sendBroadcast(intentBC);
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
binding.doubleTapPlayerView.setVisibility(View.VISIBLE);
|
||||
binding.minController.castMiniController.setVisibility(View.GONE);
|
||||
};
|
||||
mainHandler.post(myRunnable);
|
||||
|
||||
} else {
|
||||
b.putInt("displayed", 1);
|
||||
b.putParcelable("castedTube", peertube);
|
||||
intentBC.putExtras(b);
|
||||
LocalBroadcastManager.getInstance(BasePeertubeActivity.this).sendBroadcast(intentBC);
|
||||
try {
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
invalidateOptionsMenu();
|
||||
binding.minController.castLoader.setVisibility(View.VISIBLE);
|
||||
player.setPlayWhenReady(false);
|
||||
binding.doubleTapPlayerView.setVisibility(View.GONE);
|
||||
binding.minController.castMiniController.setVisibility(View.VISIBLE);
|
||||
dialog.dismiss();
|
||||
if (videoURL != null) {
|
||||
if (player != null && player.getCurrentPosition() > 0) {
|
||||
videoURL += "?start=" + (player.getCurrentPosition() / 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
mainHandler.post(myRunnable);
|
||||
if (!BaseMainActivity.chromeCast.isConnected()) {
|
||||
BaseMainActivity.chromeCast.connect();
|
||||
}
|
||||
myRunnable = this::invalidateOptionsMenu;
|
||||
mainHandler.post(myRunnable);
|
||||
Status status = BaseMainActivity.chromeCast.getStatus();
|
||||
if (BaseMainActivity.chromeCast.isAppAvailable(CAST_ID) && !status.isAppRunning(CAST_ID)) {
|
||||
BaseMainActivity.chromeCast.launchApp(CAST_ID);
|
||||
}
|
||||
if (videoURL != null) {
|
||||
String mime = MimeTypeMap.getFileExtensionFromUrl(videoURL);
|
||||
BaseMainActivity.chromeCast.setRequestTimeout(60000);
|
||||
BaseMainActivity.chromeCast.load(peertube.getTitle(), null, videoURL, mime);
|
||||
BaseMainActivity.chromeCast.play();
|
||||
binding.minController.castPlay.setImageResource(R.drawable.ic_baseline_pause_32);
|
||||
}
|
||||
myRunnable = () -> binding.minController.castLoader.setVisibility(View.GONE);
|
||||
mainHandler.post(myRunnable);
|
||||
} catch (IOException | GeneralSecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Runnable myRunnable = () -> {
|
||||
invalidateOptionsMenu();
|
||||
dialog.dismiss();
|
||||
};
|
||||
mainHandler.post(myRunnable);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
alt_bld.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
|
||||
AlertDialog alert = alt_bld.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.video_menu, menu);
|
||||
MenuItem castItem = menu.findItem(R.id.action_cast);
|
||||
if (BaseMainActivity.chromeCasts != null && BaseMainActivity.chromeCasts.size() > 0) {
|
||||
castItem.setVisible(true);
|
||||
if (BaseMainActivity.chromeCast != null && BaseMainActivity.chromeCast.isConnected()) {
|
||||
castItem.setIcon(R.drawable.ic_baseline_cast_connected_24);
|
||||
} else {
|
||||
castItem.setIcon(R.drawable.ic_baseline_cast_24);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package app.fedilab.fedilabtube.provider;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
public class CastOptionsProvider {
|
||||
}
|
54
app/src/no_google_cast_lib/res/layout/min_controller.xml
Normal file
54
app/src/no_google_cast_lib/res/layout/min_controller.xml
Normal 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>
|
@ -0,0 +1,20 @@
|
||||
package app.fedilab.fedilabtube;
|
||||
/* Copyright 2021 Thomas Schneider
|
||||
*
|
||||
* This file is a part of TubeLab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
//Do nothing
|
||||
public class DonationActivity {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
Added:
|
||||
- Notification counter
|
||||
- Mark all notifications as read
|
||||
- Google: donations via Google Billing
|
||||
|
||||
Changed:
|
||||
- Improve layout for lives
|
||||
- Move the account item
|
||||
|
||||
Fixed:
|
||||
- Cannot connect Pleroma/Mastodon accounts
|
||||
- Issue with captions when changing the resolution
|
||||
- Keep playing when screen is off
|
||||
- Creating a Playlist without description crashes
|
||||
- Live not starting issue
|
@ -0,0 +1,16 @@
|
||||
Added:
|
||||
- Notification counter
|
||||
- Mark all notifications as read
|
||||
- Google: donations via Google Billing
|
||||
|
||||
Changed:
|
||||
- Improve layout for lives
|
||||
- Move the account item
|
||||
|
||||
Fixed:
|
||||
- Cannot connect Pleroma/Mastodon accounts
|
||||
- Cannot comment/reply with Pleroma accounts
|
||||
- Issue with captions when changing the resolution
|
||||
- Keep playing when screen is off
|
||||
- Creating a Playlist without description crashes
|
||||
- Live not starting issue
|
@ -20,6 +20,7 @@ apply plugin: 'de.undercouch.download'
|
||||
|
||||
group='com.github.TorrentStream'
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
|
Reference in New Issue
Block a user