Clean code

This commit is contained in:
Thomas 2023-07-27 14:47:22 +02:00
parent 44752cc329
commit bf447d823e
27 changed files with 102 additions and 121 deletions

View file

@ -212,6 +212,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
public static String regex_home, regex_local, regex_public; public static String regex_home, regex_local, regex_public;
public static BaseAccount currentAccount; public static BaseAccount currentAccount;
public static iconLauncher mLauncher = iconLauncher.BUBBLES; public static iconLauncher mLauncher = iconLauncher.BUBBLES;
public static boolean headerMenuOpen;
Fragment currentFragment; Fragment currentFragment;
private AppBarConfiguration mAppBarConfiguration; private AppBarConfiguration mAppBarConfiguration;
private ActivityMainBinding binding; private ActivityMainBinding binding;
@ -330,7 +331,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
} }
}; };
private NetworkStateReceiver networkStateReceiver; private NetworkStateReceiver networkStateReceiver;
public static boolean headerMenuOpen;
public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) { public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
@ -644,8 +644,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
popup.show(); popup.show();
} }
protected abstract void rateThisApp();
/** /**
* Open notifications tab when coming from a notification device * Open notifications tab when coming from a notification device
* *
@ -1034,6 +1032,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
intent.setFlags(0); intent.setFlags(0);
} }
protected abstract void rateThisApp();
@Override @Override
protected void onNewIntent(Intent intent) { protected void onNewIntent(Intent intent) {
super.onNewIntent(intent); super.onNewIntent(intent);

View file

@ -404,12 +404,21 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
}).start(); }).start();
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
public enum range { public enum range {
ALL, ALL,
DAY DAY
} }
public static class GraphElement { public static class GraphElement {
String dateLabel; String dateLabel;
int count; int count;
@ -424,15 +433,6 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
} }
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
public class CustomMarkerView extends MarkerView { public class CustomMarkerView extends MarkerView {
private final TextView tvContent; private final TextView tvContent;

View file

@ -79,34 +79,34 @@ class InstanceHealthActivity : DialogFragment() {
} }
binding.name.text = instance.name binding.name.text = instance.name
if (instance.up) { if (instance.up) {
binding.up.setText(app.fedilab.android.R.string.is_up) binding.up.setText(R.string.is_up)
binding.up.setTextColor( binding.up.setTextColor(
ThemeHelper.getAttColor( ThemeHelper.getAttColor(
requireContext(), requireContext(),
app.fedilab.android.R.attr.colorPrimary R.attr.colorPrimary
) )
) )
} else { } else {
binding.up.setText(app.fedilab.android.R.string.is_down) binding.up.setText(R.string.is_down)
binding.up.setTextColor( binding.up.setTextColor(
ThemeHelper.getAttColor( ThemeHelper.getAttColor(
requireContext(), requireContext(),
app.fedilab.android.R.attr.colorError R.attr.colorError
) )
) )
} }
binding.uptime.text = getString( binding.uptime.text = getString(
app.fedilab.android.R.string.instance_health_uptime, R.string.instance_health_uptime,
instance.uptime * 100 instance.uptime * 100
) )
if (instance.checked_at != null) if (instance.checked_at != null)
binding.checkedAt.text = binding.checkedAt.text =
getString( getString(
app.fedilab.android.R.string.instance_health_checkedat, R.string.instance_health_checkedat,
Helper.dateToString(instance.checked_at) Helper.dateToString(instance.checked_at)
) )
binding.values.text = getString( binding.values.text = getString(
app.fedilab.android.R.string.instance_health_indication, R.string.instance_health_indication,
instance.version, instance.version,
Helper.withSuffix(instance.active_users.toLong()), Helper.withSuffix(instance.active_users.toLong()),
Helper.withSuffix(instance.statuses.toLong()) Helper.withSuffix(instance.statuses.toLong())

View file

@ -373,7 +373,8 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(MastodonListActivity.this).sendBroadcast(intentBD); LocalBroadcastManager.getInstance(MastodonListActivity.this).sendBroadcast(intentBD);
} catch (DBException e) { } catch (
DBException e) {
e.printStackTrace(); e.printStackTrace();
} }
}).start(); }).start();

View file

@ -67,10 +67,10 @@ import es.dmoral.toasty.Toasty;
public class SearchResultTabActivity extends BaseBarActivity { public class SearchResultTabActivity extends BaseBarActivity {
public Boolean tagEmpty, accountEmpty;
private String search; private String search;
private ActivitySearchResultTabsBinding binding; private ActivitySearchResultTabsBinding binding;
private TabLayout.Tab initial; private TabLayout.Tab initial;
public Boolean tagEmpty, accountEmpty;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

View file

@ -48,16 +48,6 @@ public class LemmyPost implements Serializable {
@SerializedName("unread_comments") @SerializedName("unread_comments")
public int unread_comments; public int unread_comments;
public static class LemmyPosts {
@SerializedName("posts")
public List<LemmyPost> posts;
}
public static class LemmyComments {
@SerializedName("comments")
public List<LemmyPost> comments;
}
public static Status convert(LemmyPost lemmyPost, String instance) { public static Status convert(LemmyPost lemmyPost, String instance) {
Status status = new Status(); Status status = new Status();
status.id = lemmyPost.comment == null ? lemmyPost.post.id : lemmyPost.comment.id; status.id = lemmyPost.comment == null ? lemmyPost.post.id : lemmyPost.comment.id;
@ -109,6 +99,16 @@ public class LemmyPost implements Serializable {
return status; return status;
} }
public static class LemmyPosts {
@SerializedName("posts")
public List<LemmyPost> posts;
}
public static class LemmyComments {
@SerializedName("comments")
public List<LemmyPost> comments;
}
public static class Post implements Serializable { public static class Post implements Serializable {
@SerializedName("id") @SerializedName("id")
public String id; public String id;

View file

@ -30,8 +30,8 @@ import app.fedilab.android.mastodon.client.entities.api.Status;
public class CustomEmoji extends ReplacementSpan { public class CustomEmoji extends ReplacementSpan {
private float scale;
private final WeakReference<View> viewWeakReference; private final WeakReference<View> viewWeakReference;
private float scale;
private Drawable imageDrawable; private Drawable imageDrawable;
private boolean callbackCalled; private boolean callbackCalled;

View file

@ -192,7 +192,9 @@ public class ECDHFedilab {
cipher.init(Cipher.DECRYPT_MODE, aesKey, gCMParameterSpec); cipher.init(Cipher.DECRYPT_MODE, aesKey, gCMParameterSpec);
byte[] decrypted = cipher.doFinal(ciphertext); byte[] decrypted = cipher.doFinal(ciphertext);
decryptedStr = new String(decrypted, 2, decrypted.length - 2, StandardCharsets.UTF_8); decryptedStr = new String(decrypted, 2, decrypted.length - 2, StandardCharsets.UTF_8);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidAlgorithmParameterException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) { } catch (NoSuchAlgorithmException | NoSuchPaddingException |
InvalidAlgorithmParameterException | InvalidKeyException | BadPaddingException |
IllegalBlockSizeException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }

View file

@ -467,7 +467,6 @@ public class Helper {
} }
/*** /***
* Check if the user is connected to Internet * Check if the user is connected to Internet
* @return boolean * @return boolean

View file

@ -133,8 +133,8 @@ import es.dmoral.toasty.Toasty;
public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int searchDeep = 15;
public static final int TYPE_COMPOSE = 1; public static final int TYPE_COMPOSE = 1;
private static final int searchDeep = 15;
public static boolean autocomplete = false; public static boolean autocomplete = false;
public static String[] ALPHA = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", public static String[] ALPHA = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r",
"s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "!", ",", "?", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "!", ",", "?",
@ -985,7 +985,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
contentBuilder.append(subject); contentBuilder.append(subject);
} }
if(contentBuilder.length() > 0) { if (contentBuilder.length() > 0) {
contentBuilder.append("\n\n"); contentBuilder.append("\n\n");
} }

View file

@ -190,10 +190,10 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
private final List<Status> statusList; private final List<Status> statusList;
private final boolean minified; private final boolean minified;
private final Timeline.TimeLineEnum timelineType; private final Timeline.TimeLineEnum timelineType;
public RemoteInstance.InstanceType type;
public PinnedTimeline pinnedTimeline;
private final boolean canBeFederated; private final boolean canBeFederated;
private final boolean checkRemotely; private final boolean checkRemotely;
public RemoteInstance.InstanceType type;
public PinnedTimeline pinnedTimeline;
public FetchMoreCallBack fetchMoreCallBack; public FetchMoreCallBack fetchMoreCallBack;
private Context context; private Context context;
private boolean visiblePixelfed; private boolean visiblePixelfed;

View file

@ -87,22 +87,15 @@ import app.fedilab.android.mastodon.viewmodel.mastodon.StatusesVM;
public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static float measuredWidth = -1;
private final List<Status> statusList; private final List<Status> statusList;
private Context context; private Context context;
private RecyclerView mRecyclerView; private RecyclerView mRecyclerView;
private static float measuredWidth = -1;
public StatusDirectMessageAdapter(List<Status> data) { public StatusDirectMessageAdapter(List<Status> data) {
this.statusList = data; this.statusList = data;
} }
@NotNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
context = parent.getContext();
DrawerStatusChatBinding itemBinding = DrawerStatusChatBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new StatusChatViewHolder(itemBinding);
}
public static void loadAndAddAttachment(Context context, LayoutMediaBinding layoutMediaBinding, public static void loadAndAddAttachment(Context context, LayoutMediaBinding layoutMediaBinding,
StatusChatViewHolder holder, StatusChatViewHolder holder,
RecyclerView.Adapter<RecyclerView.ViewHolder> adapter, RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
@ -214,6 +207,14 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
} }
@NotNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
context = parent.getContext();
DrawerStatusChatBinding itemBinding = DrawerStatusChatBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new StatusChatViewHolder(itemBinding);
}
@Override @Override
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) { public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView); super.onAttachedToRecyclerView(recyclerView);
@ -227,15 +228,6 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
return statusList.size(); return statusList.size();
} }
public static class StatusChatViewHolder extends RecyclerView.ViewHolder {
DrawerStatusChatBinding binding;
StatusChatViewHolder(DrawerStatusChatBinding itemView) {
super(itemView.getRoot());
binding = itemView;
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
@ -675,4 +667,13 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
holder.binding.media.mediaContainer.setVisibility(View.GONE); holder.binding.media.mediaContainer.setVisibility(View.GONE);
} }
} }
public static class StatusChatViewHolder extends RecyclerView.ViewHolder {
DrawerStatusChatBinding binding;
StatusChatViewHolder(DrawerStatusChatBinding itemView) {
super(itemView.getRoot());
binding = itemView;
}
}
} }

View file

@ -43,6 +43,7 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements
boolean prefChanged = false; boolean prefChanged = false;
@Override @Override
public void onCreatePreferences(Bundle bundle, String s) { public void onCreatePreferences(Bundle bundle, String s) {
createPref(); createPref();

View file

@ -108,7 +108,7 @@ public class FragmentMastodonDirectMessage extends Fragment {
private Status firstStatus; private Status firstStatus;
private boolean pullToRefresh; private boolean pullToRefresh;
private String user_token, user_instance; private String user_token, user_instance;
private Status statusCompose;
private final BroadcastReceiver broadcast_data = new BroadcastReceiver() { private final BroadcastReceiver broadcast_data = new BroadcastReceiver() {
@Override @Override
public void onReceive(android.content.Context context, Intent intent) { public void onReceive(android.content.Context context, Intent intent) {
@ -126,7 +126,6 @@ public class FragmentMastodonDirectMessage extends Fragment {
} }
} }
}; };
private Status statusCompose;
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {

View file

@ -65,6 +65,9 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
private boolean flagLoading; private boolean flagLoading;
private List<Notification> notificationList; private List<Notification> notificationList;
private NotificationAdapter notificationAdapter; private NotificationAdapter notificationAdapter;
private boolean isViewInitialized;
private Notifications initialNotifications;
private String max_id, min_id, min_id_fetch_more, max_id_fetch_more;
private final BroadcastReceiver receive_action = new BroadcastReceiver() { private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
@ -108,9 +111,6 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
} }
} }
}; };
private boolean isViewInitialized;
private Notifications initialNotifications;
private String max_id, min_id, min_id_fetch_more, max_id_fetch_more;
private LinearLayoutManager mLayoutManager; private LinearLayoutManager mLayoutManager;
private NotificationTypeEnum notificationType; private NotificationTypeEnum notificationType;
private boolean aggregateNotification; private boolean aggregateNotification;

View file

@ -73,9 +73,9 @@ import es.dmoral.toasty.Toasty;
public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.FetchMoreCallBack { public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.FetchMoreCallBack {
private boolean scrollingUp;
private static final int PRELOAD_AHEAD_ITEMS = 10; private static final int PRELOAD_AHEAD_ITEMS = 10;
public UpdateCounters update; public UpdateCounters update;
private boolean scrollingUp;
private FragmentPaginationBinding binding; private FragmentPaginationBinding binding;
private TimelinesVM timelinesVM; private TimelinesVM timelinesVM;
private AccountsVM accountsVM; private AccountsVM accountsVM;
@ -87,10 +87,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
private StatusAdapter statusAdapter; private StatusAdapter statusAdapter;
private Timeline.TimeLineEnum timelineType; private Timeline.TimeLineEnum timelineType;
private List<Status> timelineStatuses; private List<Status> timelineStatuses;
private boolean retry_for_home_done;
private String lemmy_post_id;
//Handle actions that can be done in other fragments //Handle actions that can be done in other fragments
private final BroadcastReceiver receive_action = new BroadcastReceiver() { private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override @Override
@ -180,6 +176,8 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
} }
}; };
private boolean retry_for_home_done;
private String lemmy_post_id;
private boolean checkRemotely; private boolean checkRemotely;
private String accountIDInRemoteInstance; private String accountIDInRemoteInstance;
private boolean isViewInitialized; private boolean isViewInitialized;

View file

@ -91,8 +91,6 @@ public class FragmentNotificationContainer extends Fragment {
dialogBuilder.setView(dialogView.getRoot()); dialogBuilder.setView(dialogView.getRoot());
boolean displayAllCategory = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_ALL_NOTIFICATIONS_TYPE) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, false); boolean displayAllCategory = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_ALL_NOTIFICATIONS_TYPE) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, false);
dialogView.displayAllCategories.setChecked(displayAllCategory); dialogView.displayAllCategories.setChecked(displayAllCategory);
dialogView.displayAllCategories.setOnCheckedChangeListener((compoundButton, checked) -> { dialogView.displayAllCategories.setOnCheckedChangeListener((compoundButton, checked) -> {

View file

@ -205,6 +205,8 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
private boolean isShowingTrackSelectionDialog; private boolean isShowingTrackSelectionDialog;
private Status status; private Status status;
private int flags; private int flags;
private boolean humanInteraction;
public static void hideKeyboard(Activity activity) { public static void hideKeyboard(Activity activity) {
if (activity != null && activity.getWindow() != null) { if (activity != null && activity.getWindow() != null) {
activity.getWindow().getDecorView(); activity.getWindow().getDecorView();
@ -215,8 +217,6 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
} }
} }
private boolean humanInteraction;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -88,7 +88,6 @@ public class ShowAccountActivity extends BaseBarActivity {
} }
manageAccount(); manageAccount();
AccountsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(AccountsVM.class); AccountsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(AccountsVM.class);
viewModel.getAccount(accountAcct == null ? account.getUsername() + "@" + account.getHost() : accountAcct).observe(ShowAccountActivity.this, this::manageViewAccounts); viewModel.getAccount(accountAcct == null ? account.getUsername() + "@" + account.getHost() : accountAcct).observe(ShowAccountActivity.this, this::manageViewAccounts);

View file

@ -20,6 +20,8 @@ import com.google.gson.annotations.SerializedName;
public class OauthParams { public class OauthParams {
@SerializedName("x_peertube_otp")
public String x_peertube_otp;
@SerializedName("client_id") @SerializedName("client_id")
private String client_id; private String client_id;
@SerializedName("client_secret") @SerializedName("client_secret")
@ -44,9 +46,6 @@ public class OauthParams {
private String code; private String code;
@SerializedName("redirect_uri") @SerializedName("redirect_uri")
private String redirect_uri; private String redirect_uri;
@SerializedName("x_peertube_otp")
public String x_peertube_otp;
public String getClient_secret() { public String getClient_secret() {
return client_secret; return client_secret;

View file

@ -45,10 +45,8 @@ import app.fedilab.android.peertube.helper.RoundedBackgroundSpan;
public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final List<Instance> instances; private final List<Instance> instances;
private Context context;
public ActionClick actionClick; public ActionClick actionClick;
private Context context;
public InstanceAdapter(List<Instance> instances) { public InstanceAdapter(List<Instance> instances) {
this.instances = instances; this.instances = instances;
@ -159,6 +157,10 @@ public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
} }
public interface ActionClick {
void instance(String instance);
}
static class ViewHolder extends RecyclerView.ViewHolder { static class ViewHolder extends RecyclerView.ViewHolder {
DrawerInstancePeertubeBinding binding; DrawerInstancePeertubeBinding binding;
@ -167,8 +169,4 @@ public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
binding = itemView; binding = itemView;
} }
} }
public interface ActionClick {
void instance(String instance);
}
} }

View file

@ -91,6 +91,18 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private ChannelData.Channel forChannel; private ChannelData.Channel forChannel;
private AccountData.PeertubeAccount forAccount; private AccountData.PeertubeAccount forAccount;
public PeertubeAdapter(List<VideoData.Video> videos, TimelineVM.TimelineType timelineType, boolean sepiaSearch, ChannelData.Channel forChannel, AccountData.PeertubeAccount forAccount) {
this.videos = videos;
this.timelineType = timelineType;
this.sepiaSearch = sepiaSearch || timelineType == SEPIA_SEARCH;
this.forChannel = forChannel;
this.forAccount = forAccount;
}
public PeertubeAdapter(List<VideoData.Video> videos) {
this.videos = videos;
}
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -107,19 +119,6 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
} }
public PeertubeAdapter(List<VideoData.Video> videos, TimelineVM.TimelineType timelineType, boolean sepiaSearch, ChannelData.Channel forChannel, AccountData.PeertubeAccount forAccount) {
this.videos = videos;
this.timelineType = timelineType;
this.sepiaSearch = sepiaSearch || timelineType == SEPIA_SEARCH;
this.forChannel = forChannel;
this.forAccount = forAccount;
}
public PeertubeAdapter(List<VideoData.Video> videos) {
this.videos = videos;
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
@ -509,13 +508,6 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
} }
enum typeOfTimeline {
CLASSIC,
LIST
}
public void manageVIewPlaylists(VideoData.Video video, APIResponse apiResponse) { public void manageVIewPlaylists(VideoData.Video video, APIResponse apiResponse) {
if (apiResponse.getError() != null) { if (apiResponse.getError() != null) {
return; return;
@ -667,6 +659,11 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
} }
enum typeOfTimeline {
CLASSIC,
LIST
}
public interface RelationShipListener { public interface RelationShipListener {
Map<String, Boolean> getRelationShip(); Map<String, Boolean> getRelationShip();
} }

View file

@ -15,8 +15,6 @@ package app.fedilab.android.peertube.drawer;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View file

@ -60,8 +60,7 @@ public class DisplayNotificationsFragment extends Fragment {
public final static int AUTO_INSTANCE_FOLLOWING = 14; public final static int AUTO_INSTANCE_FOLLOWING = 14;
public final static int MY_VIDEO_REPPORT_SUCCESS = 15; public final static int MY_VIDEO_REPPORT_SUCCESS = 15;
public final static int ABUSE_NEW_MESSAGE = 16; public final static int ABUSE_NEW_MESSAGE = 16;
FragmentRecyclerviewPeertubeBinding binding;
private boolean flag_loading; private boolean flag_loading;
private Context context; private Context context;
private PeertubeNotificationsListAdapter peertubeNotificationsListAdapter; private PeertubeNotificationsListAdapter peertubeNotificationsListAdapter;
@ -69,7 +68,6 @@ public class DisplayNotificationsFragment extends Fragment {
private List<Notification> notifications; private List<Notification> notifications;
private boolean firstLoad; private boolean firstLoad;
private NotificationsVM viewModel; private NotificationsVM viewModel;
FragmentRecyclerviewPeertubeBinding binding;
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

View file

@ -171,7 +171,6 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();

View file

@ -841,11 +841,6 @@ public class Helper {
} }
} }
public interface PermissionGranted {
void proceed();
}
public static String readFileFromAssets(Context context, String filename) { public static String readFileFromAssets(Context context, String filename) {
String json; String json;
try { try {
@ -862,4 +857,9 @@ public class Helper {
return json; return json;
} }
public interface PermissionGranted {
void proceed();
}
} }

View file

@ -206,8 +206,8 @@ public class Sqlite extends SQLiteOpenHelper {
+ COL_USER_ID + " TEXT NOT NULL, " + COL_USER_ID + " TEXT NOT NULL, "
+ COL_TYPE + " TEXT NOT NULL, " + COL_TYPE + " TEXT NOT NULL, "
+ COL_MUTED_ACCOUNTS + " TEXT)"; + COL_MUTED_ACCOUNTS + " TEXT)";
public static SQLiteDatabase db;
private static Sqlite sInstance;
private final String CREATE_TABLE_STORED_INSTANCES = "CREATE TABLE " private final String CREATE_TABLE_STORED_INSTANCES = "CREATE TABLE "
+ TABLE_BOOKMARKED_INSTANCES + "(" + TABLE_BOOKMARKED_INSTANCES + "("
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
@ -215,12 +215,10 @@ public class Sqlite extends SQLiteOpenHelper {
+ COL_USER_ID + " TEXT NOT NULL, " + COL_USER_ID + " TEXT NOT NULL, "
+ COL_ABOUT + " TEXT NOT NULL, " + COL_ABOUT + " TEXT NOT NULL, "
+ COL_USER_INSTANCE + " TEXT NOT NULL)"; + COL_USER_INSTANCE + " TEXT NOT NULL)";
private final String CREATE_TABLE_CACHE_TAGS = "CREATE TABLE " private final String CREATE_TABLE_CACHE_TAGS = "CREATE TABLE "
+ TABLE_CACHE_TAGS + "(" + TABLE_CACHE_TAGS + "("
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COL_TAG + " TEXT NOT NULL)"; + COL_TAG + " TEXT NOT NULL)";
private final String CREATE_TABLE_TIMELINE_CACHE_LOGS = "CREATE TABLE " private final String CREATE_TABLE_TIMELINE_CACHE_LOGS = "CREATE TABLE "
+ TABLE_TIMELINE_CACHE_LOGS + "(" + TABLE_TIMELINE_CACHE_LOGS + "("
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
@ -236,10 +234,6 @@ public class Sqlite extends SQLiteOpenHelper {
+ COL_CREATED_AT + " TEXT NOT NULL)"; + COL_CREATED_AT + " TEXT NOT NULL)";
public static SQLiteDatabase db;
private static Sqlite sInstance;
public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) { public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version); super(context, name, factory, version);
} }