Retrieve subscriber count + change layout for profiles
This commit is contained in:
parent
f6ca2e8265
commit
19779c2cf6
|
@ -27,12 +27,12 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -40,7 +40,6 @@ import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
import androidx.viewpager.widget.PagerAdapter;
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
|
@ -50,6 +49,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.asynctasks.PostActionAsyncTask;
|
import app.fedilab.fedilabtube.asynctasks.PostActionAsyncTask;
|
||||||
|
import app.fedilab.fedilabtube.asynctasks.RetrieveAccountsAsyncTask;
|
||||||
import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask;
|
import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask;
|
||||||
import app.fedilab.fedilabtube.asynctasks.RetrieveRelationshipAsyncTask;
|
import app.fedilab.fedilabtube.asynctasks.RetrieveRelationshipAsyncTask;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
|
@ -64,6 +64,7 @@ import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
||||||
import app.fedilab.fedilabtube.fragment.DisplayStatusFragment;
|
import app.fedilab.fedilabtube.fragment.DisplayStatusFragment;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.interfaces.OnPostActionInterface;
|
import app.fedilab.fedilabtube.interfaces.OnPostActionInterface;
|
||||||
|
import app.fedilab.fedilabtube.interfaces.OnRetrieveAccountsInterface;
|
||||||
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsAccountInterface;
|
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsAccountInterface;
|
||||||
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
|
import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface;
|
||||||
import app.fedilab.fedilabtube.interfaces.OnRetrieveRelationshipInterface;
|
import app.fedilab.fedilabtube.interfaces.OnRetrieveRelationshipInterface;
|
||||||
|
@ -74,7 +75,7 @@ import static app.fedilab.fedilabtube.helper.Helper.getLiveInstance;
|
||||||
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||||
|
|
||||||
|
|
||||||
public class ShowAccountActivity extends AppCompatActivity implements OnPostActionInterface, OnRetrieveFeedsAccountInterface, OnRetrieveRelationshipInterface, OnRetrieveFeedsInterface {
|
public class ShowAccountActivity extends AppCompatActivity implements OnPostActionInterface, OnRetrieveFeedsAccountInterface, OnRetrieveRelationshipInterface, OnRetrieveFeedsInterface, OnRetrieveAccountsInterface {
|
||||||
|
|
||||||
|
|
||||||
private List<Status> statuses;
|
private List<Status> statuses;
|
||||||
|
@ -82,13 +83,10 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
private Button account_follow;
|
private Button account_follow;
|
||||||
private ViewPager mPager;
|
private ViewPager mPager;
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
private TextView account_note;
|
private TextView account_note, subscriber_count;
|
||||||
private Relationship relationship;
|
private Relationship relationship;
|
||||||
private int maxScrollSize;
|
|
||||||
private boolean avatarShown = true;
|
|
||||||
private ImageView account_pp;
|
private ImageView account_pp;
|
||||||
private TextView account_dn;
|
private TextView account_dn;
|
||||||
private TextView account_un;
|
|
||||||
private Account account;
|
private Account account;
|
||||||
private String accountId;
|
private String accountId;
|
||||||
private boolean ischannel;
|
private boolean ischannel;
|
||||||
|
@ -102,10 +100,10 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
setTitle("");
|
setTitle("");
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
account_follow = findViewById(R.id.account_follow);
|
account_follow = findViewById(R.id.account_follow);
|
||||||
|
subscriber_count = findViewById(R.id.subscriber_count);
|
||||||
account_follow.setEnabled(false);
|
account_follow.setEnabled(false);
|
||||||
account_pp = findViewById(R.id.account_pp);
|
account_pp = findViewById(R.id.account_pp);
|
||||||
account_dn = findViewById(R.id.account_dn);
|
account_dn = findViewById(R.id.account_dn);
|
||||||
account_un = findViewById(R.id.account_un);
|
|
||||||
account_pp.setBackgroundResource(R.drawable.account_pp_border);
|
account_pp.setBackgroundResource(R.drawable.account_pp_border);
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
account = b.getParcelable("account");
|
account = b.getParcelable("account");
|
||||||
|
@ -125,23 +123,29 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
statusDrawerParams.setStatuses(statuses);
|
statusDrawerParams.setStatuses(statuses);
|
||||||
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
||||||
|
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
if (getSupportActionBar() != null) {
|
||||||
|
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_baseline_arrow_white_24);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
tabLayout = findViewById(R.id.account_tabLayout);
|
tabLayout = findViewById(R.id.account_tabLayout);
|
||||||
account_note = findViewById(R.id.account_note);
|
account_note = findViewById(R.id.account_note);
|
||||||
|
|
||||||
|
|
||||||
/*header_edit_profile.setOnClickListener(v -> {
|
|
||||||
Intent intent = new Intent(ShowAccountActivity.this, EditProfileActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
});*/
|
|
||||||
|
|
||||||
ImageView action_back = findViewById(R.id.action_back);
|
|
||||||
action_back.setOnClickListener(v -> finish());
|
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
ManageAccount();
|
ManageAccount();
|
||||||
|
new RetrieveAccountsAsyncTask(ShowAccountActivity.this, account.getAcct(), RetrieveAccountsAsyncTask.actionType.CHANNEL, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSupportNavigateUp() {
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void ManageAccount() {
|
private void ManageAccount() {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
|
||||||
|
@ -150,17 +154,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
retrieveRelationship = new RetrieveRelationshipAsyncTask(ShowAccountActivity.this, accountIdRelation, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
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();
|
|
||||||
}
|
|
||||||
if (urlHeader != null && !urlHeader.contains("missing.png")) {
|
|
||||||
ImageView banner_pp = findViewById(R.id.banner_pp);
|
|
||||||
Glide.with(banner_pp.getContext())
|
|
||||||
.load(urlHeader)
|
|
||||||
.into(banner_pp);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView actionbar_title = findViewById(R.id.show_account_title);
|
TextView actionbar_title = findViewById(R.id.show_account_title);
|
||||||
if (account.getAcct() != null)
|
if (account.getAcct() != null)
|
||||||
actionbar_title.setText(account.getAcct());
|
actionbar_title.setText(account.getAcct());
|
||||||
|
@ -170,39 +163,18 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
|
|
||||||
}
|
}
|
||||||
final AppBarLayout appBar = findViewById(R.id.appBar);
|
final AppBarLayout appBar = findViewById(R.id.appBar);
|
||||||
maxScrollSize = appBar.getTotalScrollRange();
|
|
||||||
|
|
||||||
|
|
||||||
appBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
appBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
||||||
LinearLayout toolbarContent = findViewById(R.id.toolbar_content);
|
if (pp_actionBar != null) {
|
||||||
if (toolbarContent != null) {
|
|
||||||
if (Math.abs(verticalOffset) - appBar.getTotalScrollRange() == 0) {
|
if (Math.abs(verticalOffset) - appBar.getTotalScrollRange() == 0) {
|
||||||
if (toolbarContent.getVisibility() == View.GONE)
|
if (pp_actionBar.getVisibility() == View.GONE)
|
||||||
toolbarContent.setVisibility(View.VISIBLE);
|
pp_actionBar.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
if (toolbarContent.getVisibility() == View.VISIBLE)
|
if (pp_actionBar.getVisibility() == View.VISIBLE)
|
||||||
toolbarContent.setVisibility(View.GONE);
|
pp_actionBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxScrollSize == 0)
|
|
||||||
maxScrollSize = appBarLayout.getTotalScrollRange();
|
|
||||||
|
|
||||||
int percentage = (Math.abs(verticalOffset)) * 100 / maxScrollSize;
|
|
||||||
|
|
||||||
if (percentage >= 40 && avatarShown) {
|
|
||||||
avatarShown = false;
|
|
||||||
|
|
||||||
account_pp.animate()
|
|
||||||
.scaleY(0).scaleX(0)
|
|
||||||
.setDuration(400)
|
|
||||||
.start();
|
|
||||||
}
|
|
||||||
if (percentage <= 40 && !avatarShown) {
|
|
||||||
avatarShown = true;
|
|
||||||
account_pp.animate()
|
|
||||||
.scaleY(1).scaleX(1)
|
|
||||||
.start();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
mPager = findViewById(R.id.account_viewpager);
|
mPager = findViewById(R.id.account_viewpager);
|
||||||
if (!ischannel) {
|
if (!ischannel) {
|
||||||
|
@ -275,27 +247,9 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
});
|
});
|
||||||
|
|
||||||
account_dn.setText(account.getDisplay_name());
|
account_dn.setText(account.getDisplay_name());
|
||||||
if (!ischannel || account.getAcct().split("-").length < 4) {
|
|
||||||
account_un.setText(String.format("@%s", account.getAcct()));
|
|
||||||
} else {
|
|
||||||
account_un.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpannableString spannableString;
|
|
||||||
|
|
||||||
if (account.getNote() != null && account.getNote().compareTo("null") != 0 && account.getNote().trim().length() > 0) {
|
manageNotes(account);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
spannableString = new SpannableString(Html.fromHtml(account.getNote(), FROM_HTML_MODE_LEGACY));
|
|
||||||
else
|
|
||||||
spannableString = new SpannableString(Html.fromHtml(account.getNote()));
|
|
||||||
|
|
||||||
account.setNoteSpan(spannableString);
|
|
||||||
account_note.setText(account.getNoteSpan(), TextView.BufferType.SPANNABLE);
|
|
||||||
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
account_note.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
account_note.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
Helper.loadGiF(ShowAccountActivity.this, account, account_pp);
|
Helper.loadGiF(ShowAccountActivity.this, account, account_pp);
|
||||||
//Follow button
|
//Follow button
|
||||||
String target = account.getAcct();
|
String target = account.getAcct();
|
||||||
|
@ -436,6 +390,32 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
retrieveRelationship = new RetrieveRelationshipAsyncTask(ShowAccountActivity.this, target, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
retrieveRelationship = new RetrieveRelationshipAsyncTask(ShowAccountActivity.this, target, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRetrieveAccounts(APIResponse apiResponse) {
|
||||||
|
if (apiResponse.getAccounts() != null && apiResponse.getAccounts().size() == 1) {
|
||||||
|
Account account = apiResponse.getAccounts().get(0);
|
||||||
|
subscriber_count.setText(getString(R.string.followers_count, Helper.withSuffix(account.getFollowers_count())));
|
||||||
|
subscriber_count.setVisibility(View.VISIBLE);
|
||||||
|
manageNotes(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void manageNotes(Account account) {
|
||||||
|
if (account.getNote() != null && account.getNote().compareTo("null") != 0 && account.getNote().trim().length() > 0) {
|
||||||
|
SpannableString spannableString;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(account.getNote(), FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
spannableString = new SpannableString(Html.fromHtml(account.getNote()));
|
||||||
|
|
||||||
|
account.setNoteSpan(spannableString);
|
||||||
|
account_note.setText(account.getNoteSpan(), TextView.BufferType.SPANNABLE);
|
||||||
|
account_note.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
account_note.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
account_note.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum action {
|
public enum action {
|
||||||
FOLLOW,
|
FOLLOW,
|
||||||
|
|
|
@ -29,18 +29,25 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, APIResponse
|
||||||
private OnRetrieveAccountsInterface listener;
|
private OnRetrieveAccountsInterface listener;
|
||||||
private WeakReference<Context> contextReference;
|
private WeakReference<Context> contextReference;
|
||||||
private String name;
|
private String name;
|
||||||
|
private actionType type;
|
||||||
|
|
||||||
public RetrieveAccountsAsyncTask(Context context, String name, OnRetrieveAccountsInterface onRetrieveAccountsInterface) {
|
public RetrieveAccountsAsyncTask(Context context, String name, actionType type, OnRetrieveAccountsInterface onRetrieveAccountsInterface) {
|
||||||
this.contextReference = new WeakReference<>(context);
|
this.contextReference = new WeakReference<>(context);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.listener = onRetrieveAccountsInterface;
|
this.listener = onRetrieveAccountsInterface;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected APIResponse doInBackground(Void... params) {
|
protected APIResponse doInBackground(Void... params) {
|
||||||
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
|
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
|
||||||
return peertubeAPI.getPeertubeChannel(name);
|
if (type == actionType.ACCOUNT) {
|
||||||
|
return peertubeAPI.getPeertubeChannel(name);
|
||||||
|
} else if (type == actionType.CHANNEL) {
|
||||||
|
return peertubeAPI.getPeertubeChannelInfo(name);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,4 +55,9 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, APIResponse
|
||||||
listener.onRetrieveAccounts(apiResponse);
|
listener.onRetrieveAccounts(apiResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum actionType {
|
||||||
|
ACCOUNT,
|
||||||
|
CHANNEL
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1400,6 +1400,32 @@ public class PeertubeAPI {
|
||||||
return apiResponse;
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves Peertube channel info from an account *synchronously*
|
||||||
|
* Peertube channels are dealt like accounts
|
||||||
|
*
|
||||||
|
* @return APIResponse
|
||||||
|
*/
|
||||||
|
public APIResponse getPeertubeChannelInfo(String name) {
|
||||||
|
|
||||||
|
List<Account> accounts = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
HttpsConnection httpsConnection = new HttpsConnection(context);
|
||||||
|
String response = httpsConnection.get(getAbsoluteUrl(String.format("/video-channels/%s", name)), 60, null, null);
|
||||||
|
JSONObject jsonObject = new JSONObject(response);
|
||||||
|
Account account = parseAccountResponsePeertube(jsonObject);
|
||||||
|
accounts.add(account);
|
||||||
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
setError(e.getStatusCode(), e);
|
||||||
|
} catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
apiResponse.setAccounts(accounts);
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves Peertube videos from an instance *synchronously*
|
* Retrieves Peertube videos from an instance *synchronously*
|
||||||
*
|
*
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||||
|
|
||||||
boolean ownVideos = peertube.getAccount().getInstance().compareTo(Helper.getLiveInstance(context)) == 0 && userId != null && peertube.getAccount().getId() != null && peertube.getAccount().getId().compareTo(userId) == 0;
|
boolean ownVideos = peertube.getAccount().getInstance().compareTo(Helper.getLiveInstance(context)) == 0 && userId != null && peertube.getAccount().getId() != null && peertube.getAccount().getId().compareTo(userId) == 0;
|
||||||
|
|
||||||
if( peertube.getChannel() == null) {
|
if (peertube.getChannel() == null) {
|
||||||
holder.peertube_account_name.setText(account.getAcct());
|
holder.peertube_account_name.setText(account.getAcct());
|
||||||
if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http")) {
|
if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http")) {
|
||||||
account.setAvatar("https://" + peertube.getInstance() + account.getAvatar());
|
account.setAvatar("https://" + peertube.getInstance() + account.getAvatar());
|
||||||
|
@ -105,9 +105,9 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||||
holder.peertube_profile.setOnClickListener(v -> {
|
holder.peertube_profile.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
if( peertube.getChannel() == null) {
|
if (peertube.getChannel() == null) {
|
||||||
b.putParcelable("account", peertube.getAccount());
|
b.putParcelable("account", peertube.getAccount());
|
||||||
}else{
|
} else {
|
||||||
b.putParcelable("account", peertube.getChannel());
|
b.putParcelable("account", peertube.getChannel());
|
||||||
b.putBoolean("ischannel", true);
|
b.putBoolean("ischannel", true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
||||||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||||
if (!flag_loading) {
|
if (!flag_loading) {
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
asyncTask = new RetrieveAccountsAsyncTask(context, name, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveAccountsAsyncTask(context, name, RetrieveAccountsAsyncTask.actionType.ACCOUNT, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
nextElementLoader.setVisibility(View.VISIBLE);
|
nextElementLoader.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,7 +114,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
||||||
});
|
});
|
||||||
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
||||||
|
|
||||||
asyncTask = new RetrieveAccountsAsyncTask(context, name, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveAccountsAsyncTask(context, name, RetrieveAccountsAsyncTask.actionType.ACCOUNT, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
swiped = true;
|
swiped = true;
|
||||||
swipeRefreshLayout.setRefreshing(true);
|
swipeRefreshLayout.setRefreshing(true);
|
||||||
asyncTask = new RetrieveAccountsAsyncTask(context, name, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
asyncTask = new RetrieveAccountsAsyncTask(context, name, RetrieveAccountsAsyncTask.actionType.ACCOUNT, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||||
|
</vector>
|
|
@ -14,7 +14,8 @@
|
||||||
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||||
see <http://www.gnu.org/licenses>.
|
see <http://www.gnu.org/licenses>.
|
||||||
-->
|
-->
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -26,7 +27,8 @@
|
||||||
android:id="@+id/appBar"
|
android:id="@+id/appBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true"
|
||||||
|
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||||
|
|
||||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -34,45 +36,23 @@
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
app:expandedTitleMarginEnd="64dp"
|
app:expandedTitleMarginEnd="64dp"
|
||||||
app:expandedTitleMarginStart="48dp"
|
app:expandedTitleMarginStart="48dp"
|
||||||
app:layout_scrollFlags="scroll">
|
app:contentScrim="?attr/colorPrimary"
|
||||||
|
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/top_banner"
|
android:id="@+id/top_banner"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/action_back"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:contentDescription="@string/go_back"
|
|
||||||
android:src="@drawable/ic_baseline_arrow_back_24"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:tint="@android:color/white" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/banner_pp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/layout_height_header"
|
|
||||||
android:contentDescription="@string/profile_banner"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/default_banner"
|
|
||||||
app:layout_collapseMode="parallax"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/account_pp"
|
android:id="@+id/account_pp"
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="80dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
|
@ -81,75 +61,62 @@
|
||||||
android:contentDescription="@string/profile_picture"
|
android:contentDescription="@string/profile_picture"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/action_back"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_scrollFlags="scroll" />
|
/>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:padding="2dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/action_back">
|
app:layout_constraintTop_toTopOf="@+id/account_pp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/subscriber_count"
|
||||||
|
android:id="@+id/account_dn"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/names_container"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/subscriber_count"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_width="wrap_content"
|
||||||
android:orientation="vertical"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:singleLine="true"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
android:visibility="invisible"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/account_pp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/account_dn"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/account_follow"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextView
|
<Button
|
||||||
android:id="@+id/account_dn"
|
android:id="@+id/account_follow"
|
||||||
android:layout_width="wrap_content"
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:singleLine="true"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
android:layout_marginStart="10dp"
|
||||||
android:textColor="@android:color/white"
|
android:contentDescription="@string/make_an_action"
|
||||||
android:textSize="18sp" />
|
android:scaleType="fitCenter"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/subscriber_count"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
||||||
|
|
||||||
<TextView
|
<Button
|
||||||
android:id="@+id/account_un"
|
android:id="@+id/header_edit_profile"
|
||||||
android:layout_width="wrap_content"
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:singleLine="true"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:layout_marginStart="10dp"
|
||||||
android:textColor="@android:color/white"
|
android:contentDescription="@string/edit_profile"
|
||||||
android:textSize="14sp" />
|
android:scaleType="fitCenter"
|
||||||
</LinearLayout>
|
android:src="@drawable/ic_baseline_edit_24"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/subscriber_count"
|
||||||
<Button
|
app:layout_constraintTop_toBottomOf="@id/account_dn" />
|
||||||
android:id="@+id/account_follow"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:contentDescription="@string/make_an_action"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/names_container" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/header_edit_profile"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:contentDescription="@string/edit_profile"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/ic_baseline_edit_24"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/names_container" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@ -176,47 +143,46 @@
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
app:layout_collapseMode="pin"
|
||||||
|
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/toolbar_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:animationCache="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:ignore="UseCompoundDrawables">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/pp_actionBar"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:contentDescription="@string/profile_picture"
|
||||||
|
android:gravity="center_vertical" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/show_account_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="?attr/actionBarSize"
|
|
||||||
app:layout_collapseMode="pin"
|
|
||||||
app:theme="@style/ThemeOverlay.AppCompat.Light">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/toolbar_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:animationCache="true"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:ignore="UseCompoundDrawables">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/pp_actionBar"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:contentDescription="@string/profile_picture"
|
|
||||||
android:gravity="center_vertical" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/show_account_title"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/account_tabLayout"
|
android:id="@+id/account_tabLayout"
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
<string name="no_channels">Aucune chaîne !</string>
|
<string name="no_channels">Aucune chaîne !</string>
|
||||||
<string name="following">Suit</string>
|
<string name="following">Suit</string>
|
||||||
<string name="followers">Abonné·e·s</string>
|
<string name="followers">Abonné·e·s</string>
|
||||||
|
<string name="followers_count">%1$s Abonné·e·s</string>
|
||||||
<string name="nothing_to_do">Aucune action ne peut être réalisée</string>
|
<string name="nothing_to_do">Aucune action ne peut être réalisée</string>
|
||||||
<string name="unfollow_confirm">Voulez-vous vous désabonner de ce compte ?</string>
|
<string name="unfollow_confirm">Voulez-vous vous désabonner de ce compte ?</string>
|
||||||
<string name="action_unfollow">Se désabonner</string>
|
<string name="action_unfollow">Se désabonner</string>
|
||||||
|
|
Loading…
Reference in New Issue