mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-04-25 07:28:46 +02:00
some upgrades
This commit is contained in:
parent
e605dd8417
commit
ce4913452b
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.badgeCount;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
@ -54,13 +56,12 @@ import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
|
|||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.badgeCount;
|
|
||||||
|
|
||||||
|
|
||||||
public class AccountActivity extends AppCompatActivity {
|
public class AccountActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
private ActivityAccountBinding binding;
|
private ActivityAccountBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -259,6 +260,11 @@ public class AccountActivity extends AppCompatActivity {
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
|
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pager adapter for three tabs (notifications, muted, blocked)
|
* Pager adapter for three tabs (notifications, muted, blocked)
|
||||||
@ -292,11 +298,5 @@ public class AccountActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
super.onBackPressed();
|
|
||||||
overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up_down);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -67,9 +70,6 @@ import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistAdapter.AllPlaylistRemoved {
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@ import android.os.Build;
|
|||||||
|
|
||||||
import androidx.multidex.MultiDex;
|
import androidx.multidex.MultiDex;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
import androidx.work.Configuration;
|
|
||||||
import androidx.work.WorkManager;
|
|
||||||
|
|
||||||
import net.gotev.uploadservice.UploadServiceConfig;
|
import net.gotev.uploadservice.UploadServiceConfig;
|
||||||
import net.gotev.uploadservice.observer.request.GlobalRequestObserver;
|
import net.gotev.uploadservice.observer.request.GlobalRequestObserver;
|
||||||
|
@ -15,6 +15,8 @@ package app.fedilab.fedilabtube;
|
|||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
@ -48,8 +50,6 @@ import app.fedilab.fedilabtube.helper.RoundedBackgroundSpan;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.InstancesVM;
|
import app.fedilab.fedilabtube.viewmodel.InstancesVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class InstancePickerActivity extends AppCompatActivity {
|
public class InstancePickerActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -22,7 +24,6 @@ import android.text.SpannableString;
|
|||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.text.style.UnderlineSpan;
|
import android.text.style.UnderlineSpan;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -54,8 +55,6 @@ import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
|||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
|
||||||
|
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@ -132,11 +131,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
for (AcadInstances ac : acadInstances) {
|
for (AcadInstances ac : acadInstances) {
|
||||||
academiesKey[i] = ac.getName();
|
academiesKey[i] = ac.getName();
|
||||||
academiesValue[i] = ac.getUrl();
|
academiesValue[i] = ac.getUrl();
|
||||||
Log.v(Helper.TAG, "url 1: " + ac.getUrl());
|
|
||||||
Log.v(Helper.TAG, "url 2: " + acad);
|
|
||||||
if (ac.getUrl().compareTo(acad) == 0) {
|
if (ac.getUrl().compareTo(acad) == 0) {
|
||||||
position = i;
|
position = i;
|
||||||
Log.v(Helper.TAG, "ok: " + position);
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -147,17 +143,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
acadInstance = academiesValue[position];
|
acadInstance = academiesValue[position];
|
||||||
if (acadInstances.get(position).isOpenId()) {
|
binding.loginUidContainer.setVisibility(View.GONE);
|
||||||
binding.loginUidContainer.setVisibility(View.GONE);
|
binding.loginPasswdContainer.setVisibility(View.GONE);
|
||||||
binding.loginPasswdContainer.setVisibility(View.GONE);
|
binding.loginInstanceContainer.setVisibility(View.GONE);
|
||||||
binding.loginInstanceContainer.setVisibility(View.GONE);
|
binding.createAnAccountPeertube.setVisibility(View.GONE);
|
||||||
binding.createAnAccountPeertube.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
binding.loginUidContainer.setVisibility(View.VISIBLE);
|
|
||||||
binding.loginPasswdContainer.setVisibility(View.VISIBLE);
|
|
||||||
binding.loginInstanceContainer.setVisibility(View.GONE);
|
|
||||||
binding.createAnAccountPeertube.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -213,7 +202,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
editor.apply();
|
editor.apply();
|
||||||
Intent intent = new Intent(LoginActivity.this, WebviewConnectActivity.class);
|
Intent intent = new Intent(LoginActivity.this, WebviewConnectActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
b.putString("url", "https://" + acadInstance + "/plugins/auth-openid-connect/0.0.1/auth/openid-connect");
|
b.putString("url", "https://" + acadInstance + "/plugins/auth-openid-connect/0.0.7/auth/openid-connect");
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.NORMAL;
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -82,10 +86,6 @@ import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.NORMAL;
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class MainActivity extends BaseMainActivity {
|
public class MainActivity extends BaseMainActivity {
|
||||||
|
|
||||||
@ -95,12 +95,10 @@ public class MainActivity extends BaseMainActivity {
|
|||||||
public static UserMe userMe;
|
public static UserMe userMe;
|
||||||
public static InstanceData.InstanceConfig instanceConfig;
|
public static InstanceData.InstanceConfig instanceConfig;
|
||||||
public static TypeOfConnection typeOfConnection;
|
public static TypeOfConnection typeOfConnection;
|
||||||
|
public static int badgeCount;
|
||||||
|
|
||||||
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
||||||
private DisplayOverviewFragment overviewFragment;
|
private DisplayOverviewFragment overviewFragment;
|
||||||
private ActivityMainBinding binding;
|
private ActivityMainBinding binding;
|
||||||
public static int badgeCount;
|
|
||||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
= item -> {
|
= item -> {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
@ -215,7 +213,6 @@ public class MainActivity extends BaseMainActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -223,7 +220,6 @@ public class MainActivity extends BaseMainActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE_SURF;
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.showRadioButtonDialogFullInstances;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -39,9 +42,6 @@ import app.fedilab.fedilabtube.sqlite.Sqlite;
|
|||||||
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
|
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE_SURF;
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.showRadioButtonDialogFullInstances;
|
|
||||||
|
|
||||||
|
|
||||||
public class ManageInstancesActivity extends AppCompatActivity implements AboutInstanceAdapter.AllInstancesRemoved {
|
public class ManageInstancesActivity extends AppCompatActivity implements AboutInstanceAdapter.AllInstancesRemoved {
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@ import android.widget.Toast;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.mastodon.RetrofitMastodonAPI;
|
|
||||||
import app.fedilab.fedilabtube.client.entities.Error;
|
import app.fedilab.fedilabtube.client.entities.Error;
|
||||||
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
import app.fedilab.fedilabtube.client.entities.OauthParams;
|
||||||
import app.fedilab.fedilabtube.client.entities.Token;
|
import app.fedilab.fedilabtube.client.entities.Token;
|
||||||
|
import app.fedilab.fedilabtube.client.mastodon.RetrofitMastodonAPI;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
||||||
|
import static app.fedilab.fedilabtube.worker.WorkHelper.NOTIFICATION_WORKER;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -55,9 +58,6 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
import app.fedilab.fedilabtube.worker.WorkHelper;
|
import app.fedilab.fedilabtube.worker.WorkHelper;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
|
||||||
import static app.fedilab.fedilabtube.worker.WorkHelper.NOTIFICATION_WORKER;
|
|
||||||
|
|
||||||
public class MyAccountActivity extends AppCompatActivity {
|
public class MyAccountActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final int PICK_IMAGE = 466;
|
private static final int PICK_IMAGE = 466;
|
||||||
|
@ -14,6 +14,18 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
|
||||||
|
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.canMakeAction;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.getAttColor;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.loadGiF;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -158,23 +170,13 @@ import app.fedilab.fedilabtube.webview.MastalabWebChromeClient;
|
|||||||
import app.fedilab.fedilabtube.webview.MastalabWebViewClient;
|
import app.fedilab.fedilabtube.webview.MastalabWebViewClient;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
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.canMakeAction;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.getAttColor;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.loadGiF;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
import static com.google.android.exoplayer2.Player.MEDIA_ITEM_TRANSITION_REASON_AUTO;
|
|
||||||
|
|
||||||
|
|
||||||
public class PeertubeActivity extends BasePeertubeActivity 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 String video_id;
|
||||||
public static List<String> playedVideos = new ArrayList<>();
|
public static List<String> playedVideos = new ArrayList<>();
|
||||||
|
Uri captionURI;
|
||||||
|
String captionLang;
|
||||||
private String peertubeInstance, videoUuid;
|
private String peertubeInstance, videoUuid;
|
||||||
private ImageView fullScreenIcon;
|
private ImageView fullScreenIcon;
|
||||||
private boolean fullScreenMode;
|
private boolean fullScreenMode;
|
||||||
@ -203,10 +205,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
|
|||||||
private String currentCaption;
|
private String currentCaption;
|
||||||
private boolean isRemote;
|
private boolean isRemote;
|
||||||
private boolean willPlayFromIntent;
|
private boolean willPlayFromIntent;
|
||||||
|
|
||||||
private app.fedilab.fedilabtube.client.mastodon.Status status;
|
private app.fedilab.fedilabtube.client.mastodon.Status status;
|
||||||
Uri captionURI;
|
|
||||||
String captionLang;
|
|
||||||
|
|
||||||
public static void hideKeyboard(Activity activity) {
|
public static void hideKeyboard(Activity activity) {
|
||||||
if (activity != null && activity.getWindow() != null) {
|
if (activity != null && activity.getWindow() != null) {
|
||||||
@ -495,7 +494,6 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void manageVIewVideos(APIResponse apiResponse) {
|
private void manageVIewVideos(APIResponse apiResponse) {
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.PEERTUBEDELETEVIDEO;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -61,10 +65,6 @@ import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.PEERTUBEDELETEVIDEO;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class PeertubeEditUploadActivity extends AppCompatActivity {
|
public class PeertubeEditUploadActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -42,8 +44,6 @@ import app.fedilab.fedilabtube.helper.HelperAcadInstance;
|
|||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.PICK_INSTANCE;
|
|
||||||
|
|
||||||
public class PeertubeRegisterActivity extends AppCompatActivity {
|
public class PeertubeRegisterActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
@ -62,10 +66,6 @@ import app.fedilab.fedilabtube.helper.HelperInstance;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class PeertubeUploadActivity extends AppCompatActivity {
|
public class PeertubeUploadActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.PeertubeActivity.hideKeyboard;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -42,9 +45,6 @@ import app.fedilab.fedilabtube.databinding.ActivitySepiaSearchBinding;
|
|||||||
import app.fedilab.fedilabtube.fragment.DisplaySepiaSearchFragment;
|
import app.fedilab.fedilabtube.fragment.DisplaySepiaSearchFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.PeertubeActivity.hideKeyboard;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class SepiaSearchActivity extends AppCompatActivity {
|
public class SepiaSearchActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -54,10 +58,6 @@ import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
|
||||||
|
|
||||||
|
|
||||||
public class ShowAccountActivity extends AppCompatActivity {
|
public class ShowAccountActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -14,6 +14,15 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.CHANNEL;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
@ -69,15 +78,6 @@ import app.fedilab.fedilabtube.viewmodel.RelationshipVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.TypeOfConnection.SURFING;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.CHANNEL;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
|
||||||
|
|
||||||
|
|
||||||
public class ShowChannelActivity extends AppCompatActivity {
|
public class ShowChannelActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.HISTORY;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -38,8 +40,6 @@ import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
|||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.HISTORY;
|
|
||||||
|
|
||||||
|
|
||||||
public class VideosTimelineActivity extends AppCompatActivity {
|
public class VideosTimelineActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -23,6 +25,7 @@ import android.view.MenuItem;
|
|||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
import android.webkit.CookieSyncManager;
|
import android.webkit.CookieSyncManager;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
@ -40,13 +43,11 @@ import app.fedilab.fedilabtube.client.entities.Token;
|
|||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.webview.CustomWebview;
|
import app.fedilab.fedilabtube.webview.CustomWebview;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.updateCredential;
|
|
||||||
|
|
||||||
|
|
||||||
public class WebviewConnectActivity extends AppCompatActivity {
|
public class WebviewConnectActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
private CustomWebview webView;
|
private WebView webView;
|
||||||
private AlertDialog alert;
|
private AlertDialog alert;
|
||||||
private String clientId, clientSecret;
|
private String clientId, clientSecret;
|
||||||
private String url;
|
private String url;
|
||||||
@ -72,7 +73,7 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
WebView.setWebContentsDebuggingEnabled(true);
|
||||||
setContentView(R.layout.activity_webview_connect);
|
setContentView(R.layout.activity_webview_connect);
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
@ -87,11 +88,19 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
|||||||
webView = findViewById(R.id.webviewConnect);
|
webView = findViewById(R.id.webviewConnect);
|
||||||
clearCookies(WebviewConnectActivity.this);
|
clearCookies(WebviewConnectActivity.this);
|
||||||
webView.getSettings().setJavaScriptEnabled(true);
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
|
||||||
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
|
webView.getSettings().setUseWideViewPort(true);
|
||||||
} else {
|
webView.getSettings().setLoadWithOverviewMode(true);
|
||||||
CookieManager.getInstance().setAcceptCookie(true);
|
webView.getSettings().setSupportZoom(true);
|
||||||
}
|
webView.getSettings().setDisplayZoomControls(false);
|
||||||
|
webView.getSettings().setBuiltInZoomControls(true);
|
||||||
|
webView.getSettings().setAllowContentAccess(true);
|
||||||
|
webView.getSettings().setLoadsImagesAutomatically(true);
|
||||||
|
webView.getSettings().setSupportMultipleWindows(false);
|
||||||
|
webView.getSettings().setAppCacheEnabled(true);
|
||||||
|
webView.getSettings().setDatabaseEnabled(true);
|
||||||
|
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
|
webView.getSettings().setMediaPlaybackRequiresUserGesture(true);
|
||||||
if (getSupportActionBar() != null)
|
if (getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
setTitle(R.string.login);
|
setTitle(R.string.login);
|
||||||
@ -112,7 +121,6 @@ public class WebviewConnectActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
webView.setWebViewClient(new WebViewClient() {
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageFinished(WebView view, String url) {
|
public void onPageFinished(WebView view, String url) {
|
||||||
Matcher matcher = Helper.redirectPattern.matcher(url);
|
Matcher matcher = Helper.redirectPattern.matcher(url);
|
||||||
|
@ -97,6 +97,10 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||||||
@SuppressWarnings({"unused", "RedundantSuppression", "ConstantConditions"})
|
@SuppressWarnings({"unused", "RedundantSuppression", "ConstantConditions"})
|
||||||
public class RetrofitPeertubeAPI {
|
public class RetrofitPeertubeAPI {
|
||||||
|
|
||||||
|
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||||
|
.readTimeout(60, TimeUnit.SECONDS)
|
||||||
|
.connectTimeout(60, TimeUnit.SECONDS)
|
||||||
|
.build();
|
||||||
private final String finalUrl;
|
private final String finalUrl;
|
||||||
private final Context _context;
|
private final Context _context;
|
||||||
private final String instance;
|
private final String instance;
|
||||||
@ -106,12 +110,6 @@ public class RetrofitPeertubeAPI {
|
|||||||
private Set<String> selection;
|
private Set<String> selection;
|
||||||
|
|
||||||
|
|
||||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
||||||
.readTimeout(60, TimeUnit.SECONDS)
|
|
||||||
.connectTimeout(60, TimeUnit.SECONDS)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
|
|
||||||
public RetrofitPeertubeAPI(Context context) {
|
public RetrofitPeertubeAPI(Context context) {
|
||||||
_context = context;
|
_context = context;
|
||||||
instance = HelperInstance.getLiveInstance(context);
|
instance = HelperInstance.getLiveInstance(context);
|
||||||
|
@ -15,7 +15,6 @@ package app.fedilab.fedilabtube.client.entities;
|
|||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -29,6 +29,18 @@ import app.fedilab.fedilabtube.client.entities.Avatar;
|
|||||||
public class MastodonAccount {
|
public class MastodonAccount {
|
||||||
|
|
||||||
|
|
||||||
|
public static AccountData.Account convertToPeertubeAccount(MastodonAccount.Account initialAccount) {
|
||||||
|
AccountData.Account account = new AccountData.Account();
|
||||||
|
Avatar avatar = new Avatar();
|
||||||
|
avatar.setPath(initialAccount.getAvatar());
|
||||||
|
account.setAvatar(avatar);
|
||||||
|
account.setDescription(initialAccount.getDescription());
|
||||||
|
account.setDisplayName(initialAccount.getDisplayName());
|
||||||
|
account.setUsername(initialAccount.getUsername());
|
||||||
|
account.setHost(initialAccount.getHost());
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
public static class Account implements Parcelable {
|
public static class Account implements Parcelable {
|
||||||
public static final Creator<Account> CREATOR = new Creator<Account>() {
|
public static final Creator<Account> CREATOR = new Creator<Account>() {
|
||||||
@Override
|
@Override
|
||||||
@ -240,16 +252,4 @@ public class MastodonAccount {
|
|||||||
dest.writeString(this.url);
|
dest.writeString(this.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AccountData.Account convertToPeertubeAccount(MastodonAccount.Account initialAccount) {
|
|
||||||
AccountData.Account account = new AccountData.Account();
|
|
||||||
Avatar avatar = new Avatar();
|
|
||||||
avatar.setPath(initialAccount.getAvatar());
|
|
||||||
account.setAvatar(avatar);
|
|
||||||
account.setDescription(initialAccount.getDescription());
|
|
||||||
account.setDisplayName(initialAccount.getDisplayName());
|
|
||||||
account.setUsername(initialAccount.getUsername());
|
|
||||||
account.setHost(initialAccount.getHost());
|
|
||||||
return account;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -45,17 +45,33 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||||||
|
|
||||||
public class RetrofitMastodonAPI {
|
public class RetrofitMastodonAPI {
|
||||||
|
|
||||||
|
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||||
|
.readTimeout(60, TimeUnit.SECONDS)
|
||||||
|
.connectTimeout(60, TimeUnit.SECONDS)
|
||||||
|
.build();
|
||||||
private final String finalUrl;
|
private final String finalUrl;
|
||||||
private final String finalUrl2;
|
private final String finalUrl2;
|
||||||
private final Context _context;
|
private final Context _context;
|
||||||
private String instance;
|
private String instance;
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
|
public RetrofitMastodonAPI(Context context) {
|
||||||
|
_context = context;
|
||||||
|
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
this.instance = sharedpreferences.getString(Helper.PREF_REMOTE_INSTANCE, null);
|
||||||
|
this.token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||||
|
finalUrl = "https://" + this.instance + "/api/v1/";
|
||||||
|
finalUrl2 = "https://" + this.instance + "/api/v2/";
|
||||||
|
}
|
||||||
|
|
||||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
||||||
.readTimeout(60, TimeUnit.SECONDS)
|
public RetrofitMastodonAPI(Context context, String instance, String token) {
|
||||||
.connectTimeout(60, TimeUnit.SECONDS)
|
_context = context;
|
||||||
.build();
|
this.instance = instance;
|
||||||
|
this.token = token;
|
||||||
|
finalUrl = "https://" + instance + "/api/v1/";
|
||||||
|
finalUrl2 = "https://" + this.instance + "/api/v2/";
|
||||||
|
}
|
||||||
|
|
||||||
public Status search(String url) throws Error {
|
public Status search(String url) throws Error {
|
||||||
MastodonService mastodonService2 = init2();
|
MastodonService mastodonService2 = init2();
|
||||||
@ -81,24 +97,6 @@ public class RetrofitMastodonAPI {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RetrofitMastodonAPI(Context context) {
|
|
||||||
_context = context;
|
|
||||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
|
||||||
this.instance = sharedpreferences.getString(Helper.PREF_REMOTE_INSTANCE, null);
|
|
||||||
this.token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
|
||||||
finalUrl = "https://" + this.instance + "/api/v1/";
|
|
||||||
finalUrl2 = "https://" + this.instance + "/api/v2/";
|
|
||||||
}
|
|
||||||
|
|
||||||
public RetrofitMastodonAPI(Context context, String instance, String token) {
|
|
||||||
_context = context;
|
|
||||||
this.instance = instance;
|
|
||||||
this.token = token;
|
|
||||||
finalUrl = "https://" + instance + "/api/v1/";
|
|
||||||
finalUrl2 = "https://" + this.instance + "/api/v2/";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateCredential(Activity activity, String client_id, String client_secret, String refresh_token, String software) {
|
public void updateCredential(Activity activity, String client_id, String client_secret, String refresh_token, String software) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
MastodonAccount.Account account;
|
MastodonAccount.Account account;
|
||||||
@ -340,6 +338,13 @@ public class RetrofitMastodonAPI {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getToken() {
|
||||||
|
if (token != null) {
|
||||||
|
return "Bearer " + token;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum actionType {
|
public enum actionType {
|
||||||
BOOST,
|
BOOST,
|
||||||
@ -349,12 +354,4 @@ public class RetrofitMastodonAPI {
|
|||||||
BOOKMARK,
|
BOOKMARK,
|
||||||
UNBOOKMARK
|
UNBOOKMARK
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getToken() {
|
|
||||||
if (token != null) {
|
|
||||||
return "Bearer " + token;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ package app.fedilab.fedilabtube.drawer;
|
|||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@ -45,8 +47,6 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
|
||||||
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
|
||||||
|
|
||||||
|
|
||||||
public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube.drawer;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@ -64,9 +67,6 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
|
|
||||||
|
|
||||||
|
|
||||||
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
@ -15,6 +15,10 @@ package app.fedilab.fedilabtube.drawer;
|
|||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -41,10 +45,6 @@ import app.fedilab.fedilabtube.client.data.InstanceData.Instance;
|
|||||||
import app.fedilab.fedilabtube.databinding.DrawerInstanceBinding;
|
import app.fedilab.fedilabtube.databinding.DrawerInstanceBinding;
|
||||||
import app.fedilab.fedilabtube.helper.RoundedBackgroundSpan;
|
import app.fedilab.fedilabtube.helper.RoundedBackgroundSpan;
|
||||||
|
|
||||||
import static android.app.Activity.RESULT_OK;
|
|
||||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
@ -14,6 +14,11 @@ package app.fedilab.fedilabtube.drawer;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.MY_VIDEOS;
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.SEPIA_SEARCH;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -70,11 +75,6 @@ import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
|||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.MY_VIDEOS;
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.SEPIA_SEARCH;
|
|
||||||
|
|
||||||
|
|
||||||
public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.drawer;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.badgeCount;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -45,8 +47,6 @@ import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment;
|
|||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.badgeCount;
|
|
||||||
|
|
||||||
|
|
||||||
public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.drawer;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.PlaylistsVM.action.GET_LIST_VIDEOS;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -72,8 +74,6 @@ import app.fedilab.fedilabtube.sqlite.Sqlite;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.PlaylistsVM.action.GET_LIST_VIDEOS;
|
|
||||||
|
|
||||||
|
|
||||||
public class PlaylistAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class PlaylistAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.fragment;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -63,8 +65,6 @@ import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.SearchVM;
|
import app.fedilab.fedilabtube.viewmodel.SearchVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
|
|
||||||
|
|
||||||
|
|
||||||
public class DisplayChannelsFragment extends Fragment implements ChannelListAdapter.AllChannelRemoved, ChannelListAdapter.EditAlertDialog {
|
public class DisplayChannelsFragment extends Fragment implements ChannelListAdapter.AllChannelRemoved, ChannelListAdapter.EditAlertDialog {
|
||||||
|
|
||||||
|
@ -14,6 +14,10 @@ package app.fedilab.fedilabtube.fragment;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.data.VideoData.Video.titleType.CATEGORY;
|
||||||
|
import static app.fedilab.fedilabtube.client.data.VideoData.Video.titleType.CHANNEL;
|
||||||
|
import static app.fedilab.fedilabtube.client.data.VideoData.Video.titleType.TAG;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -52,10 +56,6 @@ import app.fedilab.fedilabtube.viewmodel.RelationshipVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.data.VideoData.Video.titleType.CATEGORY;
|
|
||||||
import static app.fedilab.fedilabtube.client.data.VideoData.Video.titleType.CHANNEL;
|
|
||||||
import static app.fedilab.fedilabtube.client.data.VideoData.Video.titleType.TAG;
|
|
||||||
|
|
||||||
|
|
||||||
public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter.RelationShipListener, PeertubeAdapter.PlaylistListener {
|
public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter.RelationShipListener, PeertubeAdapter.PlaylistListener {
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube.fragment;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -64,9 +67,6 @@ import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class DisplayPlaylistsFragment extends Fragment {
|
public class DisplayPlaylistsFragment extends Fragment {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.fragment;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.SEPIA_SEARCH;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@ -49,8 +51,6 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.SepiaSearchVM;
|
import app.fedilab.fedilabtube.viewmodel.SepiaSearchVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.SEPIA_SEARCH;
|
|
||||||
|
|
||||||
|
|
||||||
public class DisplaySepiaSearchFragment extends Fragment implements AccountsHorizontalListAdapter.EventListener {
|
public class DisplaySepiaSearchFragment extends Fragment implements AccountsHorizontalListAdapter.EventListener {
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.fragment;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.VIDEOS_IN_LOCAL_PLAYLIST;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@ -62,8 +64,6 @@ import app.fedilab.fedilabtube.viewmodel.SearchVM;
|
|||||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.VIDEOS_IN_LOCAL_PLAYLIST;
|
|
||||||
|
|
||||||
|
|
||||||
public class DisplayVideosFragment extends Fragment implements AccountsHorizontalListAdapter.EventListener, PeertubeAdapter.RelationShipListener, PeertubeAdapter.PlaylistListener {
|
public class DisplayVideosFragment extends Fragment implements AccountsHorizontalListAdapter.EventListener, PeertubeAdapter.RelationShipListener, PeertubeAdapter.PlaylistListener {
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package app.fedilab.fedilabtube.fragment;
|
package app.fedilab.fedilabtube.fragment;
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -45,8 +47,6 @@ import app.fedilab.fedilabtube.helper.HelperInstance;
|
|||||||
import app.fedilab.fedilabtube.helper.ThemeHelper;
|
import app.fedilab.fedilabtube.helper.ThemeHelper;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.MainActivity.userMe;
|
|
||||||
|
|
||||||
/* Copyright 2020 Thomas Schneider
|
/* Copyright 2020 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of TubeLab
|
* This file is a part of TubeLab
|
||||||
|
@ -14,6 +14,9 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static android.content.Context.DOWNLOAD_SERVICE;
|
||||||
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.DownloadManager;
|
import android.app.DownloadManager;
|
||||||
@ -76,9 +79,6 @@ import app.fedilab.fedilabtube.webview.ProxyHelper;
|
|||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
|
|
||||||
import static android.content.Context.DOWNLOAD_SERVICE;
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
|
||||||
|
|
||||||
public class Helper {
|
public class Helper {
|
||||||
|
|
||||||
public static final int RELOAD_MYVIDEOS = 10;
|
public static final int RELOAD_MYVIDEOS = 10;
|
||||||
|
@ -14,7 +14,7 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
|
||||||
@ -29,8 +29,7 @@ public class HelperAcadInstance {
|
|||||||
public static String HISTORY = "HISTORIQUE";
|
public static String HISTORY = "HISTORIQUE";
|
||||||
public static String SUBSCRIPTIONS = "ABONNEMENTS";
|
public static String SUBSCRIPTIONS = "ABONNEMENTS";
|
||||||
public static String MYVIDEOS = "VIDEOS";
|
public static String MYVIDEOS = "VIDEOS";
|
||||||
|
public static String openIdURL = "https://auth.apps.education.fr/auth/realms/apps/protocol/openid-connect/auth?";
|
||||||
|
|
||||||
|
|
||||||
//List of available emails
|
//List of available emails
|
||||||
public static String[] valideEmails = {
|
public static String[] valideEmails = {
|
||||||
@ -73,7 +72,7 @@ public class HelperAcadInstance {
|
|||||||
|
|
||||||
|
|
||||||
public static LinkedHashMap<String, String> instances_themes;
|
public static LinkedHashMap<String, String> instances_themes;
|
||||||
|
public static HashMap<String, String> instance_client_id;
|
||||||
static {
|
static {
|
||||||
instances_themes = new LinkedHashMap<>();
|
instances_themes = new LinkedHashMap<>();
|
||||||
instances_themes.put("Institutionnel Éducatif", "tube-institutionnel.apps.education.fr");
|
instances_themes.put("Institutionnel Éducatif", "tube-institutionnel.apps.education.fr");
|
||||||
@ -87,5 +86,19 @@ public class HelperAcadInstance {
|
|||||||
instances_themes.put("Cycle-2 Éducatif", "tube-cycle-2.apps.education.fr");
|
instances_themes.put("Cycle-2 Éducatif", "tube-cycle-2.apps.education.fr");
|
||||||
instances_themes.put("Cycle-3 Éducatif", "tube-cycle-3.apps.education.fr");
|
instances_themes.put("Cycle-3 Éducatif", "tube-cycle-3.apps.education.fr");
|
||||||
}
|
}
|
||||||
|
static {
|
||||||
|
instance_client_id = new HashMap<>();
|
||||||
|
instance_client_id.put("tube-institutionnel.apps.education.fr", "tube-institutionnel");
|
||||||
|
instance_client_id.put("tube-maternelle.apps.education.fr", "tube-maternelle");
|
||||||
|
instance_client_id.put("tube-arts-lettres-sciences-humaines.apps.education.fr", "tube-arts-lettres-sciences-humaines");
|
||||||
|
instance_client_id.put("tube-sciences-technologies.apps.education.fr", "tube-sciences-technologies");
|
||||||
|
instance_client_id.put("tube-education-physique-et-sportive.apps.education.fr", "tube-education-physique-et-sportive");
|
||||||
|
instance_client_id.put("tube-enseignement-professionnel.apps.education.fr", "tube-enseignement-professionnel");
|
||||||
|
instance_client_id.put("tube-langues-vivantes.apps.education.fr", "tube-langues-vivantes");
|
||||||
|
instance_client_id.put("tube-action-educative.apps.education.fr", "tube-action-educative");
|
||||||
|
instance_client_id.put("tube-cycle-2.apps.education.fr", "tube-cycle-2");
|
||||||
|
instance_client_id.put("tube-cycle-3.apps.education.fr", "tube-cycle-3");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.worker.NotificationsWorker.FETCH_NOTIFICATION_CHANNEL_ID;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
@ -31,8 +33,6 @@ import androidx.core.app.NotificationManagerCompat;
|
|||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.worker.NotificationsWorker.FETCH_NOTIFICATION_CHANNEL_ID;
|
|
||||||
|
|
||||||
public class NotificationHelper {
|
public class NotificationHelper {
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -31,8 +33,6 @@ import app.fedilab.fedilabtube.drawer.OwnAccountsAdapter;
|
|||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
|
||||||
|
|
||||||
public class SwitchAccountHelper {
|
public class SwitchAccountHelper {
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@ package app.fedilab.fedilabtube.helper;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.DARK_MODE;
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.LIGHT_MODE;
|
||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.DARK_MODE;
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.LIGHT_MODE;
|
|
||||||
|
|
||||||
public class ThemeHelper {
|
public class ThemeHelper {
|
||||||
|
|
||||||
public static void switchTo(int themePref) {
|
public static void switchTo(int themePref) {
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.services;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
@ -36,8 +38,6 @@ import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
|
|||||||
import app.fedilab.fedilabtube.helper.EmojiHelper;
|
import app.fedilab.fedilabtube.helper.EmojiHelper;
|
||||||
import app.fedilab.fedilabtube.helper.NetworkStateReceiver;
|
import app.fedilab.fedilabtube.helper.NetworkStateReceiver;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
|
|
||||||
|
|
||||||
|
|
||||||
public class RetrieveInfoService extends Service implements NetworkStateReceiver.NetworkStateReceiverListener {
|
public class RetrieveInfoService extends Service implements NetworkStateReceiver.NetworkStateReceiverListener {
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ import android.database.sqlite.SQLiteDatabase;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.client.mastodon.MastodonAccount.Account;
|
|
||||||
import app.fedilab.fedilabtube.client.entities.Token;
|
import app.fedilab.fedilabtube.client.entities.Token;
|
||||||
|
import app.fedilab.fedilabtube.client.mastodon.MastodonAccount.Account;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.helper.HelperInstance;
|
import app.fedilab.fedilabtube.helper.HelperInstance;
|
||||||
|
|
||||||
@ -200,8 +200,6 @@ public class MastodonAccountDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the current user is already stored in data base
|
* Test if the current user is already stored in data base
|
||||||
*
|
*
|
||||||
@ -218,5 +216,4 @@ public class MastodonAccountDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.viewmodel;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -26,7 +28,6 @@ import androidx.lifecycle.AndroidViewModel;
|
|||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.AccountActivity;
|
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||||
@ -34,8 +35,6 @@ import app.fedilab.fedilabtube.helper.Helper;
|
|||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
|
||||||
|
|
||||||
|
|
||||||
public class ChannelsVM extends AndroidViewModel {
|
public class ChannelsVM extends AndroidViewModel {
|
||||||
private MutableLiveData<APIResponse> apiResponseMutableLiveData;
|
private MutableLiveData<APIResponse> apiResponseMutableLiveData;
|
||||||
|
@ -16,7 +16,6 @@ package app.fedilab.fedilabtube.viewmodel;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.viewmodel;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static app.fedilab.fedilabtube.viewmodel.PlaylistsVM.action.GET_LIST_VIDEOS;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
@ -38,8 +40,6 @@ import app.fedilab.fedilabtube.helper.HelperInstance;
|
|||||||
import app.fedilab.fedilabtube.sqlite.ManagePlaylistsDAO;
|
import app.fedilab.fedilabtube.sqlite.ManagePlaylistsDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
import static app.fedilab.fedilabtube.viewmodel.PlaylistsVM.action.GET_LIST_VIDEOS;
|
|
||||||
|
|
||||||
|
|
||||||
public class TimelineVM extends AndroidViewModel {
|
public class TimelineVM extends AndroidViewModel {
|
||||||
private MutableLiveData<APIResponse> apiResponseMutableLiveData;
|
private MutableLiveData<APIResponse> apiResponseMutableLiveData;
|
||||||
@ -125,10 +125,7 @@ public class TimelineVM extends AndroidViewModel {
|
|||||||
|
|
||||||
private void getSingle(String instance, String videoId, boolean myVideo) {
|
private void getSingle(String instance, String videoId, boolean myVideo) {
|
||||||
Context _mContext = getApplication().getApplicationContext();
|
Context _mContext = getApplication().getApplicationContext();
|
||||||
boolean canUseToken = false;
|
boolean canUseToken = instance == null || instance.compareTo(HelperInstance.getLiveInstance(_mContext)) == 0;
|
||||||
if (instance == null || instance.compareTo(HelperInstance.getLiveInstance(_mContext)) == 0) {
|
|
||||||
canUseToken = true;
|
|
||||||
}
|
|
||||||
boolean finalCanUseToken = canUseToken;
|
boolean finalCanUseToken = canUseToken;
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
|
@ -14,6 +14,8 @@ package app.fedilab.fedilabtube.worker;
|
|||||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import static android.content.Context.NOTIFICATION_SERVICE;
|
||||||
|
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
@ -57,8 +59,6 @@ import app.fedilab.fedilabtube.helper.NotificationHelper;
|
|||||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||||
|
|
||||||
import static android.content.Context.NOTIFICATION_SERVICE;
|
|
||||||
|
|
||||||
public class NotificationsWorker extends Worker {
|
public class NotificationsWorker extends Worker {
|
||||||
|
|
||||||
public static String FETCH_NOTIFICATION_CHANNEL_ID = "fetch_notification_peertube";
|
public static String FETCH_NOTIFICATION_CHANNEL_ID = "fetch_notification_peertube";
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
android:layout_height="10dp"
|
android:layout_height="10dp"
|
||||||
android:padding="2dp" />
|
android:padding="2dp" />
|
||||||
|
|
||||||
<app.fedilab.fedilabtube.webview.CustomWebview
|
<WebView
|
||||||
android:id="@+id/webviewConnect"
|
android:id="@+id/webviewConnect"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user