From 8c1b07c2c8b7909c904df77cf143c2f1fecfa1e4 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Wed, 14 Sep 2022 20:40:44 +0200 Subject: [PATCH] Timeline issue/pr (#1201) Closes #953 Co-authored-by: M M Arif Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1201 Reviewed-by: qwerty287 --- .woodpecker/check.yml | 12 +- .../activities/AddNewAccountActivity.java | 6 +- .../gitnex/activities/CodeEditorActivity.java | 6 +- .../gitnex/activities/CreateFileActivity.java | 7 +- .../activities/CreateIssueActivity.java | 13 +- .../activities/CreatePullRequestActivity.java | 13 +- .../activities/CreateReleaseActivity.java | 13 +- .../gitnex/activities/CreateRepoActivity.java | 7 +- .../gitnex/activities/DeepLinksActivity.java | 6 +- .../gitnex/activities/EditIssueActivity.java | 14 +- .../activities/IssueDetailActivity.java | 103 ++- .../mian/gitnex/activities/LoginActivity.java | 19 +- .../mian/gitnex/activities/MainActivity.java | 22 +- .../gitnex/activities/ProfileActivity.java | 7 +- .../gitnex/activities/RepoDetailActivity.java | 36 +- .../mian/gitnex/adapters/CommitsAdapter.java | 14 +- .../gitnex/adapters/ExploreIssuesAdapter.java | 16 +- .../adapters/ExploreRepositoriesAdapter.java | 6 +- .../mian/gitnex/adapters/FilesAdapter.java | 6 +- .../gitnex/adapters/IssueCommentsAdapter.java | 593 ++++++++++++++++-- .../mian/gitnex/adapters/IssuesAdapter.java | 16 +- .../gitnex/adapters/PullRequestsAdapter.java | 16 +- .../mian/gitnex/adapters/ReleasesAdapter.java | 8 +- .../gitnex/adapters/RepoForksAdapter.java | 6 +- .../gitnex/adapters/ReposListAdapter.java | 12 +- .../BottomSheetSingleIssueFragment.java | 6 +- .../fragments/CommitDetailFragment.java | 17 +- .../fragments/ExploreIssuesFragment.java | 7 +- .../ExploreRepositoriesFragment.java | 7 +- .../fragments/ExploreUsersFragment.java | 7 +- .../mian/gitnex/fragments/FilesFragment.java | 7 +- .../mian/gitnex/fragments/IssuesFragment.java | 7 +- .../gitnex/fragments/MyIssuesFragment.java | 6 +- .../gitnex/fragments/MyProfileFragment.java | 7 +- .../fragments/MyRepositoriesFragment.java | 7 +- .../fragments/NotificationsFragment.java | 7 +- .../OrganizationTeamInfoReposFragment.java | 7 +- .../fragments/OrganizationsFragment.java | 7 +- .../fragments/PullRequestCommitsFragment.java | 7 +- .../fragments/PullRequestsFragment.java | 7 +- .../gitnex/fragments/RepoInfoFragment.java | 15 +- .../fragments/RepositoriesFragment.java | 7 +- .../gitnex/fragments/SettingsFragment.java | 10 +- .../StarredRepositoriesFragment.java | 7 +- .../fragments/profile/DetailFragment.java | 9 +- .../fragments/profile/FollowersFragment.java | 7 +- .../fragments/profile/FollowingFragment.java | 7 +- .../profile/OrganizationsFragment.java | 7 +- .../profile/RepositoriesFragment.java | 7 +- .../profile/StarredRepositoriesFragment.java | 7 +- .../java/org/mian/gitnex/helpers/AppUtil.java | 29 +- .../org/mian/gitnex/helpers/Markdown.java | 15 +- .../org/mian/gitnex/helpers/PicassoCache.java | 7 +- .../gitnex/helpers/RoundedTransformation.java | 7 +- .../gitnex/notifications/Notifications.java | 6 +- .../viewmodels/IssueCommentsViewModel.java | 74 ++- app/src/main/res/drawable/ic_bookmark.xml | 13 + app/src/main/res/drawable/ic_branch.xml | 70 ++- app/src/main/res/drawable/ic_browser.xml | 30 +- app/src/main/res/drawable/ic_clock.xml | 20 + app/src/main/res/drawable/ic_dependency.xml | 41 ++ app/src/main/res/drawable/ic_directory.xml | 11 +- app/src/main/res/drawable/ic_file.xml | 16 +- app/src/main/res/drawable/ic_flame.xml | 13 + app/src/main/res/drawable/ic_fork.xml | 47 +- app/src/main/res/drawable/ic_history.xml | 20 + app/src/main/res/drawable/ic_kanban.xml | 34 + app/src/main/res/drawable/ic_key.xml | 34 + app/src/main/res/drawable/ic_milestone.xml | 25 +- app/src/main/res/drawable/ic_organization.xml | 56 +- app/src/main/res/drawable/ic_pull_request.xml | 70 ++- .../drawable/{ic_reset.xml => ic_refresh.xml} | 8 +- app/src/main/res/drawable/ic_repo.xml | 21 +- app/src/main/res/drawable/ic_tag.xml | 20 + app/src/main/res/drawable/ic_update.xml | 27 - .../main/res/layout/activity_issue_detail.xml | 389 ++++++------ .../res/layout/bottom_sheet_organization.xml | 2 +- .../res/layout/bottom_sheet_releases_tags.xml | 2 +- app/src/main/res/layout/bottom_sheet_repo.xml | 2 +- .../res/layout/bottom_sheet_single_issue.xml | 41 +- .../res/layout/fragment_commit_details.xml | 41 +- app/src/main/res/layout/list_commits.xml | 24 +- app/src/main/res/layout/list_diff_files.xml | 6 +- .../main/res/layout/list_issue_comments.xml | 119 +++- app/src/main/res/layout/list_issues.xml | 51 +- app/src/main/res/layout/list_labels.xml | 2 +- .../res/layout/list_most_visited_repos.xml | 24 +- app/src/main/res/layout/list_pr.xml | 45 +- app/src/main/res/layout/list_releases.xml | 2 +- app/src/main/res/menu/reset_menu.xml | 6 +- app/src/main/res/values/strings.xml | 41 ++ 91 files changed, 2017 insertions(+), 667 deletions(-) create mode 100644 app/src/main/res/drawable/ic_bookmark.xml create mode 100644 app/src/main/res/drawable/ic_clock.xml create mode 100644 app/src/main/res/drawable/ic_dependency.xml create mode 100644 app/src/main/res/drawable/ic_flame.xml create mode 100644 app/src/main/res/drawable/ic_history.xml create mode 100644 app/src/main/res/drawable/ic_kanban.xml create mode 100644 app/src/main/res/drawable/ic_key.xml rename app/src/main/res/drawable/{ic_reset.xml => ic_refresh.xml} (85%) create mode 100644 app/src/main/res/drawable/ic_tag.xml delete mode 100644 app/src/main/res/drawable/ic_update.xml diff --git a/.woodpecker/check.yml b/.woodpecker/check.yml index 31ce0882..678558cb 100644 --- a/.woodpecker/check.yml +++ b/.woodpecker/check.yml @@ -7,12 +7,12 @@ pipeline: regex: " \\\\* \\\\@author [\\\\S\\\\s]+" must_contain: true - style: - image: qwerty287/woodpecker-intellij-formatter - group: check - settings: - file_pattern: "*.java" - path: "app/" + #style: + #image: qwerty287/woodpecker-intellij-formatter + #group: check + # settings: + #file_pattern: "*.java" + #path: "app/" test: image: alvrme/alpine-android:android-31-jdk11 diff --git a/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java b/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java index 0d198bae..c54c2265 100644 --- a/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/AddNewAccountActivity.java @@ -17,7 +17,11 @@ import org.mian.gitnex.database.api.BaseApi; import org.mian.gitnex.database.api.UserAccountsApi; import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.databinding.ActivityAddNewAccountBinding; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.PathsHelper; +import org.mian.gitnex.helpers.Toasty; +import org.mian.gitnex.helpers.UrlHelper; +import org.mian.gitnex.helpers.Version; import org.mian.gitnex.structs.Protocol; import java.net.URI; import java.util.Objects; diff --git a/app/src/main/java/org/mian/gitnex/activities/CodeEditorActivity.java b/app/src/main/java/org/mian/gitnex/activities/CodeEditorActivity.java index b8600723..c60da848 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CodeEditorActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CodeEditorActivity.java @@ -10,7 +10,11 @@ import com.amrdeveloper.codeview.Code; import org.apache.commons.lang3.EnumUtils; import org.mian.gitnex.R; import org.mian.gitnex.databinding.ActivityCodeEditorBinding; -import org.mian.gitnex.helpers.codeeditor.*; +import org.mian.gitnex.helpers.codeeditor.CustomCodeViewAdapter; +import org.mian.gitnex.helpers.codeeditor.LanguageManager; +import org.mian.gitnex.helpers.codeeditor.LanguageName; +import org.mian.gitnex.helpers.codeeditor.SourcePositionListener; +import org.mian.gitnex.helpers.codeeditor.ThemeName; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java index ab66764c..2dc2e8d7 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java @@ -15,7 +15,12 @@ import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import org.apache.commons.io.FilenameUtils; -import org.gitnex.tea4j.v2.models.*; +import org.gitnex.tea4j.v2.models.Branch; +import org.gitnex.tea4j.v2.models.CreateFileOptions; +import org.gitnex.tea4j.v2.models.DeleteFileOptions; +import org.gitnex.tea4j.v2.models.FileDeleteResponse; +import org.gitnex.tea4j.v2.models.FileResponse; +import org.gitnex.tea4j.v2.models.UpdateFileOptions; import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.databinding.ActivityCreateFileBinding; diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java index 51712f62..b78fb61f 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java @@ -12,7 +12,11 @@ import android.widget.ArrayAdapter; import android.widget.TextView; import androidx.annotation.NonNull; import com.google.android.material.dialog.MaterialAlertDialogBuilder; -import org.gitnex.tea4j.v2.models.*; +import org.gitnex.tea4j.v2.models.CreateIssueOption; +import org.gitnex.tea4j.v2.models.Issue; +import org.gitnex.tea4j.v2.models.Label; +import org.gitnex.tea4j.v2.models.Milestone; +import org.gitnex.tea4j.v2.models.User; import org.mian.gitnex.R; import org.mian.gitnex.actions.AssigneesActions; import org.mian.gitnex.actions.LabelsActions; @@ -28,7 +32,12 @@ import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.contexts.RepositoryContext; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Objects; import retrofit2.Call; import retrofit2.Callback; diff --git a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java index ae003072..951238cf 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java @@ -11,7 +11,11 @@ import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import com.google.android.material.dialog.MaterialAlertDialogBuilder; -import org.gitnex.tea4j.v2.models.*; +import org.gitnex.tea4j.v2.models.Branch; +import org.gitnex.tea4j.v2.models.CreatePullRequestOption; +import org.gitnex.tea4j.v2.models.Label; +import org.gitnex.tea4j.v2.models.Milestone; +import org.gitnex.tea4j.v2.models.PullRequest; import org.mian.gitnex.R; import org.mian.gitnex.actions.LabelsActions; import org.mian.gitnex.adapters.LabelsListAdapter; @@ -22,7 +26,12 @@ import org.mian.gitnex.fragments.PullRequestsFragment; import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.contexts.RepositoryContext; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Objects; import retrofit2.Call; import retrofit2.Callback; diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java index eb520339..8fa49cb9 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java @@ -8,9 +8,18 @@ import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; -import android.widget.*; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageView; import androidx.annotation.NonNull; -import org.gitnex.tea4j.v2.models.*; +import org.gitnex.tea4j.v2.models.Branch; +import org.gitnex.tea4j.v2.models.CreateReleaseOption; +import org.gitnex.tea4j.v2.models.CreateTagOption; +import org.gitnex.tea4j.v2.models.Release; +import org.gitnex.tea4j.v2.models.Tag; import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.databinding.ActivityCreateReleaseBinding; diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java index b1189e85..46431ecb 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateRepoActivity.java @@ -7,7 +7,12 @@ import android.os.Looper; import android.util.Log; import android.view.View; import android.view.inputmethod.InputMethodManager; -import android.widget.*; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageView; import androidx.annotation.NonNull; import org.gitnex.tea4j.v2.models.CreateRepoOption; import org.gitnex.tea4j.v2.models.Organization; diff --git a/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java b/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java index 8d5bc133..42b54b10 100644 --- a/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java @@ -9,7 +9,11 @@ import android.util.Log; import android.view.View; import androidx.annotation.NonNull; import org.apache.commons.lang3.StringUtils; -import org.gitnex.tea4j.v2.models.*; +import org.gitnex.tea4j.v2.models.ContentsResponse; +import org.gitnex.tea4j.v2.models.Organization; +import org.gitnex.tea4j.v2.models.PullRequest; +import org.gitnex.tea4j.v2.models.Repository; +import org.gitnex.tea4j.v2.models.User; import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.database.api.BaseApi; diff --git a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java index f350766d..88c23200 100644 --- a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java @@ -11,7 +11,12 @@ import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; -import android.widget.*; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; import androidx.annotation.NonNull; import org.gitnex.tea4j.v2.models.EditIssueOption; import org.gitnex.tea4j.v2.models.Issue; @@ -28,7 +33,12 @@ import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.contexts.IssueContext; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Objects; import retrofit2.Call; import retrofit2.Callback; diff --git a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java index 39528963..6406b878 100644 --- a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java @@ -16,7 +16,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.RelativeLayout; import android.widget.ScrollView; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; @@ -94,7 +93,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt private String repoName; private int issueIndex; private String issueCreator; - private IssueContext issue; + public IssueContext issue; private LabelsListAdapter labelsAdapter; private AssigneesListAdapter assigneesAdapter; private List currentLabelsIds = new ArrayList<>(); @@ -124,6 +123,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt } } }); + private int page = 1; @Override public void onCreate(Bundle savedInstanceState) { @@ -164,10 +164,11 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt viewBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { + page = 1; viewBinding.pullToRefresh.setRefreshing(false); - issueCommentsModel.loadIssueComments(repoOwner, repoName, issueIndex, ctx); + issueCommentsModel.loadIssueComments(repoOwner, repoName, issueIndex, ctx, null); - }, 500)); + }, 50)); Typeface myTypeface = AppUtil.getTypeface(this); viewBinding.toolbarTitle.setTypeface(myTypeface); @@ -459,7 +460,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt viewBinding.scrollViewComments.post(() -> { - issueCommentsModel.loadIssueComments(repoOwner, repoName, issueIndex, ctx); + issueCommentsModel.loadIssueComments(repoOwner, repoName, issueIndex, ctx, null); commentEdited = false; }); } @@ -482,21 +483,37 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt issueCommentsModel.getIssueCommentList(owner, repo, index, ctx).observe(this, issueCommentsMain -> { - assert issueCommentsMain != null; - Bundle bundle = new Bundle(); bundle.putString("repoOwner", repoOwner); bundle.putString("repoName", repoName); bundle.putInt("issueNumber", issueIndex); adapter = new IssueCommentsAdapter(ctx, bundle, issueCommentsMain, getSupportFragmentManager(), this::onResume, issue); + adapter.setLoadMoreListener(new IssueCommentsAdapter.OnLoadMoreListener() { + @Override + public void onLoadMore() { + + page += 1; + issueCommentsModel.loadMoreIssueComments(owner, repo, index, ctx, page, adapter); + viewBinding.progressBar.setVisibility(View.VISIBLE); + } + + @Override + public void onLoadFinished() { + + viewBinding.progressBar.setVisibility(View.GONE); + } + }); + + adapter.notifyDataChanged(); viewBinding.recyclerView.setAdapter(adapter); - + viewBinding.progressBar.setVisibility(View.GONE); }); } private void getSingleIssue(String repoOwner, String repoName, int issueIndex) { + if(issue.hasIssue()) { viewBinding.progressBar.setVisibility(View.GONE); getSubscribed(); @@ -570,6 +587,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt } private void initWithIssue() { + if(!issue.getRepository().hasRepository()) { getRepoInfo(); } @@ -663,12 +681,18 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt }); } - Markdown.render(ctx, EmojiParser.parseToUnicode(cleanIssueDescription), viewBinding.issueDescription, issue.getRepository()); + viewBinding.author.setText(issue.getIssue().getUser().getLogin()); - RelativeLayout.LayoutParams paramsDesc = (RelativeLayout.LayoutParams) viewBinding.issueDescription.getLayoutParams(); + if(!cleanIssueDescription.equals("")) { + viewBinding.issueDescription.setVisibility(View.VISIBLE); + Markdown.render(ctx, EmojiParser.parseToUnicode(cleanIssueDescription), viewBinding.issueDescription, issue.getRepository()); + } + else { + viewBinding.issueDescription.setVisibility(View.GONE); + } - LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(80, 80); - params1.setMargins(15, 0, 0, 0); + LinearLayout.LayoutParams paramsAssignees = new LinearLayout.LayoutParams(64, 64); + paramsAssignees.setMargins(15, 0, 0, 0); if(issue.getIssue().getAssignees() != null) { @@ -678,11 +702,11 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt ImageView assigneesView = new ImageView(ctx); - PicassoService.getInstance(ctx).get().load(issue.getIssue().getAssignees().get(i).getAvatarUrl()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(48, 0)).resize(96, 96) + PicassoService.getInstance(ctx).get().load(issue.getIssue().getAssignees().get(i).getAvatarUrl()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(36, 0)).resize(72, 72) .centerCrop().into(assigneesView); viewBinding.frameAssignees.addView(assigneesView); - assigneesView.setLayoutParams(params1); + assigneesView.setLayoutParams(paramsAssignees); int finalI = i; @@ -699,17 +723,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt return true; }); } - - /*if(!issue.getIssue().getAssignees().get(i).getFull_name().equals("")) { - - assigneesView.setOnClickListener( - new ClickListener(getString(R.string.assignedTo, issue.getIssue().getAssignees().get(i).getFull_name()), ctx)); - } - else { - - assigneesView.setOnClickListener( - new ClickListener(getString(R.string.assignedTo, issue.getIssue().getAssignees().get(i).getLogin()), ctx)); - }*/ } } else { @@ -717,10 +730,10 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt viewBinding.assigneesScrollView.setVisibility(View.GONE); } - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); - params.setMargins(0, 0, 15, 0); + LinearLayout.LayoutParams paramsLabels = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); + paramsLabels.setMargins(0, 0, 15, 0); - if(issue.getIssue().getLabels() != null) { + if(issue.getIssue().getLabels().size() > 0) { viewBinding.labelsScrollView.setVisibility(View.VISIBLE); @@ -733,7 +746,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt ImageView labelsView = new ImageView(ctx); viewBinding.frameLabels.setOrientation(LinearLayout.HORIZONTAL); viewBinding.frameLabels.setGravity(Gravity.START | Gravity.TOP); - labelsView.setLayoutParams(params); + labelsView.setLayoutParams(paramsLabels); int height = AppUtil.getPixelsFromDensity(ctx, 20); int textSize = AppUtil.getPixelsFromScaledDensity(ctx, 12); @@ -787,27 +800,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt viewBinding.issueModified.setVisibility(View.INVISIBLE); } - if((issue.getIssue().getDueDate() == null && issue.getIssue().getMilestone() == null) && issue.getIssue().getAssignees() != null) { - - paramsDesc.setMargins(0, 35, 0, 0); - viewBinding.issueDescription.setLayoutParams(paramsDesc); - } - else if(issue.getIssue().getDueDate() == null && issue.getIssue().getMilestone() == null) { - - paramsDesc.setMargins(0, 55, 0, 0); - viewBinding.issueDescription.setLayoutParams(paramsDesc); - } - else if(issue.getIssue().getAssignees() == null) { - - paramsDesc.setMargins(0, 35, 0, 0); - viewBinding.issueDescription.setLayoutParams(paramsDesc); - } - else { - - paramsDesc.setMargins(0, 15, 0, 0); - viewBinding.issueDescription.setLayoutParams(paramsDesc); - } - viewBinding.issueCreatedTime.setText(TimeHelper.formatTime(issue.getIssue().getCreatedAt(), locale, timeFormat, ctx)); viewBinding.issueCreatedTime.setVisibility(View.VISIBLE); @@ -842,17 +834,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt viewBinding.milestoneFrame.setVisibility(View.GONE); } - - /*if(!issue.getIssue().getUser().getFull_name().equals("")) { - - viewBinding.assigneeAvatar.setOnClickListener( - new ClickListener(ctx.getResources().getString(R.string.issueCreator) + issue.getIssue().getUser().getFull_name(), ctx)); - } - else { - - viewBinding.assigneeAvatar.setOnClickListener( - new ClickListener(ctx.getResources().getString(R.string.issueCreator) + issue.getIssue().getUser().getLogin(), ctx)); - }*/ } private void getPullRequest() { diff --git a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java index f686a70d..d37e48ca 100644 --- a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java @@ -3,17 +3,30 @@ package org.mian.gitnex.activities; import android.content.Intent; import android.os.Bundle; import android.view.View; -import android.widget.*; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.Button; +import android.widget.EditText; +import android.widget.RadioGroup; import androidx.annotation.NonNull; import com.google.android.material.dialog.MaterialAlertDialogBuilder; -import org.gitnex.tea4j.v2.models.*; +import org.gitnex.tea4j.v2.models.AccessToken; +import org.gitnex.tea4j.v2.models.CreateAccessTokenOption; +import org.gitnex.tea4j.v2.models.GeneralAPISettings; +import org.gitnex.tea4j.v2.models.ServerVersion; +import org.gitnex.tea4j.v2.models.User; import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.database.api.BaseApi; import org.mian.gitnex.database.api.UserAccountsApi; import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.databinding.ActivityLoginBinding; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.NetworkStatusObserver; +import org.mian.gitnex.helpers.PathsHelper; +import org.mian.gitnex.helpers.Toasty; +import org.mian.gitnex.helpers.UrlHelper; +import org.mian.gitnex.helpers.Version; import org.mian.gitnex.structs.Protocol; import java.net.URI; import java.nio.charset.StandardCharsets; diff --git a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java index aef956ac..e3780102 100644 --- a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java @@ -34,8 +34,26 @@ import org.mian.gitnex.database.api.BaseApi; import org.mian.gitnex.database.api.UserAccountsApi; import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.databinding.ActivityMainBinding; -import org.mian.gitnex.fragments.*; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.fragments.AdministrationFragment; +import org.mian.gitnex.fragments.BottomSheetDraftsFragment; +import org.mian.gitnex.fragments.BottomSheetMyIssuesFilterFragment; +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.MyProfileFragment; +import org.mian.gitnex.fragments.MyRepositoriesFragment; +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; +import org.mian.gitnex.helpers.AlertDialogs; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ChangeLog; +import org.mian.gitnex.helpers.ColorInverter; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.structs.BottomSheetListener; import org.mian.gitnex.structs.FragmentRefreshListener; import java.util.ArrayList; diff --git a/app/src/main/java/org/mian/gitnex/activities/ProfileActivity.java b/app/src/main/java/org/mian/gitnex/activities/ProfileActivity.java index 81bd4865..50f88ede 100644 --- a/app/src/main/java/org/mian/gitnex/activities/ProfileActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/ProfileActivity.java @@ -19,7 +19,12 @@ import com.google.android.material.tabs.TabLayoutMediator; import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.fragments.BottomSheetUserProfileFragment; -import org.mian.gitnex.fragments.profile.*; +import org.mian.gitnex.fragments.profile.DetailFragment; +import org.mian.gitnex.fragments.profile.FollowersFragment; +import org.mian.gitnex.fragments.profile.FollowingFragment; +import org.mian.gitnex.fragments.profile.OrganizationsFragment; +import org.mian.gitnex.fragments.profile.RepositoriesFragment; +import org.mian.gitnex.fragments.profile.StarredRepositoriesFragment; import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.structs.BottomSheetListener; diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java index c77e5a78..ccc38432 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java @@ -6,7 +6,12 @@ import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Typeface; import android.os.Bundle; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.activity.result.ActivityResultLauncher; @@ -21,10 +26,27 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.progressindicator.LinearProgressIndicator; import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; -import org.gitnex.tea4j.v2.models.*; +import org.gitnex.tea4j.v2.models.Branch; +import org.gitnex.tea4j.v2.models.Milestone; +import org.gitnex.tea4j.v2.models.Organization; +import org.gitnex.tea4j.v2.models.Repository; +import org.gitnex.tea4j.v2.models.WatchInfo; import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; -import org.mian.gitnex.fragments.*; +import org.mian.gitnex.fragments.BottomSheetIssuesFilterFragment; +import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment; +import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment; +import org.mian.gitnex.fragments.BottomSheetReleasesTagsFragment; +import org.mian.gitnex.fragments.BottomSheetRepoFragment; +import org.mian.gitnex.fragments.CollaboratorsFragment; +import org.mian.gitnex.fragments.FilesFragment; +import org.mian.gitnex.fragments.IssuesFragment; +import org.mian.gitnex.fragments.LabelsFragment; +import org.mian.gitnex.fragments.MilestonesFragment; +import org.mian.gitnex.fragments.PullRequestsFragment; +import org.mian.gitnex.fragments.ReleasesFragment; +import org.mian.gitnex.fragments.RepoInfoFragment; +import org.mian.gitnex.fragments.WikiFragment; import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.contexts.RepositoryContext; @@ -85,6 +107,8 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetListe private FragmentRefreshListener fragmentRefreshListenerFilterIssuesByMilestone; private FragmentRefreshListener fragmentRefreshListenerReleases; private Dialog progressDialog; + private MaterialAlertDialogBuilder materialAlertDialogBuilder; + private Intent intentWiki; private final ActivityResultLauncher createReleaseLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> { if(result.getResultCode() == 201) { assert result.getData() != null; @@ -97,8 +121,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetListe } } }); - private MaterialAlertDialogBuilder materialAlertDialogBuilder; - private Intent intentWiki; @Override public void onCreate(Bundle savedInstanceState) { @@ -143,7 +165,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetListe } @Override - public boolean onCreateOptionsMenu(Menu menu) { + public boolean onCreateOptionsMenu(@NonNull Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.repo_dotted_menu, menu); @@ -857,6 +879,4 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetListe } } - - } diff --git a/app/src/main/java/org/mian/gitnex/adapters/CommitsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/CommitsAdapter.java index 2051e546..638381ad 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/CommitsAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/CommitsAdapter.java @@ -11,6 +11,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.core.text.HtmlCompat; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.card.MaterialCardView; import com.vdurmont.emoji.EmojiParser; import org.gitnex.tea4j.v2.models.Commit; import org.mian.gitnex.R; @@ -99,6 +100,8 @@ public class CommitsAdapter extends RecyclerView.Adapter { @@ -248,6 +257,11 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter 15) { + commentIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_flame)); + commentIcon.setColorFilter(context.getResources().getColor(R.color.releasePre, null)); + } + switch(timeFormat) { case "pretty": { PrettyTime prettyTime = new PrettyTime(locale); diff --git a/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java index 20952faf..7ac6ef7b 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/ExploreRepositoriesAdapter.java @@ -17,7 +17,11 @@ import com.amulyakhare.textdrawable.util.ColorGenerator; import org.mian.gitnex.R; import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.clients.PicassoService; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.ocpsoft.prettytime.PrettyTime; import java.text.DateFormat; diff --git a/app/src/main/java/org/mian/gitnex/adapters/FilesAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/FilesAdapter.java index e8779541..12531975 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/FilesAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/FilesAdapter.java @@ -4,7 +4,11 @@ import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.*; +import android.widget.Filter; +import android.widget.Filterable; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.content.res.AppCompatResources; import androidx.recyclerview.widget.RecyclerView; diff --git a/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java index 1918d8f4..7fe1babe 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java @@ -5,29 +5,55 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; +import android.graphics.Color; +import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ImageSpan; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.core.content.res.ResourcesCompat; +import androidx.core.text.HtmlCompat; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; +import com.amulyakhare.textdrawable.TextDrawable; import com.google.android.material.bottomsheet.BottomSheetDialog; +import com.google.android.material.card.MaterialCardView; import com.vdurmont.emoji.EmojiParser; -import org.gitnex.tea4j.v2.models.Comment; +import org.apache.commons.lang3.StringUtils; +import org.gitnex.tea4j.v2.models.TimelineComment; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; import org.mian.gitnex.R; import org.mian.gitnex.activities.BaseActivity; +import org.mian.gitnex.activities.CommitDetailActivity; +import org.mian.gitnex.activities.IssueDetailActivity; import org.mian.gitnex.activities.ProfileActivity; import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.fragments.BottomSheetReplyFragment; import org.mian.gitnex.fragments.IssuesFragment; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AlertDialogs; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ColorInverter; +import org.mian.gitnex.helpers.LabelWidthCalculator; +import org.mian.gitnex.helpers.Markdown; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; +import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.contexts.IssueContext; import org.mian.gitnex.views.ReactionList; import org.mian.gitnex.views.ReactionSpinner; @@ -41,18 +67,21 @@ import retrofit2.Callback; * @author M M Arif */ -public class IssueCommentsAdapter extends RecyclerView.Adapter { +public class IssueCommentsAdapter extends RecyclerView.Adapter { private final Context context; private final TinyDB tinyDB; private final Bundle bundle; - private final List issuesComments; private final FragmentManager fragmentManager; private final Runnable onInteractedListener; private final Locale locale; private final IssueContext issue; + private List issuesComments; + private OnLoadMoreListener loadMoreListener; + private boolean isLoading = false, isMoreDataAvailable = true, timelineLastView = false; + private Intent intent; - public IssueCommentsAdapter(Context ctx, Bundle bundle, List issuesCommentsMain, FragmentManager fragmentManager, Runnable onInteractedListener, IssueContext issue) { + public IssueCommentsAdapter(Context ctx, Bundle bundle, List issuesCommentsMain, FragmentManager fragmentManager, Runnable onInteractedListener, IssueContext issue) { this.context = ctx; this.bundle = bundle; @@ -75,7 +104,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter call = RetrofitClient.getApiInterface(ctx).issueDeleteComment(issue.getRepository().getOwner(), issue.getRepository().getName(), (long) commentId); - call.enqueue(new Callback() { + call.enqueue(new Callback<>() { @Override public void onResponse(@NonNull Call call, @NonNull retrofit2.Response response) { @@ -116,63 +145,47 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter TimeHelper.customDateFormatForToastDateFormat(issueComment.getCreatedAt())); - } - else if(timeFormat.equals("normal")) { - informationBuilder = new StringBuilder(TimeHelper.formatTime(issueComment.getCreatedAt(), locale, "normal", context)); - } - - if(!issueComment.getCreatedAt().equals(issueComment.getUpdatedAt())) { - if(informationBuilder != null) { - informationBuilder.append(context.getString(R.string.colorfulBulletSpan)).append(context.getString(R.string.modifiedText)); - } - } + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) { + isLoading = true; + loadMoreListener.onLoadMore(); + timelineLastView = true; } - holder.information.setText(informationBuilder); + ((IssueCommentsAdapter.IssueCommentViewHolder) holder).bindData(issuesComments.get(position)); + } - Bundle bundle1 = new Bundle(); - bundle1.putAll(bundle); - bundle1.putInt("commentId", Math.toIntExact(issueComment.getId())); + public void notifyDataChanged() { + notifyItemInserted(issuesComments.size()); + isLoading = false; + loadMoreListener.onLoadFinished(); + } - ReactionList reactionList = new ReactionList(context, bundle1); + public void setMoreDataAvailable(boolean moreDataAvailable) { + isMoreDataAvailable = moreDataAvailable; + if(!isMoreDataAvailable) { + loadMoreListener.onLoadFinished(); + } + } - holder.commentReactionBadges.addView(reactionList); - reactionList.setOnReactionAddedListener(() -> { + public void setLoadMoreListener(OnLoadMoreListener loadMoreListener) { + this.loadMoreListener = loadMoreListener; + } - if(holder.commentReactionBadges.getVisibility() != View.VISIBLE) { - holder.commentReactionBadges.post(() -> holder.commentReactionBadges.setVisibility(View.VISIBLE)); - } - }); + public void updateList(List list) { + issuesComments = list; + notifyDataChanged(); + } + @Override + public int getItemViewType(int position) { + return position; } @Override @@ -180,6 +193,12 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter { final String loginUid = ((BaseActivity) context).getAccount().getAccount().getUserName(); @@ -325,7 +358,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter { - deleteIssueComment(context, Math.toIntExact(issueComment.getId()), getAdapterPosition()); + deleteIssueComment(context, Math.toIntExact(issueComment.getId()), getBindingAdapterPosition()); dialog.dismiss(); }); @@ -347,6 +380,456 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter TimeHelper.customDateFormatForToastDateFormat(issueComment.getCreatedAt())); + } + else if(timeFormat.equals("normal")) { + informationBuilder = new StringBuilder(TimeHelper.formatTime(issueComment.getCreatedAt(), locale, "normal", context)); + } + + if(!issueComment.getCreatedAt().equals(issueComment.getUpdatedAt())) { + if(informationBuilder != null) { + informationBuilder.append(context.getString(R.string.colorfulBulletSpan)).append(context.getString(R.string.modifiedText)); + } + } + } + + // label view in timeline + if(issueComment.getType().equalsIgnoreCase("label")) { + + int color = Color.parseColor("#" + issueComment.getLabel().getColor()); + int height = AppUtil.getPixelsFromDensity(context, 20); + int textSize = AppUtil.getPixelsFromScaledDensity(context, 12); + + TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).textColor(new ColorInverter().getContrastColor(color)).fontSize(textSize) + .width(LabelWidthCalculator.calculateLabelWidth(issueComment.getLabel().getName(), Typeface.DEFAULT, textSize, AppUtil.getPixelsFromDensity(context, 10))).height(height).endConfig() + .buildRoundRect(issueComment.getLabel().getName(), color, AppUtil.getPixelsFromDensity(context, 18)); + + TextView textView = new TextView(context); + String startText; + String endText = context.getString(R.string.timelineLabelEnd, informationBuilder); + + if(issueComment.getBody().equals("")) { + startText = context.getString(R.string.timelineRemovedLabelStart, issueComment.getUser().getLogin()); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + else { + startText = context.getString(R.string.timelineAddedLabelStart, issueComment.getUser().getLogin()); + } + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_tag)); + + SpannableString spannableString = new SpannableString(startText + " " + endText); + + drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); + ImageSpan image = new ImageSpan(drawable); + + new Handler().postDelayed(() -> { + + spannableString.setSpan(image, startText.length(), startText.length() + 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); + textView.setText(spannableString); + timelineData.addView(textView); + }, 250); + } + // pull/push/commit data view in timeline + else if(issueComment.getType().equalsIgnoreCase("pull_push")) { + + TextView start = new TextView(context); + + JSONObject commitsObj = null; + try { + commitsObj = new JSONObject(issueComment.getBody()); + } + catch(JSONException ignored) {} + + JSONArray commitsShaArray = null; + try { + commitsShaArray = Objects.requireNonNull(commitsObj).getJSONArray("commit_ids"); + } + catch(JSONException ignored) {} + + String commitText = context.getResources().getString(R.string.commits).toLowerCase(); + if(Objects.requireNonNull(commitsShaArray).length() == 1) { + commitText = context.getResources().getString(R.string.commitText).toLowerCase(); + } + + String commitString = context.getString(R.string.timelineAddedCommit, issueComment.getUser().getLogin()) + commitText + " " + informationBuilder; + start.setText(HtmlCompat.fromHtml(commitString, HtmlCompat.FROM_HTML_MODE_LEGACY)); + start.setTextSize(fontSize); + + timelineData.setOrientation(LinearLayout.VERTICAL); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_commit)); + timelineData.addView(start); + + for(int i = 0; i < Objects.requireNonNull(commitsShaArray).length(); i++) { + + try { + + String timelineCommits = "" + StringUtils.substring(String.valueOf(commitsShaArray.get(i)), 0, 10) + ""; + + TextView dynamicCommitTv = new TextView(context); + dynamicCommitTv.setId(View.generateViewId()); + + dynamicCommitTv.setText(HtmlCompat.fromHtml(timelineCommits, HtmlCompat.FROM_HTML_MODE_LEGACY)); + + JSONArray finalCommitsArray = commitsShaArray; + int finalI = i; + + dynamicCommitTv.setOnClickListener(v14 -> { + intent = IssueContext.fromIntent(((IssueDetailActivity) context).getIntent()).getRepository().getIntent(context, CommitDetailActivity.class); + try { + intent.putExtra("sha", (String) finalCommitsArray.get(finalI)); + } + catch(JSONException ignored) {} + context.startActivity(intent); + }); + + timelineData.setOrientation(LinearLayout.VERTICAL); + timelineData.addView(dynamicCommitTv); + } + catch(JSONException ignored) {} + } + } + // assignees data view in timeline + else if(issueComment.getType().equalsIgnoreCase("assignees")) { + + TextView start = new TextView(context); + + if(issueComment.isRemovedAssignee()) { + + if(issueComment.getUser().getLogin().equalsIgnoreCase(issueComment.getAssignee().getLogin())) { + start.setText(context.getString(R.string.timelineAssigneesRemoved, issueComment.getUser().getLogin(), informationBuilder)); + } + else { + start.setText(context.getString(R.string.timelineAssigneesUnassigned, issueComment.getAssignee().getLogin(), issueComment.getUser().getLogin(), informationBuilder)); + } + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + else { + if(issueComment.getUser().getLogin().equalsIgnoreCase(issueComment.getAssignee().getLogin())) { + start.setText(context.getString(R.string.timelineAssigneesSelfAssigned, issueComment.getUser().getLogin(), informationBuilder)); + } + else { + start.setText(context.getString(R.string.timelineAssigneesAssigned, issueComment.getAssignee().getLogin(), issueComment.getUser().getLogin(), informationBuilder)); + } + } + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_person)); + timelineData.addView(start); + } + // milestone data view in timeline + else if(issueComment.getType().equalsIgnoreCase("milestone")) { + + TextView start = new TextView(context); + + if(issueComment.getMilestone() != null) { + start.setText(context.getString(R.string.timelineMilestoneAdded, issueComment.getUser().getLogin(), issueComment.getMilestone().getTitle(), informationBuilder)); + } + else { + start.setText(context.getString(R.string.timelineMilestoneRemoved, issueComment.getUser().getLogin(), issueComment.getOldMilestone().getTitle(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_milestone)); + timelineData.addView(start); + } + // status view in timeline + else if(issueComment.getType().equalsIgnoreCase("close") || issueComment.getType().equalsIgnoreCase("reopen") || issueComment.getType().equalsIgnoreCase("merge_pull") || issueComment.getType() + .equalsIgnoreCase("commit_ref")) { + + TextView start = new TextView(context); + + if(issue.getIssueType().equalsIgnoreCase("Issue")) { + if(issueComment.getType().equals("close")) { + start.setText(context.getString(R.string.timelineStatusClosedIssue, issueComment.getUser().getLogin(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + else if(issueComment.getType().equalsIgnoreCase("reopen")) { + start.setText(context.getString(R.string.timelineStatusReopenedIssue, issueComment.getUser().getLogin(), informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("commit_ref")) { + String commitString = context.getString(R.string.timelineStatusRefIssue, issueComment.getUser().getLogin()) + "" + context.getResources().getString(R.string.commitText).toLowerCase() + " " + informationBuilder; + start.setText(HtmlCompat.fromHtml(commitString, HtmlCompat.FROM_HTML_MODE_LEGACY)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark)); + + start.setOnClickListener(v14 -> { + intent = IssueContext.fromIntent(((IssueDetailActivity) context).getIntent()).getRepository().getIntent(context, CommitDetailActivity.class); + intent.putExtra("sha", issueComment.getRefCommitSha()); + context.startActivity(intent); + }); + } + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_issue)); + } + else if(issue.getIssueType().equalsIgnoreCase("Pull")) { + if(issueComment.getType().equalsIgnoreCase("close")) { + start.setText(context.getString(R.string.timelineStatusClosedPr, issueComment.getUser().getLogin(), informationBuilder)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_pull_request)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + else if(issueComment.getType().equalsIgnoreCase("merge_pull")) { + start.setText(context.getString(R.string.timelineStatusMergedPr, issueComment.getUser().getLogin(), informationBuilder)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_pull_request)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconPrMergedColor, null)); + } + else if(issueComment.getType().equalsIgnoreCase("commit_ref")) { + String commitString = context.getString(R.string.timelineStatusRefPr, issueComment.getUser().getLogin()) + "" + context.getResources().getString(R.string.commitText).toLowerCase() + " " + informationBuilder; + start.setText(HtmlCompat.fromHtml(commitString, HtmlCompat.FROM_HTML_MODE_LEGACY)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark)); + + start.setOnClickListener(v14 -> { + intent = IssueContext.fromIntent(((IssueDetailActivity) context).getIntent()).getRepository().getIntent(context, CommitDetailActivity.class); + intent.putExtra("sha", issueComment.getRefCommitSha()); + context.startActivity(intent); + }); + } + else { + start.setText(context.getString(R.string.timelineStatusReopenedPr, issueComment.getUser().getLogin(), informationBuilder)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_pull_request)); + } + } + start.setTextSize(fontSize); + + timelineData.addView(start); + } + // review data view in timeline + else if(issueComment.getType().equalsIgnoreCase("review_request") || issueComment.getType().equalsIgnoreCase("review") || issueComment.getType().equalsIgnoreCase("dismiss_review")) { + + TextView start = new TextView(context); + + if(issueComment.getType().equalsIgnoreCase("review")) { + timelineView.setVisibility(View.GONE); + timelineDividerView.setVisibility(View.GONE); + } + else if(issueComment.getType().equalsIgnoreCase("dismiss_review")) { + timelineView.setVisibility(View.GONE); + timelineDividerView.setVisibility(View.GONE); + } + else if(issueComment.getType().equalsIgnoreCase("review_request")) { + start.setText(context.getString(R.string.timelineReviewRequest, issueComment.getUser().getLogin(), issueComment.getAssignee().getLogin(), informationBuilder)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_unwatch)); + } + start.setTextSize(fontSize); + + timelineData.addView(start); + } + // change title data view in timeline + else if(issueComment.getType().equalsIgnoreCase("change_title")) { + + TextView start = new TextView(context); + start.setText(context.getString(R.string.timelineChangeTitle, issueComment.getUser().getLogin(), issueComment.getOldTitle(), issueComment.getNewTitle(), informationBuilder)); + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_edit)); + timelineData.addView(start); + } + // lock/unlock data view in timeline + else if(issueComment.getType().equalsIgnoreCase("lock") || issueComment.getType().equalsIgnoreCase("unlock")) { + + TextView start = new TextView(context); + + if(issueComment.getType().equalsIgnoreCase("lock")) { + start.setText(context.getString(R.string.timelineLocked, issueComment.getUser().getLogin(), issueComment.getBody(), informationBuilder)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_lock)); + } + else if(issueComment.getType().equalsIgnoreCase("unlock")) { + start.setText(context.getString(R.string.timelineUnlocked, issueComment.getUser().getLogin(), informationBuilder)); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_key)); + } + start.setTextSize(fontSize); + + timelineData.addView(start); + } + // dependency data view in timeline + else if(issueComment.getType().equalsIgnoreCase("add_dependency") || issueComment.getType().equalsIgnoreCase("remove_dependency")) { + + TextView start = new TextView(context); + + if(issueComment.getType().equalsIgnoreCase("add_dependency")) { + start.setText(context.getString(R.string.timelineDependencyAdded, issueComment.getUser().getLogin(), issueComment.getDependentIssue().getNumber(), informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("remove_dependency")) { + start.setText(context.getString(R.string.timelineDependencyRemoved, issueComment.getUser().getLogin(), issueComment.getDependentIssue().getNumber(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_dependency)); + timelineData.addView(start); + } + // project data view in timeline + else if(issueComment.getType().equalsIgnoreCase("project") || issueComment.getType().equalsIgnoreCase("project_board")) { + + TextView start = new TextView(context); + + if(issueComment.getProjectId() > 0) { + start.setText(context.getString(R.string.timelineProjectAdded, issueComment.getUser().getLogin(), informationBuilder)); + } + else { + start.setText(context.getString(R.string.timelineProjectRemoved, issueComment.getUser().getLogin(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_kanban)); + timelineData.addView(start); + } + // due date/deadline data view in timeline + else if(issueComment.getType().equalsIgnoreCase("added_deadline") || issueComment.getType().equalsIgnoreCase("modified_deadline") || issueComment.getType().equalsIgnoreCase("removed_deadline")) { + + TextView start = new TextView(context); + + if(issueComment.getType().equalsIgnoreCase("added_deadline")) { + start.setText(context.getString(R.string.timelineDueDateAdded, issueComment.getUser().getLogin(), issueComment.getBody(), informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("modified_deadline")) { + start.setText( + context.getString(R.string.timelineDueDateModified, issueComment.getUser().getLogin(), issueComment.getBody().split("\\|")[0], issueComment.getBody().split("\\|")[1], informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("removed_deadline")) { + start.setText(context.getString(R.string.timelineDueDateRemoved, issueComment.getUser().getLogin(), issueComment.getBody(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_clock)); + timelineData.addView(start); + } + // branch data view in timeline + else if(issueComment.getType().equalsIgnoreCase("change_target_branch") || issueComment.getType().equalsIgnoreCase("delete_branch")) { + + TextView start = new TextView(context); + + if(issueComment.getType().equalsIgnoreCase("change_target_branch")) { + start.setText(context.getString(R.string.timelineBranchChanged, issueComment.getUser().getLogin(), issueComment.getOldRef(), issueComment.getNewRef(), informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("delete_branch")) { + start.setText(context.getString(R.string.timelineBranchDeleted, issueComment.getUser().getLogin(), issueComment.getOldRef(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_branch)); + timelineData.addView(start); + } + // time tracking data view in timeline + else if(issueComment.getType().equalsIgnoreCase("start_tracking") || issueComment.getType().equalsIgnoreCase("stop_tracking") || issueComment.getType() + .equalsIgnoreCase("cancel_tracking") || issueComment.getType().equalsIgnoreCase("add_time_manual") || issueComment.getType().equalsIgnoreCase("delete_time_manual")) { + + TextView start = new TextView(context); + + if(issueComment.getType().equalsIgnoreCase("start_tracking")) { + start.setText(context.getString(R.string.timelineTimeTrackingStart, issueComment.getUser().getLogin(), informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("stop_tracking")) { + start.setText(context.getString(R.string.timelineTimeTrackingStop, issueComment.getUser().getLogin(), informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("cancel_tracking")) { + start.setText(context.getString(R.string.timelineTimeTrackingCancel, issueComment.getUser().getLogin(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + else if(issueComment.getType().equalsIgnoreCase("add_time_manual")) { + start.setText(context.getString(R.string.timelineTimeTrackingAddManualTime, issueComment.getUser().getLogin(), issueComment.getBody(), informationBuilder)); + } + else if(issueComment.getType().equalsIgnoreCase("delete_time_manual")) { + start.setText(context.getString(R.string.timelineTimeTrackingDeleteManualTime, issueComment.getUser().getLogin(), issueComment.getBody(), informationBuilder)); + timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null)); + } + start.setTextSize(fontSize); + + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_clock)); + timelineData.addView(start); + } + // issue/pr refs data view in timeline + else if(issueComment.getType().equalsIgnoreCase("change_issue_ref") || issueComment.getType().equalsIgnoreCase("issue_ref") || issueComment.getType().equalsIgnoreCase("comment_ref") || issueComment.getType() + .equalsIgnoreCase("pull_ref")) { + + RecyclerView recyclerView = new RecyclerView(context); + + if(issueComment.getType().equalsIgnoreCase("change_issue_ref")) { + String text = context.getString(R.string.timelineChangeIssueRef, issueComment.getUser().getLogin(), issueComment.getNewRef(), informationBuilder); + Markdown.render(context, EmojiParser.parseToUnicode(text), recyclerView, issue.getRepository()); + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_branch)); + } + else if(issueComment.getType().equalsIgnoreCase("comment_ref") || issueComment.getType().equalsIgnoreCase("issue_ref") || issueComment.getType().equalsIgnoreCase("pull_ref")) { + + if(issue.getIssueType().equalsIgnoreCase("Issue")) { + String text = context.getString(R.string.timelineRefIssue, issueComment.getUser().getLogin(), issueComment.getRefIssue().getNumber(), informationBuilder); + Markdown.render(context, EmojiParser.parseToUnicode(text), recyclerView, issue.getRepository()); + } + else if(issue.getIssueType().equalsIgnoreCase("Pull")) { + String text = context.getString(R.string.timelineRefPr, issueComment.getUser().getLogin(), issueComment.getRefIssue().getNumber(), informationBuilder); + Markdown.render(context, EmojiParser.parseToUnicode(text), recyclerView, issue.getRepository()); + } + timelineIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark)); + } + + timelineData.addView(recyclerView); + } + // code data view in timeline + else if(issueComment.getType().equalsIgnoreCase("code")) { + timelineView.setVisibility(View.GONE); + timelineDividerView.setVisibility(View.GONE); + } + // schedule pr view in timeline + else if(issueComment.getType().equalsIgnoreCase("pull_scheduled_merge") || issueComment.getType().equalsIgnoreCase("pull_cancel_scheduled_merge")) { + timelineView.setVisibility(View.GONE); + timelineDividerView.setVisibility(View.GONE); + } + else { + timelineView.setVisibility(View.GONE); + } + + // comment data view in timeline + if(issueComment.getType().equalsIgnoreCase("comment")) { + + author.setText(issueComment.getUser().getLogin()); + + PicassoService.getInstance(context).get().load(issueComment.getUser().getAvatarUrl()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)) + .resize(AppUtil.getPixelsFromDensity(context, 35), AppUtil.getPixelsFromDensity(context, 35)).centerCrop().into(avatar); + + Markdown.render(context, EmojiParser.parseToUnicode(issueComment.getBody()), comment, issue.getRepository()); + + information.setText(informationBuilder); + + Bundle bundle1 = new Bundle(); + bundle1.putAll(bundle); + bundle1.putInt("commentId", Math.toIntExact(issueComment.getId())); + + ReactionList reactionList = new ReactionList(context, bundle1); + + commentReactionBadges.addView(reactionList); + reactionList.setOnReactionAddedListener(() -> { + + if(commentReactionBadges.getVisibility() != View.VISIBLE) { + commentReactionBadges.post(() -> commentReactionBadges.setVisibility(View.VISIBLE)); + } + }); + } + else { + commentView.setVisibility(View.GONE); + } + } + } } diff --git a/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java index 20ac10cb..510e86d5 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/IssuesAdapter.java @@ -15,6 +15,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; import androidx.core.text.HtmlCompat; import androidx.recyclerview.widget.RecyclerView; @@ -26,7 +27,13 @@ import org.mian.gitnex.activities.IssueDetailActivity; import org.mian.gitnex.activities.ProfileActivity; import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.clients.PicassoService; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.ColorInverter; +import org.mian.gitnex.helpers.LabelWidthCalculator; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.contexts.IssueContext; import org.ocpsoft.prettytime.PrettyTime; import java.text.DateFormat; @@ -111,6 +118,7 @@ public class IssuesAdapter extends RecyclerView.Adapter private final LinearLayout frameLabels; private final HorizontalScrollView labelsScrollViewDots; private final LinearLayout frameLabelsDots; + private final ImageView commentIcon; private Issue issueObject; IssuesHolder(View itemView) { @@ -124,6 +132,7 @@ public class IssuesAdapter extends RecyclerView.Adapter frameLabels = itemView.findViewById(R.id.frameLabels); labelsScrollViewDots = itemView.findViewById(R.id.labelsScrollViewDots); frameLabelsDots = itemView.findViewById(R.id.frameLabelsDots); + commentIcon = itemView.findViewById(R.id.comment_icon); new Handler().postDelayed(() -> { if(!AppUtil.checkGhostUsers(issueObject.getUser().getLogin())) { @@ -222,6 +231,11 @@ public class IssuesAdapter extends RecyclerView.Adapter } } + if(issue.getComments() > 15) { + commentIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_flame)); + commentIcon.setColorFilter(context.getResources().getColor(R.color.releasePre, null)); + } + switch(timeFormat) { case "pretty": { PrettyTime prettyTime = new PrettyTime(locale); diff --git a/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java index e61d18e5..204e48a4 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/PullRequestsAdapter.java @@ -15,6 +15,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; import androidx.core.text.HtmlCompat; import androidx.recyclerview.widget.RecyclerView; @@ -26,7 +27,13 @@ import org.mian.gitnex.activities.IssueDetailActivity; import org.mian.gitnex.activities.ProfileActivity; import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.clients.PicassoService; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.ColorInverter; +import org.mian.gitnex.helpers.LabelWidthCalculator; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.contexts.IssueContext; import java.util.List; import java.util.Locale; @@ -103,6 +110,7 @@ public class PullRequestsAdapter extends RecyclerView.Adapter { Intent intentPrDetail = new IssueContext(pullRequestObject, ((RepoDetailActivity) context).repository).getIntent(context, IssueDetailActivity.class); @@ -219,6 +228,11 @@ public class PullRequestsAdapter extends RecyclerView.Adapter 15) { + commentIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_flame)); + commentIcon.setColorFilter(context.getResources().getColor(R.color.releasePre, null)); + } + if(timeFormat.equals("pretty")) { this.prCreatedTime.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(pullRequest.getCreatedAt()), context)); } diff --git a/app/src/main/java/org/mian/gitnex/adapters/ReleasesAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/ReleasesAdapter.java index d8b5184a..8b03190d 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/ReleasesAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/ReleasesAdapter.java @@ -23,7 +23,13 @@ import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.databinding.FragmentReleasesBinding; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.Markdown; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; +import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.structs.FragmentRefreshListener; import java.util.List; import java.util.Locale; diff --git a/app/src/main/java/org/mian/gitnex/adapters/RepoForksAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/RepoForksAdapter.java index bfddce62..56aa45b8 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/RepoForksAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/RepoForksAdapter.java @@ -17,7 +17,11 @@ import com.amulyakhare.textdrawable.util.ColorGenerator; import org.mian.gitnex.R; import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.clients.PicassoService; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.ocpsoft.prettytime.PrettyTime; import java.text.DateFormat; diff --git a/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java index 5dc30342..218221b2 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java @@ -7,7 +7,11 @@ import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.*; +import android.widget.CheckBox; +import android.widget.Filter; +import android.widget.Filterable; +import android.widget.ImageView; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.amulyakhare.textdrawable.TextDrawable; @@ -15,7 +19,11 @@ import com.amulyakhare.textdrawable.util.ColorGenerator; import org.mian.gitnex.R; import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.clients.PicassoService; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.ocpsoft.prettytime.PrettyTime; import java.text.DateFormat; diff --git a/app/src/main/java/org/mian/gitnex/fragments/BottomSheetSingleIssueFragment.java b/app/src/main/java/org/mian/gitnex/fragments/BottomSheetSingleIssueFragment.java index 2299d2eb..3f50bcb1 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/BottomSheetSingleIssueFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/BottomSheetSingleIssueFragment.java @@ -13,7 +13,11 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import org.mian.gitnex.R; import org.mian.gitnex.actions.IssueActions; import org.mian.gitnex.actions.PullRequestActions; -import org.mian.gitnex.activities.*; +import org.mian.gitnex.activities.BaseActivity; +import org.mian.gitnex.activities.DiffActivity; +import org.mian.gitnex.activities.EditIssueActivity; +import org.mian.gitnex.activities.IssueDetailActivity; +import org.mian.gitnex.activities.MergePullRequestActivity; import org.mian.gitnex.databinding.BottomSheetSingleIssueBinding; import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AppUtil; diff --git a/app/src/main/java/org/mian/gitnex/fragments/CommitDetailFragment.java b/app/src/main/java/org/mian/gitnex/fragments/CommitDetailFragment.java index c0b79fbe..76d560ad 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/CommitDetailFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/CommitDetailFragment.java @@ -22,7 +22,13 @@ import org.mian.gitnex.adapters.DiffFilesAdapter; import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.databinding.FragmentCommitDetailsBinding; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AlertDialogs; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.FileDiffView; +import org.mian.gitnex.helpers.ParseDiff; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.contexts.IssueContext; import org.mian.gitnex.helpers.contexts.RepositoryContext; import java.util.ArrayList; @@ -172,7 +178,7 @@ public class CommitDetailFragment extends Fragment { if(commitsModel.getAuthor() != null && commitsModel.getAuthor().getAvatarUrl() != null && !commitsModel.getAuthor().getAvatarUrl().isEmpty()) { - binding.commitAuthorAvatar.setVisibility(View.VISIBLE); + binding.commitAuthorAvatarFrame.setVisibility(View.VISIBLE); int imgRadius = AppUtil.getPixelsFromDensity(requireContext(), 3); @@ -188,13 +194,13 @@ public class CommitDetailFragment extends Fragment { } else { binding.commitAuthorAvatar.setImageDrawable(null); - binding.commitAuthorAvatar.setVisibility(View.GONE); + binding.commitAuthorAvatarFrame.setVisibility(View.GONE); } if(commitsModel.getCommitter() != null && (commitsModel.getAuthor() == null || !commitsModel.getAuthor().getLogin().equals(commitsModel.getCommitter().getLogin())) && commitsModel.getCommitter() .getAvatarUrl() != null && !commitsModel.getCommitter().getAvatarUrl().isEmpty()) { - binding.commitCommitterAvatar.setVisibility(View.VISIBLE); + binding.commitCommitterAvatarFrame.setVisibility(View.VISIBLE); int imgRadius = AppUtil.getPixelsFromDensity(requireContext(), 3); @@ -210,7 +216,7 @@ public class CommitDetailFragment extends Fragment { } else { binding.commitCommitterAvatar.setImageDrawable(null); - binding.commitCommitterAvatar.setVisibility(View.GONE); + binding.commitCommitterAvatarFrame.setVisibility(View.GONE); } binding.commitSha.setText(commitsModel.getSha().substring(0, Math.min(commitsModel.getSha().length(), 10))); @@ -241,5 +247,4 @@ public class CommitDetailFragment extends Fragment { binding.progressBar.setVisibility(View.GONE); } } - } diff --git a/app/src/main/java/org/mian/gitnex/fragments/ExploreIssuesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ExploreIssuesFragment.java index 528fe8a1..2ea7e963 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ExploreIssuesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ExploreIssuesFragment.java @@ -3,7 +3,12 @@ package org.mian.gitnex.fragments; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/ExploreRepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ExploreRepositoriesFragment.java index c4fd5206..9218e142 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ExploreRepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ExploreRepositoriesFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/ExploreUsersFragment.java b/app/src/main/java/org/mian/gitnex/fragments/ExploreUsersFragment.java index 95f0b94e..53529c02 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/ExploreUsersFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/ExploreUsersFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java index 68750fa2..6d4c4b59 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java @@ -4,7 +4,12 @@ import android.annotation.SuppressLint; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; diff --git a/app/src/main/java/org/mian/gitnex/fragments/IssuesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/IssuesFragment.java index e42646f1..e9449de3 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/IssuesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/IssuesFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/app/src/main/java/org/mian/gitnex/fragments/MyIssuesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/MyIssuesFragment.java index 896e6dba..9cb77571 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/MyIssuesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/MyIssuesFragment.java @@ -26,13 +26,13 @@ import org.mian.gitnex.viewmodels.IssuesViewModel; public class MyIssuesFragment extends Fragment { + public String state = "open"; + public boolean assignedToMe = false; private IssuesViewModel issuesViewModel; private FragmentIssuesBinding fragmentIssuesBinding; private ExploreIssuesAdapter adapter; private int page = 1; private Menu menu; - public String state = "open"; - public boolean assignedToMe = false; @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -75,8 +75,6 @@ public class MyIssuesFragment extends Fragment { return fragmentIssuesBinding.getRoot(); } - ; - private void fetchDataAsync(String query, String state, boolean assignedToMe) { issuesViewModel.getIssuesList(query, "issues", true, state, assignedToMe, getContext()).observe(getViewLifecycleOwner(), issuesListMain -> { diff --git a/app/src/main/java/org/mian/gitnex/fragments/MyProfileFragment.java b/app/src/main/java/org/mian/gitnex/fragments/MyProfileFragment.java index c0c821c0..af750f33 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/MyProfileFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/MyProfileFragment.java @@ -5,7 +5,12 @@ import android.content.res.ColorStateList; import android.graphics.Typeface; import android.os.Bundle; import android.text.Html; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; diff --git a/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java index 5f8e5e03..00ac85f0 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/MyRepositoriesFragment.java @@ -4,7 +4,12 @@ import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/NotificationsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/NotificationsFragment.java index 9a72645d..e41729c4 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/NotificationsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/NotificationsFragment.java @@ -4,7 +4,12 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/OrganizationTeamInfoReposFragment.java b/app/src/main/java/org/mian/gitnex/fragments/OrganizationTeamInfoReposFragment.java index 7ac646b7..8f56a436 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/OrganizationTeamInfoReposFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/OrganizationTeamInfoReposFragment.java @@ -3,7 +3,12 @@ package org.mian.gitnex.fragments; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java index 5ef737b2..032a82fb 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/OrganizationsFragment.java @@ -4,7 +4,12 @@ import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/PullRequestCommitsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/PullRequestCommitsFragment.java index d7777912..6e01f1d9 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/PullRequestCommitsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/PullRequestCommitsFragment.java @@ -5,7 +5,12 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.util.Log; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.RelativeLayout; import androidx.annotation.NonNull; diff --git a/app/src/main/java/org/mian/gitnex/fragments/PullRequestsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/PullRequestsFragment.java index 13262dcf..247340f9 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/PullRequestsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/PullRequestsFragment.java @@ -5,7 +5,12 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.util.Log; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java b/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java index e0077bfa..991c07a4 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/RepoInfoFragment.java @@ -16,10 +16,21 @@ import org.gitnex.tea4j.v2.models.Organization; import org.gitnex.tea4j.v2.models.Repository; import org.jetbrains.annotations.NotNull; import org.mian.gitnex.R; -import org.mian.gitnex.activities.*; +import org.mian.gitnex.activities.OrganizationDetailActivity; +import org.mian.gitnex.activities.ProfileActivity; +import org.mian.gitnex.activities.RepoDetailActivity; +import org.mian.gitnex.activities.RepoForksActivity; +import org.mian.gitnex.activities.RepoStargazersActivity; +import org.mian.gitnex.activities.RepoWatchersActivity; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.databinding.FragmentRepoInfoBinding; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AlertDialogs; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.Markdown; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; +import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.contexts.RepositoryContext; import java.io.IOException; import java.util.Locale; diff --git a/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java index cbac8fb8..20a031f3 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/RepositoriesFragment.java @@ -4,7 +4,12 @@ import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java index 24b2db92..5d465314 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java @@ -13,7 +13,15 @@ import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import org.mian.gitnex.R; -import org.mian.gitnex.activities.*; +import org.mian.gitnex.activities.BaseActivity; +import org.mian.gitnex.activities.MainActivity; +import org.mian.gitnex.activities.SettingsAppearanceActivity; +import org.mian.gitnex.activities.SettingsDraftsActivity; +import org.mian.gitnex.activities.SettingsGeneralActivity; +import org.mian.gitnex.activities.SettingsNotificationsActivity; +import org.mian.gitnex.activities.SettingsReportsActivity; +import org.mian.gitnex.activities.SettingsSecurityActivity; +import org.mian.gitnex.activities.SettingsTranslationActivity; import org.mian.gitnex.databinding.CustomAboutDialogBinding; import org.mian.gitnex.databinding.FragmentSettingsBinding; import org.mian.gitnex.helpers.AppUtil; diff --git a/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java index 64d216af..6886e838 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/StarredRepositoriesFragment.java @@ -4,7 +4,12 @@ import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; diff --git a/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java b/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java index 62f30e6f..67c41eeb 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/profile/DetailFragment.java @@ -12,7 +12,14 @@ import org.mian.gitnex.R; import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.databinding.FragmentProfileDetailBinding; -import org.mian.gitnex.helpers.*; +import org.mian.gitnex.helpers.AlertDialogs; +import org.mian.gitnex.helpers.AppUtil; +import org.mian.gitnex.helpers.ClickListener; +import org.mian.gitnex.helpers.ColorInverter; +import org.mian.gitnex.helpers.RoundedTransformation; +import org.mian.gitnex.helpers.TimeHelper; +import org.mian.gitnex.helpers.TinyDB; +import org.mian.gitnex.helpers.Toasty; import java.util.Locale; import jp.wasabeef.picasso.transformations.BlurTransformation; import retrofit2.Call; diff --git a/app/src/main/java/org/mian/gitnex/fragments/profile/FollowersFragment.java b/app/src/main/java/org/mian/gitnex/fragments/profile/FollowersFragment.java index ec99d70d..8f283871 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/profile/FollowersFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/profile/FollowersFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/app/src/main/java/org/mian/gitnex/fragments/profile/FollowingFragment.java b/app/src/main/java/org/mian/gitnex/fragments/profile/FollowingFragment.java index b910b89e..e74e545a 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/profile/FollowingFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/profile/FollowingFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/app/src/main/java/org/mian/gitnex/fragments/profile/OrganizationsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/profile/OrganizationsFragment.java index 4d4f3524..45ee9fbe 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/profile/OrganizationsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/profile/OrganizationsFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/app/src/main/java/org/mian/gitnex/fragments/profile/RepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/profile/RepositoriesFragment.java index fc2e93c0..6f9c1d7d 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/profile/RepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/profile/RepositoriesFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/app/src/main/java/org/mian/gitnex/fragments/profile/StarredRepositoriesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/profile/StarredRepositoriesFragment.java index dd900df8..3fddb3dd 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/profile/StarredRepositoriesFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/profile/StarredRepositoriesFragment.java @@ -4,7 +4,12 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.view.*; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/app/src/main/java/org/mian/gitnex/helpers/AppUtil.java b/app/src/main/java/org/mian/gitnex/helpers/AppUtil.java index ccb28608..c1ea2005 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/AppUtil.java +++ b/app/src/main/java/org/mian/gitnex/helpers/AppUtil.java @@ -1,7 +1,11 @@ package org.mian.gitnex.helpers; import android.app.Activity; -import android.content.*; +import android.content.ActivityNotFoundException; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -13,7 +17,6 @@ import android.net.Uri; import android.os.Build; import android.util.Base64; import android.util.DisplayMetrics; -import android.util.Log; import android.util.TypedValue; import android.view.View; import androidx.annotation.ColorInt; @@ -35,7 +38,14 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -109,7 +119,6 @@ public class AppUtil { } return FileType.UNKNOWN; - } public static boolean hasNetworkConnection(Context context) { @@ -193,7 +202,6 @@ public class AppUtil { } public static Boolean checkIntegers(String str) { - return str.matches("\\d+"); } @@ -203,7 +211,6 @@ public class AppUtil { Configuration config = resource.getConfiguration(); config.setLocale(new Locale(locCode.toLowerCase())); resource.updateConfiguration(config, dm); - } public static String getTimestampFromDate(Context context, Date date) { @@ -217,7 +224,6 @@ public class AppUtil { else { return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", locale).format(date); } - } @ColorInt @@ -227,7 +233,6 @@ public class AppUtil { context.getTheme().resolveAttribute(resid, typedValue, true); return typedValue.data; - } public static String customDateFormat(String customDate) { @@ -254,7 +259,6 @@ public class AppUtil { } return year + "-" + sMonth + "-" + sDay; - } public static String customDateCombine(String customDate) { @@ -281,7 +285,6 @@ public class AppUtil { } return (customDate + "T" + mHour + ":" + sMin + ":" + sSec + "Z"); - } public static String encodeBase64(String str) { @@ -293,7 +296,6 @@ public class AppUtil { } return base64Str; - } public static String decodeBase64(String str) { @@ -305,7 +307,6 @@ public class AppUtil { } return base64Str; - } public static String getLastCharactersOfWord(String str, int count) { @@ -342,7 +343,6 @@ public class AppUtil { lines++; return lines; - } public static void copyToClipboard(Context ctx, CharSequence data, String message) { @@ -522,7 +522,6 @@ public class AppUtil { URL url = new URL(u); HttpURLConnection http = (HttpURLConnection) url.openConnection(); return (http.getResponseCode()); - } public enum FileType {IMAGE, AUDIO, VIDEO, DOCUMENT, TEXT, EXECUTABLE, FONT, UNKNOWN} @@ -536,7 +535,5 @@ public class AppUtil { } void onProgressChanged(short progress); - } - } diff --git a/app/src/main/java/org/mian/gitnex/helpers/Markdown.java b/app/src/main/java/org/mian/gitnex/helpers/Markdown.java index ca660ac2..8453b4ac 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/Markdown.java +++ b/app/src/main/java/org/mian/gitnex/helpers/Markdown.java @@ -10,7 +10,12 @@ import androidx.core.content.res.ResourcesCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import org.commonmark.ext.gfm.tables.TableBlock; -import org.commonmark.node.*; +import org.commonmark.node.AbstractVisitor; +import org.commonmark.node.FencedCodeBlock; +import org.commonmark.node.Image; +import org.commonmark.node.Link; +import org.commonmark.node.Node; +import org.commonmark.node.Text; import org.commonmark.parser.InlineParserFactory; import org.commonmark.parser.Parser; import org.commonmark.parser.PostProcessor; @@ -55,7 +60,13 @@ import io.noties.markwon.recycler.SimpleEntry; import io.noties.markwon.recycler.table.TableEntry; import io.noties.markwon.recycler.table.TableEntryPlugin; import io.noties.prism4j.Prism4j; -import stormpot.*; +import stormpot.Allocator; +import stormpot.BlazePool; +import stormpot.Config; +import stormpot.Pool; +import stormpot.Poolable; +import stormpot.Slot; +import stormpot.Timeout; /** * @author opyale diff --git a/app/src/main/java/org/mian/gitnex/helpers/PicassoCache.java b/app/src/main/java/org/mian/gitnex/helpers/PicassoCache.java index a166b750..da04e186 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/PicassoCache.java +++ b/app/src/main/java/org/mian/gitnex/helpers/PicassoCache.java @@ -6,7 +6,12 @@ import android.graphics.BitmapFactory; import android.util.Log; import com.squareup.picasso.Cache; import org.mian.gitnex.R; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.util.HashMap; import java.util.Map; import java.util.Objects; diff --git a/app/src/main/java/org/mian/gitnex/helpers/RoundedTransformation.java b/app/src/main/java/org/mian/gitnex/helpers/RoundedTransformation.java index e38f9e02..f5528494 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/RoundedTransformation.java +++ b/app/src/main/java/org/mian/gitnex/helpers/RoundedTransformation.java @@ -1,6 +1,11 @@ package org.mian.gitnex.helpers; -import android.graphics.*; +import android.graphics.Bitmap; +import android.graphics.BitmapShader; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.RectF; +import android.graphics.Shader; /** * @author M M Arif diff --git a/app/src/main/java/org/mian/gitnex/notifications/Notifications.java b/app/src/main/java/org/mian/gitnex/notifications/Notifications.java index 36f323ec..140cd40a 100644 --- a/app/src/main/java/org/mian/gitnex/notifications/Notifications.java +++ b/app/src/main/java/org/mian/gitnex/notifications/Notifications.java @@ -5,7 +5,11 @@ import android.app.NotificationManager; import android.content.Context; import android.graphics.Color; import android.os.Build; -import androidx.work.*; +import androidx.work.Constraints; +import androidx.work.ExistingPeriodicWorkPolicy; +import androidx.work.NetworkType; +import androidx.work.PeriodicWorkRequest; +import androidx.work.WorkManager; import org.mian.gitnex.R; import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.TinyDB; diff --git a/app/src/main/java/org/mian/gitnex/viewmodels/IssueCommentsViewModel.java b/app/src/main/java/org/mian/gitnex/viewmodels/IssueCommentsViewModel.java index 2be96fab..d1e0ac4f 100644 --- a/app/src/main/java/org/mian/gitnex/viewmodels/IssueCommentsViewModel.java +++ b/app/src/main/java/org/mian/gitnex/viewmodels/IssueCommentsViewModel.java @@ -5,9 +5,11 @@ import androidx.annotation.NonNull; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; -import org.gitnex.tea4j.v2.models.Comment; +import org.gitnex.tea4j.v2.models.TimelineComment; import org.mian.gitnex.R; +import org.mian.gitnex.adapters.IssueCommentsAdapter; import org.mian.gitnex.clients.RetrofitClient; +import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.Toasty; import java.util.List; import retrofit2.Call; @@ -20,33 +22,34 @@ import retrofit2.Response; public class IssueCommentsViewModel extends ViewModel { - private MutableLiveData> issueComments; + private MutableLiveData> issueComments; + private int resultLimit; - public LiveData> getIssueCommentList(String owner, String repo, int index, Context ctx) { + public LiveData> getIssueCommentList(String owner, String repo, int index, Context ctx) { issueComments = new MutableLiveData<>(); - loadIssueComments(owner, repo, index, ctx); - - return issueComments; - } - - public void loadIssueComments(String owner, String repo, int index, Context ctx) { + resultLimit = Constants.getCurrentResultLimit(ctx); loadIssueComments(owner, repo, index, ctx, null); + return issueComments; } public void loadIssueComments(String owner, String repo, int index, Context ctx, Runnable onLoadingFinished) { - Call> call = RetrofitClient.getApiInterface(ctx).issueGetComments(owner, repo, (long) index, null, null); + Call> call = RetrofitClient.getApiInterface(ctx).issueGetCommentsAndTimeline(owner, repo, (long) index, null, 1, resultLimit, null); call.enqueue(new Callback<>() { @Override - public void onResponse(@NonNull Call> call, @NonNull Response> response) { + public void onResponse(@NonNull Call> call, @NonNull Response> response) { if(response.isSuccessful()) { - issueComments.postValue(response.body()); - if(onLoadingFinished != null) { - onLoadingFinished.run(); + + if(response.body() != null) { + + issueComments.postValue(response.body()); + if(onLoadingFinished != null) { + onLoadingFinished.run(); + } } } else { @@ -55,11 +58,52 @@ public class IssueCommentsViewModel extends ViewModel { } @Override - public void onFailure(@NonNull Call> call, @NonNull Throwable t) { + public void onFailure(@NonNull Call> call, @NonNull Throwable t) { Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError)); } }); } + public void loadMoreIssueComments(String owner, String repo, int index, Context ctx, int page, IssueCommentsAdapter adapter) { + + Call> call = RetrofitClient.getApiInterface(ctx).issueGetCommentsAndTimeline(owner, repo, (long) index, null, page, resultLimit, null); + + call.enqueue(new Callback<>() { + + @Override + public void onResponse(@NonNull Call> call, @NonNull Response> response) { + + if(response.isSuccessful()) { + + if(response.body() != null) { + + List list = issueComments.getValue(); + assert list != null; + assert response.body() != null; + + if(response.body().size() != 0) { + list.addAll(response.body()); + adapter.updateList(list); + } + else { + adapter.setMoreDataAvailable(false); + } + } + else { + adapter.setMoreDataAvailable(false); + } + } + else { + Toasty.error(ctx, ctx.getString(R.string.genericError)); + } + } + + @Override + public void onFailure(@NonNull Call> call, @NonNull Throwable t) { + Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError)); + } + }); + } + } diff --git a/app/src/main/res/drawable/ic_bookmark.xml b/app/src/main/res/drawable/ic_bookmark.xml new file mode 100644 index 00000000..f6c973f0 --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmark.xml @@ -0,0 +1,13 @@ + + + diff --git a/app/src/main/res/drawable/ic_branch.xml b/app/src/main/res/drawable/ic_branch.xml index 936bfb56..9765ef6f 100644 --- a/app/src/main/res/drawable/ic_branch.xml +++ b/app/src/main/res/drawable/ic_branch.xml @@ -3,32 +3,46 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - - - - + + + + + + diff --git a/app/src/main/res/drawable/ic_browser.xml b/app/src/main/res/drawable/ic_browser.xml index eab9daf1..a38d21d6 100644 --- a/app/src/main/res/drawable/ic_browser.xml +++ b/app/src/main/res/drawable/ic_browser.xml @@ -1,5 +1,27 @@ - - + + + + diff --git a/app/src/main/res/drawable/ic_clock.xml b/app/src/main/res/drawable/ic_clock.xml new file mode 100644 index 00000000..d165ae17 --- /dev/null +++ b/app/src/main/res/drawable/ic_clock.xml @@ -0,0 +1,20 @@ + + + + diff --git a/app/src/main/res/drawable/ic_dependency.xml b/app/src/main/res/drawable/ic_dependency.xml new file mode 100644 index 00000000..1dd9a72e --- /dev/null +++ b/app/src/main/res/drawable/ic_dependency.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_directory.xml b/app/src/main/res/drawable/ic_directory.xml index 87e891e7..7fa464f8 100644 --- a/app/src/main/res/drawable/ic_directory.xml +++ b/app/src/main/res/drawable/ic_directory.xml @@ -3,8 +3,11 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/app/src/main/res/drawable/ic_file.xml b/app/src/main/res/drawable/ic_file.xml index 9383376a..fed66146 100644 --- a/app/src/main/res/drawable/ic_file.xml +++ b/app/src/main/res/drawable/ic_file.xml @@ -4,7 +4,17 @@ android:viewportWidth="24" android:viewportHeight="24"> + android:pathData="M14,3v4a1,1 0,0 0,1 1h4" + android:strokeLineJoin="round" + android:strokeWidth="2" + android:fillColor="#00000000" + android:strokeColor="?attr/iconsColor" + android:strokeLineCap="round"/> + diff --git a/app/src/main/res/drawable/ic_flame.xml b/app/src/main/res/drawable/ic_flame.xml new file mode 100644 index 00000000..fa0337ca --- /dev/null +++ b/app/src/main/res/drawable/ic_flame.xml @@ -0,0 +1,13 @@ + + + diff --git a/app/src/main/res/drawable/ic_fork.xml b/app/src/main/res/drawable/ic_fork.xml index c039c3f8..02fb7b50 100644 --- a/app/src/main/res/drawable/ic_fork.xml +++ b/app/src/main/res/drawable/ic_fork.xml @@ -3,16 +3,39 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - - - + + + + + diff --git a/app/src/main/res/drawable/ic_history.xml b/app/src/main/res/drawable/ic_history.xml new file mode 100644 index 00000000..bd820821 --- /dev/null +++ b/app/src/main/res/drawable/ic_history.xml @@ -0,0 +1,20 @@ + + + + diff --git a/app/src/main/res/drawable/ic_kanban.xml b/app/src/main/res/drawable/ic_kanban.xml new file mode 100644 index 00000000..e8f40f30 --- /dev/null +++ b/app/src/main/res/drawable/ic_kanban.xml @@ -0,0 +1,34 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_key.xml b/app/src/main/res/drawable/ic_key.xml new file mode 100644 index 00000000..df65f6eb --- /dev/null +++ b/app/src/main/res/drawable/ic_key.xml @@ -0,0 +1,34 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_milestone.xml b/app/src/main/res/drawable/ic_milestone.xml index e4c3ae7a..9dd16654 100644 --- a/app/src/main/res/drawable/ic_milestone.xml +++ b/app/src/main/res/drawable/ic_milestone.xml @@ -3,8 +3,25 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - + + + diff --git a/app/src/main/res/drawable/ic_organization.xml b/app/src/main/res/drawable/ic_organization.xml index ce6f121c..bd1f29bd 100644 --- a/app/src/main/res/drawable/ic_organization.xml +++ b/app/src/main/res/drawable/ic_organization.xml @@ -3,11 +3,53 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - - + + + + + + + diff --git a/app/src/main/res/drawable/ic_pull_request.xml b/app/src/main/res/drawable/ic_pull_request.xml index 3d4f443d..7f14620b 100644 --- a/app/src/main/res/drawable/ic_pull_request.xml +++ b/app/src/main/res/drawable/ic_pull_request.xml @@ -3,32 +3,46 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - - - - + + + + + + diff --git a/app/src/main/res/drawable/ic_reset.xml b/app/src/main/res/drawable/ic_refresh.xml similarity index 85% rename from app/src/main/res/drawable/ic_reset.xml rename to app/src/main/res/drawable/ic_refresh.xml index 409ba9b1..b6cb15b8 100644 --- a/app/src/main/res/drawable/ic_reset.xml +++ b/app/src/main/res/drawable/ic_refresh.xml @@ -4,10 +4,10 @@ android:viewportWidth="24" android:viewportHeight="24"> + android:strokeLineCap="round" + android:strokeLineJoin="round" /> diff --git a/app/src/main/res/drawable/ic_repo.xml b/app/src/main/res/drawable/ic_repo.xml index 1fd3fac9..f04ca96b 100644 --- a/app/src/main/res/drawable/ic_repo.xml +++ b/app/src/main/res/drawable/ic_repo.xml @@ -3,11 +3,18 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - - + + diff --git a/app/src/main/res/drawable/ic_tag.xml b/app/src/main/res/drawable/ic_tag.xml new file mode 100644 index 00000000..d984b404 --- /dev/null +++ b/app/src/main/res/drawable/ic_tag.xml @@ -0,0 +1,20 @@ + + + + diff --git a/app/src/main/res/drawable/ic_update.xml b/app/src/main/res/drawable/ic_update.xml deleted file mode 100644 index ff53349e..00000000 --- a/app/src/main/res/drawable/ic_update.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/activity_issue_detail.xml b/app/src/main/res/layout/activity_issue_detail.xml index 57202ab2..35804733 100644 --- a/app/src/main/res/layout/activity_issue_detail.xml +++ b/app/src/main/res/layout/activity_issue_detail.xml @@ -1,19 +1,18 @@ - + android:background="?attr/primaryBackgroundColor" + android:orientation="vertical"> + android:theme="@style/Widget.AppCompat.SearchView" + app:elevation="@dimen/dimen0dp"> + android:src="@drawable/ic_issue" + android:visibility="gone" /> + android:textSize="@dimen/dimen20sp" /> @@ -46,31 +45,31 @@ + app:indicatorColor="?attr/progressIndicatorColor" /> + android:layout_margin="@dimen/dimen16dp" + android:backgroundTint="?attr/fabColor" + android:contentDescription="@string/commentButtonText" + android:text="@string/commentButtonText" + android:textColor="@color/colorWhite" + app:icon="@drawable/ic_reply" + app:iconTint="@color/colorWhite" /> + android:layout_height="match_parent" + android:layout_marginTop="@dimen/dimen64dp"> + android:paddingStart="@dimen/dimen8dp" + android:paddingTop="@dimen/dimen2dp" + android:paddingEnd="@dimen/dimen8dp" + android:paddingBottom="@dimen/dimen8dp"> + android:foreground="?android:attr/selectableItemBackground" + android:orientation="vertical" + android:padding="@dimen/dimen12dp"> - + android:gravity="start" + android:textColor="?attr/primaryTextColor" + android:textIsSelectable="true" + android:textSize="@dimen/dimen16sp" /> + + + + + + + + + + + app:cardCornerRadius="@dimen/dimen12dp" + app:cardElevation="@dimen/dimen0dp"> + android:layout_weight="0" + android:contentDescription="@string/generalImgContentText" + tools:srcCompat="@tools:sample/avatars" + tools:ignore="TooDeepLayout" /> - - - - - - - - - + android:ellipsize="middle" + android:singleLine="true" + android:textColor="?attr/primaryTextColor" + android:textSize="14sp" + android:textStyle="bold" /> - - + android:orientation="horizontal"> + android:gravity="start" + android:textColor="?attr/hintColor" + android:textSize="12sp" + android:visibility="gone" /> + + - + + + + + android:contentDescription="@string/generalImgContentText" + app:srcCompat="@drawable/ic_calendar" /> - - - - - - - - - - - - - - - + android:layout_marginStart="@dimen/dimen8dp" + android:singleLine="true" + android:textColor="?attr/primaryTextColor" + android:textSize="@dimen/dimen14sp" /> - + - + - + + + + + + + + android:gravity="end" + android:orientation="horizontal"> - + + + + + + + + + + + + + + + @@ -302,15 +331,15 @@ + android:layout_below="@+id/mainThreadCard" + android:background="?attr/primaryBackgroundColor"> + android:layout_height="wrap_content" + android:clipToPadding="false" + android:paddingBottom="@dimen/dimen72dp" /> diff --git a/app/src/main/res/layout/bottom_sheet_organization.xml b/app/src/main/res/layout/bottom_sheet_organization.xml index 23e14c7e..d3bf335b 100644 --- a/app/src/main/res/layout/bottom_sheet_organization.xml +++ b/app/src/main/res/layout/bottom_sheet_organization.xml @@ -82,7 +82,7 @@ android:text="@string/label" android:textColor="?attr/primaryTextColor" android:textSize="16sp" - app:drawableTopCompat="@drawable/ic_label" + app:drawableTopCompat="@drawable/ic_tag" app:layout_alignSelf="flex_start"/> diff --git a/app/src/main/res/layout/bottom_sheet_releases_tags.xml b/app/src/main/res/layout/bottom_sheet_releases_tags.xml index d02f81a2..9220f4ae 100644 --- a/app/src/main/res/layout/bottom_sheet_releases_tags.xml +++ b/app/src/main/res/layout/bottom_sheet_releases_tags.xml @@ -69,7 +69,7 @@ android:text="@string/tags" android:textColor="?attr/primaryTextColor" android:textSize="16sp" - app:drawableTopCompat="@drawable/ic_label" + app:drawableTopCompat="@drawable/ic_tag" app:layout_alignSelf="flex_start"/> diff --git a/app/src/main/res/layout/bottom_sheet_repo.xml b/app/src/main/res/layout/bottom_sheet_repo.xml index 2fdd780b..387f565d 100644 --- a/app/src/main/res/layout/bottom_sheet_repo.xml +++ b/app/src/main/res/layout/bottom_sheet_repo.xml @@ -82,7 +82,7 @@ android:text="@string/label" android:textColor="?attr/primaryTextColor" android:textSize="16sp" - app:drawableTopCompat="@drawable/ic_label" + app:drawableTopCompat="@drawable/ic_tag" app:layout_alignSelf="flex_start"/> - + android:orientation="horizontal" /> + android:background="?attr/dividerColor" /> + android:textSize="16sp" /> @@ -73,7 +72,7 @@ android:textSize="16sp" android:visibility="gone" app:drawableTopCompat="@drawable/ic_file" - app:layout_alignSelf="flex_start"/> + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> + app:drawableTopCompat="@drawable/ic_refresh" + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> + app:drawableTopCompat="@drawable/ic_tag" + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> @@ -202,7 +201,7 @@ android:layout_width="match_parent" android:layout_height="4dp" android:layout_marginBottom="16dp" - android:background="?attr/dividerColor"/> + android:background="?attr/dividerColor" /> + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> + app:layout_alignSelf="flex_start" /> diff --git a/app/src/main/res/layout/fragment_commit_details.xml b/app/src/main/res/layout/fragment_commit_details.xml index 471581d8..6ceea373 100644 --- a/app/src/main/res/layout/fragment_commit_details.xml +++ b/app/src/main/res/layout/fragment_commit_details.xml @@ -117,21 +117,42 @@ android:orientation="horizontal" tools:ignore="UseCompoundDrawables"> - + style="?attr/materialCardViewFilledStyle" + app:cardElevation="@dimen/dimen0dp" + android:layout_marginEnd="@dimen/dimen6dp" + app:cardCornerRadius="@dimen/dimen12dp"> - + + + + + style="?attr/materialCardViewFilledStyle" + app:cardElevation="@dimen/dimen0dp" + android:layout_marginEnd="@dimen/dimen6dp" + app:cardCornerRadius="@dimen/dimen12dp"> + + + + + tools:srcCompat="@tools:sample/avatars" /> - + style="?attr/materialCardViewFilledStyle" + app:cardElevation="@dimen/dimen0dp" + android:layout_marginEnd="@dimen/dimen6dp" + app:cardCornerRadius="@dimen/dimen12dp"> + + + + @@ -61,8 +62,9 @@ + android:layout_gravity="center_vertical" + android:contentDescription="@string/generalImgContentText" + app:srcCompat="@drawable/ic_chevron_right" /> diff --git a/app/src/main/res/layout/list_issue_comments.xml b/app/src/main/res/layout/list_issue_comments.xml index 4d5333f8..03e88d7e 100644 --- a/app/src/main/res/layout/list_issue_comments.xml +++ b/app/src/main/res/layout/list_issue_comments.xml @@ -4,23 +4,39 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingTop="@dimen/dimen4dp" - android:paddingBottom="@dimen/dimen4dp"> + android:orientation="vertical"> + + + + + + + android:foreground="?android:attr/selectableItemBackground" + android:orientation="vertical" + android:padding="@dimen/dimen12dp"> + app:cardCornerRadius="@dimen/dimen12dp" + app:cardElevation="@dimen/dimen0dp"> + tools:srcCompat="@tools:sample/avatars" /> @@ -62,7 +78,7 @@ android:singleLine="true" android:textColor="?attr/primaryTextColor" android:textSize="14sp" - android:textStyle="bold"/> + android:textStyle="bold" /> + android:textSize="12sp" /> + android:contentDescription="@string/menuContentDesc" + app:srcCompat="@drawable/ic_dotted_menu_horizontal" /> @@ -91,22 +107,85 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="12dp" - android:textColor="?attr/primaryTextColor" - android:textIsSelectable="true" android:autoLink="web" + android:textColor="?attr/primaryTextColor" android:textColorLink="@color/lightBlue" - android:textSize="14sp"/> + android:textIsSelectable="true" + android:textSize="14sp" /> + android:orientation="horizontal" + android:visibility="gone" /> + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/list_issues.xml b/app/src/main/res/layout/list_issues.xml index c4d64de9..1457f691 100644 --- a/app/src/main/res/layout/list_issues.xml +++ b/app/src/main/res/layout/list_issues.xml @@ -61,25 +61,25 @@ android:text="@string/newIssueTitle" android:textAlignment="gravity" android:textColor="?attr/primaryTextColor" - android:textSize="16sp" - tools:text="Id illum odio repellat omnis fuga deserunt aut. Ut est aut similique qui incidunt quia et."/> + android:textSize="@dimen/dimen16sp" + tools:text="Id illum odio repellat omnis fuga deserunt aut. Ut est aut similique qui incidunt quia et." /> + android:visibility="gone"> + android:layout_marginTop="@dimen/dimen10dp" + android:orientation="horizontal" /> @@ -91,18 +91,18 @@ android:id="@+id/labelsScrollViewWithText" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/dimen8dp" + android:fillViewport="true" android:foregroundGravity="right" - android:layout_marginBottom="8dp" android:scrollbarThumbHorizontal="@android:color/transparent" - android:visibility="gone" - android:fillViewport="true"> + android:visibility="gone"> + android:layout_marginTop="@dimen/dimen10dp" + android:orientation="horizontal" /> @@ -119,31 +119,32 @@ android:layout_height="wrap_content" android:gravity="start" android:textColor="?attr/hintColor" - android:textSize="12sp" - tools:text="10.01.2020"/> + android:textSize="@dimen/dimen12sp" + tools:text="10.01.2020" /> + app:tint="?attr/iconsColor" /> + android:textSize="@dimen/dimen14sp" + tools:text="50" /> diff --git a/app/src/main/res/layout/list_labels.xml b/app/src/main/res/layout/list_labels.xml index c54ddfff..45da86b7 100644 --- a/app/src/main/res/layout/list_labels.xml +++ b/app/src/main/res/layout/list_labels.xml @@ -50,7 +50,7 @@ android:layout_weight="0" android:contentDescription="@string/generalImgContentText" app:tint="@color/colorWhite" - app:srcCompat="@drawable/ic_label"/> + app:srcCompat="@drawable/ic_tag"/> + android:foreground="?android:attr/selectableItemBackground" + android:orientation="vertical" + android:padding="@dimen/dimen12dp"> + android:src="@drawable/ic_android" /> + tools:text="@string/orgName" /> @@ -57,13 +57,13 @@ android:text="@string/repoName" android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen16sp" - android:textStyle="bold"/> + android:textStyle="bold" /> + android:layout_marginBottom="@dimen/dimen8dp" /> + app:tint="?attr/iconsColor" /> + tools:text="@string/repoStars" /> + app:srcCompat="@drawable/ic_delete" + app:tint="?attr/iconsColor" /> diff --git a/app/src/main/res/layout/list_pr.xml b/app/src/main/res/layout/list_pr.xml index 69029f8e..b496c495 100644 --- a/app/src/main/res/layout/list_pr.xml +++ b/app/src/main/res/layout/list_pr.xml @@ -44,7 +44,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:contentDescription="@string/generalImgContentText" - android:src="@drawable/ic_android"/> + android:src="@drawable/ic_android" /> @@ -62,23 +62,23 @@ android:textAlignment="gravity" android:text="@string/newIssueTitle" android:textColor="?attr/primaryTextColor" - android:textSize="16sp"/> + android:textSize="@dimen/dimen16sp" /> + android:scrollbarThumbHorizontal="@android:color/transparent"> + android:layout_marginTop="@dimen/dimen10dp" + android:orientation="horizontal" /> @@ -90,18 +90,18 @@ android:id="@+id/labelsScrollViewWithText" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/dimen8dp" + android:fillViewport="true" android:foregroundGravity="right" - android:layout_marginBottom="8dp" android:scrollbarThumbHorizontal="@android:color/transparent" - android:visibility="gone" - android:fillViewport="true"> + android:visibility="gone"> + android:layout_marginTop="@dimen/dimen10dp" + android:orientation="horizontal" /> @@ -118,27 +118,28 @@ android:layout_height="wrap_content" android:gravity="start" android:textColor="?attr/hintColor" - android:textSize="12sp"/> + android:textSize="@dimen/dimen12sp" /> @@ -150,7 +151,7 @@ android:gravity="center_vertical" android:text="@string/repoStars" android:textColor="?attr/primaryTextColor" - android:textSize="14sp"/> + android:textSize="@dimen/dimen14sp" /> diff --git a/app/src/main/res/layout/list_releases.xml b/app/src/main/res/layout/list_releases.xml index b290e847..47d763ab 100644 --- a/app/src/main/res/layout/list_releases.xml +++ b/app/src/main/res/layout/list_releases.xml @@ -130,7 +130,7 @@ android:layout_width="@dimen/dimen18dp" android:layout_height="wrap_content" android:contentDescription="@string/generalImgContentText" - app:srcCompat="@drawable/ic_label" /> + app:srcCompat="@drawable/ic_tag" /> + android:title="@string/menuContentDesc" + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f5790f9f..5e406f98 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -790,4 +790,45 @@ %1$d:%2$d Code Editor Open in Code Editor + + + %s added the\u0020 + %s removed the\u0020 + \u0020label %s + %s added\u0020 + %s removed their assignment %s + %s was unassigned by %s %s + %s self-assigned this %s + %s was assigned by %s %s + %s added this to the %s milestone %s + %s removed this from the %s milestone %s + %s closed this issue %s + %s reopened this issue %s + %s referenced this issue from a \u0020 + %s closed this pull request %s + %s merged this pull request %s + %s referenced this pull request from a\u0020 + commit + %s reopened this pull request %s + %s requested review from %s %s + %s changed title from %s to %s %s + %s locked as %s and limited conversation to collaborators %s + %s unlocked this conversation %s + %s added a new dependency #%d %s + %s removed a dependency #%d %s + %s added this to a project %s + %s removed this from a project %s + %s added the due date %s %s + %s modified the due date to %s from %s %s + %s removed the due date %s %s + %s changed target branch from %s to %s %s + %s deleted branch %s %s + %s started working %s + %s stopped time tracking %s + %s cancelled time tracking %s + %s added spent time %s %s + %s deleted spent time %s %s + %s added reference %s %s + %s referenced this issue in #%d %s + %s referenced this pull request in #%d %s