Display account
This commit is contained in:
parent
fc654fe561
commit
9dca09b1d3
|
@ -59,6 +59,7 @@ dependencies {
|
|||
implementation 'com.google.android.exoplayer:exoplayer:2.10.6'
|
||||
implementation "com.github.mabbas007:TagsEditText:1.0.5"
|
||||
implementation "com.github.bumptech.glide:glide:4.11.0"
|
||||
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
implementation 'org.apache.poi:poi:3.16'
|
||||
implementation "net.gotev:uploadservice:3.5.2"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package app.fedilab.fedilabtube;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
@ -23,7 +22,6 @@ import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeInformationAsyncTask;
|
|||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
||||
import static app.fedilab.fedilabtube.helper.Helper.academies;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.getLiveInstance;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
|
@ -71,8 +69,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String acad = sharedpreferences.getString(Helper.PREF_INSTANCE, "ac-lyon.fr");
|
||||
int i = 0;
|
||||
for(String item: academies){
|
||||
if( item.compareTo(acad) == 0) {
|
||||
for (String item : academies) {
|
||||
if (item.compareTo(acad) == 0) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package app.fedilab.fedilabtube;
|
||||
|
||||
|
||||
|
@ -62,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;
|
||||
|
@ -162,7 +160,6 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
|
|||
peertube_bookmark.setVisibility(View.GONE);
|
||||
|
||||
|
||||
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(PeertubeActivity.this));
|
||||
|
@ -178,8 +175,6 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
|
|||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
||||
|
||||
|
||||
mode = sharedpreferences.getInt(Helper.SET_VIDEO_MODE, Helper.VIDEO_MODE_DIRECT);
|
||||
if (mode != Helper.VIDEO_MODE_WEBVIEW && mode != Helper.VIDEO_MODE_DIRECT)
|
||||
mode = Helper.VIDEO_MODE_DIRECT;
|
||||
|
@ -320,84 +315,83 @@ 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);
|
||||
|
||||
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;
|
||||
}
|
||||
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();
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
@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();
|
||||
}
|
||||
});
|
||||
} 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 -> {
|
||||
|
@ -471,22 +465,22 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
|
|||
initResolution();
|
||||
|
||||
peertube_like_count.setOnClickListener(v -> {
|
||||
if( isLoggedIn(PeertubeActivity.this) ) {
|
||||
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 {
|
||||
} else {
|
||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
peertube_dislike_count.setOnClickListener(v -> {
|
||||
if( isLoggedIn(PeertubeActivity.this) ) {
|
||||
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 {
|
||||
} else {
|
||||
Toasty.error(PeertubeActivity.this, getString(R.string.not_logged_in), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,7 +3,6 @@ package app.fedilab.fedilabtube;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -42,7 +41,6 @@ import app.fedilab.fedilabtube.client.APIResponse;
|
|||
import app.fedilab.fedilabtube.client.PeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.entities.Account;
|
||||
import app.fedilab.fedilabtube.client.entities.Error;
|
||||
import app.fedilab.fedilabtube.client.entities.InstanceNodeInfo;
|
||||
import app.fedilab.fedilabtube.client.entities.Relationship;
|
||||
import app.fedilab.fedilabtube.client.entities.Status;
|
||||
import app.fedilab.fedilabtube.client.entities.StatusDrawerParams;
|
||||
|
@ -54,12 +52,11 @@ import app.fedilab.fedilabtube.interfaces.OnPostActionInterface;
|
|||
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsAccountInterface;
|
||||
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
|
||||
import app.fedilab.fedilabtube.interfaces.OnRetrieveRelationshipInterface;
|
||||
import app.fedilab.fedilabtube.sqlite.AccountDAO;
|
||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.getLiveInstance;
|
||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||
|
||||
|
||||
public class ShowAccountActivity extends AppCompatActivity implements OnPostActionInterface, OnRetrieveFeedsAccountInterface, OnRetrieveRelationshipInterface, OnRetrieveFeedsInterface {
|
||||
|
@ -73,8 +70,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
private TextView account_note;
|
||||
private String userId;
|
||||
private Relationship relationship;
|
||||
private ImageButton header_edit_profile;
|
||||
private List<Status> pins;
|
||||
private int maxScrollSize;
|
||||
private boolean avatarShown = true;
|
||||
private ImageView account_pp;
|
||||
|
@ -85,7 +80,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
private boolean ischannel;
|
||||
private AsyncTask<Void, Void, Void> retrieveRelationship;
|
||||
private action doAction;
|
||||
private PeertubeAPI.StatusAction doActionAccount;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -93,10 +87,8 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
setContentView(R.layout.activity_show_account);
|
||||
setTitle("");
|
||||
pins = new ArrayList<>();
|
||||
Bundle b = getIntent().getExtras();
|
||||
account_follow = findViewById(R.id.account_follow);
|
||||
header_edit_profile = findViewById(R.id.header_edit_profile);
|
||||
account_follow.setEnabled(false);
|
||||
account_pp = findViewById(R.id.account_pp);
|
||||
account_dn = findViewById(R.id.account_dn);
|
||||
|
@ -143,11 +135,13 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
|
||||
String accountIdRelation = account.getAcct();
|
||||
retrieveRelationship = new RetrieveRelationshipAsyncTask(ShowAccountActivity.this, accountIdRelation, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
if (isLoggedIn(ShowAccountActivity.this)) {
|
||||
retrieveRelationship = new RetrieveRelationshipAsyncTask(ShowAccountActivity.this, accountIdRelation, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
String urlHeader = account.getHeader();
|
||||
if (urlHeader != null && urlHeader.startsWith("/")) {
|
||||
urlHeader = "https://"+Helper.getLiveInstance(ShowAccountActivity.this) + account.getHeader();
|
||||
urlHeader = "https://" + Helper.getLiveInstance(ShowAccountActivity.this) + account.getHeader();
|
||||
}
|
||||
if (urlHeader != null && !urlHeader.contains("missing.png")) {
|
||||
ImageView banner_pp = findViewById(R.id.banner_pp);
|
||||
|
@ -155,8 +149,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
.load(urlHeader)
|
||||
.into(banner_pp);
|
||||
}
|
||||
//Peertube account watched by a Mastodon account
|
||||
//Bot account
|
||||
|
||||
TextView actionbar_title = findViewById(R.id.show_account_title);
|
||||
if (account.getAcct() != null)
|
||||
|
@ -170,12 +162,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
maxScrollSize = appBar.getTotalScrollRange();
|
||||
|
||||
|
||||
//Timed muted account
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||
final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
final Account authenticatedAccount = new AccountDAO(ShowAccountActivity.this, db).getUniqAccount(userId, instance);
|
||||
|
||||
appBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
||||
LinearLayout toolbarContent = findViewById(R.id.toolbar_content);
|
||||
if (toolbarContent != null) {
|
||||
|
@ -293,13 +279,12 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
Helper.loadGiF(ShowAccountActivity.this, account, account_pp);
|
||||
//Follow button
|
||||
String target = account.getAcct();
|
||||
String finalTarget = target;
|
||||
account_follow.setOnClickListener(v -> {
|
||||
if (doAction == action.NOTHING) {
|
||||
Toasty.info(ShowAccountActivity.this, getString(R.string.nothing_to_do), Toast.LENGTH_LONG).show();
|
||||
} else if (doAction == action.FOLLOW) {
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(ShowAccountActivity.this, PeertubeAPI.StatusAction.FOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostActionAsyncTask(ShowAccountActivity.this, PeertubeAPI.StatusAction.FOLLOW, target, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else if (doAction == action.UNFOLLOW) {
|
||||
boolean confirm_unfollow = sharedpreferences.getBoolean(Helper.SET_UNFOLLOW_VALIDATION, true);
|
||||
if (confirm_unfollow) {
|
||||
|
@ -309,13 +294,13 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
unfollowConfirm.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(ShowAccountActivity.this, PeertubeAPI.StatusAction.UNFOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostActionAsyncTask(ShowAccountActivity.this, PeertubeAPI.StatusAction.UNFOLLOW, target, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
dialog.dismiss();
|
||||
});
|
||||
unfollowConfirm.show();
|
||||
} else {
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(ShowAccountActivity.this, PeertubeAPI.StatusAction.UNFOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new PostActionAsyncTask(ShowAccountActivity.this, PeertubeAPI.StatusAction.UNFOLLOW, target, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -339,7 +324,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(ShowAccountActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +389,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
@ -428,7 +411,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
}
|
||||
String target = account.getAcct();
|
||||
//IF action is unfollow or mute, sends an intent to remove statuses
|
||||
if (statusAction == PeertubeAPI.StatusAction.UNFOLLOW ) {
|
||||
if (statusAction == PeertubeAPI.StatusAction.UNFOLLOW) {
|
||||
Bundle b = new Bundle();
|
||||
b.putString("receive_action", targetedId);
|
||||
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
||||
|
@ -438,7 +421,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
}
|
||||
|
||||
|
||||
|
||||
public enum action {
|
||||
FOLLOW,
|
||||
UNFOLLOW,
|
||||
|
@ -463,7 +445,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
bundle = new Bundle();
|
||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER);
|
||||
bundle.putString("targetedid", account.getAcct());
|
||||
bundle.putBoolean("showReply", false);
|
||||
bundle.putBoolean("ischannel", ischannel);
|
||||
displayStatusFragment.setArguments(bundle);
|
||||
return displayStatusFragment;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package app.fedilab.fedilabtube.asynctasks;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package app.fedilab.fedilabtube.asynctasks;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -22,33 +22,24 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
private APIResponse apiResponse;
|
||||
private String max_id;
|
||||
private OnRetrieveFeedsInterface listener;
|
||||
private String targetedID;
|
||||
private String tag;
|
||||
private boolean showMediaOnly = false;
|
||||
private boolean showPinned = false;
|
||||
private boolean showReply = false;
|
||||
private WeakReference<Context> contextReference;
|
||||
private String instanceName, remoteInstance, name;
|
||||
private int timelineId;
|
||||
private String search;
|
||||
private String target;
|
||||
|
||||
|
||||
private String social;
|
||||
|
||||
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.action = action;
|
||||
this.max_id = max_id;
|
||||
this.listener = onRetrieveFeedsInterface;
|
||||
this.search = null;
|
||||
this.target = null;
|
||||
}
|
||||
|
||||
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, String search, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
|
||||
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, String target, OnRetrieveFeedsInterface onRetrieveFeedsInterface) {
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.action = action;
|
||||
this.max_id = max_id;
|
||||
this.listener = onRetrieveFeedsInterface;
|
||||
this.search = search;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +51,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
return null;
|
||||
switch (action) {
|
||||
case USER:
|
||||
apiResponse = peertubeAPI.getVideos(targetedID, max_id);
|
||||
apiResponse = peertubeAPI.getVideos(target, max_id);
|
||||
break;
|
||||
case MYVIDEOS:
|
||||
peertubeAPI = new PeertubeAPI(this.contextReference.get());
|
||||
|
@ -72,7 +63,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
break;
|
||||
case CHANNEL:
|
||||
peertubeAPI = new PeertubeAPI(this.contextReference.get());
|
||||
apiResponse = peertubeAPI.getVideosChannel(targetedID, max_id);
|
||||
apiResponse = peertubeAPI.getVideosChannel(target, max_id);
|
||||
break;
|
||||
|
||||
case CACHE_BOOKMARKS_PEERTUBE:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package app.fedilab.fedilabtube.asynctasks;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -165,7 +165,7 @@ public class Peertube {
|
|||
resolution = this.getResolution().get(0);
|
||||
if (resolution == null)
|
||||
return null;
|
||||
if (streamService ) {
|
||||
if (streamService) {
|
||||
return "https://" + this.host + "/static/streaming-playlists/hls/" + getUuid() + "/" + getUuid() + "-" + resolution + "-fragmented.mp4";
|
||||
} else {
|
||||
return "https://" + this.host + "/static/webseed/" + getUuid() + "-" + resolution + ".mp4";
|
||||
|
|
|
@ -32,7 +32,6 @@ import app.fedilab.fedilabtube.interfaces.OnPostActionInterface;
|
|||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
|
||||
|
||||
public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements OnPostActionInterface {
|
||||
|
||||
private List<Account> accounts;
|
||||
|
@ -95,14 +94,18 @@ public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||
holder.account_follow.setOnClickListener(v -> {
|
||||
|
||||
});
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putBoolean("peertubeaccount", true);
|
||||
b.putBoolean("ischannel", true);
|
||||
b.putString("targetedid", account.getAcct());
|
||||
b.putParcelable("account", account);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
|
||||
holder.account_pp.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putBoolean("peertubeaccount", true);
|
||||
b.putBoolean("ischannel", true);
|
||||
b.putString("targetedid", account.getAcct());
|
||||
b.putParcelable("account", account);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,6 +61,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||
private boolean ischannel;
|
||||
private View rootView;
|
||||
private RecyclerView lv_status;
|
||||
private String targetedId;
|
||||
|
||||
public DisplayStatusFragment() {
|
||||
}
|
||||
|
@ -81,6 +82,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||
|
||||
if (bundle != null) {
|
||||
search_peertube = bundle.getString("search_peertube", null);
|
||||
targetedId = bundle.getString("targetedid", null);
|
||||
ischannel = bundle.getBoolean("ischannel", false);
|
||||
}
|
||||
if (ischannel) {
|
||||
|
@ -116,7 +118,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||
if (context != null) {
|
||||
//Load data depending of the value
|
||||
if (search_peertube == null) { //Not a Peertube search
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, "0", DisplayStatusFragment.this).execute();
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, "0", targetedId, DisplayStatusFragment.this).execute();
|
||||
} else {
|
||||
asyncTask = new RetrievePeertubeSearchAsyncTask(context, "0", search_peertube, DisplayStatusFragment.this).execute();
|
||||
}
|
||||
|
@ -124,7 +126,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
if (context != null) {
|
||||
if (search_peertube == null) { //Not a Peertube search
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, "0", DisplayStatusFragment.this).execute();
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, "0", targetedId, DisplayStatusFragment.this).execute();
|
||||
} else {
|
||||
asyncTask = new RetrievePeertubeSearchAsyncTask(context, "0", search_peertube, DisplayStatusFragment.this).execute();
|
||||
}
|
||||
|
@ -132,7 +134,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||
}, 500);
|
||||
}
|
||||
|
||||
if( type != POVERVIEW) {
|
||||
if (type != POVERVIEW) {
|
||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
|
||||
|
@ -282,7 +284,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
|||
max_id = "0";
|
||||
peertubeAdapater.notifyItemRangeRemoved(0, size);
|
||||
if (search_peertube == null) { //Not a Peertube search
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, "0", DisplayStatusFragment.this).execute();
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, "0", targetedId, DisplayStatusFragment.this).execute();
|
||||
} else {
|
||||
asyncTask = new RetrievePeertubeSearchAsyncTask(context, "0", search_peertube, DisplayStatusFragment.this).execute();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
|||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -131,13 +130,13 @@ public class Helper {
|
|||
"ac-dijon.fr",
|
||||
"ac-grenoble.fr",
|
||||
"education.fr",
|
||||
// "ac-guadeloupe.fr",
|
||||
// "ac-guyane.fr",
|
||||
// "ac-reunion.fr",
|
||||
// "ac-guadeloupe.fr",
|
||||
// "ac-guyane.fr",
|
||||
// "ac-reunion.fr",
|
||||
"ac-lille.fr",
|
||||
"ac-limoges.fr",
|
||||
"ac-lyon.fr",
|
||||
// "ac-martinique.fr",
|
||||
// "ac-martinique.fr",
|
||||
"ac-mayotte.fr",
|
||||
"ac-montpellier.fr",
|
||||
"ac-nancy.fr",
|
||||
|
@ -148,7 +147,7 @@ public class Helper {
|
|||
"ac-poitiers.fr",
|
||||
"outremer.fr",
|
||||
"ac-rennes.fr",
|
||||
// "ac-spm.fr",
|
||||
// "ac-spm.fr",
|
||||
"ac-strasbourg.fr",
|
||||
"ac-toulouse.fr",
|
||||
"ac-versailles.fr"
|
||||
|
@ -351,7 +350,7 @@ public class Helper {
|
|||
public static void loadGiF(final Context context, Account account, final ImageView imageView) {
|
||||
|
||||
|
||||
if (account == null) {
|
||||
if (account == null || account.getAvatar() == null || account.getAvatar().compareTo("null") == 0) {
|
||||
Glide.with(imageView.getContext())
|
||||
.asDrawable()
|
||||
.load(R.drawable.missing_peertube)
|
||||
|
@ -360,7 +359,7 @@ public class Helper {
|
|||
return;
|
||||
}
|
||||
String url = account.getAvatar();
|
||||
if (url != null && url.startsWith("/")) {
|
||||
if (url.startsWith("/")) {
|
||||
url = Helper.getLiveInstance(context) + url;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
package app.fedilab.fedilabtube.interfaces;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.client.entities.Status;
|
||||
|
||||
public interface OnRetrieveFeedsAccountInterface {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package app.fedilab.fedilabtube.interfaces;
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
android:fitsSystemWindows="true">
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
app:expandedTitleMarginEnd="64dp"
|
||||
|
@ -120,7 +119,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/names_container"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -139,15 +137,16 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="18sp" />
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_un"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="16sp" />
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -161,6 +160,7 @@
|
|||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textIsSelectable="true" />
|
||||
|
||||
<HorizontalScrollView
|
||||
|
@ -199,182 +199,9 @@
|
|||
android:textColor="?colorAccent"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</HorizontalScrollView>
|
||||
<!-- Fields container -->
|
||||
<LinearLayout
|
||||
android:id="@+id/fields_container"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
<!-- Fields 1 to 4 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/field1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:minHeight="20dp"
|
||||
android:padding="5dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/value1BG"
|
||||
android:layout_width="0dp"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:textIsSelectable="true" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/field2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:minHeight="20dp"
|
||||
android:padding="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/value2BG"
|
||||
android:layout_width="0dp"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:textIsSelectable="true" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/field3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:minHeight="20dp"
|
||||
android:padding="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/value3BG"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:textIsSelectable="true" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/field4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:minHeight="20dp"
|
||||
android:padding="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/value4BG"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:textIsSelectable="true" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!-- End Fields container -->
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -394,7 +221,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:animationCache="true"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pp_actionBar"
|
||||
|
|
Loading…
Reference in New Issue