mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
7e514041bb
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after c9172f85ef
, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
44 lines
1.2 KiB
Java
44 lines
1.2 KiB
Java
package org.mian.gitnex.fragments;
|
|
|
|
import android.os.Bundle;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|
import org.mian.gitnex.databinding.BottomSheetNotificationsFilterBinding;
|
|
import org.mian.gitnex.structs.BottomSheetListener;
|
|
|
|
/**
|
|
* Author opyale
|
|
*/
|
|
|
|
public class BottomSheetNotificationsFilterFragment extends BottomSheetDialogFragment {
|
|
|
|
private BottomSheetListener listener;
|
|
|
|
@Nullable
|
|
@Override
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
BottomSheetNotificationsFilterBinding binding = BottomSheetNotificationsFilterBinding.inflate(inflater, container, false);
|
|
|
|
binding.readNotifications.setOnClickListener(v1 -> {
|
|
listener.onButtonClicked("read");
|
|
dismiss();
|
|
});
|
|
|
|
binding.unreadNotifications.setOnClickListener(v12 -> {
|
|
listener.onButtonClicked("unread");
|
|
dismiss();
|
|
});
|
|
|
|
return binding.getRoot();
|
|
}
|
|
|
|
public void setOnClickListener(BottomSheetListener listener) {
|
|
this.listener = listener;
|
|
}
|
|
|
|
}
|