2019-06-03 23:25:05 +02:00
|
|
|
package org.mian.gitnex.activities;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
2020-01-01 21:03:53 +01:00
|
|
|
import android.graphics.Typeface;
|
2019-06-03 23:25:05 +02:00
|
|
|
import android.os.Bundle;
|
2022-02-22 07:23:46 +01:00
|
|
|
import android.os.Handler;
|
2021-02-21 23:15:46 +01:00
|
|
|
import android.text.Html;
|
2020-09-18 06:51:41 +02:00
|
|
|
import android.view.Menu;
|
2019-06-03 23:25:05 +02:00
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.TextView;
|
2020-04-23 22:40:13 +02:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
2020-08-18 16:10:46 +02:00
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
2020-04-23 22:40:13 +02:00
|
|
|
import androidx.appcompat.widget.Toolbar;
|
|
|
|
import androidx.core.view.GravityCompat;
|
|
|
|
import androidx.drawerlayout.widget.DrawerLayout;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
2020-08-18 16:10:46 +02:00
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
2022-08-07 21:34:02 +02:00
|
|
|
import com.google.android.material.card.MaterialCardView;
|
2022-08-12 04:01:51 +02:00
|
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
2020-04-23 22:40:13 +02:00
|
|
|
import com.google.android.material.navigation.NavigationView;
|
2022-09-21 07:43:00 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2022-04-22 17:18:38 +02:00
|
|
|
import org.gitnex.tea4j.v2.models.GeneralAPISettings;
|
2022-04-18 09:10:54 +02:00
|
|
|
import org.gitnex.tea4j.v2.models.NotificationCount;
|
|
|
|
import org.gitnex.tea4j.v2.models.ServerVersion;
|
|
|
|
import org.gitnex.tea4j.v2.models.User;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.R;
|
2020-08-18 16:10:46 +02:00
|
|
|
import org.mian.gitnex.adapters.UserAccountsNavAdapter;
|
2020-04-01 13:26:32 +02:00
|
|
|
import org.mian.gitnex.clients.PicassoService;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.clients.RetrofitClient;
|
2021-04-13 20:56:50 +02:00
|
|
|
import org.mian.gitnex.database.api.BaseApi;
|
2020-08-18 16:10:46 +02:00
|
|
|
import org.mian.gitnex.database.api.UserAccountsApi;
|
|
|
|
import org.mian.gitnex.database.models.UserAccount;
|
2021-01-26 16:10:31 +01:00
|
|
|
import org.mian.gitnex.databinding.ActivityMainBinding;
|
2023-09-20 17:30:21 +02:00
|
|
|
import org.mian.gitnex.fragments.AccountSettingsFragment;
|
2022-09-14 20:40:44 +02:00
|
|
|
import org.mian.gitnex.fragments.AdministrationFragment;
|
|
|
|
import org.mian.gitnex.fragments.BottomSheetDraftsFragment;
|
|
|
|
import org.mian.gitnex.fragments.BottomSheetMyIssuesFilterFragment;
|
2023-09-19 07:23:43 +02:00
|
|
|
import org.mian.gitnex.fragments.DashboardFragment;
|
2022-09-14 20:40:44 +02:00
|
|
|
import org.mian.gitnex.fragments.DraftsFragment;
|
|
|
|
import org.mian.gitnex.fragments.ExploreFragment;
|
|
|
|
import org.mian.gitnex.fragments.MostVisitedReposFragment;
|
|
|
|
import org.mian.gitnex.fragments.MyIssuesFragment;
|
|
|
|
import org.mian.gitnex.fragments.MyRepositoriesFragment;
|
2022-10-01 06:16:19 +02:00
|
|
|
import org.mian.gitnex.fragments.NotesFragment;
|
2022-09-14 20:40:44 +02:00
|
|
|
import org.mian.gitnex.fragments.NotificationsFragment;
|
|
|
|
import org.mian.gitnex.fragments.OrganizationsFragment;
|
|
|
|
import org.mian.gitnex.fragments.RepositoriesFragment;
|
|
|
|
import org.mian.gitnex.fragments.SettingsFragment;
|
|
|
|
import org.mian.gitnex.fragments.StarredRepositoriesFragment;
|
2023-09-20 17:30:21 +02:00
|
|
|
import org.mian.gitnex.fragments.WatchedRepositoriesFragment;
|
2022-09-14 20:40:44 +02:00
|
|
|
import org.mian.gitnex.helpers.AlertDialogs;
|
|
|
|
import org.mian.gitnex.helpers.AppUtil;
|
|
|
|
import org.mian.gitnex.helpers.ChangeLog;
|
|
|
|
import org.mian.gitnex.helpers.RoundedTransformation;
|
|
|
|
import org.mian.gitnex.helpers.Toasty;
|
2021-12-15 20:20:49 +01:00
|
|
|
import org.mian.gitnex.structs.BottomSheetListener;
|
2022-04-04 09:32:03 +02:00
|
|
|
import org.mian.gitnex.structs.FragmentRefreshListener;
|
2019-06-03 23:25:05 +02:00
|
|
|
import retrofit2.Call;
|
|
|
|
import retrofit2.Callback;
|
|
|
|
|
|
|
|
/**
|
2022-04-04 10:00:54 +02:00
|
|
|
* @author M M Arif
|
2019-06-03 23:25:05 +02:00
|
|
|
*/
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
@SuppressWarnings("ConstantConditions")
|
2022-09-21 07:43:00 +02:00
|
|
|
public class MainActivity extends BaseActivity
|
|
|
|
implements NavigationView.OnNavigationItemSelectedListener, BottomSheetListener {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
public static boolean refActivity = false;
|
2022-05-01 12:00:02 +02:00
|
|
|
public static boolean reloadRepos = false;
|
2020-04-23 22:40:13 +02:00
|
|
|
private DrawerLayout drawer;
|
|
|
|
private TextView toolbarTitle;
|
|
|
|
private Typeface myTypeface;
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
private boolean noConnection = false;
|
2020-09-18 06:51:41 +02:00
|
|
|
private View hView;
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
private NavigationView navigationView;
|
2020-09-18 06:51:41 +02:00
|
|
|
private MenuItem navNotifications;
|
|
|
|
private TextView notificationCounter;
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
private BottomSheetListener profileInitListener;
|
2022-04-04 09:32:03 +02:00
|
|
|
private FragmentRefreshListener fragmentRefreshListenerMyIssues;
|
2023-09-20 17:30:21 +02:00
|
|
|
private String username;
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
|
2020-04-23 22:40:13 +02:00
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
2020-04-28 15:47:25 +02:00
|
|
|
|
2021-01-26 16:10:31 +01:00
|
|
|
ActivityMainBinding activityMainBinding = ActivityMainBinding.inflate(getLayoutInflater());
|
2021-01-26 18:43:25 +01:00
|
|
|
setContentView(activityMainBinding.getRoot());
|
2021-01-26 16:10:31 +01:00
|
|
|
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
Intent mainIntent = getIntent();
|
2022-02-22 07:23:46 +01:00
|
|
|
Handler handler = new Handler();
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2021-04-13 20:56:50 +02:00
|
|
|
// DO NOT MOVE
|
2022-09-21 07:43:00 +02:00
|
|
|
if (mainIntent.hasExtra("switchAccountId")
|
|
|
|
&& AppUtil.switchToAccount(
|
|
|
|
ctx,
|
|
|
|
BaseApi.getInstance(ctx, UserAccountsApi.class)
|
|
|
|
.getAccountById(mainIntent.getIntExtra("switchAccountId", 0)))) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-04-13 20:56:50 +02:00
|
|
|
mainIntent.removeExtra("switchAccountId");
|
|
|
|
recreate();
|
|
|
|
return;
|
2020-04-23 22:40:13 +02:00
|
|
|
}
|
2021-04-13 20:56:50 +02:00
|
|
|
// DO NOT MOVE
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (tinyDB.getInt("currentActiveAccountId", -1) <= 0) {
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
AppUtil.logout(ctx);
|
2022-04-09 11:23:49 +02:00
|
|
|
return;
|
2020-08-06 17:31:31 +02:00
|
|
|
}
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2022-04-09 11:23:49 +02:00
|
|
|
noConnection = false;
|
|
|
|
|
2021-01-26 16:10:31 +01:00
|
|
|
Toolbar toolbar = activityMainBinding.toolbar;
|
|
|
|
toolbarTitle = activityMainBinding.toolbarTitle;
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-04-25 07:42:52 +02:00
|
|
|
myTypeface = AppUtil.getTypeface(this);
|
2020-04-23 22:40:13 +02:00
|
|
|
toolbarTitle.setTypeface(myTypeface);
|
|
|
|
setSupportActionBar(toolbar);
|
|
|
|
|
|
|
|
FragmentManager fm = getSupportFragmentManager();
|
|
|
|
Fragment fragmentById = fm.findFragmentById(R.id.fragment_container);
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (fragmentById instanceof SettingsFragment) {
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navSettings));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof MyRepositoriesFragment) {
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMyRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof StarredRepositoriesFragment) {
|
2020-04-23 22:40:13 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof OrganizationsFragment) {
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navOrg));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof ExploreFragment) {
|
2020-04-23 22:40:13 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof NotificationsFragment) {
|
2020-07-22 21:32:42 +02:00
|
|
|
toolbarTitle.setText(R.string.pageTitleNotifications);
|
2023-09-20 17:30:21 +02:00
|
|
|
} else if (fragmentById instanceof AccountSettingsFragment) {
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navAccount));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof MostVisitedReposFragment) {
|
2022-08-07 22:03:17 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMostVisited));
|
2022-10-01 06:16:19 +02:00
|
|
|
} else if (fragmentById instanceof NotesFragment) {
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navNotes));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof DraftsFragment) {
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof AdministrationFragment) {
|
2020-04-23 22:40:13 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleAdministration));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (fragmentById instanceof MyIssuesFragment) {
|
2022-03-18 09:57:24 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMyIssues));
|
2023-09-19 07:23:43 +02:00
|
|
|
} else if (fragmentById instanceof DashboardFragment) {
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.dashboard));
|
2023-09-20 17:30:21 +02:00
|
|
|
} else if (fragmentById instanceof WatchedRepositoriesFragment) {
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navWatchedRepositories));
|
2022-03-18 09:57:24 +01:00
|
|
|
}
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
getNotificationsCount();
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2021-01-26 16:10:31 +01:00
|
|
|
drawer = activityMainBinding.drawerLayout;
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
navigationView = activityMainBinding.navView;
|
2020-04-23 22:40:13 +02:00
|
|
|
navigationView.setNavigationItemSelectedListener(this);
|
2020-09-18 06:51:41 +02:00
|
|
|
hView = navigationView.getHeaderView(0);
|
|
|
|
|
|
|
|
Menu menu = navigationView.getMenu();
|
|
|
|
navNotifications = menu.findItem(R.id.nav_notifications);
|
2023-09-19 07:23:43 +02:00
|
|
|
MenuItem navDashboard = menu.findItem(R.id.nav_dashboard);
|
|
|
|
|
|
|
|
navDashboard.getActionView().findViewById(R.id.betaBadge).setVisibility(View.VISIBLE);
|
|
|
|
TextView dashboardBetaView = navDashboard.getActionView().findViewById(R.id.betaBadge);
|
|
|
|
dashboardBetaView.setText(R.string.beta);
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2023-06-13 07:23:27 +02:00
|
|
|
navigationView
|
|
|
|
.getViewTreeObserver()
|
|
|
|
.addOnGlobalLayoutListener(
|
|
|
|
() -> {
|
|
|
|
ArrayList<View> menuItems = new ArrayList<>(menu.size());
|
|
|
|
for (int i = 0; i < menu.size(); i++) {
|
|
|
|
MenuItem item = menu.getItem(i);
|
|
|
|
navigationView.findViewsWithText(
|
|
|
|
menuItems, item.getTitle(), View.FIND_VIEWS_WITH_TEXT);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (final View menuItem : menuItems) {
|
|
|
|
((TextView) menuItem).setTypeface(myTypeface);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
ActionBarDrawerToggle toggle =
|
|
|
|
new ActionBarDrawerToggle(
|
|
|
|
this,
|
|
|
|
drawer,
|
|
|
|
toolbar,
|
|
|
|
R.string.navigationDrawerOpen,
|
|
|
|
R.string.navigationDrawerClose);
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2020-06-06 22:04:07 +02:00
|
|
|
drawer.addDrawerListener(toggle);
|
2022-09-21 07:43:00 +02:00
|
|
|
drawer.addDrawerListener(
|
|
|
|
new DrawerLayout.DrawerListener() {
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onDrawerOpened(@NonNull View drawerView) {
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (noConnection) {
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Toasty.error(
|
|
|
|
ctx, getResources().getString(R.string.checkNetConnection));
|
|
|
|
noConnection = false;
|
|
|
|
}
|
2020-08-18 16:10:46 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
TextView userEmail = hView.findViewById(R.id.userEmail);
|
|
|
|
TextView userFullName = hView.findViewById(R.id.userFullname);
|
|
|
|
ImageView userAvatar = hView.findViewById(R.id.userAvatar);
|
|
|
|
MaterialCardView navRecyclerViewFrame =
|
|
|
|
hView.findViewById(R.id.userAccountsFrame);
|
|
|
|
|
|
|
|
List<UserAccount> userAccountsList = new ArrayList<>();
|
|
|
|
UserAccountsApi userAccountsApi;
|
|
|
|
userAccountsApi = BaseApi.getInstance(ctx, UserAccountsApi.class);
|
|
|
|
|
|
|
|
RecyclerView navRecyclerViewUserAccounts =
|
|
|
|
hView.findViewById(R.id.userAccounts);
|
|
|
|
UserAccountsNavAdapter adapterUserAccounts =
|
|
|
|
new UserAccountsNavAdapter(ctx, userAccountsList, drawer);
|
|
|
|
|
|
|
|
userAccountsApi
|
|
|
|
.getAllAccounts()
|
|
|
|
.observe(
|
|
|
|
(AppCompatActivity) ctx,
|
|
|
|
userAccounts -> {
|
|
|
|
if (userAccounts.size() > 0) {
|
|
|
|
userAccountsList.clear();
|
|
|
|
userAccountsList.addAll(userAccounts);
|
|
|
|
navRecyclerViewUserAccounts.setAdapter(
|
|
|
|
adapterUserAccounts);
|
|
|
|
navRecyclerViewFrame.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
userEmail.setTypeface(myTypeface);
|
|
|
|
userFullName.setTypeface(myTypeface);
|
|
|
|
|
|
|
|
if (getAccount().getUserInfo() != null) {
|
2023-09-20 17:30:21 +02:00
|
|
|
username = getAccount().getUserInfo().getLogin();
|
2022-09-21 07:43:00 +02:00
|
|
|
String userEmailNav = getAccount().getUserInfo().getEmail();
|
|
|
|
String userFullNameNav = getAccount().getFullName();
|
|
|
|
String userAvatarNav = getAccount().getUserInfo().getAvatarUrl();
|
|
|
|
|
|
|
|
if (!userEmailNav.equals("")) {
|
|
|
|
userEmail.setText(userEmailNav);
|
|
|
|
}
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!userFullNameNav.equals("")) {
|
|
|
|
userFullName.setText(Html.fromHtml(userFullNameNav));
|
|
|
|
}
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!userAvatarNav.equals("")) {
|
|
|
|
|
|
|
|
int avatarRadius = AppUtil.getPixelsFromDensity(ctx, 60);
|
|
|
|
|
|
|
|
PicassoService.getInstance(ctx)
|
|
|
|
.get()
|
|
|
|
.load(userAvatarNav)
|
|
|
|
.placeholder(R.drawable.loader_animated)
|
|
|
|
.transform(new RoundedTransformation(avatarRadius, 0))
|
|
|
|
.resize(160, 160)
|
|
|
|
.centerCrop()
|
|
|
|
.into(userAvatar);
|
|
|
|
}
|
|
|
|
}
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
userAvatar.setOnClickListener(
|
|
|
|
v -> {
|
2023-09-20 17:30:21 +02:00
|
|
|
Intent intentProfile = new Intent(ctx, ProfileActivity.class);
|
|
|
|
intentProfile.putExtra("username", username);
|
|
|
|
ctx.startActivity(intentProfile);
|
2022-09-21 07:43:00 +02:00
|
|
|
drawer.closeDrawers();
|
|
|
|
});
|
|
|
|
|
|
|
|
getNotificationsCount();
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
|
|
|
|
|
|
|
|
if (getAccount().getUserInfo() != null) {
|
|
|
|
navigationView
|
|
|
|
.getMenu()
|
|
|
|
.findItem(R.id.nav_administration)
|
|
|
|
.setVisible(getAccount().getUserInfo().isIsAdmin());
|
|
|
|
} else {
|
|
|
|
// hide first
|
|
|
|
navigationView
|
|
|
|
.getMenu()
|
|
|
|
.findItem(R.id.nav_administration)
|
|
|
|
.setVisible(false);
|
|
|
|
}
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (getAccount().requiresVersion("1.14.0")) {
|
|
|
|
navigationView.getMenu().findItem(R.id.nav_my_issues).setVisible(true);
|
|
|
|
}
|
2023-09-19 07:23:43 +02:00
|
|
|
|
|
|
|
if (getAccount().requiresVersion("1.20.0")) {
|
|
|
|
navigationView.getMenu().findItem(R.id.nav_dashboard).setVisible(true);
|
|
|
|
}
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onDrawerClosed(@NonNull View drawerView) {}
|
2021-03-21 16:56:54 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onDrawerStateChanged(int newState) {}
|
2020-04-23 22:40:13 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
toggle.syncState();
|
2020-07-12 19:18:50 +02:00
|
|
|
toolbar.setNavigationIcon(R.drawable.ic_menu);
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2021-04-13 20:56:50 +02:00
|
|
|
String launchFragment = mainIntent.getStringExtra("launchFragment");
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (launchFragment != null) {
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2020-07-22 21:32:42 +02:00
|
|
|
mainIntent.removeExtra("launchFragment");
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
switch (launchFragment) {
|
2020-07-22 21:32:42 +02:00
|
|
|
case "drafts":
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new DraftsFragment())
|
|
|
|
.commit();
|
2020-07-22 21:32:42 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_comments_draft);
|
|
|
|
return;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-04-13 20:56:50 +02:00
|
|
|
case "notifications":
|
2020-07-22 21:32:42 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleNotifications));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new NotificationsFragment())
|
|
|
|
.commit();
|
2020-07-22 21:32:42 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_notifications);
|
|
|
|
return;
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-23 20:13:13 +02:00
|
|
|
String launchFragmentByHandler = mainIntent.getStringExtra("launchFragmentByLinkHandler");
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (launchFragmentByHandler != null) {
|
2020-10-23 20:13:13 +02:00
|
|
|
|
|
|
|
mainIntent.removeExtra("launchFragmentByLinkHandler");
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
switch (launchFragmentByHandler) {
|
2020-10-23 20:13:13 +02:00
|
|
|
case "repos":
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new RepositoriesFragment())
|
|
|
|
.commit();
|
2020-10-23 20:13:13 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_repositories);
|
|
|
|
return;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case "org":
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new OrganizationsFragment())
|
|
|
|
.commit();
|
2020-10-23 20:13:13 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_organizations);
|
|
|
|
return;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case "notification":
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new NotificationsFragment())
|
|
|
|
.commit();
|
2020-10-23 20:13:13 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_notifications);
|
2021-07-23 17:41:19 +02:00
|
|
|
setActionBarTitle(getResources().getString(R.string.pageTitleNotifications));
|
2020-10-23 20:13:13 +02:00
|
|
|
return;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case "explore":
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new ExploreFragment())
|
|
|
|
.commit();
|
2020-10-23 20:13:13 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_explore);
|
|
|
|
return;
|
2021-07-23 17:41:19 +02:00
|
|
|
|
|
|
|
case "profile":
|
2023-09-20 17:30:21 +02:00
|
|
|
Intent intentProfile = new Intent(ctx, ProfileActivity.class);
|
|
|
|
intentProfile.putExtra("username", username);
|
|
|
|
ctx.startActivity(intentProfile);
|
2021-07-23 17:41:19 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
case "admin":
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new AdministrationFragment())
|
|
|
|
.commit();
|
2021-07-23 17:41:19 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_administration);
|
|
|
|
return;
|
2020-10-23 20:13:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (savedInstanceState == null) {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!getAccount().requiresVersion("1.12.3")) {
|
|
|
|
if (tinyDB.getInt("homeScreenId", 0) == 7) {
|
2020-11-02 16:17:00 +01:00
|
|
|
tinyDB.putInt("homeScreenId", 0);
|
2020-08-12 09:31:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
switch (tinyDB.getInt("homeScreenId", 0)) {
|
2020-06-06 22:04:07 +02:00
|
|
|
case 1:
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new StarredRepositoriesFragment())
|
|
|
|
.commit();
|
2020-06-06 22:04:07 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_starred_repos);
|
|
|
|
break;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case 2:
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navOrg));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new OrganizationsFragment())
|
|
|
|
.commit();
|
2020-06-06 22:04:07 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_organizations);
|
|
|
|
break;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case 3:
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new RepositoriesFragment())
|
|
|
|
.commit();
|
2020-06-06 22:04:07 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_repositories);
|
|
|
|
break;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case 4:
|
2023-09-20 17:30:21 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navAccount));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
2023-09-20 17:30:21 +02:00
|
|
|
.replace(R.id.fragment_container, new AccountSettingsFragment())
|
2022-09-21 07:43:00 +02:00
|
|
|
.commit();
|
2023-09-20 17:30:21 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_account_settings);
|
2020-06-06 22:04:07 +02:00
|
|
|
break;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case 5:
|
2020-07-19 12:05:08 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new ExploreFragment())
|
|
|
|
.commit();
|
2020-07-19 12:05:08 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_explore);
|
|
|
|
break;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case 6:
|
2020-07-19 12:05:08 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new DraftsFragment())
|
|
|
|
.commit();
|
2020-07-19 12:05:08 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_comments_draft);
|
|
|
|
break;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2021-03-21 16:56:54 +01:00
|
|
|
case 7:
|
2020-08-12 09:31:39 +02:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleNotifications));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new NotificationsFragment())
|
|
|
|
.commit();
|
2020-08-12 09:31:39 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_notifications);
|
|
|
|
break;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-03-18 09:57:24 +01:00
|
|
|
case 8:
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMyIssues));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new MyIssuesFragment())
|
|
|
|
.commit();
|
2022-03-18 09:57:24 +01:00
|
|
|
navigationView.setCheckedItem(R.id.nav_my_issues);
|
|
|
|
break;
|
2022-08-12 04:01:51 +02:00
|
|
|
case 9:
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMostVisited));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new MostVisitedReposFragment())
|
|
|
|
.commit();
|
2022-08-12 04:01:51 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_most_visited);
|
|
|
|
break;
|
2022-10-01 06:16:19 +02:00
|
|
|
case 10:
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navNotes));
|
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new NotesFragment())
|
|
|
|
.commit();
|
|
|
|
navigationView.setCheckedItem(R.id.nav_notes);
|
|
|
|
break;
|
2023-09-19 07:23:43 +02:00
|
|
|
case 11:
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.dashboard));
|
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new DashboardFragment())
|
|
|
|
.commit();
|
|
|
|
navigationView.setCheckedItem(R.id.nav_dashboard);
|
|
|
|
break;
|
2023-09-20 17:30:21 +02:00
|
|
|
case 12:
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navWatchedRepositories));
|
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new WatchedRepositoriesFragment())
|
|
|
|
.commit();
|
|
|
|
navigationView.setCheckedItem(R.id.nav_watched_repositories);
|
|
|
|
break;
|
2021-03-21 16:56:54 +01:00
|
|
|
default:
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMyRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new MyRepositoriesFragment())
|
|
|
|
.commit();
|
2020-06-06 22:04:07 +02:00
|
|
|
navigationView.setCheckedItem(R.id.nav_home);
|
|
|
|
break;
|
2020-04-23 22:40:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-13 07:23:27 +02:00
|
|
|
loadUserInfo();
|
2022-09-21 07:43:00 +02:00
|
|
|
handler.postDelayed(
|
|
|
|
() -> {
|
|
|
|
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
|
|
|
if (!connToInternet) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!noConnection) {
|
|
|
|
Toasty.error(
|
|
|
|
ctx, getResources().getString(R.string.checkNetConnection));
|
|
|
|
}
|
|
|
|
noConnection = true;
|
|
|
|
} else {
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
giteaVersion();
|
|
|
|
serverPageLimitSettings();
|
|
|
|
noConnection = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
1500);
|
2020-04-23 22:40:13 +02:00
|
|
|
|
|
|
|
// Changelog popup
|
2021-01-26 16:10:31 +01:00
|
|
|
int versionCode = AppUtil.getAppBuildNo(appCtx);
|
2022-09-21 07:43:00 +02:00
|
|
|
if (versionCode > tinyDB.getInt("versionCode")) {
|
2020-07-22 21:32:42 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
tinyDB.putInt("versionCode", versionCode);
|
2020-07-22 21:32:42 +02:00
|
|
|
|
2020-04-23 22:40:13 +02:00
|
|
|
ChangeLog changelogDialog = new ChangeLog(this);
|
|
|
|
changelogDialog.showDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (refActivity) {
|
2022-04-18 09:10:54 +02:00
|
|
|
this.recreate();
|
|
|
|
this.overridePendingTransition(0, 0);
|
|
|
|
refActivity = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-27 09:36:57 +02:00
|
|
|
public void setActionBarTitle(String title) {
|
|
|
|
|
|
|
|
toolbarTitle.setText(title);
|
|
|
|
}
|
|
|
|
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
@Override
|
|
|
|
public void onButtonClicked(String text) {
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
int currentActiveAccountId = tinyDB.getInt("currentActiveAccountId");
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
switch (text) {
|
2022-04-04 09:32:03 +02:00
|
|
|
case "deleteDrafts":
|
2022-09-21 07:43:00 +02:00
|
|
|
if (currentActiveAccountId > 0) {
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2022-04-04 09:32:03 +02:00
|
|
|
FragmentManager fm = getSupportFragmentManager();
|
2022-09-21 07:43:00 +02:00
|
|
|
DraftsFragment frag =
|
|
|
|
(DraftsFragment) fm.findFragmentById(R.id.fragment_container);
|
|
|
|
|
|
|
|
if (frag != null) {
|
|
|
|
|
|
|
|
new MaterialAlertDialogBuilder(ctx)
|
|
|
|
.setTitle(R.string.deleteAllDrafts)
|
|
|
|
.setCancelable(false)
|
|
|
|
.setMessage(R.string.deleteAllDraftsDialogMessage)
|
|
|
|
.setPositiveButton(
|
|
|
|
R.string.menuDeleteText,
|
|
|
|
(dialog, which) -> {
|
|
|
|
frag.deleteAllDrafts(currentActiveAccountId);
|
|
|
|
dialog.dismiss();
|
|
|
|
})
|
|
|
|
.setNeutralButton(R.string.cancelButton, null)
|
|
|
|
.show();
|
|
|
|
} else {
|
2022-04-04 09:32:03 +02:00
|
|
|
|
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
|
|
|
}
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
|
|
|
}
|
2022-04-04 09:32:03 +02:00
|
|
|
break;
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2022-04-04 09:32:03 +02:00
|
|
|
case "openMyIssues":
|
2022-09-21 07:43:00 +02:00
|
|
|
if (getFragmentRefreshListener() != null) {
|
2022-04-04 09:32:03 +02:00
|
|
|
getFragmentRefreshListener().onRefresh("open");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "closedMyIssues":
|
2022-09-21 07:43:00 +02:00
|
|
|
if (getFragmentRefreshListener() != null) {
|
2022-04-04 09:32:03 +02:00
|
|
|
getFragmentRefreshListener().onRefresh("closed");
|
|
|
|
}
|
|
|
|
break;
|
2022-04-22 17:18:38 +02:00
|
|
|
case "assignedToMe":
|
2022-09-21 07:43:00 +02:00
|
|
|
if (getFragmentRefreshListener() != null) {
|
2022-04-22 17:18:38 +02:00
|
|
|
getFragmentRefreshListener().onRefresh("assignedToMe");
|
|
|
|
}
|
|
|
|
break;
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-23 22:40:13 +02:00
|
|
|
@Override
|
|
|
|
public void onBackPressed() {
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-04-23 22:40:13 +02:00
|
|
|
drawer.closeDrawer(GravityCompat.START);
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-04-23 22:40:13 +02:00
|
|
|
super.onBackPressed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
|
|
|
|
2020-10-29 14:13:19 +01:00
|
|
|
int id = menuItem.getItemId();
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (id == R.id.nav_home) {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMyRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new MyRepositoriesFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_organizations) {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navOrg));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new OrganizationsFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_profile) {
|
2023-09-20 17:30:21 +02:00
|
|
|
|
|
|
|
Intent intentProfile = new Intent(ctx, ProfileActivity.class);
|
|
|
|
intentProfile.putExtra("username", username);
|
|
|
|
ctx.startActivity(intentProfile);
|
|
|
|
drawer.closeDrawers();
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (id == R.id.nav_repositories) {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new RepositoriesFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_settings) {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2021-12-15 20:37:53 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navSettings));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new SettingsFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_starred_repos) {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2020-10-29 14:13:19 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new StarredRepositoriesFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_explore) {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2020-10-29 14:13:19 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new ExploreFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_notifications) {
|
2020-07-22 21:32:42 +02:00
|
|
|
|
2020-10-29 14:13:19 +01:00
|
|
|
toolbarTitle.setText(R.string.pageTitleNotifications);
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new NotificationsFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_comments_draft) {
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2020-10-29 14:13:19 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new DraftsFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_administration) {
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2020-10-29 14:13:19 +01:00
|
|
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleAdministration));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new AdministrationFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_my_issues) {
|
2022-03-18 09:57:24 +01:00
|
|
|
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMyIssues));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new MyIssuesFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_most_visited) {
|
2022-08-07 22:03:17 +02:00
|
|
|
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navMostVisited));
|
2022-09-21 07:43:00 +02:00
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new MostVisitedReposFragment())
|
|
|
|
.commit();
|
2022-10-01 06:16:19 +02:00
|
|
|
} else if (id == R.id.nav_notes) {
|
|
|
|
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navNotes));
|
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new NotesFragment())
|
|
|
|
.commit();
|
2023-09-19 07:23:43 +02:00
|
|
|
} else if (id == R.id.nav_dashboard) {
|
|
|
|
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.dashboard));
|
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new DashboardFragment())
|
|
|
|
.commit();
|
2023-09-20 17:30:21 +02:00
|
|
|
} else if (id == R.id.nav_account_settings) {
|
|
|
|
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navAccount));
|
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new AccountSettingsFragment())
|
|
|
|
.commit();
|
|
|
|
} else if (id == R.id.nav_watched_repositories) {
|
|
|
|
|
|
|
|
toolbarTitle.setText(getResources().getString(R.string.navWatchedRepositories));
|
|
|
|
getSupportFragmentManager()
|
|
|
|
.beginTransaction()
|
|
|
|
.replace(R.id.fragment_container, new WatchedRepositoriesFragment())
|
|
|
|
.commit();
|
2022-08-07 22:03:17 +02:00
|
|
|
}
|
2020-04-23 22:40:13 +02:00
|
|
|
|
|
|
|
drawer.closeDrawer(GravityCompat.START);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
|
|
|
int id = item.getItemId();
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (id == R.id.genericMenu) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
BottomSheetDraftsFragment bottomSheet = new BottomSheetDraftsFragment();
|
|
|
|
bottomSheet.show(getSupportFragmentManager(), "draftsBottomSheet");
|
|
|
|
return true;
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (id == R.id.filter) {
|
2022-04-04 09:32:03 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
BottomSheetMyIssuesFilterFragment filterBottomSheet =
|
|
|
|
new BottomSheetMyIssuesFilterFragment();
|
2022-04-04 09:32:03 +02:00
|
|
|
filterBottomSheet.show(getSupportFragmentManager(), "myIssuesFilterMenuBottomSheet");
|
|
|
|
return true;
|
|
|
|
}
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
|
2022-04-22 17:18:38 +02:00
|
|
|
private void serverPageLimitSettings() {
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Call<GeneralAPISettings> generalAPISettings =
|
|
|
|
RetrofitClient.getApiInterface(ctx).getGeneralAPISettings();
|
|
|
|
generalAPISettings.enqueue(
|
|
|
|
new Callback<>() {
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull final Call<GeneralAPISettings> generalAPISettings,
|
|
|
|
@NonNull retrofit2.Response<GeneralAPISettings> response) {
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (response.code() == 200 && response.body() != null) {
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
int maxResponseItems = 50;
|
|
|
|
int defaultPagingNumber = 25;
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (response.body().getMaxResponseItems() != null) {
|
|
|
|
maxResponseItems =
|
|
|
|
Math.toIntExact(response.body().getMaxResponseItems());
|
|
|
|
}
|
|
|
|
if (response.body().getDefaultPagingNum() != null) {
|
|
|
|
defaultPagingNumber =
|
|
|
|
Math.toIntExact(response.body().getDefaultPagingNum());
|
|
|
|
}
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
BaseApi.getInstance(ctx, UserAccountsApi.class)
|
|
|
|
.updateServerPagingLimit(
|
|
|
|
maxResponseItems,
|
|
|
|
defaultPagingNumber,
|
|
|
|
tinyDB.getInt("currentActiveAccountId"));
|
|
|
|
}
|
|
|
|
}
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(
|
|
|
|
@NonNull Call<GeneralAPISettings> generalAPISettings,
|
|
|
|
@NonNull Throwable t) {}
|
|
|
|
});
|
2022-04-22 17:18:38 +02:00
|
|
|
}
|
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void giteaVersion() {
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<ServerVersion> callVersion = RetrofitClient.getApiInterface(ctx).getVersion();
|
2022-09-21 07:43:00 +02:00
|
|
|
callVersion.enqueue(
|
|
|
|
new Callback<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull final Call<ServerVersion> callVersion,
|
|
|
|
@NonNull retrofit2.Response<ServerVersion> responseVersion) {
|
|
|
|
|
|
|
|
if (responseVersion.code() == 200 && responseVersion.body() != null) {
|
|
|
|
String version = responseVersion.body().getVersion();
|
|
|
|
|
|
|
|
BaseApi.getInstance(ctx, UserAccountsApi.class)
|
|
|
|
.updateServerVersion(
|
|
|
|
version, tinyDB.getInt("currentActiveAccountId"));
|
|
|
|
getAccount()
|
|
|
|
.setAccount(
|
|
|
|
BaseApi.getInstance(ctx, UserAccountsApi.class)
|
|
|
|
.getAccountById(
|
|
|
|
tinyDB.getInt(
|
|
|
|
"currentActiveAccountId")));
|
|
|
|
}
|
|
|
|
}
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(
|
|
|
|
@NonNull Call<ServerVersion> callVersion, @NonNull Throwable t) {}
|
|
|
|
});
|
2020-04-23 22:40:13 +02:00
|
|
|
}
|
|
|
|
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
private void loadUserInfo() {
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<User> call = RetrofitClient.getApiInterface(ctx).userGetCurrent();
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
call.enqueue(
|
|
|
|
new Callback<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<User> call, @NonNull retrofit2.Response<User> response) {
|
|
|
|
|
|
|
|
User userDetails = response.body();
|
|
|
|
|
|
|
|
if (response.isSuccessful()) {
|
|
|
|
|
|
|
|
if (response.code() == 200) {
|
|
|
|
|
|
|
|
assert userDetails != null;
|
|
|
|
|
|
|
|
getAccount().setUserInfo(userDetails);
|
|
|
|
navigationView
|
|
|
|
.getMenu()
|
|
|
|
.findItem(R.id.nav_administration)
|
|
|
|
.setVisible(userDetails.isIsAdmin());
|
|
|
|
if (!getAccount()
|
|
|
|
.getAccount()
|
|
|
|
.getUserName()
|
|
|
|
.equals(userDetails.getLogin())) {
|
|
|
|
// user changed it's name -> update database
|
|
|
|
int accountId = getAccount().getAccount().getAccountId();
|
|
|
|
BaseApi.getInstance(MainActivity.this, UserAccountsApi.class)
|
|
|
|
.updateUsername(accountId, userDetails.getLogin());
|
|
|
|
getAccount()
|
|
|
|
.setAccount(
|
|
|
|
BaseApi.getInstance(
|
|
|
|
MainActivity.this,
|
|
|
|
UserAccountsApi.class)
|
|
|
|
.getAccountById(accountId));
|
|
|
|
}
|
|
|
|
if (profileInitListener != null) {
|
|
|
|
profileInitListener.onButtonClicked(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (response.code() == 401) {
|
2020-04-23 22:40:13 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
|
|
|
} else {
|
2020-06-06 22:04:07 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
String toastError =
|
|
|
|
getResources()
|
|
|
|
.getString(R.string.genericApiError, response.code());
|
|
|
|
Toasty.error(ctx, toastError);
|
2022-04-22 17:18:38 +02:00
|
|
|
}
|
2020-04-23 22:40:13 +02:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(@NonNull Call<User> call, @NonNull Throwable t) {}
|
|
|
|
});
|
2020-04-23 22:40:13 +02:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
private void getNotificationsCount() {
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<NotificationCount> call = RetrofitClient.getApiInterface(ctx).notifyNewAvailable();
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
call.enqueue(
|
|
|
|
new Callback<>() {
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<NotificationCount> call,
|
|
|
|
@NonNull retrofit2.Response<NotificationCount> response) {
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
NotificationCount notificationCount = response.body();
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (response.code() == 200) {
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
assert notificationCount != null;
|
2023-03-11 09:59:11 +01:00
|
|
|
if (notificationCount.getNew() > 0) {
|
|
|
|
|
|
|
|
navNotifications
|
|
|
|
.getActionView()
|
|
|
|
.findViewById(R.id.counterBadgeNotification)
|
|
|
|
.setVisibility(View.VISIBLE);
|
|
|
|
notificationCounter =
|
|
|
|
navNotifications
|
|
|
|
.getActionView()
|
|
|
|
.findViewById(R.id.counterBadgeNotification);
|
|
|
|
notificationCounter.setText(
|
|
|
|
String.valueOf(notificationCount.getNew()));
|
|
|
|
} else {
|
|
|
|
navNotifications
|
|
|
|
.getActionView()
|
|
|
|
.findViewById(R.id.counterBadgeNotification)
|
|
|
|
.setVisibility(View.GONE);
|
|
|
|
}
|
2022-09-21 07:43:00 +02:00
|
|
|
}
|
|
|
|
}
|
2020-09-18 06:51:41 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(
|
|
|
|
@NonNull Call<NotificationCount> call, @NonNull Throwable t) {}
|
|
|
|
});
|
2020-09-18 06:51:41 +02:00
|
|
|
}
|
|
|
|
|
Don't use TinyDB as cache (#1034)
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 https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, 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>
2022-03-13 03:59:13 +01:00
|
|
|
public void setProfileInitListener(BottomSheetListener profileInitListener) {
|
|
|
|
|
|
|
|
this.profileInitListener = profileInitListener;
|
|
|
|
}
|
|
|
|
|
2022-04-22 17:18:38 +02:00
|
|
|
// My issues interface
|
2022-08-15 16:26:02 +02:00
|
|
|
public FragmentRefreshListener getFragmentRefreshListener() {
|
|
|
|
return fragmentRefreshListenerMyIssues;
|
|
|
|
}
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
public void setFragmentRefreshListenerMyIssues(
|
|
|
|
FragmentRefreshListener fragmentRefreshListener) {
|
2022-08-15 16:26:02 +02:00
|
|
|
this.fragmentRefreshListenerMyIssues = fragmentRefreshListener;
|
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
}
|