Fixes and cleanups for alert dialogs and strings (#1121)

* remove arguments from alert dialogs funcs
* clean up strings
* fix strings with multiple `%s`

Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1121
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
qwerty287 2022-05-01 12:35:50 +02:00 committed by M M Arif
parent 656ca5073e
commit de62996fd2
37 changed files with 91 additions and 255 deletions

View File

@ -40,9 +40,7 @@ public class CollaboratorActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {
@ -91,9 +89,7 @@ public class CollaboratorActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {

View File

@ -52,9 +52,7 @@ public class IssueActions {
case 401:
actionResult.finish(ActionResult.Status.FAILED, response);
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
context.getResources().getString(R.string.cancelButton), context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
default:
@ -119,9 +117,7 @@ public class IssueActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 403) {
@ -173,7 +169,7 @@ public class IssueActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle), ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton), ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {
@ -214,9 +210,7 @@ public class IssueActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {
@ -259,9 +253,7 @@ public class IssueActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getString(R.string.alertDialogTokenRevokedTitle),
context.getString(R.string.alertDialogTokenRevokedMessage), context.getString(R.string.cancelButton),
context.getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else {

View File

@ -48,9 +48,7 @@ public class MilestoneActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {

View File

@ -34,9 +34,7 @@ public class PullRequestActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
context.getResources().getString(R.string.cancelButton), context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {

View File

@ -38,9 +38,7 @@ public class RepositoryActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {
@ -84,9 +82,7 @@ public class RepositoryActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {
@ -130,9 +126,7 @@ public class RepositoryActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {
@ -174,9 +168,7 @@ public class RepositoryActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {

View File

@ -40,9 +40,7 @@ public class TeamActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {
@ -87,9 +85,7 @@ public class TeamActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {
@ -136,9 +132,7 @@ public class TeamActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {
@ -184,9 +178,7 @@ public class TeamActions {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
context.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
}
else if(response.code() == 403) {

View File

@ -208,10 +208,7 @@ public class CreateFileActivity extends BaseActivity {
case 401:
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
break;
case 404:
@ -272,10 +269,7 @@ public class CreateFileActivity extends BaseActivity {
case 401:
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
break;
case 404:
@ -336,10 +330,7 @@ public class CreateFileActivity extends BaseActivity {
case 401:
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
break;
case 404:

View File

@ -262,8 +262,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
else if(response2.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton), getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {

View File

@ -236,10 +236,7 @@ public class CreateLabelActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {
@ -294,10 +291,7 @@ public class CreateLabelActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {
@ -360,10 +354,7 @@ public class CreateLabelActivity extends BaseActivity {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {

View File

@ -159,10 +159,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {

View File

@ -140,10 +140,7 @@ public class CreateNewUserActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 403) {

View File

@ -153,10 +153,7 @@ public class CreateOrganizationActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 409) {

View File

@ -160,10 +160,7 @@ public class CreateReleaseActivity extends BaseActivity {
}
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 403) {
enableProcessButton();
@ -259,9 +256,7 @@ public class CreateReleaseActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 403) {
@ -320,8 +315,7 @@ public class CreateReleaseActivity extends BaseActivity {
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton), getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
}

View File

@ -186,10 +186,7 @@ public class CreateRepoActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 409) {
@ -269,8 +266,7 @@ public class CreateRepoActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton), getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
}

View File

@ -324,10 +324,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
}
else if(response2.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {

View File

@ -194,10 +194,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {
@ -340,8 +337,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton), getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {

View File

@ -187,11 +187,7 @@ public class FileViewActivity extends BaseActivity implements BottomSheetListene
switch(response.code()) {
case 401:
runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(ctx,
getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout)));
runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(ctx));
break;
case 403:

View File

@ -332,10 +332,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
}
else if(response2.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response2.code() == 403) {
@ -393,9 +390,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 403) {
@ -461,7 +456,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
TextView baseBranch = view.findViewById(R.id.baseBranch);
TextView headBranch = view.findViewById(R.id.headBranch);
baseBranch.setText(issue.getPullRequest().getHead().getRef());
baseBranch.setText(issue.getPullRequest().getBase().getRef());
headBranch.setText(issue.getPullRequest().getHead().getRef());
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx);
@ -573,9 +568,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 404) {

View File

@ -701,8 +701,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else {

View File

@ -217,8 +217,7 @@ public class MergePullRequestActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 404) {

View File

@ -123,8 +123,7 @@ public class MyProfileEmailActivity extends BaseActivity {
else if(response.code() == 401) {
enableProcessButton();
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton), getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 403) {

View File

@ -129,10 +129,7 @@ public class AdminCronTasksAdapter extends RecyclerView.Adapter<AdminCronTasksAd
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
break;
case 403:

View File

@ -261,10 +261,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
break;
case 403:

View File

@ -9,9 +9,11 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.RecyclerView;
import org.gitnex.tea4j.v2.models.User;
import org.mian.gitnex.R;
import org.mian.gitnex.actions.TeamActions;
import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.activities.ProfileActivity;
import org.mian.gitnex.clients.PicassoService;
@ -62,21 +64,8 @@ public class UserSearchForTeamMemberAdapter extends RecyclerView.Adapter<UserSea
addMemberButtonAdd = itemView.findViewById(R.id.addCollaboratorButtonAdd);
addMemberButtonRemove = itemView.findViewById(R.id.addCollaboratorButtonRemove);
addMemberButtonAdd.setOnClickListener(v -> {
AlertDialogs.addMemberDialog(context, userInfo.getLogin(),
context.getResources().getString(R.string.addTeamMemberTitle),
context.getResources().getString(R.string.addTeamMemberMessage),
context.getResources().getString(R.string.addButton),
context.getResources().getString(R.string.cancelButton), Integer.parseInt(String.valueOf(teamId)));
});
addMemberButtonRemove.setOnClickListener(v -> {
AlertDialogs.removeMemberDialog(context, userInfo.getLogin(),
context.getResources().getString(R.string.removeTeamMemberTitle),
context.getResources().getString(R.string.removeTeamMemberMessage),
context.getResources().getString(R.string.removeButton),
context.getResources().getString(R.string.cancelButton), Integer.parseInt(String.valueOf(teamId)));
});
addMemberButtonAdd.setOnClickListener(v -> AlertDialogs.addMemberDialog(context, userInfo.getLogin(), Integer.parseInt(String.valueOf(teamId))));
addMemberButtonRemove.setOnClickListener(v -> AlertDialogs.removeMemberDialog(context, userInfo.getLogin(), Integer.parseInt(String.valueOf(teamId))));
userAvatar.setOnClickListener(loginId -> {
Intent intent = new Intent(context, ProfileActivity.class);

View File

@ -103,8 +103,7 @@ public class CommitDetailFragment extends Fragment {
break;
case 401:
requireActivity().runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(requireContext(), getString(R.string.alertDialogTokenRevokedTitle),
getString(R.string.alertDialogTokenRevokedMessage), getString(R.string.cancelButton), getString(R.string.cancelButton)));
requireActivity().runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(requireContext()));
break;
case 403:

View File

@ -94,11 +94,7 @@ public class DiffFilesFragment extends Fragment {
break;
case 401:
requireActivity().runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(ctx,
getString(R.string.alertDialogTokenRevokedTitle),
getString(R.string.alertDialogTokenRevokedMessage),
getString(R.string.cancelButton),
getString(R.string.cancelButton)));
requireActivity().runOnUiThread(() -> AlertDialogs.authorizationTokenRevokedDialog(ctx));
break;
case 403:

View File

@ -262,10 +262,7 @@ public class RepoInfoFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage),
getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
break;
case 403:

View File

@ -136,7 +136,7 @@ public class DetailFragment extends Fragment {
case 401:
AlertDialogs
.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle), context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton), context.getResources().getString(R.string.navLogout));
.authorizationTokenRevokedDialog(context);
break;
case 403:

View File

@ -133,9 +133,7 @@ public class FollowersFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:
@ -193,9 +191,7 @@ public class FollowersFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:

View File

@ -133,9 +133,7 @@ public class FollowingFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:
@ -193,9 +191,7 @@ public class FollowingFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:

View File

@ -141,9 +141,7 @@ public class OrganizationsFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:
@ -201,9 +199,7 @@ public class OrganizationsFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:

View File

@ -134,9 +134,7 @@ public class RepositoriesFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:
@ -192,9 +190,7 @@ public class RepositoriesFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:

View File

@ -135,9 +135,7 @@ public class StarredRepositoriesFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:
@ -195,9 +193,7 @@ public class StarredRepositoriesFragment extends Fragment {
break;
case 401:
AlertDialogs.authorizationTokenRevokedDialog(context, getResources().getString(R.string.alertDialogTokenRevokedTitle),
getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.cancelButton),
getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(context);
break;
case 403:

View File

@ -20,37 +20,15 @@ import org.mian.gitnex.helpers.contexts.RepositoryContext;
public class AlertDialogs {
public static void authorizationTokenRevokedDialog(final Context context, String title, String message, String copyNegativeButton, String copyPositiveButton) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context)
.setTitle(title)
.setMessage(message)
public static void authorizationTokenRevokedDialog(final Context context) {
new AlertDialog.Builder(context)
.setTitle(R.string.alertDialogTokenRevokedTitle)
.setMessage(R.string.alertDialogTokenRevokedMessage)
.setCancelable(true)
.setIcon(R.drawable.ic_warning)
.setNeutralButton(copyNegativeButton, (dialog, which) -> dialog.dismiss())
.setPositiveButton(copyPositiveButton, (dialog, which) -> {
AppUtil.logout(context);
dialog.dismiss();
});
alertDialogBuilder.create().show();
}
public static void forceLogoutDialog(final Context context, String title, String message, String copyPositiveButton) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context)
.setTitle(title)
.setMessage(message)
.setCancelable(false)
.setIcon(R.drawable.ic_info)
.setPositiveButton(copyPositiveButton, (dialog, which) -> {
AppUtil.logout(context);
dialog.dismiss();
});
alertDialogBuilder.create().show();
.setNeutralButton(R.string.cancelButton, null)
.setPositiveButton(R.string.navLogout, (dialog, which) -> AppUtil.logout(context))
.show();
}
public static void labelDeleteDialog(final Context context, final String labelTitle, final String labelId, String type, String orgName,
@ -85,30 +63,30 @@ public class AlertDialogs {
}
public static void addMemberDialog(final Context context, final String userNameMain, String title, String message, String positiveButton, String negativeButton, int teamId) {
public static void addMemberDialog(final Context context, final String userNameMain, int teamId) {
new AlertDialog.Builder(context)
.setTitle(title + userNameMain)
.setMessage(message)
.setPositiveButton(positiveButton, (dialog, whichButton) -> TeamActions.addTeamMember(context, userNameMain, teamId))
.setNeutralButton(negativeButton, null).show();
.setTitle(context.getResources().getString(R.string.addTeamMember, userNameMain))
.setMessage(R.string.addTeamMemberMessage)
.setPositiveButton(R.string.addButton, (dialog, whichButton) -> TeamActions.addTeamMember(context, userNameMain, teamId))
.setNeutralButton(R.string.cancelButton, null).show();
}
public static void removeMemberDialog(final Context context, final String userNameMain, String title, String message, String positiveButton, String negativeButton, int teamId) {
public static void removeMemberDialog(final Context context, final String userNameMain, int teamId) {
new AlertDialog.Builder(context)
.setTitle(title + userNameMain)
.setMessage(message)
.setPositiveButton(positiveButton, (dialog, whichButton) -> TeamActions.removeTeamMember(context, userNameMain, teamId))
.setNeutralButton(negativeButton, null).show();
.setTitle(context.getResources().getString(R.string.removeTeamMember, userNameMain))
.setMessage(R.string.removeTeamMemberMessage)
.setPositiveButton(R.string.removeButton, (dialog, whichButton) -> TeamActions.removeTeamMember(context, userNameMain, teamId))
.setNeutralButton(R.string.cancelButton, null).show();
}
public static void addRepoDialog(final Context context, final String orgName, String repo, int teamId, String teamName) {
new AlertDialog.Builder(context)
.setTitle(context.getResources().getString(R.string.addTeamMemberTitle) + repo)
.setTitle(context.getResources().getString(R.string.addTeamMember) + repo)
.setMessage(context.getResources().getString(R.string.repoAddToTeamMessage, repo, orgName, teamName))
.setPositiveButton(context.getResources().getString(R.string.addButton), (dialog, whichButton) -> TeamActions.addTeamRepo(context, orgName, teamId, repo))
.setNeutralButton(context.getResources().getString(R.string.cancelButton), null).show();
@ -118,7 +96,7 @@ public class AlertDialogs {
public static void removeRepoDialog(final Context context, final String orgName, String repo, int teamId, String teamName) {
new AlertDialog.Builder(context)
.setTitle(context.getResources().getString(R.string.removeTeamMemberTitle) + repo)
.setTitle(context.getResources().getString(R.string.removeTeamMember) + repo)
.setMessage(context.getResources().getString(R.string.repoRemoveTeamMessage, repo, teamName))
.setPositiveButton(context.getResources().getString(R.string.removeButton), (dialog, whichButton) -> TeamActions.removeTeamRepo(context, orgName, teamId, repo))
.setNeutralButton(context.getResources().getString(R.string.cancelButton), null).show();

View File

@ -46,9 +46,7 @@ public class AdminCronTasksViewModel extends ViewModel {
tasksList.postValue(response.body());
}
else if(response.code() == 401) {
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
ctx.getResources().getString(R.string.navLogout));
AlertDialogs.authorizationTokenRevokedDialog(ctx);
}
else if(response.code() == 403) {
Toasty.error(ctx, ctx.getString(R.string.authorizeError));

View File

@ -240,7 +240,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:text="@string/createdText"
android:visibility="gone"
android:textColor="?attr/hintColor"
android:textSize="12sp" />

View File

@ -101,7 +101,7 @@
<string name="orgCreated">Organization created successfully</string>
<string name="orgExistsError">Organization already exists</string>
<string name="diffStatistics">%s addition(s) and %s deletion(s)</string>
<string name="diffStatistics">%1$s addition(s) and %2$s deletion(s)</string>
<string name="processingText">Processing</string>
<string name="search">Search</string>
@ -140,9 +140,6 @@
<string name="timeAtText">at</string>
<string name="hash" translatable="false">#</string>
<string name="createdText">Opened\u0020</string>
<string name="issueCreator">Creator :\u0020</string>
<string name="issueCommenter">Commenter:\u0020</string>
<string name="issueMilestone">Milestone %1$s</string>
<string name="dueDate">Due on %1$s</string>
<string name="assignedTo">Assigned to: %1$s</string>
@ -286,16 +283,16 @@
<string name="teamShowAll">show all</string>
<string name="orgMember">Org members</string>
<string name="orgTeamMembers">Organization team members</string>
<string name="removeTeamMemberTitle">Remove\u0020</string>
<string name="addTeamMemberTitle">Add\u0020</string>
<string name="removeTeamMember">Remove %s</string>
<string name="addTeamMember">Add %s</string>
<string name="addTeamMemberMessage">Do you want to add this user to the team?</string>
<string name="removeTeamMemberMessage">Do you want to remove this user from the team?</string>
<string name="memberAddedMessage">Member added to the team successfully</string>
<string name="memberRemovedMessage">Member removed from the team successfully</string>
<string name="repoAddedMessage">Repository added to the team successfully</string>
<string name="repoRemovedMessage">Repository removed from the team successfully</string>
<string name="repoAddToTeamMessage">Add repository %s to organization %s team %s</string>
<string name="repoRemoveTeamMessage">Remove repository %s from team %s</string>
<string name="repoAddToTeamMessage">Add repository %1$s to organization %2$s team %3$s</string>
<string name="repoRemoveTeamMessage">Remove repository %1$s from team %2$s</string>
<!-- org tabbed layout str -->
<!-- create team -->
@ -572,8 +569,8 @@
<string name="shareRepository">Share Repository</string>
<string name="createRepository">Create Repository</string>
<string name="commitTitle">Commits</string>
<string name="commitAuthoredByAndCommittedByWhen"><![CDATA[<b>%s</b> authored and <b>%s</b> committed %s]]></string>
<string name="commitCommittedByWhen"><![CDATA[<b>%s</b> committed %s]]></string>
<string name="commitAuthoredByAndCommittedByWhen"><![CDATA[<b>%1$s</b> authored and <b>%2$s</b> committed %3$s]]></string>
<string name="commitCommittedByWhen"><![CDATA[<b>%1$s</b> committed %2$s]]></string>
<string name="viewCommits">View Commits</string>
<string name="changelogTitle" translatable="false">Changelog</string>