remove unused classes

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-02-28 13:23:10 +01:00
parent 76270077a1
commit 92a2c44415
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
3 changed files with 0 additions and 375 deletions

View File

@ -1,121 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.adapters.items;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import com.nextcloud.talk.R;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.databinding.RvItemAppBinding;
import java.util.List;
import androidx.annotation.Nullable;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.flexibleadapter.items.IFlexible;
import eu.davidea.viewholders.FlexibleViewHolder;
public class AppItem extends AbstractFlexibleItem<AppItem.AppItemViewHolder> {
private final String title;
private final String packageName;
private final String name;
@Nullable
private final Drawable drawable;
public AppItem(String title, String packageName, String name, @Nullable Drawable drawable) {
this.title = title;
this.packageName = packageName;
this.name = name;
this.drawable = drawable;
}
@Override
public boolean equals(Object o) {
if (o instanceof AppItem) {
AppItem inItem = (AppItem) o;
return title.equals(inItem.getTitle()) && packageName.equals(inItem.getPackageName()) && name.equals(inItem
.getName());
}
return false;
}
public String getTitle() {
return title;
}
public String getPackageName() {
return packageName;
}
public String getName() {
return name;
}
@Override
public int getLayoutRes() {
return R.layout.rv_item_app;
}
@Override
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, AppItemViewHolder holder, int position, List<Object> payloads) {
if (drawable != null) {
holder.binding.iconImageView.setVisibility(View.VISIBLE);
holder.binding.iconImageView.setImageDrawable(drawable);
} else {
holder.binding.iconImageView.setVisibility(View.GONE);
}
if (position == 0) {
Spannable spannableString = new SpannableString(title);
spannableString.setSpan(new ForegroundColorSpan(NextcloudTalkApplication.Companion.getSharedApplication()
.getResources().getColor(R.color.grey_600)), 0,
spannableString.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
holder.binding.appTitleTextView.setText(spannableString);
} else {
holder.binding.appTitleTextView.setText(title);
}
}
@Override
public AppItem.AppItemViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
return new AppItemViewHolder(view, adapter);
}
static class AppItemViewHolder extends FlexibleViewHolder {
RvItemAppBinding binding;
/**
* Default constructor.
*/
AppItemViewHolder(View view, FlexibleAdapter adapter) {
super(view, adapter);
binding = RvItemAppBinding.bind(view);
}
}
}

View File

@ -1,116 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
* Copyright (C) 2018 Andy Scherzinger <info@andy-scherzinger.de>
*
* 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.adapters.items;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import com.nextcloud.talk.R;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.databinding.RvItemMenuBinding;
import com.nextcloud.talk.utils.DisplayUtils;
import java.util.List;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.viewholders.FlexibleViewHolder;
public class MenuItem extends AbstractFlexibleItem<MenuItem.MenuItemViewHolder> {
private final String title;
private final Drawable icon;
private final int tag;
private final int padding;
public MenuItem(String title, int tag, Drawable icon) {
this.title = title;
this.tag = tag;
this.icon = icon;
padding = (int) DisplayUtils.convertDpToPixel(32,
NextcloudTalkApplication
.Companion
.getSharedApplication()
.getApplicationContext());
}
@Override
public boolean equals(Object o) {
if (o instanceof MenuItem) {
MenuItem inItem = (MenuItem) o;
return tag == inItem.tag;
}
return false;
}
public int getTag() {
return tag;
}
@Override
public int getLayoutRes() {
return R.layout.rv_item_menu;
}
@Override
public MenuItem.MenuItemViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
return new MenuItemViewHolder(view, adapter);
}
@Override
public void bindViewHolder(FlexibleAdapter adapter, MenuItem.MenuItemViewHolder holder, int position, List payloads) {
if (position == 0) {
Spannable spannableString = new SpannableString(title);
spannableString.setSpan(
new ForegroundColorSpan(
NextcloudTalkApplication
.Companion
.getSharedApplication()
.getResources()
.getColor(R.color.grey_600)),
0,
spannableString.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
holder.binding.menuText.setText(spannableString);
} else {
holder.binding.menuText.setText(title);
holder.binding.menuText.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
holder.binding.menuText.setCompoundDrawablePadding(padding);
}
}
static class MenuItemViewHolder extends FlexibleViewHolder {
RvItemMenuBinding binding;
/**
* Default constructor.
*/
MenuItemViewHolder(View view, FlexibleAdapter adapter) {
super(view, adapter);
binding = RvItemMenuBinding.bind(view);
}
}
}

View File

@ -1,138 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
*
* 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* Heavily copied from and influenced by
* https://github.com/davideas/FlexibleAdapter/wiki/5.x-%7C-On-Load-More#automatic-load-more.
* Author: David Steduto under Apache2 licence
*/
package com.nextcloud.talk.adapters.items;
import android.animation.Animator;
import android.content.Context;
import android.view.View;
import com.nextcloud.talk.R;
import com.nextcloud.talk.databinding.RvItemProgressBinding;
import java.util.List;
import androidx.annotation.NonNull;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.Payload;
import eu.davidea.flexibleadapter.helpers.AnimatorHelper;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.flexibleadapter.items.IFlexible;
import eu.davidea.viewholders.FlexibleViewHolder;
/**
* @author Davide Steduto
* @since 22/04/2016
*/
public class ProgressItem extends AbstractFlexibleItem<ProgressItem.ProgressViewHolder> {
private StatusEnum status = StatusEnum.MORE_TO_LOAD;
@Override
public boolean equals(Object o) {
return this == o;//The default implementation
}
public StatusEnum getStatus() {
return status;
}
public void setStatus(StatusEnum status) {
this.status = status;
}
@Override
public int getLayoutRes() {
return R.layout.rv_item_progress;
}
@Override
public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, ProgressViewHolder holder, int position, List<Object> payloads) {
Context context = holder.itemView.getContext();
holder.binding.progressBar.setVisibility(View.GONE);
holder.binding.progressMessage.setVisibility(View.VISIBLE);
if (!adapter.isEndlessScrollEnabled()) {
setStatus(StatusEnum.DISABLE_ENDLESS);
} else if (payloads.contains(Payload.NO_MORE_LOAD)) {
setStatus(StatusEnum.NO_MORE_LOAD);
}
switch (this.status) {
case NO_MORE_LOAD:
holder.binding.progressMessage.setText(
context.getString(R.string.nc_no_more_load_retry));
// Reset to default status for next binding
setStatus(StatusEnum.MORE_TO_LOAD);
break;
case DISABLE_ENDLESS:
holder.binding.progressMessage.setText(context.getString(R.string.nc_endless_disabled));
break;
case ON_CANCEL:
holder.binding.progressMessage.setText(context.getString(R.string.nc_endless_cancel));
// Reset to default status for next binding
setStatus(StatusEnum.MORE_TO_LOAD);
break;
case ON_ERROR:
holder.binding.progressMessage.setText(context.getString(R.string.nc_endless_error));
// Reset to default status for next binding
setStatus(StatusEnum.MORE_TO_LOAD);
break;
default:
holder.binding.progressBar.setVisibility(View.VISIBLE);
holder.binding.progressMessage.setVisibility(View.GONE);
break;
}
}
@Override
public ProgressViewHolder createViewHolder(View view, FlexibleAdapter adapter) {
return new ProgressViewHolder(view, adapter);
}
public enum StatusEnum {
MORE_TO_LOAD, //Default = should have an empty Payload
DISABLE_ENDLESS, //Endless is disabled because user has set limits
NO_MORE_LOAD, //Non-empty Payload = Payload.NO_MORE_LOAD
ON_CANCEL,
ON_ERROR
}
static class ProgressViewHolder extends FlexibleViewHolder {
RvItemProgressBinding binding;
ProgressViewHolder(View view, FlexibleAdapter adapter) {
super(view, adapter);
binding = RvItemProgressBinding.bind(view);
}
@Override
public void scrollAnimators(@NonNull List<Animator> animators, int position, boolean isForward) {
AnimatorHelper.scaleAnimator(animators, itemView, 0f);
}
}
}