some changes

This commit is contained in:
Thomas 2020-06-27 11:21:25 +02:00
parent c30e2d6a40
commit 3ed94c4e7f
80 changed files with 574 additions and 549 deletions

View File

@ -1,5 +1,6 @@
<?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">
@ -12,7 +13,8 @@
<application
android:allowBackup="true"
android:allowBackup="false"
tools:replace="android:allowBackup"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
@ -41,7 +43,7 @@
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysHidden" />
<receiver
android:name="app.fedilab.android.services.PeertubeUploadReceiver"
android:name=".services.PeertubeUploadReceiver"
android:exported="false">
<intent-filter>
<action android:name="app.fedilab.android.uploadservice.broadcast.status" />

View File

@ -1,15 +1,18 @@
package app.fedilab.fedilabtube;
import android.os.AsyncTask;
import android.os.Bundle;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeInformationAsyncTask;
public class MainActivity extends AppCompatActivity {
@Override
@ -17,10 +20,16 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BottomNavigationView navView = findViewById(R.id.nav_view);
try {
new RetrievePeertubeInformationAsyncTask(MainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} catch (Exception ignored) {
}
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_home, R.id.navigation_recently_added, R.id.navigation_most_liked, R.id.navigation_trending, R.id.navigation_discover)
R.id.navigation_discover, R.id.navigation_trending, R.id.navigation_most_liked, R.id.navigation_recently_added, R.id.navigation_home)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube;
@ -17,7 +16,6 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@ -35,7 +33,6 @@ import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.PopupMenu;
@ -64,7 +61,6 @@ import java.util.Objects;
import javax.net.ssl.HttpsURLConnection;
import app.fedilab.fedilabtube.asynctasks.ManagePlaylistsAsyncTask;
import app.fedilab.fedilabtube.asynctasks.PostActionAsyncTask;
import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeSingleAsyncTask;
@ -96,6 +92,7 @@ import es.dmoral.toasty.Toasty;
import static app.fedilab.fedilabtube.asynctasks.ManagePlaylistsAsyncTask.action.GET_PLAYLIST;
import static app.fedilab.fedilabtube.asynctasks.ManagePlaylistsAsyncTask.action.GET_PLAYLIST_FOR_VIDEO;
import static app.fedilab.fedilabtube.helper.Helper.changeDrawableColor;
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
public class PeertubeActivity extends AppCompatActivity implements OnRetrievePeertubeInterface, OnPostActionInterface, OnPlaylistActionInterface {
@ -107,7 +104,6 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
private TextView peertube_view_count, peertube_playlist, peertube_bookmark, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
private ScrollView peertube_information_container;
private Peertube peertube;
private TextView toolbar_title;
private PlayerView playerView;
private SimpleExoPlayer player;
private boolean fullScreenMode;
@ -158,29 +154,11 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
add_comment_write = findViewById(R.id.add_comment_write);
peertube_playlist = findViewById(R.id.peertube_playlist);
send = findViewById(R.id.send);
add_comment_read.setOnClickListener(v -> {
add_comment_read.setVisibility(View.GONE);
add_comment_write.setVisibility(View.VISIBLE);
send.setVisibility(View.VISIBLE);
add_comment_write.requestFocus();
add_comment_write.setSelection(add_comment_write.getText().length());
});
peertube_playlist.setVisibility(View.VISIBLE);
peertube_bookmark.setVisibility(View.GONE);
send.setOnClickListener(v -> {
String comment = add_comment_write.getText().toString();
if (comment.trim().length() > 0) {
new PostActionAsyncTask(PeertubeActivity.this, PeertubeAPI.StatusAction.PEERTUBECOMMENT, peertube.getId(), null, comment, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
add_comment_write.setText("");
add_comment_read.setVisibility(View.VISIBLE);
add_comment_write.setVisibility(View.GONE);
send.setVisibility(View.GONE);
add_comment_read.requestFocus();
}
});
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
@ -189,22 +167,12 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
Helper.loadGiF(PeertubeActivity.this, account, my_pp);
Bundle b = getIntent().getExtras();
if (b != null) {
peertubeInstance = b.getString("peertube_instance", null);
peertubeInstance = b.getString("peertube_instance", Helper.getLiveInstance(PeertubeActivity.this));
videoId = b.getString("video_id", null);
}
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
assert inflater != null;
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(PeertubeActivity.this), false);
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
toolbar_close.setOnClickListener(v -> finish());
}
mode = sharedpreferences.getInt(Helper.SET_VIDEO_MODE, Helper.VIDEO_MODE_DIRECT);
@ -346,6 +314,84 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
new ManagePlaylistsAsyncTask(PeertubeActivity.this, GET_PLAYLIST_FOR_VIDEO, null, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
peertube_playlist.setOnClickListener(v -> {
if (isLoggedIn(PeertubeActivity.this)) {
if (playlists != null && peertube.getId() != null) {
PopupMenu popup = new PopupMenu(PeertubeActivity.this, peertube_playlist);
for (Playlist playlist : playlists) {
String title = null;
for (String id : playlistForVideo) {
if (playlist.getId().equals(id)) {
title = "" + playlist.getDisplayName();
break;
}
}
if (title == null) {
title = playlist.getDisplayName();
}
MenuItem item = popup.getMenu().add(0, 0, Menu.NONE, title);
item.setOnMenuItemClickListener(item1 -> {
item1.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
item1.setActionView(new View(PeertubeActivity.this));
item1.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item1) {
return false;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item1) {
return false;
}
});
if (playlistForVideo.contains(playlist.getId())) {
item1.setTitle(playlist.getDisplayName());
new ManagePlaylistsAsyncTask(PeertubeActivity.this, ManagePlaylistsAsyncTask.action.DELETE_VIDEOS, playlist, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
playlistForVideo.remove(playlist.getId());
} else {
item1.setTitle("" + playlist.getDisplayName());
new ManagePlaylistsAsyncTask(PeertubeActivity.this, ManagePlaylistsAsyncTask.action.ADD_VIDEOS, playlist, peertube.getId(), null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
playlistForVideo.add(playlist.getId());
}
return false;
});
popup.show();
}
}
} else {
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
}
});
add_comment_read.setOnClickListener(v -> {
if (isLoggedIn(PeertubeActivity.this)) {
add_comment_read.setVisibility(View.GONE);
add_comment_write.setVisibility(View.VISIBLE);
send.setVisibility(View.VISIBLE);
add_comment_write.requestFocus();
add_comment_write.setSelection(add_comment_write.getText().length());
} else {
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
}
});
send.setOnClickListener(v -> {
if (isLoggedIn(PeertubeActivity.this)) {
String comment = add_comment_write.getText().toString();
if (comment.trim().length() > 0) {
new PostActionAsyncTask(PeertubeActivity.this, PeertubeAPI.StatusAction.PEERTUBECOMMENT, peertube.getId(), null, comment, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
add_comment_write.setText("");
add_comment_read.setVisibility(View.VISIBLE);
add_comment_write.setVisibility(View.GONE);
send.setVisibility(View.GONE);
add_comment_read.requestFocus();
}
} else {
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
}
});
peertube_playlist.setOnClickListener(v -> {
if (playlists != null && peertube.getId() != null) {
@ -406,8 +452,7 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
write_comment_container.setVisibility(View.GONE);
}
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
toolbar_title.setText(peertube.getName());
setTitle(peertube.getName());
peertube_description.setText(peertube.getDescription());
peertube_title.setText(peertube.getName());
peertube_dislike_count.setText(String.valueOf(peertube.getDislike()));
@ -419,17 +464,26 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
initResolution();
peertube_like_count.setOnClickListener(v -> {
String newState = peertube.getMyRating().equals("like") ? "none" : "like";
new PostActionAsyncTask(PeertubeActivity.this, PeertubeAPI.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
peertube.setMyRating(newState);
changeColor();
if (isLoggedIn(PeertubeActivity.this)) {
String newState = peertube.getMyRating().equals("like") ? "none" : "like";
new PostActionAsyncTask(PeertubeActivity.this, PeertubeAPI.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
peertube.setMyRating(newState);
changeColor();
} else {
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
}
});
peertube_dislike_count.setOnClickListener(v -> {
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
new PostActionAsyncTask(PeertubeActivity.this, PeertubeAPI.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
peertube.setMyRating(newState);
changeColor();
if (isLoggedIn(PeertubeActivity.this)) {
String newState = peertube.getMyRating().equals("dislike") ? "none" : "dislike";
new PostActionAsyncTask(PeertubeActivity.this, PeertubeAPI.StatusAction.RATEVIDEO, peertube.getId(), null, newState, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
peertube.setMyRating(newState);
changeColor();
} else {
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
}
});
try {
HttpsURLConnection.setDefaultSSLSocketFactory(new TLSSocketFactory(instance));
} catch (KeyManagementException | NoSuchAlgorithmException e) {

View File

@ -1,7 +1,6 @@
package app.fedilab.fedilabtube;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;

View File

@ -48,7 +48,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;
@ -7,6 +6,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.PeertubeAPI;
@ -45,7 +45,11 @@ public class ManagePlaylistsAsyncTask extends AsyncTask<Void, Void, Void> {
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(contextReference.get()));
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
Account account = new AccountDAO(contextReference.get(), db).getUniqAccount(userId, instance);
if (apiAction == action.GET_PLAYLIST) {
if (account == null) {
statusCode = 403;
apiResponse = new APIResponse();
apiResponse.setPlaylists(new ArrayList<>());
} else if (apiAction == action.GET_PLAYLIST) {
apiResponse = new PeertubeAPI(contextReference.get()).getPlayists(account.getUsername());
} else if (apiAction == action.GET_LIST_VIDEOS) {
apiResponse = new PeertubeAPI(contextReference.get()).getPlaylistVideos(playlist.getId(), max_id, null);

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;
@ -102,6 +101,14 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
peertubeAPI = new PeertubeAPI(this.contextReference.get());
apiResponse = peertubeAPI.getLocalTL(max_id);
break;
case PPUBLIC:
peertubeAPI = new PeertubeAPI(this.contextReference.get());
apiResponse = peertubeAPI.getPublicTL(max_id);
break;
case PMOSTLIKED:
peertubeAPI = new PeertubeAPI(this.contextReference.get());
apiResponse = peertubeAPI.getLikedTL(max_id);
break;
}
return null;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.asynctasks;
import android.content.Context;

View File

@ -1,16 +1,14 @@
package app.fedilab.fedilabtube.client;
import java.util.List;
import app.fedilab.fedilabtube.client.entities.Account;
import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.client.entities.Instance;
import app.fedilab.fedilabtube.client.entities.Peertube;
import app.fedilab.fedilabtube.client.entities.PeertubeNotification;
import app.fedilab.fedilabtube.client.entities.Playlist;
import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.client.entities.Status;
public class APIResponse {
@ -69,7 +67,6 @@ public class APIResponse {
}
public List<Peertube> getPeertubes() {
return peertubes;
}
@ -79,7 +76,6 @@ public class APIResponse {
}
public List<PeertubeNotification> getPeertubeNotifications() {
return peertubeNotifications;
}
@ -89,7 +85,6 @@ public class APIResponse {
}
public List<Playlist> getPlaylists() {
return playlists;
}

View File

@ -7,7 +7,6 @@ import android.os.Build;
import android.text.Html;
import android.text.SpannableString;
import com.google.gson.JsonObject;
import net.gotev.uploadservice.MultipartUploadRequest;
@ -47,9 +46,9 @@ import java.util.regex.Pattern;
import javax.net.ssl.HttpsURLConnection;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.helper.FileNameCleaner;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.interfaces.OnDownloadInterface;
public class HttpsConnection {
@ -567,7 +566,7 @@ public class HttpsConnection {
try {
httpsURLConnection.getInputStream().close();
} catch (Exception ignored) {
}
}
return null;
}

View File

@ -28,10 +28,10 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.entities.Account;
import app.fedilab.fedilabtube.client.entities.AccountCreation;
import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.client.entities.Instance;
import app.fedilab.fedilabtube.client.entities.InstanceNodeInfo;
import app.fedilab.fedilabtube.client.entities.InstanceReg;
@ -49,8 +49,6 @@ import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.sqlite.AccountDAO;
import app.fedilab.fedilabtube.sqlite.Sqlite;
import app.fedilab.fedilabtube.client.entities.Error;
/**
* Created by Thomas on 02/01/2019.
* Manage Calls to the Peertube REST API
@ -69,34 +67,12 @@ public class PeertubeAPI {
private Error APIError;
public enum StatusAction {
FOLLOW,
UNFOLLOW,
RATEVIDEO,
PEERTUBECOMMENT,
PEERTUBEREPLY,
PEERTUBEDELETECOMMENT,
PEERTUBEDELETEVIDEO,
}
public PeertubeAPI(Context context) {
this.context = context;
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
tootPerPage = Helper.VIDEOS_PER_PAGE;
if (Helper.getLiveInstance(context) != null)
this.instance = Helper.getLiveInstance(context);
else {
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
if (account == null) {
apiResponse = new APIResponse();
APIError = new Error();
return;
}
this.instance = account.getInstance().trim();
}
Helper.getLiveInstance(context);
this.instance = Helper.getLiveInstance(context);
this.prefKeyOauthTokenT = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
apiResponse = new APIResponse();
APIError = null;
@ -391,7 +367,6 @@ public class PeertubeAPI {
return peertube;
}
/**
* Parse json response for emoji
*
@ -481,6 +456,90 @@ public class PeertubeAPI {
return account;
}
/**
* Parse json response for peertube comments
*
* @param resobj JSONObject
* @return Peertube
*/
private static List<Status> parseSinglePeertubeComments(Context context, String instance, JSONObject resobj) {
List<Status> statuses = new ArrayList<>();
try {
JSONArray jsonArray = resobj.getJSONArray("data");
int i = 0;
while (i < jsonArray.length()) {
Status status = new Status();
JSONObject comment = jsonArray.getJSONObject(i);
status.setId(comment.get("id").toString());
status.setUri(comment.get("url").toString());
status.setUrl(comment.get("url").toString());
status.setSensitive(false);
status.setContent(comment.get("text").toString());
status.setIn_reply_to_id(comment.get("inReplyToCommentId").toString());
status.setAccount(parseAccountResponsePeertube(instance, comment.getJSONObject("account")));
status.setCreated_at(Helper.mstStringToDate(comment.get("createdAt").toString()));
status.setVisibility("public");
SpannableString spannableString;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spannableString = new SpannableString(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
else
spannableString = new SpannableString(Html.fromHtml(status.getContent()));
status.setContentSpan(new SpannableString(spannableString));
i++;
statuses.add(status);
}
} catch (JSONException | ParseException e) {
e.printStackTrace();
}
return statuses;
}
/**
* Parse json response an unique peertube account
*
* @param resobj JSONObject
* @return Account
*/
private static Account parseAccountResponsePeertube(String instance, JSONObject resobj) {
Account account = new Account();
try {
account.setId(resobj.get("id").toString());
account.setUsername(resobj.get("name").toString());
account.setAcct(resobj.get("name").toString() + "@" + resobj.get("host").toString());
account.setDisplay_name(resobj.get("displayName").toString());
account.setHost(resobj.get("host").toString());
if (resobj.has("createdAt"))
account.setCreated_at(Helper.mstStringToDate(resobj.get("createdAt").toString()));
else
account.setCreated_at(new Date());
if (resobj.has("followersCount"))
account.setFollowers_count(resobj.getInt("followersCount"));
else
account.setFollowers_count(0);
if (resobj.has("followingCount"))
account.setFollowing_count(resobj.getInt("followingCount"));
else
account.setFollowing_count(0);
account.setStatuses_count(0);
if (resobj.has("description"))
account.setNote(resobj.get("description").toString());
else
account.setNote("");
account.setUrl(resobj.get("url").toString());
account.setSocial("PEERTUBE");
if (resobj.has("avatar") && !resobj.get("avatar").toString().equals("null")) {
account.setAvatar("https://" + instance + resobj.getJSONObject("avatar").get("path"));
account.setAvatar_static("https://" + instance + resobj.getJSONObject("avatar").get("path"));
} else
account.setAvatar(null);
account.setAvatar_static(resobj.get("avatar").toString());
} catch (JSONException ignored) {
} catch (ParseException e) {
e.printStackTrace();
}
return account;
}
/***
* Get info on the current Instance *synchronously*
@ -712,8 +771,6 @@ public class PeertubeAPI {
return account;
}
public InstanceNodeInfo displayNodeInfo(String domain) {
String response;
@ -1185,6 +1242,21 @@ public class PeertubeAPI {
}
}
/**
* Retrieves most likded videos *synchronously*
*
* @param max_id String id max
* @return APIResponse
*/
public APIResponse getLikedTL(String max_id) {
try {
return getTL("/videos/", "-likes", null, max_id, null, null);
} catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e);
return apiResponse;
}
}
/**
* Retrieves trending videos *synchronously*
*
@ -1216,7 +1288,7 @@ public class PeertubeAPI {
}
/**
* Retrieves trending videos *synchronously*
* Retrieves local videos *synchronously*
*
* @param max_id String id max
* @return APIResponse
@ -1230,6 +1302,20 @@ public class PeertubeAPI {
}
}
/**
* Retrieves public videos *synchronously*
*
* @param max_id String id max
* @return APIResponse
*/
public APIResponse getPublicTL(String max_id) {
try {
return getTL("/videos/", "-publishedAt", null, max_id, null, null);
} catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e);
return apiResponse;
}
}
/**
* Retrieves home timeline for the account *synchronously*
@ -1357,7 +1443,6 @@ public class PeertubeAPI {
return apiResponse;
}
/**
* Retrieves rating of user on a video *synchronously*
*
@ -1482,7 +1567,6 @@ public class PeertubeAPI {
return actionCode;
}
/**
* Video is in play lists
*
@ -1636,7 +1720,6 @@ public class PeertubeAPI {
return apiResponse;
}
/**
* Retrieves Peertube videos from an instance *synchronously*
*
@ -1658,93 +1741,6 @@ public class PeertubeAPI {
return apiResponse;
}
/**
* Parse json response for peertube comments
*
* @param resobj JSONObject
* @return Peertube
*/
private static List<Status> parseSinglePeertubeComments(Context context, String instance, JSONObject resobj) {
List<Status> statuses = new ArrayList<>();
try {
JSONArray jsonArray = resobj.getJSONArray("data");
int i = 0;
while (i < jsonArray.length()) {
Status status = new Status();
JSONObject comment = jsonArray.getJSONObject(i);
status.setId(comment.get("id").toString());
status.setUri(comment.get("url").toString());
status.setUrl(comment.get("url").toString());
status.setSensitive(false);
status.setContent(comment.get("text").toString());
status.setIn_reply_to_id(comment.get("inReplyToCommentId").toString());
status.setAccount(parseAccountResponsePeertube(instance, comment.getJSONObject("account")));
status.setCreated_at(Helper.mstStringToDate(comment.get("createdAt").toString()));
status.setVisibility("public");
SpannableString spannableString;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spannableString = new SpannableString(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
else
spannableString = new SpannableString(Html.fromHtml(status.getContent()));
status.setContentSpan(new SpannableString(spannableString));
i++;
statuses.add(status);
}
} catch (JSONException | ParseException e) {
e.printStackTrace();
}
return statuses;
}
/**
* Parse json response an unique peertube account
*
* @param resobj JSONObject
* @return Account
*/
private static Account parseAccountResponsePeertube(String instance, JSONObject resobj) {
Account account = new Account();
try {
account.setId(resobj.get("id").toString());
account.setUsername(resobj.get("name").toString());
account.setAcct(resobj.get("name").toString() + "@" + resobj.get("host").toString());
account.setDisplay_name(resobj.get("displayName").toString());
account.setHost(resobj.get("host").toString());
if (resobj.has("createdAt"))
account.setCreated_at(Helper.mstStringToDate(resobj.get("createdAt").toString()));
else
account.setCreated_at(new Date());
if (resobj.has("followersCount"))
account.setFollowers_count(resobj.getInt("followersCount"));
else
account.setFollowers_count(0);
if (resobj.has("followingCount"))
account.setFollowing_count(resobj.getInt("followingCount"));
else
account.setFollowing_count(0);
account.setStatuses_count(0);
if (resobj.has("description"))
account.setNote(resobj.get("description").toString());
else
account.setNote("");
account.setUrl(resobj.get("url").toString());
account.setSocial("PEERTUBE");
if (resobj.has("avatar") && !resobj.get("avatar").toString().equals("null")) {
account.setAvatar("https://" + instance + resobj.getJSONObject("avatar").get("path"));
account.setAvatar_static("https://" + instance + resobj.getJSONObject("avatar").get("path"));
} else
account.setAvatar(null);
account.setAvatar_static(resobj.get("avatar").toString());
} catch (JSONException ignored) {
} catch (ParseException e) {
e.printStackTrace();
}
return account;
}
/**
* Retrieves peertube search *synchronously*
*
@ -1778,7 +1774,6 @@ public class PeertubeAPI {
return apiResponse;
}
/**
* Parse json response for peertube notifications
*
@ -1932,7 +1927,6 @@ public class PeertubeAPI {
return accounts;
}
/**
* Set the error message
*
@ -1968,14 +1962,23 @@ public class PeertubeAPI {
apiResponse.setError(APIError);
}
public Error getError() {
return APIError;
}
private String getAbsoluteUrl(String action) {
return Helper.instanceWithProtocol(context) + "/api/v1" + action;
}
public enum StatusAction {
FOLLOW,
UNFOLLOW,
RATEVIDEO,
PEERTUBECOMMENT,
PEERTUBEREPLY,
PEERTUBEDELETECOMMENT,
PEERTUBEDELETEVIDEO,
}
}

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;
@ -7,13 +6,11 @@ import android.os.Parcelable;
import android.text.SpannableString;
import android.text.TextUtils;
import org.jetbrains.annotations.NotNull;
import java.util.Date;
public class Account implements Parcelable {
public static final Creator<Account> CREATOR = new Creator<Account>() {
@ -512,8 +509,6 @@ public class Account implements Parcelable {
}
@NotNull
public String toString() {
return this.getAcct() + " - " + this.getUrl();

View File

@ -1,8 +1,6 @@
package app.fedilab.fedilabtube.client.entities;
public class Error {
private String error = null;

View File

@ -1,10 +1,8 @@
package app.fedilab.fedilabtube.client.entities;
import java.util.HashMap;
public class Instance {
private String uri;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;

View File

@ -1,7 +1,6 @@
package app.fedilab.fedilabtube.client.entities;
public class InstanceReg {
private String domain;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;
import android.os.Parcel;

View File

@ -1,8 +1,6 @@
package app.fedilab.fedilabtube.client.entities;
public class PeertubeAccountNotification {
private String id;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;
import android.os.Parcel;

View File

@ -22,7 +22,6 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.net.URISyntaxException;
@ -42,8 +41,6 @@ import app.fedilab.fedilabtube.helper.CustomQuoteSpan;
import app.fedilab.fedilabtube.helper.Helper;
@SuppressWarnings("unused")
public class Status implements Parcelable {
@ -82,10 +79,6 @@ public class Status implements Parcelable {
private String conversationId;
private String contentType;
public void setContent(String content) {
this.content = content;
}
public Status() {
}
@ -117,12 +110,10 @@ public class Status implements Parcelable {
this.contentType = in.readString();
}
public static void fillSpan(WeakReference<Context> contextWeakReference, Status status) {
Status.transform(contextWeakReference, status);
}
private static void transform(WeakReference<Context> contextWeakReference, Status status) {
Context context = contextWeakReference.get();
if (status == null)
@ -390,7 +381,6 @@ public class Status implements Parcelable {
return SpannableString.valueOf(spannableStringT);
}
private static void replaceQuoteSpans(Context context, Spannable spannable) {
QuoteSpan[] quoteSpans = spannable.getSpans(0, spannable.length(), QuoteSpan.class);
for (QuoteSpan quoteSpan : quoteSpans) {
@ -488,7 +478,9 @@ public class Status implements Parcelable {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreated_at() {
return created_at;
@ -568,7 +560,6 @@ public class Status implements Parcelable {
}
public String getLanguage() {
return language;
}
@ -587,8 +578,6 @@ public class Status implements Parcelable {
}
@Override
public boolean equals(Object otherStatus) {
return otherStatus != null && (otherStatus == this || otherStatus instanceof Status && this.getId().equals(((Status) otherStatus).getId()));
@ -627,7 +616,6 @@ public class Status implements Parcelable {
}
public String getConversationId() {
return conversationId;
}
@ -637,7 +625,6 @@ public class Status implements Parcelable {
}
@Override
public int describeContents() {
return 0;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.client.entities;
import android.os.Parcel;
@ -30,7 +29,6 @@ public class Tag implements Parcelable {
}
public String getName() {
return name;
}

View File

@ -1,7 +1,6 @@
package app.fedilab.fedilabtube.drawer;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -18,12 +17,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import app.fedilab.fedilabtube.PeertubeActivity;
import app.fedilab.fedilabtube.PeertubeEditUploadActivity;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.entities.Account;
@ -91,7 +86,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
}
holder.bottom_container.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeEditUploadActivity.class);
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
b.putString("video_id", peertube.getUuid());
intent.putExtras(b);
@ -100,16 +95,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
holder.peertube_video_image.setOnClickListener(v -> {
Intent intent = new Intent(context, PeertubeActivity.class);
Bundle b = new Bundle();
String instance = Helper.getLiveInstance(context);
String finalUrl = "https://" + instance + peertube.getEmbedPath();
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/embed/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$");
Matcher matcherLink = link.matcher(finalUrl);
if (matcherLink.find()) {
String url = matcherLink.group(1) + "/videos/watch/" + matcherLink.group(2);
b.putString("peertubeLinkToFetch", url);
b.putString("peertube_instance", Objects.requireNonNull(matcherLink.group(1)).replace("https://", "").replace("http://", ""));
b.putString("video_id", matcherLink.group(2));
}
b.putString("video_id", peertube.getUuid());
intent.putExtras(b);
context.startActivity(intent);
});

View File

@ -23,6 +23,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -42,11 +43,9 @@ import es.dmoral.toasty.Toasty;
import static android.content.Context.MODE_PRIVATE;
public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements OnPostActionInterface {
private Context context;
private List<Status> statuses;

View File

@ -14,16 +14,18 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask;
import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeSearchAsyncTask;
@ -117,7 +119,6 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, context != null ? Helper.getLiveInstance(context) : null);
peertubeAdapater = new PeertubeAdapter(this.peertubes);
lv_status.setAdapter(peertubeAdapater);
mLayoutManager = new LinearLayoutManager(context);
@ -278,7 +279,6 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
}
public void scrollToTop() {
if (mLayoutManager != null) {
mLayoutManager.scrollToPositionWithOffset(0, 0);

View File

@ -57,6 +57,67 @@ import static android.content.Context.DOWNLOAD_SERVICE;
public class Helper {
public static final int RELOAD_MYVIDEOS = 10;
public static final String SET_VIDEO_MODE = "set_video_mode";
public static final int VIDEO_MODE_TORRENT = 0;
public static final int VIDEO_MODE_WEBVIEW = 1;
public static final int VIDEO_MODE_DIRECT = 2;
public static final String SET_SHARE_DETAILS = "set_share_details";
public static final int DEFAULT_VIDEO_CACHE_MB = 100;
public static final String TAG = "mastodon_etalab";
public static final String CLIENT_NAME_VALUE = "Fedilab";
public static final String OAUTH_SCOPES = "read write follow";
public static final String OAUTH_SCOPES_ADMIN = "read write follow admin:read admin:write admin";
public static final String OAUTH_SCOPES_PEERTUBE = "user";
public static final String PREF_KEY_OAUTH_TOKEN = "oauth_token";
public static final Pattern urlPattern = Pattern.compile(
"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,10}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))",
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
public static final Pattern hashtagPattern = Pattern.compile("(#[\\w_A-zÀ-ÿ]+)");
public static final String SET_ALLOW_STREAM = "set_allow_stream";
public static final String SET_CUSTOM_USER_AGENT = "set_custom_user_agent";
public static final String SET_VIDEO_CACHE = "set_video_cache";
public static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0";
//Proxy
public static final String SET_PROXY_ENABLED = "set_proxy_enabled";
public static final String SET_PROXY_TYPE = "set_proxy_type";
public static final String SET_PROXY_HOST = "set_proxy_host";
public static final String SET_PROXY_PORT = "set_proxy_port";
public static final String SET_PROXY_LOGIN = "set_proxy_login";
public static final String SET_PROXY_PASSWORD = "set_proxy_password";
public static final String INTENT_ACTION = "intent_action";
public static final String PREF_KEY_ID = "userID";
public static final String PREF_IS_MODERATOR = "is_moderator";
public static final String PREF_IS_ADMINISTRATOR = "is_administrator";
public static final String PREF_INSTANCE = "instance";
public static final String REDIRECT_CONTENT = "urn:ietf:wg:oauth:2.0:oob";
public static final String REDIRECT_CONTENT_WEB = "mastalab://backtomastalab";
public static final int EXTERNAL_STORAGE_REQUEST_CODE = 84;
public static final String SET_VIDEOS_PER_PAGE = "set_videos_per_page";
public static final String VIDEO_ID = "video_id_update";
public static final String CLIENT_NAME = "client_name";
public static final String APP_PREFS = "app_prefs";
public static final String ID = "id";
public static final String CLIENT_ID = "client_id";
public static final String CLIENT_SECRET = "client_secret";
public static final String REDIRECT_URI = "redirect_uri";
public static final String REDIRECT_URIS = "redirect_uris";
public static final String RESPONSE_TYPE = "response_type";
public static final String SCOPE = "scope";
public static final String SCOPES = "scopes";
public static final String WEBSITE = "website";
public static final String SHOW_ACCOUNT_BOOSTS = "show_account_boosts";
public static final String SHOW_ACCOUNT_REPLIES = "show_account_replies";
public static final String WEBSITE_VALUE = "https://fedilab.app";
public static final String SHOW_BATTERY_SAVER_MESSAGE = "show_battery_saver_message";
public static final String LAST_NOTIFICATION_MAX_ID = "last_notification_max_id";
public static final int VIDEOS_PER_PAGE = 40;
public static final String SET_VIDEO_NSFW = "set_video_nsfw";
public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser";
public static final String SET_CUSTOM_TABS = "set_custom_tabs";
public static final String SET_DISPLAY_CONFIRM = "set_display_confirm";
public static final String INTENT_ADD_UPLOADED_MEDIA = "intent_add_uploaded_media";
//List of available academies
public static List<String> academies = new ArrayList<>(Arrays.asList(
"ac-aix-marseille.fr",
@ -91,83 +152,14 @@ public class Helper {
"ac-versailles.fr"
));
public static final int RELOAD_MYVIDEOS = 10;
public static final String SET_VIDEO_MODE = "set_video_mode";
public static final int VIDEO_MODE_TORRENT = 0;
public static final int VIDEO_MODE_WEBVIEW = 1;
public static final int VIDEO_MODE_DIRECT = 2;
public static final String SET_SHARE_DETAILS = "set_share_details";
public static final int DEFAULT_VIDEO_CACHE_MB = 100;
public static final String TAG = "mastodon_etalab";
public static final String CLIENT_NAME_VALUE = "Fedilab";
public static final String OAUTH_SCOPES = "read write follow";
public static final String OAUTH_SCOPES_ADMIN = "read write follow admin:read admin:write admin";
public static final String OAUTH_SCOPES_PEERTUBE = "user";
public static final String PREF_KEY_OAUTH_TOKEN = "oauth_token";
public static final Pattern urlPattern = Pattern.compile(
"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,10}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))",
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
public static final Pattern hashtagPattern = Pattern.compile("(#[\\w_A-zÀ-ÿ]+)");
public static final String SET_ALLOW_STREAM = "set_allow_stream";
public static final String SET_CUSTOM_USER_AGENT = "set_custom_user_agent";
public static final String SET_VIDEO_CACHE = "set_video_cache";
public static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0";
//Proxy
public static final String SET_PROXY_ENABLED = "set_proxy_enabled";
public static final String SET_PROXY_TYPE = "set_proxy_type";
public static final String SET_PROXY_HOST = "set_proxy_host";
public static final String SET_PROXY_PORT = "set_proxy_port";
public static final String SET_PROXY_LOGIN = "set_proxy_login";
public static final String SET_PROXY_PASSWORD = "set_proxy_password";
public static final String INTENT_ACTION = "intent_action";
public static final String PREF_KEY_ID = "userID";
public static final String PREF_IS_MODERATOR = "is_moderator";
public static final String PREF_IS_ADMINISTRATOR = "is_administrator";
public static final String PREF_INSTANCE = "instance";
public static final String REDIRECT_CONTENT = "urn:ietf:wg:oauth:2.0:oob";
public static final String REDIRECT_CONTENT_WEB = "mastalab://backtomastalab";
public static final int EXTERNAL_STORAGE_REQUEST_CODE = 84;
public static final String SET_VIDEOS_PER_PAGE = "set_videos_per_page";
public static final String VIDEO_ID = "video_id_update";
public static final String CLIENT_NAME = "client_name";
public static final String APP_PREFS = "app_prefs";
public static final String ID = "id";
public static final String CLIENT_ID = "client_id";
public static final String CLIENT_SECRET = "client_secret";
public static final String REDIRECT_URI = "redirect_uri";
public static final String REDIRECT_URIS = "redirect_uris";
public static final String RESPONSE_TYPE = "response_type";
public static final String SCOPE = "scope";
public static final String SCOPES = "scopes";
public static final String WEBSITE = "website";
public static final String SHOW_ACCOUNT_BOOSTS = "show_account_boosts";
public static final String SHOW_ACCOUNT_REPLIES = "show_account_replies";
public static final String WEBSITE_VALUE = "https://fedilab.app";
public static final String SHOW_BATTERY_SAVER_MESSAGE = "show_battery_saver_message";
public static final String LAST_NOTIFICATION_MAX_ID = "last_notification_max_id";
public static final int VIDEOS_PER_PAGE = 40;
public static final String SET_VIDEO_NSFW = "set_video_nsfw";
public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser";
public static final String SET_CUSTOM_TABS = "set_custom_tabs";
public static final String SET_DISPLAY_CONFIRM = "set_display_confirm";
public static final String INTENT_ADD_UPLOADED_MEDIA = "intent_add_uploaded_media";
/**
* Returns the peertube URL depending of the academic domain name
*
* @param acad String academic domain name
* @return String the peertube URL
*/
private static String getPeertubeUrl(String acad) {
return "tube-"+acad.replaceAll("ac-|\\.fr","")+".beta.education.fr";
return "tube-" + acad.replaceAll("ac-|\\.fr", "") + ".beta.education.fr";
}
@ -179,13 +171,13 @@ public class Helper {
*/
public static String getLiveInstance(Context context) {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String acad = sharedpreferences.getString(Helper.PREF_INSTANCE, "ac-lyon.fr");
String acad = sharedpreferences.getString(Helper.PREF_INSTANCE, "ac-lyon.fr");
return getPeertubeUrl(acad);
}
public static String instanceWithProtocol(Context context) {
return "https://"+getLiveInstance(context);
return "https://" + getLiveInstance(context);
}
/**
@ -344,6 +336,16 @@ public class Helper {
public static void loadGiF(final Context context, Account account, final ImageView imageView) {
if (account == null) {
Glide.with(imageView.getContext())
.asDrawable()
.load(R.drawable.missing_peertube)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
return;
}
String url = account.getAvatar();
if (url != null && url.startsWith("/")) {
url = Helper.getLiveInstance(context) + url;
@ -371,7 +373,6 @@ public class Helper {
}
/**
* Manage URLs to open (built-in or external app)
*
@ -528,4 +529,18 @@ public class Helper {
DrawableCompat.setTint(mDrawable, color);
return mDrawable;
}
/**
* Returns boolean depending if the user is authenticated
*
* @param context Context
* @return boolean
*/
public static boolean isLoggedIn(Context context) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String prefKeyOauthTokenT = sharedpreferences.getString(PREF_KEY_OAUTH_TOKEN, null);
return (prefKeyOauthTokenT != null);
}
}

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.interfaces;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.interfaces;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.interfaces;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.interfaces;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.interfaces;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.interfaces;

View File

@ -1,4 +1,3 @@
package app.fedilab.fedilabtube.interfaces;

View File

@ -4,7 +4,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import net.gotev.uploadservice.ServerResponse;

View File

@ -13,7 +13,6 @@ import app.fedilab.fedilabtube.client.entities.Account;
import app.fedilab.fedilabtube.helper.Helper;
public class AccountDAO {
public Context context;
@ -224,7 +223,6 @@ public class AccountDAO {
}
/**
* Returns an Account by token
*

View File

@ -116,7 +116,7 @@ public class PeertubeFavoritesDAO {
while (c.moveToNext()) {
//Restore cached status
try {
Peertube peertube = PeertubeAPI.parsePeertube( new JSONObject(c.getString(c.getColumnIndex(Sqlite.COL_CACHE))));
Peertube peertube = PeertubeAPI.parsePeertube(new JSONObject(c.getString(c.getColumnIndex(Sqlite.COL_CACHE))));
peertubes.add(peertube);
} catch (JSONException e) {
e.printStackTrace();

View File

@ -40,8 +40,12 @@ public class Sqlite extends SQLiteOpenHelper {
static final String COL_UPDATED_AT = "UPDATED_AT";
static final String COL_PRIVACY = "PRIVACY";
static final String COL_SENSITIVE = "SENSITIVE";
//Table for peertube favorites
static final String TABLE_PEERTUBE_FAVOURITES = "PEERTUBE_FAVOURITES";
static final String COL_ID = "ID";
static final String COL_UUID = "UUID";
static final String COL_CACHE = "CACHE";
static final String COL_DATE = "DATE";
private static final String CREATE_TABLE_USER_ACCOUNT = "CREATE TABLE " + TABLE_USER_ACCOUNT + " ("
+ COL_USER_ID + " TEXT, " + COL_USERNAME + " TEXT NOT NULL, " + COL_ACCT + " TEXT NOT NULL, "
+ COL_DISPLAYED_NAME + " TEXT NOT NULL, " + COL_LOCKED + " INTEGER NOT NULL, "
@ -56,15 +60,8 @@ public class Sqlite extends SQLiteOpenHelper {
+ COL_PRIVACY + " TEXT, "
+ COL_SENSITIVE + " INTEGER DEFAULT 0, "
+ COL_INSTANCE + " TEXT NOT NULL, " + COL_OAUTHTOKEN + " TEXT NOT NULL, " + COL_CREATED_AT + " TEXT NOT NULL)";
//Table for peertube favorites
static final String TABLE_PEERTUBE_FAVOURITES = "PEERTUBE_FAVOURITES";
static final String COL_ID = "ID";
static final String COL_UUID = "UUID";
static final String COL_CACHE = "CACHE";
static final String COL_DATE = "DATE";
public static SQLiteDatabase db;
private static Sqlite sInstance;
private final String CREATE_TABLE_PEERTUBE_FAVOURITES = "CREATE TABLE "
+ TABLE_PEERTUBE_FAVOURITES + "("
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
@ -73,9 +70,6 @@ public class Sqlite extends SQLiteOpenHelper {
+ COL_CACHE + " TEXT NOT NULL, "
+ COL_DATE + " TEXT NOT NULL)";
public static SQLiteDatabase db;
private static Sqlite sInstance;
public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);

View File

@ -9,8 +9,6 @@ import android.util.AttributeSet;
import android.webkit.WebView;
public class CustomWebview extends WebView {

View File

@ -17,7 +17,6 @@ import androidx.appcompat.app.AppCompatActivity;
import app.fedilab.fedilabtube.R;
public class MastalabWebViewClient extends WebViewClient {
private Activity activity;

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17,3L7,3c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M17,3L7,3c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM14,13v4h-4v-4H7l5,-5 5,5h-3z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM14,13v4h-4v-4H7l5,-5 5,5h-3z" />
</vector>

View File

@ -1,10 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z"/>
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z" />
</vector>

View File

@ -1,10 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M5,16h3v3h2v-5L5,14v2zM8,8L5,8v2h5L10,5L8,5v3zM14,19h2v-3h3v-2h-5v5zM16,8L16,5h-2v5h5L19,8h-3z"/>
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M5,16h3v3h2v-5L5,14v2zM8,8L5,8v2h5L10,5L8,5v3zM14,19h2v-3h3v-2h-5v5zM16,8L16,5h-2v5h5L19,8h-3z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10,9h4L14,6h3l-5,-5 -5,5h3v3zM9,10L6,10L6,7l-5,5 5,5v-3h3v-4zM23,12l-5,-5v3h-3v4h3v3l5,-5zM14,15h-4v3L7,18l5,5 5,-5h-3v-3z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M10,9h4L14,6h3l-5,-5 -5,5h3v3zM9,10L6,10L6,7l-5,5 5,5v-3h3v-4zM23,12l-5,-5v3h-3v4h3v3l5,-5zM14,15h-4v3L7,18l5,5 5,-5h-3v-3z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M22,4h-2c-0.55,0 -1,0.45 -1,1v9c0,0.55 0.45,1 1,1h2V4zM2.17,11.12c-0.11,0.25 -0.17,0.52 -0.17,0.8V13c0,1.1 0.9,2 2,2h5.5l-0.92,4.65c-0.05,0.22 -0.02,0.46 0.08,0.66 0.23,0.45 0.52,0.86 0.88,1.22L10,22l6.41,-6.41c0.38,-0.38 0.59,-0.89 0.59,-1.42V6.34C17,5.05 15.95,4 14.66,4h-8.1c-0.71,0 -1.36,0.37 -1.72,0.97l-2.67,6.15z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M22,4h-2c-0.55,0 -1,0.45 -1,1v9c0,0.55 0.45,1 1,1h2V4zM2.17,11.12c-0.11,0.25 -0.17,0.52 -0.17,0.8V13c0,1.1 0.9,2 2,2h5.5l-0.92,4.65c-0.05,0.22 -0.02,0.46 0.08,0.66 0.23,0.45 0.52,0.86 0.88,1.22L10,22l6.41,-6.41c0.38,-0.38 0.59,-0.89 0.59,-1.42V6.34C17,5.05 15.95,4 14.66,4h-8.1c-0.71,0 -1.36,0.37 -1.72,0.97l-2.67,6.15z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-2z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-2z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M2,20h2c0.55,0 1,-0.45 1,-1v-9c0,-0.55 -0.45,-1 -1,-1L2,9v11zM21.83,12.88c0.11,-0.25 0.17,-0.52 0.17,-0.8L22,11c0,-1.1 -0.9,-2 -2,-2h-5.5l0.92,-4.65c0.05,-0.22 0.02,-0.46 -0.08,-0.66 -0.23,-0.45 -0.52,-0.86 -0.88,-1.22L14,2 7.59,8.41C7.21,8.79 7,9.3 7,9.83v7.84C7,18.95 8.05,20 9.34,20h8.11c0.7,0 1.36,-0.37 1.72,-0.97l2.66,-6.15z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M2,20h2c0.55,0 1,-0.45 1,-1v-9c0,-0.55 -0.45,-1 -1,-1L2,9v11zM21.83,12.88c0.11,-0.25 0.17,-0.52 0.17,-0.8L22,11c0,-1.1 -0.9,-2 -2,-2h-5.5l0.92,-4.65c0.05,-0.22 0.02,-0.46 -0.08,-0.66 -0.23,-0.45 -0.52,-0.86 -0.88,-1.22L14,2 7.59,8.41C7.21,8.79 7,9.3 7,9.83v7.84C7,18.95 8.05,20 9.34,20h8.11c0.7,0 1.36,-0.37 1.72,-0.97l2.66,-6.15z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16,6l2.29,2.29 -4.88,4.88 -4,-4L2,16.59 3.41,18l6,-6 4,4 6.3,-6.29L22,12V6z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M16,6l2.29,2.29 -4.88,4.88 -4,-4L2,16.59 3.41,18l6,-6 4,4 6.3,-6.29L22,12V6z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z" />
</vector>

View File

@ -1,10 +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"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM7.07,18.28c0.43,-0.9 3.05,-1.78 4.93,-1.78s4.51,0.88 4.93,1.78C15.57,19.36 13.86,20 12,20s-3.57,-0.64 -4.93,-1.72zM18.36,16.83c-1.43,-1.74 -4.9,-2.33 -6.36,-2.33s-4.93,0.59 -6.36,2.33C4.62,15.49 4,13.82 4,12c0,-4.41 3.59,-8 8,-8s8,3.59 8,8c0,1.82 -0.62,3.49 -1.64,4.83zM12,6c-1.94,0 -3.5,1.56 -3.5,3.5S10.06,13 12,13s3.5,-1.56 3.5,-3.5S13.94,6 12,6zM12,11c-0.83,0 -1.5,-0.67 -1.5,-1.5S11.17,8 12,8s1.5,0.67 1.5,1.5S12.83,11 12,11z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM7.07,18.28c0.43,-0.9 3.05,-1.78 4.93,-1.78s4.51,0.88 4.93,1.78C15.57,19.36 13.86,20 12,20s-3.57,-0.64 -4.93,-1.72zM18.36,16.83c-1.43,-1.74 -4.9,-2.33 -6.36,-2.33s-4.93,0.59 -6.36,2.33C4.62,15.49 4,13.82 4,12c0,-4.41 3.59,-8 8,-8s8,3.59 8,8c0,1.82 -0.62,3.49 -1.64,4.83zM12,6c-1.94,0 -3.5,1.56 -3.5,3.5S10.06,13 12,13s3.5,-1.56 3.5,-3.5S13.94,6 12,6zM12,11c-0.83,0 -1.5,-0.67 -1.5,-1.5S11.17,8 12,8s1.5,0.67 1.5,1.5S12.83,11 12,11z" />
</vector>

View File

@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?attr/actionBarSize">
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"

View File

@ -18,6 +18,7 @@
android:gravity="center"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textColor="@android:color/white"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone" />

View File

@ -1,91 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/main_container"
android:paddingTop="10dp"
android:divider="?android:dividerHorizontal"
android:showDividers="end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
android:divider="?android:dividerHorizontal"
android:orientation="vertical"
android:paddingTop="10dp"
android:showDividers="end">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:baselineAligned="false">
android:baselineAligned="false"
android:orientation="horizontal">
<ImageView
android:id="@+id/status_account_profile"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:id="@+id/status_account_profile"
android:contentDescription="@string/profile_picture" />
<LinearLayout
android:layout_marginStart="10dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/status_account_displayname"
android:maxLines="1"
android:drawablePadding="2dp"
android:layout_marginTop="-2dp"
android:layout_marginStart="-2dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginStart="-2dp"
android:layout_marginTop="-2dp"
android:drawablePadding="2dp"
android:maxLines="1"
android:textStyle="bold" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/status_account_displayname_owner"
android:maxLines="1"
android:drawablePadding="2dp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_marginStart="5dp"
android:textSize="12sp"
android:layout_height="wrap_content"
android:drawablePadding="2dp"
android:maxLines="1"
android:ellipsize="end"
android:layout_width="0dp"
android:layout_weight="1"
android:id="@+id/status_account_username"
android:layout_height="wrap_content" />
android:textStyle="bold" />
<TextView
android:id="@+id/status_account_username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textSize="12sp" />
<TextView
android:layout_marginStart="2dp"
android:id="@+id/status_toot_date"
android:layout_width="wrap_content"
android:layout_weight="0"
android:maxLines="1"
android:textSize="12sp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="2dp"
android:layout_weight="0"
android:gravity="end"
android:layout_height="wrap_content" />
android:maxLines="1"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/status_content_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:layout_height="wrap_content">
android:orientation="vertical">
<TextView
android:id="@+id/status_content"
android:textIsSelectable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:textIsSelectable="true" />
</LinearLayout>

View File

@ -13,11 +13,11 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:gravity="center_horizontal"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center_horizontal" />
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -57,7 +57,7 @@
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
<!-- Loader for next status -->
<!-- Loader for next videos -->
<RelativeLayout
android:id="@+id/loading_next_status"
android:layout_width="match_parent"
@ -73,6 +73,4 @@
android:indeterminate="true" />
</RelativeLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -23,8 +23,7 @@
android:layout_marginEnd="10dp"
android:contentDescription="@string/close"
android:gravity="center_vertical"
android:src="@drawable/ic_baseline_close_24"
/>
android:src="@drawable/ic_baseline_close_24" />
<TextView
android:id="@+id/toolbar_title"

View File

@ -2,19 +2,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="@string/title_home" />
<item
android:id="@+id/navigation_recently_added"
android:icon="@drawable/ic_baseline_add_circle_outline_24"
android:title="@string/title_recently_added" />
<item
android:id="@+id/navigation_most_liked"
android:icon="@drawable/ic_baseline_thumb_up_24"
android:title="@string/title_most_liked" />
android:id="@+id/navigation_discover"
android:icon="@drawable/ic_baseline_public_24"
android:title="@string/title_discover" />
<item
android:id="@+id/navigation_trending"
@ -22,7 +12,19 @@
android:title="@string/title_trending" />
<item
android:id="@+id/navigation_discover"
android:icon="@drawable/ic_baseline_public_24"
android:title="@string/title_discover" />
android:id="@+id/navigation_most_liked"
android:icon="@drawable/ic_baseline_thumb_up_24"
android:title="@string/title_most_liked" />
<item
android:id="@+id/navigation_recently_added"
android:icon="@drawable/ic_baseline_add_circle_outline_24"
android:title="@string/title_recently_added" />
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="@string/title_home" />
</menu>

View File

@ -3,28 +3,30 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@id/navigation_home">
app:startDestination="@id/navigation_discover">
<fragment
android:id="@+id/navigation_home"
android:id="@+id/navigation_discover"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_home"
tools:layout="@layout/fragment_video" >
<argument
android:name="type"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type"
android:defaultValue="PLOCAL"/>
</fragment>
<fragment
android:id="@+id/navigation_recently_added"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_recently_added"
android:label="@string/title_discover"
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type"
android:defaultValue="PRECENTLYADDED"/>
android:defaultValue="POVERVIEW"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type" />
</fragment>
<fragment
android:id="@+id/navigation_trending"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_trending"
tools:layout="@layout/fragment_video">
<argument
android:name="type"
android:defaultValue="PTRENDING"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type" />
</fragment>
<fragment
@ -34,30 +36,33 @@
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type"
android:defaultValue="PMOSTLIKED"/>
android:defaultValue="PMOSTLIKED"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type" />
</fragment>
<fragment
android:id="@+id/navigation_trending"
android:id="@+id/navigation_recently_added"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_trending"
android:label="@string/title_recently_added"
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type"
android:defaultValue="PTRENDING"/>
android:defaultValue="PRECENTLYADDED"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type" />
</fragment>
<fragment
android:id="@+id/navigation_discover"
android:id="@+id/navigation_home"
android:name="app.fedilab.fedilabtube.fragment.DisplayStatusFragment"
android:label="@string/title_discover"
android:label="@string/title_home"
tools:layout="@layout/fragment_video">
<argument
android:name="type"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type"
android:defaultValue="PPUBLIC"/>
android:defaultValue="PLOCAL"
app:argType=".asynctasks.RetrieveFeedsAsyncTask$Type" />
</fragment>
</navigation>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="colorPrimary">#512DA8</color>
<color name="colorPrimaryDark">#4527A0</color>
<color name="colorAccent">#9C27B0</color>
<color name="positive_thumbs">#2b90d9</color>
<color name="negative_thumbs">#F44336</color>

View File

@ -93,4 +93,5 @@
<string name="set_video_mode">Mode pour les vidéos</string>
<string name="display_nsfw_videos">Afficher les vidéos sensibles</string>
<string name="action_playlist_add">Vous n\'avez aucune liste de lecture. Cliquez sur l\'icône « + » pour en ajouter une</string>
<string name="not_logged_in">Vous devez être connecté.e pour effectuer cette action !</string>
</resources>

View File

@ -1,4 +1,6 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->