diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f8369a2..d7d6854 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ . */ +import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -112,9 +113,7 @@ public class MainActivity extends AppCompatActivity { SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); Account account = new AccountDAO(MainActivity.this, db).getUniqAccount(userId, instance); if (account != null) { - new Thread(() -> { - new PeertubeAPI(MainActivity.this).refreshToken(account.getToken(), account.getInstance()); - }).start(); + new Thread(() -> new PeertubeAPI(MainActivity.this).refreshToken(account.getToken(), account.getInstance())).start(); } } else { instanceItem.setVisible(true); @@ -174,6 +173,7 @@ public class MainActivity extends AppCompatActivity { } } + @SuppressLint("ApplySharedPref") private void showRadioButtonDialog() { AlertDialog.Builder alt_bld = new AlertDialog.Builder(this); diff --git a/app/src/main/java/app/fedilab/fedilabtube/asynctasks/RetrieveAccountSubscriptionsAsyncTask.java b/app/src/main/java/app/fedilab/fedilabtube/asynctasks/RetrieveAccountSubscriptionsAsyncTask.java new file mode 100644 index 0000000..ec8f3f9 --- /dev/null +++ b/app/src/main/java/app/fedilab/fedilabtube/asynctasks/RetrieveAccountSubscriptionsAsyncTask.java @@ -0,0 +1,50 @@ +package app.fedilab.fedilabtube.asynctasks; +/* Copyright 2020 Thomas Schneider + * + * This file is a part of TubeLab + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with TubeLab; if not, + * see . */ + +import android.content.Context; +import android.os.AsyncTask; + +import java.lang.ref.WeakReference; + +import app.fedilab.fedilabtube.client.APIResponse; +import app.fedilab.fedilabtube.client.PeertubeAPI; +import app.fedilab.fedilabtube.interfaces.OnRetrieveAccountsInterface; + + +public class RetrieveAccountSubscriptionsAsyncTask extends AsyncTask { + + private OnRetrieveAccountsInterface listener; + private WeakReference contextReference; + private String max_id; + + public RetrieveAccountSubscriptionsAsyncTask(Context context, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface) { + this.contextReference = new WeakReference<>(context); + this.max_id = max_id; + this.listener = onRetrieveAccountsInterface; + } + + @Override + protected APIResponse doInBackground(Void... params) { + PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get()); + return peertubeAPI.getSubscriptionUsers(max_id); + } + + @Override + protected void onPostExecute(APIResponse apiResponse) { + listener.onRetrieveAccounts(apiResponse); + } + +} diff --git a/app/src/main/java/app/fedilab/fedilabtube/asynctasks/RetrieveAccountsAsyncTask.java b/app/src/main/java/app/fedilab/fedilabtube/asynctasks/RetrieveAccountsAsyncTask.java index 45cb3d4..7c39a0d 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/asynctasks/RetrieveAccountsAsyncTask.java +++ b/app/src/main/java/app/fedilab/fedilabtube/asynctasks/RetrieveAccountsAsyncTask.java @@ -24,9 +24,8 @@ import app.fedilab.fedilabtube.client.PeertubeAPI; import app.fedilab.fedilabtube.interfaces.OnRetrieveAccountsInterface; -public class RetrieveAccountsAsyncTask extends AsyncTask { +public class RetrieveAccountsAsyncTask extends AsyncTask { - private APIResponse apiResponse; private OnRetrieveAccountsInterface listener; private WeakReference contextReference; private String name; @@ -39,16 +38,14 @@ public class RetrieveAccountsAsyncTask extends AsyncTask { @Override - protected Void doInBackground(Void... params) { + protected APIResponse doInBackground(Void... params) { PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get()); - apiResponse = peertubeAPI.getPeertubeChannel(name); - return null; + return peertubeAPI.getPeertubeChannel(name); } @Override - protected void onPostExecute(Void result) { + protected void onPostExecute(APIResponse apiResponse) { listener.onRetrieveAccounts(apiResponse); } - } diff --git a/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java b/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java index 6e2ac97..d219235 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java +++ b/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java @@ -450,7 +450,9 @@ public class PeertubeAPI { else account.setNote(""); - account.setUrl(accountObject.get("url").toString()); + if (accountObject.has("url")) { + account.setUrl(accountObject.get("url").toString()); + } if (accountObject.has("avatar") && !accountObject.isNull("avatar")) { account.setAvatar(accountObject.getJSONObject("avatar").get("path").toString()); account.setAvatar_static(accountObject.getJSONObject("avatar").get("path").toString()); @@ -1168,7 +1170,7 @@ public class PeertubeAPI { } /** - * Retrieves subscription videos *synchronously* + * Retrieves subscriptions *synchronously* * * @param max_id String id max * @return APIResponse @@ -1181,11 +1183,12 @@ public class PeertubeAPI { if (max_id != null) params.put("start", max_id); params.put("sort", "-createdAt"); - String response = httpsConnection.get("/users/me/subscriptions", 60, params, null); + String response = httpsConnection.get(getAbsoluteUrl("/users/me/subscriptions"), 10, params, prefKeyOauthTokenT); JSONArray jsonArray = new JSONObject(response).getJSONArray("data"); accounts = parseAccountResponsePeertube(jsonArray); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); + e.printStackTrace(); } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { e.printStackTrace(); } @@ -1867,7 +1870,7 @@ public class PeertubeAPI { String errorM = jsonObject.getString("error"); message = "Error " + statusCode + " : " + errorM; } catch (JSONException e) { - if (error.getMessage().split(".").length > 0) { + if (error.getMessage() != null && error.getMessage().split(".").length > 0) { String errorM = error.getMessage().split(".")[0]; message = "Error " + statusCode + " : " + errorM; } diff --git a/app/src/main/java/app/fedilab/fedilabtube/drawer/AccountsHorizontalListAdapter.java b/app/src/main/java/app/fedilab/fedilabtube/drawer/AccountsHorizontalListAdapter.java new file mode 100644 index 0000000..eea0fd6 --- /dev/null +++ b/app/src/main/java/app/fedilab/fedilabtube/drawer/AccountsHorizontalListAdapter.java @@ -0,0 +1,160 @@ +package app.fedilab.fedilabtube.drawer; +/* Copyright 2020 Thomas Schneider + * + * This file is a part of TubeLab + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with TubeLab; if not, + * see . */ + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.List; + +import app.fedilab.fedilabtube.R; +import app.fedilab.fedilabtube.ShowAccountActivity; +import app.fedilab.fedilabtube.client.PeertubeAPI; +import app.fedilab.fedilabtube.client.entities.Account; +import app.fedilab.fedilabtube.client.entities.Error; +import app.fedilab.fedilabtube.helper.Helper; +import app.fedilab.fedilabtube.interfaces.OnPostActionInterface; +import es.dmoral.toasty.Toasty; + + +public class AccountsHorizontalListAdapter extends RecyclerView.Adapter implements OnPostActionInterface { + + private List accounts; + + private Context context; + private AccountsHorizontalListAdapter accountsListAdapter; + + public AccountsHorizontalListAdapter(List accounts) { + this.accounts = accounts; + this.accountsListAdapter = this; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + context = parent.getContext(); + LayoutInflater layoutInflater = LayoutInflater.from(context); + return new ViewHolder(layoutInflater.inflate(R.layout.drawer_horizontal_account, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { + final AccountsHorizontalListAdapter.ViewHolder holder = (AccountsHorizontalListAdapter.ViewHolder) viewHolder; + final Account account = accounts.get(position); + + if (account.getDisplay_name() != null && !account.getDisplay_name().trim().equals("")) + holder.account_dn.setText(account.getDisplay_name()); + else + holder.account_dn.setText(account.getUsername().replace("@", "")); + + //Profile picture + Helper.loadGiF(context, account, holder.account_pp, 270); + 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 + public long getItemId(int position) { + return position; + } + + @Override + public int getItemCount() { + return accounts.size(); + } + + private Account getItemAt(int position) { + if (accounts.size() > position) + return accounts.get(position); + else + return null; + } + + @Override + public void onPostAction(int statusCode, PeertubeAPI.StatusAction statusAction, String targetedId, Error error) { + if (error != null) { + Toasty.error(context, error.getError(), Toast.LENGTH_LONG).show(); + return; + } + + if (statusAction == PeertubeAPI.StatusAction.FOLLOW) { + /* if (action == RetrieveAccountsAsyncTask.Type.CHANNELS) { + SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); + new InstancesDAO(context, db).insertInstance(accounts.get(0).getAcct().split("@")[1], accounts.get(0).getAcct().split("@")[0], "PEERTUBE_CHANNEL"); + } else { + for (Account account : accounts) { + if (account.getId().equals(targetedId)) { + account.setFollowType(Account.followAction.FOLLOW); + account.setMakingAction(false); + } + } + accountsListAdapter.notifyDataSetChanged(); + }*/ + } + if (statusAction == PeertubeAPI.StatusAction.UNFOLLOW) { + for (Account account : accounts) { + if (account.getId().equals(targetedId)) { + account.setFollowType(Account.followAction.NOT_FOLLOW); + account.setMakingAction(false); + } + } + accountsListAdapter.notifyDataSetChanged(); + } + } + + private void notifyAccountChanged(Account account) { + for (int i = 0; i < accountsListAdapter.getItemCount(); i++) { + //noinspection ConstantConditions + if (accountsListAdapter.getItemAt(i) != null && accountsListAdapter.getItemAt(i).getId().equals(account.getId())) { + try { + accountsListAdapter.notifyItemChanged(i); + } catch (Exception ignored) { + } + } + } + } + + + private static class ViewHolder extends RecyclerView.ViewHolder { + ImageView account_pp; + TextView account_dn; + + ViewHolder(View itemView) { + super(itemView); + account_pp = itemView.findViewById(R.id.account_pp); + account_dn = itemView.findViewById(R.id.account_dn); + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayAccountsFragment.java b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayAccountsFragment.java index 5054994..1d4a2b5 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayAccountsFragment.java +++ b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayAccountsFragment.java @@ -46,7 +46,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou private boolean flag_loading; private Context context; - private AsyncTask asyncTask; + private AsyncTask asyncTask; private AccountsListAdapter accountsListAdapter; private String max_id; private List accounts; diff --git a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java index 25587bb..876912a 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java +++ b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayStatusFragment.java @@ -42,22 +42,27 @@ import java.util.ArrayList; import java.util.List; import app.fedilab.fedilabtube.R; +import app.fedilab.fedilabtube.asynctasks.RetrieveAccountSubscriptionsAsyncTask; import app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask; import app.fedilab.fedilabtube.asynctasks.RetrievePeertubeSearchAsyncTask; 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.Peertube; +import app.fedilab.fedilabtube.drawer.AccountsHorizontalListAdapter; import app.fedilab.fedilabtube.drawer.PeertubeAdapter; import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.interfaces.OnPostActionInterface; +import app.fedilab.fedilabtube.interfaces.OnRetrieveAccountsInterface; import app.fedilab.fedilabtube.interfaces.OnRetrieveFeedsInterface; import es.dmoral.toasty.Toasty; import static app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type.POVERVIEW; +import static app.fedilab.fedilabtube.asynctasks.RetrieveFeedsAsyncTask.Type.PSUBSCRIPTIONS; -public class DisplayStatusFragment extends Fragment implements OnPostActionInterface, OnRetrieveFeedsInterface { +public class DisplayStatusFragment extends Fragment implements OnPostActionInterface, OnRetrieveFeedsInterface, OnRetrieveAccountsInterface { private LinearLayoutManager mLayoutManager; @@ -66,8 +71,10 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter private Context context; private AsyncTask asyncTask; private PeertubeAdapter peertubeAdapater; - private String max_id; + private AccountsHorizontalListAdapter accountsHorizontalListAdapter; + private String max_id, max_id_accounts; private List peertubes; + private List accounts; private RetrieveFeedsAsyncTask.Type type; private RelativeLayout mainLoader, nextElementLoader, textviewNoAction; private boolean firstLoad; @@ -78,7 +85,9 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter private boolean ischannel; private View rootView; private RecyclerView lv_status; + private RecyclerView lv_accounts; private String targetedId; + private boolean check_ScrollingUp; public DisplayStatusFragment() { } @@ -90,6 +99,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter peertubes = new ArrayList<>(); + accounts = new ArrayList<>(); context = getContext(); Bundle bundle = this.getArguments(); @@ -111,10 +121,13 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter lv_status = rootView.findViewById(R.id.lv_status); + lv_accounts = rootView.findViewById(R.id.lv_accounts); max_id = null; + max_id_accounts = null; flag_loading = true; firstLoad = true; + check_ScrollingUp = false; assert context != null; sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); @@ -130,6 +143,12 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter peertubeAdapater = new PeertubeAdapter(this.peertubes); lv_status.setAdapter(peertubeAdapater); + accountsHorizontalListAdapter = new AccountsHorizontalListAdapter(this.accounts); + LinearLayoutManager layoutManager + = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); + lv_accounts.setLayoutManager(layoutManager); + lv_accounts.setAdapter(accountsHorizontalListAdapter); + if (!Helper.isTablet(context)) { mLayoutManager = new LinearLayoutManager(context); lv_status.setLayoutManager(mLayoutManager); @@ -162,9 +181,39 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter }, 500); } + lv_accounts.addOnScrollListener(new RecyclerView.OnScrollListener() { + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); + if (dy > 0) { + int visibleItemCount = mLayoutManager.getChildCount(); + int totalItemCount = mLayoutManager.getItemCount(); + if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) { + new RetrieveAccountSubscriptionsAsyncTask(context, max_id_accounts, DisplayStatusFragment.this).execute(); + } + } + } + }); + + if (type != POVERVIEW) { lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (type == PSUBSCRIPTIONS) { + if (dy > 0) { + if (check_ScrollingUp) { + lv_accounts.setVisibility(View.GONE); + final Handler handler = new Handler(); + handler.postDelayed(() -> check_ScrollingUp = false, 300); + + } + } else { + if (!check_ScrollingUp) { + lv_accounts.setVisibility(View.VISIBLE); + final Handler handler = new Handler(); + handler.postDelayed(() -> check_ScrollingUp = true, 300); + } + } + } if (mLayoutManager != null) { int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); if (dy > 0) { @@ -207,7 +256,9 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter } }); } - + if (type == PSUBSCRIPTIONS) { + new RetrieveAccountSubscriptionsAsyncTask(context, max_id, DisplayStatusFragment.this).execute(); + } return rootView; } @@ -254,6 +305,24 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter asyncTask.cancel(true); } + @Override + public void onRetrieveAccounts(APIResponse apiResponse) { + + if (apiResponse != null && apiResponse.getAccounts() != null && apiResponse.getAccounts().size() > 0) { + if (lv_accounts.getVisibility() == View.GONE) { + lv_accounts.setVisibility(View.VISIBLE); + } + int previousPosition = accounts.size(); + accounts.addAll(apiResponse.getAccounts()); + accountsHorizontalListAdapter.notifyItemRangeInserted(previousPosition, apiResponse.getAccounts().size()); + if (max_id_accounts == null) + max_id_accounts = "0"; + //max_id needs to work like an offset + int tootPerPage = sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE); + max_id_accounts = String.valueOf(Integer.parseInt(max_id_accounts) + tootPerPage); + } + } + @Override public void onRetrieveFeeds(APIResponse apiResponse) { //hide loaders diff --git a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java index 027f32b..8ebf56f 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java +++ b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java @@ -407,14 +407,12 @@ public class Helper { } - public static void loadGiF(final Context context, Account account, final ImageView imageView) { - - + public static void loadGiF(final Context context, Account account, final ImageView imageView, int round) { if (account == null || account.getAvatar() == null || account.getAvatar().compareTo("null") == 0) { Glide.with(imageView.getContext()) .asDrawable() .load(R.drawable.missing_peertube) - .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))) + .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(round))) .into(imageView); return; } @@ -429,14 +427,14 @@ public class Helper { Glide.with(imageView.getContext()) .load(url) .thumbnail(0.1f) - .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))) + .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(round))) .into(imageView); } catch (Exception e) { try { Glide.with(imageView.getContext()) .asDrawable() .load(R.drawable.missing_peertube) - .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))) + .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(round))) .into(imageView); } catch (Exception ignored) { @@ -444,6 +442,10 @@ public class Helper { } } + public static void loadGiF(final Context context, Account account, final ImageView imageView) { + loadGiF(context, account, imageView, 10); + } + public static void loadGiF(final Context context, String url, final ImageView imageView) { diff --git a/app/src/main/java/app/fedilab/fedilabtube/sqlite/AccountDAO.java b/app/src/main/java/app/fedilab/fedilabtube/sqlite/AccountDAO.java index 4d6fc59..8ddfbed 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/sqlite/AccountDAO.java +++ b/app/src/main/java/app/fedilab/fedilabtube/sqlite/AccountDAO.java @@ -68,11 +68,11 @@ public class AccountDAO { values.put(Sqlite.COL_HEADER_STATIC, account.getHeader_static()); values.put(Sqlite.COL_CREATED_AT, Helper.dateToString(account.getCreated_at())); values.put(Sqlite.COL_INSTANCE, account.getInstance()); - if (account.getClient_id() != null && account.getClient_secret() != null ) { + if (account.getClient_id() != null && account.getClient_secret() != null) { values.put(Sqlite.COL_CLIENT_ID, account.getClient_id()); values.put(Sqlite.COL_CLIENT_SECRET, account.getClient_secret()); } - if( account.getRefresh_token() != null) { + if (account.getRefresh_token() != null) { values.put(Sqlite.COL_REFRESH_TOKEN, account.getRefresh_token()); } if (account.getToken() != null) @@ -120,7 +120,7 @@ public class AccountDAO { values.put(Sqlite.COL_CLIENT_ID, account.getClient_id()); values.put(Sqlite.COL_CLIENT_SECRET, account.getClient_secret()); } - if( account.getRefresh_token() != null) { + if (account.getRefresh_token() != null) { values.put(Sqlite.COL_REFRESH_TOKEN, account.getRefresh_token()); } if (account.getToken() != null) @@ -161,7 +161,7 @@ public class AccountDAO { values.put(Sqlite.COL_CLIENT_ID, account.getClient_id()); values.put(Sqlite.COL_CLIENT_SECRET, account.getClient_secret()); } - if( account.getRefresh_token() != null) { + if (account.getRefresh_token() != null) { values.put(Sqlite.COL_REFRESH_TOKEN, account.getRefresh_token()); } if (account.getToken() != null) diff --git a/app/src/main/res/drawable/ic_baseline_report_24.xml b/app/src/main/res/drawable/ic_baseline_report_24.xml index 811e67b..57f69c9 100644 --- a/app/src/main/res/drawable/ic_baseline_report_24.xml +++ b/app/src/main/res/drawable/ic_baseline_report_24.xml @@ -1,10 +1,10 @@ - + android:viewportHeight="24"> + diff --git a/app/src/main/res/drawable/ic_subscription.xml b/app/src/main/res/drawable/ic_subscription.xml index 08a1047..50f5078 100644 --- a/app/src/main/res/drawable/ic_subscription.xml +++ b/app/src/main/res/drawable/ic_subscription.xml @@ -4,50 +4,58 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_peertube.xml b/app/src/main/res/layout/activity_peertube.xml index f8cb4bf..74f064f 100644 --- a/app/src/main/res/layout/activity_peertube.xml +++ b/app/src/main/res/layout/activity_peertube.xml @@ -77,9 +77,9 @@ + android:visibility="gone"> + android:visibility="gone" /> diff --git a/app/src/main/res/layout/activity_show_account.xml b/app/src/main/res/layout/activity_show_account.xml index 9039bf0..dd0e764 100644 --- a/app/src/main/res/layout/activity_show_account.xml +++ b/app/src/main/res/layout/activity_show_account.xml @@ -67,9 +67,8 @@ android:scaleType="centerCrop" android:src="@drawable/default_banner" app:layout_collapseMode="parallax" - app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - /> + app:layout_constraintTop_toTopOf="parent" /> @@ -152,8 +151,6 @@ - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/drawer_peertube.xml b/app/src/main/res/layout/drawer_peertube.xml index 67c195f..f6816a0 100644 --- a/app/src/main/res/layout/drawer_peertube.xml +++ b/app/src/main/res/layout/drawer_peertube.xml @@ -19,8 +19,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:divider="?android:dividerHorizontal" - android:orientation="vertical" android:gravity="bottom" + android:orientation="vertical" android:showDividers="end"> . --> - + android:fillViewport="true"> - + android:layout_height="match_parent" + android:animateLayoutChanges="true" + tools:context=".MainActivity"> + + + android:layout_height="0dp" + android:layout_alignTop="@+id/lv_accounts" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@+id/lv_accounts"> @@ -45,7 +58,8 @@ android:id="@+id/no_action" android:layout_width="match_parent" android:layout_height="wrap_content" - android:visibility="gone"> + android:visibility="gone" + app:layout_constraintTop_toTopOf="parent"> + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent"> - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/popup_report.xml b/app/src/main/res/layout/popup_report.xml index c265cd0..f48d9ae 100644 --- a/app/src/main/res/layout/popup_report.xml +++ b/app/src/main/res/layout/popup_report.xml @@ -1,19 +1,20 @@ + android:padding="@dimen/popup_padding"> + + app:layout_constraintTop_toTopOf="parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/popup_report_choice.xml b/app/src/main/res/layout/popup_report_choice.xml index a520a9a..54922cc 100644 --- a/app/src/main/res/layout/popup_report_choice.xml +++ b/app/src/main/res/layout/popup_report_choice.xml @@ -1,24 +1,25 @@ + android:padding="@dimen/popup_padding"> +