remove spinner lib

This commit is contained in:
Thomas 2023-01-25 18:02:35 +01:00
parent bf8543bc77
commit fc34de1da4
11 changed files with 79 additions and 131 deletions

View file

@ -174,7 +174,6 @@ dependencies {
implementation "net.gotev:uploadservice:4.5.1"
implementation "net.gotev:uploadservice-okhttp:4.5.1"
implementation 'androidx.media:media:1.6.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.0'

View file

@ -37,13 +37,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.github.ybq.android.spinkit.SpinKitView
<ProgressBar
android:id="@+id/cast_loader_small"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_gravity="center"
android:layout_marginStart="5dp"
app:SpinKit_Color="?colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cast_loader_text"

View file

@ -18,11 +18,7 @@ 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.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@ -31,11 +27,10 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerAccountPeertubeBinding;
import app.fedilab.android.peertube.activities.ShowAccountActivity;
import app.fedilab.android.peertube.client.APIResponse;
import app.fedilab.android.peertube.client.RetrofitPeertubeAPI;
@ -63,37 +58,37 @@ public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
@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_account, parent, false));
DrawerAccountPeertubeBinding itemBinding = DrawerAccountPeertubeBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new AccountViewHolder(itemBinding);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
final ViewHolder holder = (ViewHolder) viewHolder;
final AccountViewHolder holder = (AccountViewHolder) viewHolder;
final AccountData.PeertubeAccount account = accounts.get(position);
if (type == RetrofitPeertubeAPI.DataType.MUTED) {
holder.account_action.setOnClickListener(v -> {
holder.binding.accountAction.setOnClickListener(v -> {
PostActionsVM viewModel = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
viewModel.post(RetrofitPeertubeAPI.ActionType.UNMUTE, account.getAcct(), null).observe((LifecycleOwner) context, apiResponse -> manageVIewPostActions(RetrofitPeertubeAPI.ActionType.UNMUTE, apiResponse, account.getAcct()));
});
} else {
holder.account_action.hide();
holder.binding.accountAction.hide();
}
holder.account_dn.setText(account.getDisplayName());
holder.account_ac.setText(String.format("@%s", account.getAcct()));
holder.binding.accountDn.setText(account.getDisplayName());
holder.binding.accountAc.setText(String.format("@%s", account.getAcct()));
if (account.getDescription() == null) {
account.setDescription("");
}
//Profile picture
Helper.loadAvatar(context, account, holder.account_pp);
Helper.loadAvatar(context, account, holder.binding.accountPp);
//Follow button
if (type == RetrofitPeertubeAPI.DataType.MUTED) {
holder.account_action.show();
holder.account_action.setImageResource(R.drawable.ic_baseline_volume_mute_24);
holder.binding.accountAction.show();
holder.binding.accountAction.setImageResource(R.drawable.ic_baseline_volume_mute_24);
}
holder.account_pp.setOnClickListener(v -> {
holder.binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(context, ShowAccountActivity.class);
Bundle b = new Bundle();
b.putSerializable("account", account);
@ -142,21 +137,12 @@ public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
}
private static class ViewHolder extends RecyclerView.ViewHolder {
ImageView account_pp;
TextView account_ac;
TextView account_dn;
FloatingActionButton account_action;
LinearLayout account_container;
public static class AccountViewHolder extends RecyclerView.ViewHolder {
DrawerAccountPeertubeBinding binding;
ViewHolder(View itemView) {
super(itemView);
account_pp = itemView.findViewById(R.id.account_pp);
account_dn = itemView.findViewById(R.id.account_dn);
account_ac = itemView.findViewById(R.id.account_ac);
account_action = itemView.findViewById(R.id.account_action);
account_container = itemView.findViewById(R.id.account_container);
AccountViewHolder(DrawerAccountPeertubeBinding itemView) {
super(itemView.getRoot());
binding = itemView;
}
}
}

View file

@ -22,15 +22,9 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.PopupMenu;
@ -42,6 +36,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerChannelPeertubeBinding;
import app.fedilab.android.peertube.activities.AccountActivity;
import app.fedilab.android.peertube.activities.ShowChannelActivity;
import app.fedilab.android.peertube.client.RetrofitPeertubeAPI;
@ -65,28 +60,28 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
@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_channel_peertube, parent, false));
DrawerChannelPeertubeBinding itemBinding = DrawerChannelPeertubeBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new ChannelViewHolder(itemBinding);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
final ViewHolder holder = (ViewHolder) viewHolder;
ChannelViewHolder holder = (ChannelViewHolder) viewHolder;
final Channel channel = channels.get(position);
holder.account_dn.setText(channel.getDisplayName());
holder.account_ac.setText(String.format("@%s", channel.getAcct()));
holder.binding.accountDn.setText(channel.getDisplayName());
holder.binding.accountAc.setText(String.format("@%s", channel.getAcct()));
if (channel.getDescription() == null) {
channel.setDescription("");
}
//Profile picture
Helper.loadAvatar(context, channel, holder.account_pp);
Helper.loadAvatar(context, channel, holder.binding.accountPp);
if (!isMyChannel(channel)) {
holder.more_actions.setVisibility(View.GONE);
holder.binding.moreActions.setVisibility(View.GONE);
}
holder.more_actions.setOnClickListener(view -> {
PopupMenu popup = new PopupMenu(context, holder.more_actions);
holder.binding.moreActions.setOnClickListener(view -> {
PopupMenu popup = new PopupMenu(context, holder.binding.moreActions);
popup.getMenuInflater()
.inflate(R.menu.playlist_menu_peertube, popup.getMenu());
if (channels.size() == 1) {
@ -100,18 +95,12 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
builder.setMessage(context.getString(R.string.action_channel_confirm_delete));
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.yes, (dialog, which) -> {
new Thread(() -> {
new RetrofitPeertubeAPI(context).post(RetrofitPeertubeAPI.ActionType.DELETE_CHANNEL, channel.getName(), null);
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
new Thread(() -> new RetrofitPeertubeAPI(context).post(RetrofitPeertubeAPI.ActionType.DELETE_CHANNEL, channel.getName(), null)).start();
channels.remove(channel);
notifyDataSetChanged();
notifyItemRemoved(position);
if (channels.size() == 0) {
allChannelRemoved.onAllChannelRemoved();
}
};
mainHandler.post(myRunnable);
}).start();
dialog.dismiss();
})
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
@ -126,7 +115,7 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
popup.show();
});
holder.account_pp.setOnClickListener(v -> {
holder.binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(context, ShowChannelActivity.class);
Bundle b = new Bundle();
b.putSerializable("channel", channel);
@ -174,20 +163,12 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
void show(Channel channel);
}
private static class ViewHolder extends RecyclerView.ViewHolder {
ImageView account_pp;
TextView account_ac;
TextView account_dn;
ImageButton more_actions;
LinearLayout account_container;
public static class ChannelViewHolder extends RecyclerView.ViewHolder {
DrawerChannelPeertubeBinding binding;
ViewHolder(View itemView) {
super(itemView);
account_pp = itemView.findViewById(R.id.account_pp);
account_dn = itemView.findViewById(R.id.account_dn);
account_ac = itemView.findViewById(R.id.account_ac);
more_actions = itemView.findViewById(R.id.more_actions);
account_container = itemView.findViewById(R.id.account_container);
ChannelViewHolder(DrawerChannelPeertubeBinding itemView) {
super(itemView.getRoot());
binding = itemView;
}
}

View file

@ -61,12 +61,10 @@
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone">
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
android:layout_gravity="center" />
</RelativeLayout>
<!-- Loader for next items -->
<RelativeLayout
@ -78,11 +76,10 @@
android:gravity="bottom|center_horizontal"
android:visibility="gone">
<com.github.ybq.android.spinkit.SpinKitView xmlns:app="http://schemas.android.com/apk/res-auto"
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
android:layout_gravity="center" />
</RelativeLayout>
</RelativeLayout>

View file

@ -118,11 +118,10 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/filters_container">
<com.github.ybq.android.spinkit.SpinKitView
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
android:layout_gravity="center" />
</RelativeLayout>
<LinearLayout

View file

@ -56,11 +56,10 @@
android:gravity="center"
android:visibility="gone">
<com.github.ybq.android.spinkit.SpinKitView
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
android:layout_gravity="center" />
</RelativeLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton

View file

@ -96,8 +96,7 @@
android:gravity="center"
android:visibility="gone">
<com.github.ybq.android.spinkit.SpinKitView
style="@style/SpinKitView.DoubleBounce"
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />

View file

@ -32,9 +32,7 @@
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:colorBackground"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
@ -61,36 +59,33 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:mt_backIconTint="?attr/colorAccent"
app:mt_clearIconTint="?attr/colorAccent"
app:mt_hint="@string/sepia_search_hint"
app:mt_maxSuggestionsCount="10"
app:mt_menuIconTint="?attr/colorAccent"
app:mt_searchIconTint="?attr/colorAccent"
app:mt_speechMode="false" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/explanations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginTop="10dp"
android:text="@string/sepia_indication"
android:textColor="?attr/colorAccent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/searchBar" />
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/filter"
style="@style/Base.Widget.AppCompat.Button.Colored"
style="@style/Widget.Material3.Button.OutlinedButton.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/ic_baseline_arrow_drop_down_24"
android:text="@string/filter"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/explanations" />
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/sort_by"
@ -100,6 +95,7 @@
app:layout_constraintTop_toBottomOf="@+id/explanations" />
<Spinner
android:layout_marginTop="10dp"
android:id="@+id/sort_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -149,7 +145,7 @@
android:text="@string/no" />
</RadioGroup>
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/sepia_element_published_date_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -288,7 +284,7 @@
app:layout_constraintStart_toStartOf="@+id/sepia_element_license_label"
app:layout_constraintTop_toBottomOf="@+id/sepia_element_license_label" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/sepia_element_language_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -305,7 +301,7 @@
app:layout_constraintStart_toStartOf="@+id/sepia_element_language_label"
app:layout_constraintTop_toBottomOf="@+id/sepia_element_language_label" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/sepia_element_all_of_tags_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -325,7 +321,7 @@
TagsEditText:allowSpaceInTag="true"
TagsEditText:tagsCloseImagePadding="@dimen/defaultTagsCloseImagePadding"
TagsEditText:tagsCloseImageRight="@drawable/tag_close"
TagsEditText:tagsTextColor="?colorAccent"
TagsEditText:tagsTextColor="?colorSecondary"
TagsEditText:tagsTextSize="@dimen/defaultTagsTextSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -352,7 +348,7 @@
TagsEditText:allowSpaceInTag="true"
TagsEditText:tagsCloseImagePadding="@dimen/defaultTagsCloseImagePadding"
TagsEditText:tagsCloseImageRight="@drawable/tag_close"
TagsEditText:tagsTextColor="?colorAccent"
TagsEditText:tagsTextColor="?colorSecondary"
TagsEditText:tagsTextSize="@dimen/defaultTagsTextSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -25,14 +25,12 @@
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
android:fitsSystemWindows="true">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
@ -50,6 +48,7 @@
<ImageView
android:id="@+id/account_pp"
android:layout_width="80dp"
tools:src="@tools:sample/avatars"
android:layout_height="80dp"
android:layout_margin="10dp"
android:layout_marginTop="10dp"
@ -66,7 +65,6 @@
android:layout_marginStart="10dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@android:color/white"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/subscriber_count"
app:layout_constraintStart_toEndOf="@+id/account_pp"
@ -81,26 +79,26 @@
android:gravity="center_vertical"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@android:color/white"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@id/account_follow"
app:layout_constraintStart_toEndOf="@+id/account_pp"
app:layout_constraintTop_toBottomOf="@id/account_dn" />
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/account_follow"
style="@style/Widget.AppCompat.Button.Colored"
style="@style/Widget.Material3.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:contentDescription="@string/make_an_action"
android:scaleType="fitCenter"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/subscriber_count"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible"
app:layout_constraintTop_toBottomOf="@id/account_dn" />
<Button
style="@style/Widget.AppCompat.Button.Colored"
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
@ -108,13 +106,14 @@
android:scaleType="fitCenter"
android:src="@drawable/ic_baseline_edit_24"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/subscriber_count"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible"
app:layout_constraintTop_toBottomOf="@id/account_dn" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/top_banner"
@ -123,17 +122,16 @@
android:paddingTop="8dp"
app:layout_scrollFlags="scroll|enterAlways">
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/account_note"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:padding="10dp"
android:textColor="@android:color/white"
android:textIsSelectable="true"
android:visibility="gone" />
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</RelativeLayout>
@ -145,9 +143,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="?colorAccent"
app:tabTextColor="@android:color/white" />
app:tabMode="fixed" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
@ -164,7 +160,6 @@
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_baseline_add_24"
android:tint="@android:color/white"
android:visibility="gone" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -100,11 +100,10 @@
android:gravity="center"
android:visibility="gone">
<com.github.ybq.android.spinkit.SpinKitView
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
android:layout_gravity="center" />
</RelativeLayout>
<!-- Loader for next videos -->
<RelativeLayout
@ -117,11 +116,10 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent">
<com.github.ybq.android.spinkit.SpinKitView
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="?colorAccent" />
android:layout_gravity="center" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>