mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Retrieve subscriber count + change layout for profiles
This commit is contained in:
		| @@ -27,12 +27,12 @@ import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.Button; | ||||
| import android.widget.ImageView; | ||||
| import android.widget.LinearLayout; | ||||
| import android.widget.TextView; | ||||
| import android.widget.Toast; | ||||
|  | ||||
| import androidx.appcompat.app.AlertDialog; | ||||
| import androidx.appcompat.app.AppCompatActivity; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.core.content.ContextCompat; | ||||
| import androidx.fragment.app.Fragment; | ||||
| import androidx.fragment.app.FragmentManager; | ||||
| @@ -40,7 +40,6 @@ import androidx.fragment.app.FragmentStatePagerAdapter; | ||||
| import androidx.viewpager.widget.PagerAdapter; | ||||
| import androidx.viewpager.widget.ViewPager; | ||||
|  | ||||
| import com.bumptech.glide.Glide; | ||||
| import com.google.android.material.appbar.AppBarLayout; | ||||
| import com.google.android.material.tabs.TabLayout; | ||||
|  | ||||
| @@ -50,6 +49,7 @@ import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import app.fedilab.fedilabtube.asynctasks.PostActionAsyncTask; | ||||
| import app.fedilab.fedilabtube.asynctasks.RetrieveAccountsAsyncTask; | ||||
| import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask; | ||||
| import app.fedilab.fedilabtube.asynctasks.RetrieveRelationshipAsyncTask; | ||||
| 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.helper.Helper; | ||||
| import app.fedilab.fedilabtube.interfaces.OnPostActionInterface; | ||||
| import app.fedilab.fedilabtube.interfaces.OnRetrieveAccountsInterface; | ||||
| import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsAccountInterface; | ||||
| import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface; | ||||
| 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; | ||||
|  | ||||
|  | ||||
| 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; | ||||
| @@ -82,13 +83,10 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi | ||||
|     private Button account_follow; | ||||
|     private ViewPager mPager; | ||||
|     private TabLayout tabLayout; | ||||
|     private TextView account_note; | ||||
|     private TextView account_note, subscriber_count; | ||||
|     private Relationship relationship; | ||||
|     private int maxScrollSize; | ||||
|     private boolean avatarShown = true; | ||||
|     private ImageView account_pp; | ||||
|     private TextView account_dn; | ||||
|     private TextView account_un; | ||||
|     private Account account; | ||||
|     private String accountId; | ||||
|     private boolean ischannel; | ||||
| @@ -102,10 +100,10 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi | ||||
|         setTitle(""); | ||||
|         Bundle b = getIntent().getExtras(); | ||||
|         account_follow = findViewById(R.id.account_follow); | ||||
|         subscriber_count = findViewById(R.id.subscriber_count); | ||||
|         account_follow.setEnabled(false); | ||||
|         account_pp = findViewById(R.id.account_pp); | ||||
|         account_dn = findViewById(R.id.account_dn); | ||||
|         account_un = findViewById(R.id.account_un); | ||||
|         account_pp.setBackgroundResource(R.drawable.account_pp_border); | ||||
|         if (b != null) { | ||||
|             account = b.getParcelable("account"); | ||||
| @@ -125,23 +123,29 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi | ||||
|         statusDrawerParams.setStatuses(statuses); | ||||
|         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); | ||||
|         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) { | ||||
|             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() { | ||||
|         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); | ||||
|         } | ||||
|  | ||||
|         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); | ||||
|         if (account.getAcct() != null) | ||||
|             actionbar_title.setText(account.getAcct()); | ||||
| @@ -170,39 +163,18 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi | ||||
|  | ||||
|         } | ||||
|         final AppBarLayout appBar = findViewById(R.id.appBar); | ||||
|         maxScrollSize = appBar.getTotalScrollRange(); | ||||
|  | ||||
|  | ||||
|         appBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> { | ||||
|             LinearLayout toolbarContent = findViewById(R.id.toolbar_content); | ||||
|             if (toolbarContent != null) { | ||||
|             if (pp_actionBar != null) { | ||||
|                 if (Math.abs(verticalOffset) - appBar.getTotalScrollRange() == 0) { | ||||
|                     if (toolbarContent.getVisibility() == View.GONE) | ||||
|                         toolbarContent.setVisibility(View.VISIBLE); | ||||
|                     if (pp_actionBar.getVisibility() == View.GONE) | ||||
|                         pp_actionBar.setVisibility(View.VISIBLE); | ||||
|                 } else { | ||||
|                     if (toolbarContent.getVisibility() == View.VISIBLE) | ||||
|                         toolbarContent.setVisibility(View.GONE); | ||||
|                     if (pp_actionBar.getVisibility() == View.VISIBLE) | ||||
|                         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); | ||||
|         if (!ischannel) { | ||||
| @@ -275,27 +247,9 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi | ||||
|         }); | ||||
|  | ||||
|         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) { | ||||
|             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); | ||||
|         } | ||||
|         manageNotes(account); | ||||
|         Helper.loadGiF(ShowAccountActivity.this, account, account_pp); | ||||
|         //Follow button | ||||
|         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); | ||||
|     } | ||||
|  | ||||
|     @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 { | ||||
|         FOLLOW, | ||||
|   | ||||
| @@ -29,18 +29,25 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, APIResponse | ||||
|     private OnRetrieveAccountsInterface listener; | ||||
|     private WeakReference<Context> contextReference; | ||||
|     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.name = name; | ||||
|         this.listener = onRetrieveAccountsInterface; | ||||
|         this.type = type; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     protected APIResponse doInBackground(Void... params) { | ||||
|         PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get()); | ||||
|         if (type == actionType.ACCOUNT) { | ||||
|             return peertubeAPI.getPeertubeChannel(name); | ||||
|         } else if (type == actionType.CHANNEL) { | ||||
|             return peertubeAPI.getPeertubeChannelInfo(name); | ||||
|         } else { | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -48,4 +55,9 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, APIResponse | ||||
|         listener.onRetrieveAccounts(apiResponse); | ||||
|     } | ||||
|  | ||||
|     public enum actionType { | ||||
|         ACCOUNT, | ||||
|         CHANNEL | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1400,6 +1400,32 @@ public class PeertubeAPI { | ||||
|         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* | ||||
|      * | ||||
|   | ||||
| @@ -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; | ||||
|  | ||||
|         if( peertube.getChannel() == null) { | ||||
|         if (peertube.getChannel() == null) { | ||||
|             holder.peertube_account_name.setText(account.getAcct()); | ||||
|             if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http")) { | ||||
|                 account.setAvatar("https://" + peertube.getInstance() + account.getAvatar()); | ||||
| @@ -105,9 +105,9 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde | ||||
|             holder.peertube_profile.setOnClickListener(v -> { | ||||
|                 Intent intent = new Intent(context, ShowAccountActivity.class); | ||||
|                 Bundle b = new Bundle(); | ||||
|                 if( peertube.getChannel() == null) { | ||||
|                 if (peertube.getChannel() == null) { | ||||
|                     b.putParcelable("account", peertube.getAccount()); | ||||
|                 }else{ | ||||
|                 } else { | ||||
|                     b.putParcelable("account", peertube.getChannel()); | ||||
|                     b.putBoolean("ischannel", true); | ||||
|                 } | ||||
|   | ||||
| @@ -103,7 +103,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou | ||||
|                     if (firstVisibleItem + visibleItemCount == totalItemCount) { | ||||
|                         if (!flag_loading) { | ||||
|                             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); | ||||
|                         } | ||||
|                     } else { | ||||
| @@ -114,7 +114,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou | ||||
|         }); | ||||
|         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; | ||||
|     } | ||||
|  | ||||
| @@ -189,7 +189,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou | ||||
|         flag_loading = true; | ||||
|         swiped = 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); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_arrow_white_24.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_arrow_white_24.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -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, | ||||
|     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:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
| @@ -26,7 +27,8 @@ | ||||
|         android:id="@+id/appBar" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:fitsSystemWindows="true"> | ||||
|         android:fitsSystemWindows="true" | ||||
|         app:theme="@style/ThemeOverlay.AppCompat.ActionBar"> | ||||
|  | ||||
|         <com.google.android.material.appbar.CollapsingToolbarLayout | ||||
|             android:layout_width="match_parent" | ||||
| @@ -34,45 +36,23 @@ | ||||
|             android:fitsSystemWindows="true" | ||||
|             app:expandedTitleMarginEnd="64dp" | ||||
|             app:expandedTitleMarginStart="48dp" | ||||
|             app:layout_scrollFlags="scroll"> | ||||
|             app:contentScrim="?attr/colorPrimary" | ||||
|             app:layout_scrollFlags="scroll|exitUntilCollapsed"> | ||||
|  | ||||
|             <RelativeLayout | ||||
|                 android:layout_marginTop="?attr/actionBarSize" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content"> | ||||
|  | ||||
|                 <androidx.constraintlayout.widget.ConstraintLayout | ||||
|                     android:id="@+id/top_banner" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_marginTop="5dp" | ||||
|                     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 | ||||
|                         android:id="@+id/account_pp" | ||||
|                         style="@style/Widget.AppCompat.Button.Colored" | ||||
|                         android:layout_width="80dp" | ||||
|                         android:layout_height="80dp" | ||||
|                         android:layout_margin="10dp" | ||||
| @@ -81,28 +61,14 @@ | ||||
|                         android:contentDescription="@string/profile_picture" | ||||
|                         android:padding="2dp" | ||||
|                         app:layout_constraintStart_toStartOf="parent" | ||||
|                         app:layout_constraintTop_toBottomOf="@+id/action_back" | ||||
|                         app:layout_scrollFlags="scroll" /> | ||||
|  | ||||
|                     <androidx.constraintlayout.widget.ConstraintLayout | ||||
|                         android:layout_width="0dp" | ||||
|                         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_constraintTop_toBottomOf="@+id/action_back"> | ||||
|  | ||||
|                         <LinearLayout | ||||
|                             android:id="@+id/names_container" | ||||
|                             android:layout_width="wrap_content" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_marginStart="10dp" | ||||
|                             android:orientation="vertical" | ||||
|                             app:layout_constraintStart_toStartOf="parent" | ||||
|                             app:layout_constraintTop_toTopOf="parent"> | ||||
|                         app:layout_constraintTop_toTopOf="parent" | ||||
|                         /> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:layout_marginStart="10dp" | ||||
|                         app:layout_constraintStart_toEndOf="@+id/account_pp" | ||||
|                         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" | ||||
| @@ -112,15 +78,20 @@ | ||||
|                         android:textSize="18sp" /> | ||||
|  | ||||
|                     <TextView | ||||
|                                 android:id="@+id/account_un" | ||||
|                         android:layout_marginStart="10dp" | ||||
|                         android:layout_marginTop="10dp" | ||||
|                         android:id="@+id/subscriber_count" | ||||
|                         android:layout_width="wrap_content" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:singleLine="true" | ||||
|                                 android:ellipsize="end" | ||||
|                         android:visibility="invisible" | ||||
|                         android:gravity="center_vertical" | ||||
|                         android:textAppearance="@style/TextAppearance.AppCompat.Body1" | ||||
|                         android:textColor="@android:color/white" | ||||
|                                 android:textSize="14sp" /> | ||||
|                         </LinearLayout> | ||||
|  | ||||
|                         app:layout_constraintStart_toEndOf="@+id/account_pp" | ||||
|                         app:layout_constraintTop_toBottomOf="@id/account_dn" | ||||
|                         app:layout_constraintBottom_toBottomOf="@id/account_follow" | ||||
|                         /> | ||||
|  | ||||
|                     <Button | ||||
|                         android:id="@+id/account_follow" | ||||
| @@ -128,12 +99,11 @@ | ||||
|                         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" /> | ||||
|                         app:layout_constraintStart_toEndOf="@id/subscriber_count" | ||||
|                         app:layout_constraintTop_toBottomOf="@id/account_dn" /> | ||||
|  | ||||
|                     <Button | ||||
|                         android:id="@+id/header_edit_profile" | ||||
| @@ -141,15 +111,12 @@ | ||||
|                         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> | ||||
|                         app:layout_constraintStart_toEndOf="@id/subscriber_count" | ||||
|                         app:layout_constraintTop_toBottomOf="@id/account_dn" /> | ||||
|  | ||||
|  | ||||
|                 </androidx.constraintlayout.widget.ConstraintLayout> | ||||
| @@ -176,16 +143,12 @@ | ||||
|                         android:visibility="gone" /> | ||||
|                 </LinearLayout> | ||||
|             </RelativeLayout> | ||||
|  | ||||
|         </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" | ||||
|                 android:layout_height="?attr/actionBarSize" | ||||
|                 app:layout_collapseMode="pin" | ||||
|             app:theme="@style/ThemeOverlay.AppCompat.Light"> | ||||
|                 app:theme="@style/ThemeOverlay.AppCompat.ActionBar"> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                     android:id="@+id/toolbar_content" | ||||
| @@ -193,12 +156,12 @@ | ||||
|                     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:visibility="gone" | ||||
|                         android:layout_height="30dp" | ||||
|                         android:layout_gravity="center_vertical" | ||||
|                         android:layout_marginEnd="10dp" | ||||
| @@ -217,6 +180,9 @@ | ||||
|                         android:textSize="14sp" /> | ||||
|                 </LinearLayout> | ||||
|             </androidx.appcompat.widget.Toolbar> | ||||
|         </com.google.android.material.appbar.CollapsingToolbarLayout> | ||||
|  | ||||
|  | ||||
|  | ||||
|         <com.google.android.material.tabs.TabLayout | ||||
|             android:id="@+id/account_tabLayout" | ||||
|   | ||||
| @@ -108,6 +108,7 @@ | ||||
|     <string name="no_channels">Aucune chaîne !</string> | ||||
|     <string name="following">Suit</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="unfollow_confirm">Voulez-vous vous désabonner de ce compte ?</string> | ||||
|     <string name="action_unfollow">Se désabonner</string> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user