Show labels in list / show draft status for release (#1083)

Closes #258
Closes #877

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1083
This commit is contained in:
M M Arif 2022-03-28 19:57:47 +02:00
parent 18fd368c8d
commit 1e7a0a20b2
65 changed files with 606 additions and 541 deletions

View File

@ -71,13 +71,13 @@ dependencies {
implementation "com.squareup.picasso:picasso:2.71828" implementation "com.squareup.picasso:picasso:2.71828"
implementation 'jp.wasabeef:picasso-transformations:2.4.0' implementation 'jp.wasabeef:picasso-transformations:2.4.0'
implementation 'jp.co.cyberagent.android:gpuimage:2.1.0' implementation 'jp.co.cyberagent.android:gpuimage:2.1.0'
implementation "com.amulyakhare:com.amulyakhare.textdrawable:1.0.1" implementation 'com.github.amulyakhare:TextDrawable:558677ea31'
implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0' implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2' implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'org.ocpsoft.prettytime:prettytime:5.0.2.Final' implementation 'org.ocpsoft.prettytime:prettytime:5.0.2.Final'
implementation "com.pes.materialcolorpicker:library:1.2.5" implementation 'com.github.Pes8:android-material-color-picker-dialog:master'
implementation "io.noties.markwon:core:$markwon_version" implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-latex:$markwon_version" implementation "io.noties.markwon:ext-latex:$markwon_version"
implementation "io.noties.markwon:ext-strikethrough:$markwon_version" implementation "io.noties.markwon:ext-strikethrough:$markwon_version"

View File

@ -1,9 +1,7 @@
package org.mian.gitnex.actions; package org.mian.gitnex.actions;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import org.gitnex.tea4j.models.IssueComments; import org.gitnex.tea4j.models.IssueComments;
import org.gitnex.tea4j.models.Issues; import org.gitnex.tea4j.models.Issues;

View File

@ -25,7 +25,6 @@ import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCommitsBinding; import org.mian.gitnex.databinding.ActivityCommitsBinding;
import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.Version;
import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.contexts.RepositoryContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -25,7 +25,6 @@ import org.mian.gitnex.databinding.CustomLabelsSelectionDialogBinding;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.Version;
import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.contexts.RepositoryContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;

View File

@ -6,7 +6,6 @@ import android.content.res.ColorStateList;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -24,13 +23,13 @@ import android.widget.ScrollView;
import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts; import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat; import androidx.core.text.HtmlCompat;
import androidx.core.widget.ImageViewCompat; import androidx.core.widget.ImageViewCompat;
import androidx.core.widget.NestedScrollView;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.TextDrawable;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
@ -54,10 +53,12 @@ import org.mian.gitnex.databinding.CustomAssigneesSelectionDialogBinding;
import org.mian.gitnex.databinding.CustomLabelsSelectionDialogBinding; import org.mian.gitnex.databinding.CustomLabelsSelectionDialogBinding;
import org.mian.gitnex.fragments.BottomSheetReplyFragment; import org.mian.gitnex.fragments.BottomSheetReplyFragment;
import org.mian.gitnex.fragments.BottomSheetSingleIssueFragment; import org.mian.gitnex.fragments.BottomSheetSingleIssueFragment;
import org.mian.gitnex.fragments.IssuesFragment;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.ClickListener; import org.mian.gitnex.helpers.ClickListener;
import org.mian.gitnex.helpers.ColorInverter; import org.mian.gitnex.helpers.ColorInverter;
import org.mian.gitnex.helpers.DividerItemDecorator;
import org.mian.gitnex.helpers.LabelWidthCalculator; import org.mian.gitnex.helpers.LabelWidthCalculator;
import org.mian.gitnex.helpers.Markdown; import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.RoundedTransformation;
@ -81,7 +82,7 @@ import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class IssueDetailActivity extends BaseActivity implements LabelsListAdapter.LabelsListAdapterListener, AssigneesListAdapter.AssigneesListAdapterListener, BottomSheetListener { public class IssueDetailActivity extends BaseActivity implements LabelsListAdapter.LabelsListAdapterListener, AssigneesListAdapter.AssigneesListAdapterListener, BottomSheetListener {
@ -153,7 +154,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
viewBinding.recyclerView.setNestedScrollingEnabled(false); viewBinding.recyclerView.setNestedScrollingEnabled(false);
viewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(ctx)); viewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(viewBinding.recyclerView.getContext(), DividerItemDecoration.VERTICAL); RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.shape_list_divider));
viewBinding.recyclerView.addItemDecoration(dividerItemDecoration); viewBinding.recyclerView.addItemDecoration(dividerItemDecoration);
viewBinding.addNewComment.setOnClickListener(v -> { viewBinding.addNewComment.setOnClickListener(v -> {
@ -161,7 +162,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
BottomSheetReplyFragment bottomSheetReplyFragment = BottomSheetReplyFragment.newInstance(new Bundle(), issue); BottomSheetReplyFragment bottomSheetReplyFragment = BottomSheetReplyFragment.newInstance(new Bundle(), issue);
bottomSheetReplyFragment.setOnInteractedListener(this::onResume); bottomSheetReplyFragment.setOnInteractedListener(this::onResume);
bottomSheetReplyFragment.show(getSupportFragmentManager(), "replyBottomSheet"); bottomSheetReplyFragment.show(getSupportFragmentManager(), "replyBottomSheet");
}); });
labelsAdapter = new LabelsListAdapter(labelsList, IssueDetailActivity.this, currentLabelsIds); labelsAdapter = new LabelsListAdapter(labelsList, IssueDetailActivity.this, currentLabelsIds);
@ -169,29 +169,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
LabelsActions.getCurrentIssueLabels(ctx, repoOwner, repoName, issueIndex, currentLabelsIds); LabelsActions.getCurrentIssueLabels(ctx, repoOwner, repoName, issueIndex, currentLabelsIds);
AssigneesActions.getCurrentIssueAssignees(ctx, repoOwner, repoName, issueIndex, currentAssignees); AssigneesActions.getCurrentIssueAssignees(ctx, repoOwner, repoName, issueIndex, currentAssignees);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
viewBinding.scrollViewComments.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
if((scrollY - oldScrollY) > 0 && viewBinding.addNewComment.isShown()) {
viewBinding.addNewComment.setVisibility(View.GONE);
}
else if((scrollY - oldScrollY) < 0) {
viewBinding.addNewComment.setVisibility(View.VISIBLE);
}
if(!viewBinding.scrollViewComments.canScrollVertically(1)) { // bottom
viewBinding.addNewComment.setVisibility(View.GONE);
}
if(!viewBinding.scrollViewComments.canScrollVertically(-1)) { // top
viewBinding.addNewComment.setVisibility(View.VISIBLE);
}
});
}
viewBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { viewBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
viewBinding.pullToRefresh.setRefreshing(false); viewBinding.pullToRefresh.setRefreshing(false);
@ -420,6 +397,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
getSingleIssue(repoOwner, repoName, issueIndex); getSingleIssue(repoOwner, repoName, issueIndex);
currentLabelsIds.clear(); currentLabelsIds.clear();
new Handler(Looper.getMainLooper()).postDelayed(() -> LabelsActions.getCurrentIssueLabels(ctx, repoOwner, repoName, issueIndex, currentLabelsIds), 1000); new Handler(Looper.getMainLooper()).postDelayed(() -> LabelsActions.getCurrentIssueLabels(ctx, repoOwner, repoName, issueIndex, currentLabelsIds), 1000);
IssuesFragment.resumeIssues = true;
} }
else if(response.code() == 401) { else if(response.code() == 401) {
@ -755,13 +733,13 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
viewBinding.frameLabels.setGravity(Gravity.START | Gravity.TOP); viewBinding.frameLabels.setGravity(Gravity.START | Gravity.TOP);
labelsView.setLayoutParams(params); labelsView.setLayoutParams(params);
int height = AppUtil.getPixelsFromDensity(ctx, 25); int height = AppUtil.getPixelsFromDensity(ctx, 20);
int textSize = AppUtil.getPixelsFromScaledDensity(ctx, 15); int textSize = AppUtil.getPixelsFromScaledDensity(ctx, 12);
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT) TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT)
.textColor(new ColorInverter().getContrastColor(color)).fontSize(textSize) .textColor(new ColorInverter().getContrastColor(color)).fontSize(textSize)
.width(LabelWidthCalculator.calculateLabelWidth(labelName, Typeface.DEFAULT, textSize, AppUtil.getPixelsFromDensity(ctx, 10))) .width(LabelWidthCalculator.calculateLabelWidth(labelName, Typeface.DEFAULT, textSize, AppUtil.getPixelsFromDensity(ctx, 10)))
.height(height).endConfig().buildRoundRect(labelName, color, AppUtil.getPixelsFromDensity(ctx, 5)); .height(height).endConfig().buildRoundRect(labelName, color, AppUtil.getPixelsFromDensity(ctx, 18));
labelsView.setImageDrawable(drawable); labelsView.setImageDrawable(drawable);
viewBinding.frameLabels.addView(labelsView); viewBinding.frameLabels.addView(labelsView);

View File

@ -20,7 +20,12 @@ import org.mian.gitnex.database.api.BaseApi;
import org.mian.gitnex.database.api.UserAccountsApi; import org.mian.gitnex.database.api.UserAccountsApi;
import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.databinding.ActivityLoginBinding; 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 org.mian.gitnex.structs.Protocol;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

View File

@ -36,9 +36,6 @@ import org.gitnex.tea4j.models.UserRepositories;
import org.gitnex.tea4j.models.WatchInfo; import org.gitnex.tea4j.models.WatchInfo;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.clients.RetrofitClient; 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.fragments.BottomSheetIssuesFilterFragment; import org.mian.gitnex.fragments.BottomSheetIssuesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment; import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment; import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment;
@ -53,8 +50,8 @@ import org.mian.gitnex.fragments.PullRequestsFragment;
import org.mian.gitnex.fragments.ReleasesFragment; import org.mian.gitnex.fragments.ReleasesFragment;
import org.mian.gitnex.fragments.RepoInfoFragment; import org.mian.gitnex.fragments.RepoInfoFragment;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import org.mian.gitnex.structs.BottomSheetListener; import org.mian.gitnex.structs.BottomSheetListener;
import org.mian.gitnex.structs.FragmentRefreshListener; import org.mian.gitnex.structs.FragmentRefreshListener;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -100,6 +100,16 @@ public class SettingsAppearanceActivity extends BaseActivity {
}); });
activitySettingsAppearanceBinding.counterBadgeFrame.setOnClickListener(v -> counterBadgesSwitch.setChecked(!counterBadgesSwitch.isChecked())); activitySettingsAppearanceBinding.counterBadgeFrame.setOnClickListener(v -> counterBadgesSwitch.setChecked(!counterBadgesSwitch.isChecked()));
// show labels in lists(issues, pr) - default is color dots
activitySettingsAppearanceBinding.switchLabelsInListBadge.setChecked(tinyDB.getBoolean("showLabelsInList", false));
activitySettingsAppearanceBinding.switchLabelsInListBadge.setOnCheckedChangeListener((buttonView, isChecked) -> {
tinyDB.putBoolean("showLabelsInList", isChecked);
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
});
activitySettingsAppearanceBinding.labelsInListFrame.setOnClickListener(v -> activitySettingsAppearanceBinding.switchLabelsInListBadge.setChecked(!activitySettingsAppearanceBinding.switchLabelsInListBadge.isChecked()));
// theme selection dialog // theme selection dialog
themeFrame.setOnClickListener(view -> { themeFrame.setOnClickListener(view -> {

View File

@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;

View File

@ -1,7 +1,5 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
@ -15,7 +13,6 @@ import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Locale; import java.util.Locale;
import java.util.TreeMap;
/** /**
* Author M M Arif * Author M M Arif

View File

@ -1,5 +1,6 @@
package org.mian.gitnex.adapters; package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -16,7 +17,6 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.CommitDetailActivity; import org.mian.gitnex.activities.CommitDetailActivity;
import org.mian.gitnex.activities.CommitsActivity; import org.mian.gitnex.activities.CommitsActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.fragments.CommitDetailFragment;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.TimeHelper;
@ -24,13 +24,12 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<Commits> commitsList; private List<Commits> commitsList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false; private boolean isLoading = false;
@ -45,14 +44,8 @@ public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new CommitsHolder(inflater.inflate(R.layout.list_commits, parent, false)); return new CommitsHolder(inflater.inflate(R.layout.list_commits, parent, false));
} else {
return new LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
} }
@Override @Override
@ -63,19 +56,12 @@ public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((CommitsHolder) holder).bindData(commitsList.get(position)); ((CommitsHolder) holder).bindData(commitsList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
return position;
if(commitsList.get(position).getSha() != null) {
return TYPE_LOAD;
} else {
return 1;
}
} }
@Override @Override
@ -177,16 +163,11 @@ public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
@ -198,6 +179,6 @@ public class CommitsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
public void updateList(List<Commits> list) { public void updateList(List<Commits> list) {
commitsList = list; commitsList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -3,15 +3,22 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Handler;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat; import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable;
import org.gitnex.tea4j.models.Issues; import org.gitnex.tea4j.models.Issues;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.BaseActivity; import org.mian.gitnex.activities.BaseActivity;
@ -23,6 +30,8 @@ import org.mian.gitnex.database.api.RepositoriesApi;
import org.mian.gitnex.database.models.Repository; import org.mian.gitnex.database.models.Repository;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.ClickListener; 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.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.TimeHelper;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -35,13 +44,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<Issues> searchedList; private List<Issues> searchedList;
private OnLoadMoreListener loadMoreListener; private OnLoadMoreListener loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -57,13 +65,8 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.View
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new ExploreIssuesAdapter.IssuesHolder(inflater.inflate(R.layout.list_issues, parent, false)); return new ExploreIssuesAdapter.IssuesHolder(inflater.inflate(R.layout.list_issues, parent, false));
} }
else {
return new ExploreIssuesAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -72,19 +75,12 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.View
loadMoreListener.onLoadMore(); loadMoreListener.onLoadMore();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((ExploreIssuesAdapter.IssuesHolder) holder).bindData(searchedList.get(position)); ((ExploreIssuesAdapter.IssuesHolder) holder).bindData(searchedList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(searchedList.get(position).getTitle() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -93,26 +89,36 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.View
} }
class IssuesHolder extends RecyclerView.ViewHolder { class IssuesHolder extends RecyclerView.ViewHolder {
private Issues issue; private Issues issue;
private final ImageView issueAssigneeAvatar; private final ImageView issueAssigneeAvatar;
private final TextView issueTitle; private final TextView issueTitle;
private final TextView issueCreatedTime; private final TextView issueCreatedTime;
private final TextView issueCommentsCount; private final TextView issueCommentsCount;
private final HorizontalScrollView labelsScrollViewWithText;
private final LinearLayout frameLabels;
private final HorizontalScrollView labelsScrollViewDots;
private final LinearLayout frameLabelsDots;
IssuesHolder(View itemView) { IssuesHolder(View itemView) {
super(itemView); super(itemView);
issueAssigneeAvatar = itemView.findViewById(R.id.assigneeAvatar); issueAssigneeAvatar = itemView.findViewById(R.id.assigneeAvatar);
issueTitle = itemView.findViewById(R.id.issueTitle); issueTitle = itemView.findViewById(R.id.issueTitle);
issueCommentsCount = itemView.findViewById(R.id.issueCommentsCount); issueCommentsCount = itemView.findViewById(R.id.issueCommentsCount);
issueCreatedTime = itemView.findViewById(R.id.issueCreatedTime); issueCreatedTime = itemView.findViewById(R.id.issueCreatedTime);
labelsScrollViewWithText = itemView.findViewById(R.id.labelsScrollViewWithText);
frameLabels = itemView.findViewById(R.id.frameLabels);
labelsScrollViewDots = itemView.findViewById(R.id.labelsScrollViewDots);
frameLabelsDots = itemView.findViewById(R.id.frameLabelsDots);
new Handler().postDelayed(() -> {
itemView.setOnClickListener(v -> {
String[] parts = issue.getRepository().getFull_name().split("/"); String[] parts = issue.getRepository().getFull_name().split("/");
final String repoOwner = parts[0]; final String repoOwner = parts[0];
final String repoName = parts[1]; final String repoName = parts[1];
int currentActiveAccountId = ((BaseActivity) context).getAccount().getAccount().getAccountId(); int currentActiveAccountId = ((BaseActivity) context).getAccount().getAccount().getAccountId();
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class); RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
@ -130,13 +136,13 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.View
repo.setRepositoryId(data.getRepositoryId()); repo.setRepositoryId(data.getRepositoryId());
} }
Intent intent = new IssueContext( Intent intentIssueDetail = new IssueContext(issue, repo).getIntent(context, IssueDetailActivity.class);
issue, intentIssueDetail.putExtra("openedFromLink", "true");
repo
).getIntent(context, IssueDetailActivity.class); itemView.setOnClickListener(v -> context.startActivity(intentIssueDetail));
intent.putExtra("openedFromLink", "true"); frameLabels.setOnClickListener(v -> context.startActivity(intentIssueDetail));
context.startActivity(intent); frameLabelsDots.setOnClickListener(v -> context.startActivity(intentIssueDetail));
}); }, 200);
issueAssigneeAvatar.setOnClickListener(v -> { issueAssigneeAvatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
@ -150,8 +156,8 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.View
}); });
} }
@SuppressLint("SetTextI18n")
void bindData(Issues issue) { void bindData(Issues issue) {
this.issue = issue; this.issue = issue;
int imgRadius = AppUtil.getPixelsFromDensity(context, 3); int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
@ -171,6 +177,68 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.View
issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + issue.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY)); issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + issue.getTitle(), HtmlCompat.FROM_HTML_MODE_LEGACY));
issueCommentsCount.setText(String.valueOf(issue.getComments())); issueCommentsCount.setText(String.valueOf(issue.getComments()));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 0, 15, 0);
if(issue.getLabels() != null) {
if(!tinyDb.getBoolean("showLabelsInList", false)) { // default
labelsScrollViewWithText.setVisibility(View.GONE);
labelsScrollViewDots.setVisibility(View.VISIBLE);
frameLabelsDots.removeAllViews();
for(int i = 0; i < issue.getLabels().size(); i++) {
String labelColor = issue.getLabels().get(i).getColor();
int color = Color.parseColor("#" + labelColor);
ImageView labelsView = new ImageView(context);
frameLabelsDots.setOrientation(LinearLayout.HORIZONTAL);
frameLabelsDots.setGravity(Gravity.START | Gravity.TOP);
labelsView.setLayoutParams(params);
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).width(54).height(54).endConfig().buildRound("", color);
labelsView.setImageDrawable(drawable);
frameLabelsDots.addView(labelsView);
}
}
else {
labelsScrollViewDots.setVisibility(View.GONE);
labelsScrollViewWithText.setVisibility(View.VISIBLE);
frameLabels.removeAllViews();
for(int i = 0; i < issue.getLabels().size(); i++) {
String labelColor = issue.getLabels().get(i).getColor();
String labelName = issue.getLabels().get(i).getName();
int color = Color.parseColor("#" + labelColor);
ImageView labelsView = new ImageView(context);
frameLabels.setOrientation(LinearLayout.HORIZONTAL);
frameLabels.setGravity(Gravity.START | Gravity.TOP);
labelsView.setLayoutParams(params);
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(labelName, Typeface.DEFAULT, textSize, AppUtil.getPixelsFromDensity(context, 8))).height(height).endConfig().buildRoundRect(labelName, color, AppUtil.getPixelsFromDensity(context, 18));
labelsView.setImageDrawable(drawable);
frameLabels.addView(labelsView);
}
}
}
else {
labelsScrollViewDots.setVisibility(View.GONE);
labelsScrollViewWithText.setVisibility(View.GONE);
}
switch(timeFormat) { switch(timeFormat) {
case "pretty": { case "pretty": {
PrettyTime prettyTime = new PrettyTime(locale); PrettyTime prettyTime = new PrettyTime(locale);
@ -196,12 +264,6 @@ public class ExploreIssuesAdapter extends RecyclerView.Adapter<RecyclerView.View
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
if(!isMoreDataAvailable) { if(!isMoreDataAvailable) {

View File

@ -19,13 +19,12 @@ import org.mian.gitnex.helpers.RoundedTransformation;
import java.util.List; import java.util.List;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<Organization> organizationsList; private List<Organization> organizationsList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -39,13 +38,8 @@ public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<Recy
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new ExplorePublicOrganizationsAdapter.OrganizationsHolder(inflater.inflate(R.layout.list_organizations, parent, false)); return new ExplorePublicOrganizationsAdapter.OrganizationsHolder(inflater.inflate(R.layout.list_organizations, parent, false));
} }
else {
return new ExplorePublicOrganizationsAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -53,20 +47,12 @@ public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<Recy
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((ExplorePublicOrganizationsAdapter.OrganizationsHolder) holder).bindData(organizationsList.get(position)); ((ExplorePublicOrganizationsAdapter.OrganizationsHolder) holder).bindData(organizationsList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(organizationsList.get(position).getFull_name() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -117,12 +103,6 @@ public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<Recy
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }

View File

@ -34,13 +34,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<UserRepositories> reposList; private List<UserRepositories> reposList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -56,13 +55,8 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new ExploreRepositoriesAdapter.RepositoriesHolder(inflater.inflate(R.layout.list_repositories, parent, false)); return new ExploreRepositoriesAdapter.RepositoriesHolder(inflater.inflate(R.layout.list_repositories, parent, false));
} }
else {
return new ExploreRepositoriesAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -70,20 +64,12 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((ExploreRepositoriesAdapter.RepositoriesHolder) holder).bindData(reposList.get(position)); ((ExploreRepositoriesAdapter.RepositoriesHolder) holder).bindData(reposList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(reposList.get(position).getFullName() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -213,12 +199,6 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.adapters; package org.mian.gitnex.adapters;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
@ -27,6 +26,7 @@ import org.mian.gitnex.activities.ProfileActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.fragments.BottomSheetReplyFragment; import org.mian.gitnex.fragments.BottomSheetReplyFragment;
import org.mian.gitnex.fragments.IssuesFragment;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Markdown; import org.mian.gitnex.helpers.Markdown;
@ -268,6 +268,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
case 204: case 204:
updateAdapter(position); updateAdapter(position);
Toasty.success(ctx, ctx.getResources().getString(R.string.deleteCommentSuccess)); Toasty.success(ctx, ctx.getResources().getString(R.string.deleteCommentSuccess));
IssuesFragment.resumeIssues = true;
break; break;
case 401: case 401:

View File

@ -3,15 +3,22 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Handler;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat; import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
import org.gitnex.tea4j.models.Issues; import org.gitnex.tea4j.models.Issues;
import org.mian.gitnex.R; import org.mian.gitnex.R;
@ -21,6 +28,8 @@ import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.ClickListener; 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.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.TimeHelper;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -32,61 +41,45 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<Issues> issuesList; private List<Issues> issuesList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
TinyDB tinyDb;
public IssuesAdapter(Context ctx, List<Issues> issuesListMain) { public IssuesAdapter(Context ctx, List<Issues> issuesListMain) {
this.context = ctx; this.context = ctx;
this.issuesList = issuesListMain; this.issuesList = issuesListMain;
tinyDb = TinyDB.getInstance(context);
} }
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new IssuesHolder(inflater.inflate(R.layout.list_issues, parent, false)); return new IssuesHolder(inflater.inflate(R.layout.list_issues, parent, false));
} }
else {
return new LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) { if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) {
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((IssuesHolder) holder).bindData(issuesList.get(position)); ((IssuesHolder) holder).bindData(issuesList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
return position;
if(issuesList.get(position).getTitle() != null) {
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -97,12 +90,16 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
class IssuesHolder extends RecyclerView.ViewHolder { class IssuesHolder extends RecyclerView.ViewHolder {
private Issues issue; private Issues issueObject;
private final ImageView issueAssigneeAvatar; private final ImageView issueAssigneeAvatar;
private final TextView issueTitle; private final TextView issueTitle;
private final TextView issueCreatedTime; private final TextView issueCreatedTime;
private final TextView issueCommentsCount; private final TextView issueCommentsCount;
private final HorizontalScrollView labelsScrollViewWithText;
private final LinearLayout frameLabels;
private final HorizontalScrollView labelsScrollViewDots;
private final LinearLayout frameLabelsDots;
IssuesHolder(View itemView) { IssuesHolder(View itemView) {
@ -111,31 +108,38 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
issueTitle = itemView.findViewById(R.id.issueTitle); issueTitle = itemView.findViewById(R.id.issueTitle);
issueCommentsCount = itemView.findViewById(R.id.issueCommentsCount); issueCommentsCount = itemView.findViewById(R.id.issueCommentsCount);
issueCreatedTime = itemView.findViewById(R.id.issueCreatedTime); issueCreatedTime = itemView.findViewById(R.id.issueCreatedTime);
labelsScrollViewWithText = itemView.findViewById(R.id.labelsScrollViewWithText);
frameLabels = itemView.findViewById(R.id.frameLabels);
labelsScrollViewDots = itemView.findViewById(R.id.labelsScrollViewDots);
frameLabelsDots = itemView.findViewById(R.id.frameLabelsDots);
issueAssigneeAvatar.setOnLongClickListener(loginId -> {
AppUtil.copyToClipboard(context, issueObject.getUser().getLogin(), context.getString(R.string.copyLoginIdToClipBoard, issueObject.getUser().getLogin()));
return true;
});
new Handler().postDelayed(() -> {
Intent intentIssueDetail = new IssueContext(issueObject, ((RepoDetailActivity) context).repository).getIntent(context, IssueDetailActivity.class);
itemView.setOnClickListener(layoutView -> { itemView.setOnClickListener(layoutView -> {
Intent intent = new IssueContext( context.startActivity(intentIssueDetail);
issue,
((RepoDetailActivity) context).repository
).getIntent(context, IssueDetailActivity.class);
context.startActivity(intent);
}); });
frameLabels.setOnClickListener(v -> context.startActivity(intentIssueDetail));
frameLabelsDots.setOnClickListener(v -> context.startActivity(intentIssueDetail));
}, 200);
issueAssigneeAvatar.setOnClickListener(v -> { issueAssigneeAvatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
intent.putExtra("username", issue.getUser().getLogin()); intent.putExtra("username", issueObject.getUser().getLogin());
context.startActivity(intent); context.startActivity(intent);
}); });
issueAssigneeAvatar.setOnLongClickListener(loginId -> {
AppUtil.copyToClipboard(context, issue.getUser().getLogin(), context.getString(R.string.copyLoginIdToClipBoard, issue.getUser().getLogin()));
return true;
});
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
void bindData(Issues issue) { void bindData(Issues issue) {
TinyDB tinyDb = TinyDB.getInstance(context);
Locale locale = context.getResources().getConfiguration().locale; Locale locale = context.getResources().getConfiguration().locale;
String timeFormat = tinyDb.getString("dateFormat", "pretty"); String timeFormat = tinyDb.getString("dateFormat", "pretty");
@ -152,9 +156,66 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
String issueNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + issue.getNumber() + "</font>"; String issueNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + issue.getNumber() + "</font>";
issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + EmojiParser.parseToUnicode(issue.getTitle()), HtmlCompat.FROM_HTML_MODE_LEGACY)); issueTitle.setText(HtmlCompat.fromHtml(issueNumber_ + " " + EmojiParser.parseToUnicode(issue.getTitle()), HtmlCompat.FROM_HTML_MODE_LEGACY));
this.issue = issue; this.issueObject = issue;
this.issueCommentsCount.setText(String.valueOf(issue.getComments())); this.issueCommentsCount.setText(String.valueOf(issue.getComments()));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 0, 15, 0);
if(issue.getLabels() != null) {
if(!tinyDb.getBoolean("showLabelsInList", false)) { // default
labelsScrollViewWithText.setVisibility(View.GONE);
labelsScrollViewDots.setVisibility(View.VISIBLE);
frameLabelsDots.removeAllViews();
for(int i = 0; i < issue.getLabels().size(); i++) {
String labelColor = issue.getLabels().get(i).getColor();
int color = Color.parseColor("#" + labelColor);
ImageView labelsView = new ImageView(context);
frameLabelsDots.setOrientation(LinearLayout.HORIZONTAL);
frameLabelsDots.setGravity(Gravity.START | Gravity.TOP);
labelsView.setLayoutParams(params);
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).width(54).height(54).endConfig().buildRound("", color);
labelsView.setImageDrawable(drawable);
frameLabelsDots.addView(labelsView);
}
}
else {
labelsScrollViewDots.setVisibility(View.GONE);
labelsScrollViewWithText.setVisibility(View.VISIBLE);
frameLabels.removeAllViews();
for(int i = 0; i < issue.getLabels().size(); i++) {
String labelColor = issue.getLabels().get(i).getColor();
String labelName = issue.getLabels().get(i).getName();
int color = Color.parseColor("#" + labelColor);
ImageView labelsView = new ImageView(context);
frameLabels.setOrientation(LinearLayout.HORIZONTAL);
frameLabels.setGravity(Gravity.START | Gravity.TOP);
labelsView.setLayoutParams(params);
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(labelName, Typeface.DEFAULT, textSize, AppUtil.getPixelsFromDensity(context, 8))).height(height).endConfig().buildRoundRect(labelName, color, AppUtil.getPixelsFromDensity(context, 18));
labelsView.setImageDrawable(drawable);
frameLabels.addView(labelsView);
}
}
}
switch(timeFormat) { switch(timeFormat) {
case "pretty": { case "pretty": {
PrettyTime prettyTime = new PrettyTime(locale); PrettyTime prettyTime = new PrettyTime(locale);
@ -181,34 +242,22 @@ public class IssuesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
} }
public void setLoadMoreListener(Runnable loadMoreListener) { public void setLoadMoreListener(Runnable loadMoreListener) {
this.loadMoreListener = loadMoreListener; this.loadMoreListener = loadMoreListener;
} }
public void updateList(List<Issues> list) { public void updateList(List<Issues> list) {
issuesList = list; issuesList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -32,13 +32,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<Milestones> dataList; private List<Milestones> dataList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false; private boolean isLoading = false;
@ -54,16 +53,9 @@ public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new MilestonesAdapter.DataHolder(inflater.inflate(R.layout.list_milestones, parent, false)); return new MilestonesAdapter.DataHolder(inflater.inflate(R.layout.list_milestones, parent, false));
} }
else {
return new MilestonesAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -73,12 +65,8 @@ public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((MilestonesAdapter.DataHolder) holder).bindData(dataList.get(position)); ((MilestonesAdapter.DataHolder) holder).bindData(dataList.get(position));
} }
}
class DataHolder extends RecyclerView.ViewHolder { class DataHolder extends RecyclerView.ViewHolder {
@ -240,13 +228,10 @@ public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
msDueDate.setText(context.getString(R.string.milestoneNoDueDate)); msDueDate.setText(context.getString(R.string.milestoneNoDueDate));
} }
} }
} }
private void updateAdapter(int position) { private void updateAdapter(int position) {
dataList.remove(position); dataList.remove(position);
notifyItemRemoved(position); notifyItemRemoved(position);
notifyItemRangeChanged(position, dataList.size()); notifyItemRangeChanged(position, dataList.size());
@ -254,49 +239,31 @@ public class MilestonesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
return position;
if(dataList.get(position).getTitle() != null) {
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
public int getItemCount() { public int getItemCount() {
return dataList.size(); return dataList.size();
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
} }
public void setLoadMoreListener(Runnable loadMoreListener) { public void setLoadMoreListener(Runnable loadMoreListener) {
this.loadMoreListener = loadMoreListener; this.loadMoreListener = loadMoreListener;
} }
public void updateList(List<Milestones> list) { public void updateList(List<Milestones> list) {
dataList = list; dataList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -21,14 +21,12 @@ import org.mian.gitnex.helpers.AppUtil;
import java.util.List; import java.util.List;
/** /**
* Author opyale * @author opyale
* Modified M M Arif
*/ */
public class NotificationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class NotificationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<NotificationThread> notificationThreads; private List<NotificationThread> notificationThreads;
private final OnMoreClickedListener onMoreClickedListener; private final OnMoreClickedListener onMoreClickedListener;
private final OnNotificationClickedListener onNotificationClickedListener; private final OnNotificationClickedListener onNotificationClickedListener;
@ -46,33 +44,20 @@ public class NotificationsAdapter extends RecyclerView.Adapter<RecyclerView.View
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new NotificationsAdapter.NotificationsHolder(inflater.inflate(R.layout.list_notifications, parent, false)); return new NotificationsAdapter.NotificationsHolder(inflater.inflate(R.layout.list_notifications, parent, false));
} }
else {
return new NotificationsAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading) { if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading) {
isLoading = true; isLoading = true;
} }
if(getItemViewType(position) == TYPE_LOAD) {
((NotificationsAdapter.NotificationsHolder) holder).bindData(notificationThreads.get(position)); ((NotificationsAdapter.NotificationsHolder) holder).bindData(notificationThreads.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(notificationThreads.get(position).getSubject() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -168,12 +153,6 @@ public class NotificationsAdapter extends RecyclerView.Adapter<RecyclerView.View
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }

View File

@ -3,15 +3,21 @@ package org.mian.gitnex.adapters;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.core.text.HtmlCompat; import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
import org.gitnex.tea4j.models.PullRequests; import org.gitnex.tea4j.models.PullRequests;
import org.mian.gitnex.R; import org.mian.gitnex.R;
@ -20,6 +26,8 @@ import org.mian.gitnex.activities.ProfileActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.ClickListener; 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.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.TimeHelper;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -29,13 +37,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<PullRequests> prList; private List<PullRequests> prList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -48,40 +55,23 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new PullRequestsAdapter.PullRequestsHolder(inflater.inflate(R.layout.list_pr, parent, false)); return new PullRequestsAdapter.PullRequestsHolder(inflater.inflate(R.layout.list_pr, parent, false));
} }
else {
return new PullRequestsAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) { if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) {
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((PullRequestsAdapter.PullRequestsHolder) holder).bindData(prList.get(position)); ((PullRequestsAdapter.PullRequestsHolder) holder).bindData(prList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
return position;
if(prList.get(position).getTitle() != null) {
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -91,12 +81,16 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
class PullRequestsHolder extends RecyclerView.ViewHolder { class PullRequestsHolder extends RecyclerView.ViewHolder {
private PullRequests pullRequest; private PullRequests pullRequestObject;
private final ImageView assigneeAvatar; private final ImageView assigneeAvatar;
private final TextView prTitle; private final TextView prTitle;
private final TextView prCreatedTime; private final TextView prCreatedTime;
private final TextView prCommentsCount; private final TextView prCommentsCount;
private final HorizontalScrollView labelsScrollViewWithText;
private final LinearLayout frameLabels;
private final HorizontalScrollView labelsScrollViewDots;
private final LinearLayout frameLabelsDots;
PullRequestsHolder(View itemView) { PullRequestsHolder(View itemView) {
@ -105,11 +99,15 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
prTitle = itemView.findViewById(R.id.prTitle); prTitle = itemView.findViewById(R.id.prTitle);
prCommentsCount = itemView.findViewById(R.id.prCommentsCount); prCommentsCount = itemView.findViewById(R.id.prCommentsCount);
prCreatedTime = itemView.findViewById(R.id.prCreatedTime); prCreatedTime = itemView.findViewById(R.id.prCreatedTime);
labelsScrollViewWithText = itemView.findViewById(R.id.labelsScrollViewWithText);
frameLabels = itemView.findViewById(R.id.frameLabels);
labelsScrollViewDots = itemView.findViewById(R.id.labelsScrollViewDots);
frameLabelsDots = itemView.findViewById(R.id.frameLabelsDots);
itemView.setOnClickListener(v -> { itemView.setOnClickListener(v -> {
Intent intent = new IssueContext( Intent intent = new IssueContext(
pullRequest, pullRequestObject,
new RepositoryContext(pullRequest.getBase().getRepo().getFull_name().split("/")[0], pullRequest.getBase().getRepo().getName(), context) new RepositoryContext(pullRequestObject.getBase().getRepo().getFull_name().split("/")[0], pullRequestObject.getBase().getRepo().getName(), context)
) )
.getIntent(context, IssueDetailActivity.class); .getIntent(context, IssueDetailActivity.class);
@ -119,12 +117,12 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
assigneeAvatar.setOnClickListener(v -> { assigneeAvatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
intent.putExtra("username", pullRequest.getUser().getLogin()); intent.putExtra("username", pullRequestObject.getUser().getLogin());
context.startActivity(intent); context.startActivity(intent);
}); });
assigneeAvatar.setOnLongClickListener(loginId -> { assigneeAvatar.setOnLongClickListener(loginId -> {
AppUtil.copyToClipboard(context, pullRequest.getUser().getLogin(), context.getString(R.string.copyLoginIdToClipBoard, pullRequest.getUser().getLogin())); AppUtil.copyToClipboard(context, pullRequestObject.getUser().getLogin(), context.getString(R.string.copyLoginIdToClipBoard, pullRequestObject.getUser().getLogin()));
return true; return true;
}); });
} }
@ -145,7 +143,68 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
.centerCrop() .centerCrop()
.into(this.assigneeAvatar); .into(this.assigneeAvatar);
this.pullRequest = pullRequest; this.pullRequestObject = pullRequest;
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 0, 15, 0);
if(pullRequest.getLabels() != null) {
if(!tinyDb.getBoolean("showLabelsInList", false)) { // default
labelsScrollViewWithText.setVisibility(View.GONE);
labelsScrollViewDots.setVisibility(View.VISIBLE);
frameLabelsDots.removeAllViews();
for(int i = 0; i < pullRequest.getLabels().size(); i++) {
String labelColor = pullRequest.getLabels().get(i).getColor();
int color = Color.parseColor("#" + labelColor);
ImageView labelsView = new ImageView(context);
frameLabelsDots.setOrientation(LinearLayout.HORIZONTAL);
frameLabelsDots.setGravity(Gravity.START | Gravity.TOP);
labelsView.setLayoutParams(params);
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).width(54).height(54).endConfig().buildRound("", color);
labelsView.setImageDrawable(drawable);
frameLabelsDots.addView(labelsView);
}
}
else {
labelsScrollViewDots.setVisibility(View.GONE);
labelsScrollViewWithText.setVisibility(View.VISIBLE);
frameLabels.removeAllViews();
for(int i = 0; i < pullRequest.getLabels().size(); i++) {
String labelColor = pullRequest.getLabels().get(i).getColor();
String labelName = pullRequest.getLabels().get(i).getName();
int color = Color.parseColor("#" + labelColor);
ImageView labelsView = new ImageView(context);
frameLabels.setOrientation(LinearLayout.HORIZONTAL);
frameLabels.setGravity(Gravity.START | Gravity.TOP);
labelsView.setLayoutParams(params);
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(labelName, Typeface.DEFAULT, textSize, AppUtil.getPixelsFromDensity(context, 8))).height(height).endConfig().buildRoundRect(labelName, color, AppUtil.getPixelsFromDensity(context, 18));
labelsView.setImageDrawable(drawable);
frameLabels.addView(labelsView);
}
}
}
else {
labelsScrollViewDots.setVisibility(View.GONE);
labelsScrollViewWithText.setVisibility(View.GONE);
}
String prNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + pullRequest.getNumber() + "</font>"; String prNumber_ = "<font color='" + ResourcesCompat.getColor(context.getResources(), R.color.lightGray, null) + "'>" + context.getResources().getString(R.string.hash) + pullRequest.getNumber() + "</font>";
@ -159,18 +218,11 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
@ -182,6 +234,6 @@ public class PullRequestsAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
public void updateList(List<PullRequests> list) { public void updateList(List<PullRequests> list) {
prList = list; prList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -118,7 +118,8 @@ public class ReleasesAdapter extends RecyclerView.Adapter<ReleasesAdapter.Releas
holder.releaseType.setText(R.string.releaseTypePre); holder.releaseType.setText(R.string.releaseTypePre);
} }
else if(currentItem.isDraft()) { else if(currentItem.isDraft()) {
holder.releaseType.setVisibility(View.GONE); holder.releaseType.setBackgroundResource(R.drawable.shape_draft_release);
holder.releaseType.setText(R.string.releaseDraftText);
} }
else { else {
holder.releaseType.setBackgroundResource(R.drawable.shape_stable_release); holder.releaseType.setBackgroundResource(R.drawable.shape_stable_release);

View File

@ -34,13 +34,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<UserRepositories> forksList; private List<UserRepositories> forksList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false; private boolean isLoading = false;
@ -55,45 +54,27 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new RepoForksAdapter.ForksHolder(inflater.inflate(R.layout.list_repositories, parent, false)); return new RepoForksAdapter.ForksHolder(inflater.inflate(R.layout.list_repositories, parent, false));
} else {
return new LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
} }
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) { if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) {
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((RepoForksAdapter.ForksHolder) holder).bindData(forksList.get(position)); ((RepoForksAdapter.ForksHolder) holder).bindData(forksList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
return position;
if(forksList.get(position).getName() != null) {
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
public int getItemCount() { public int getItemCount() {
return forksList.size(); return forksList.size();
} }
@ -226,34 +207,22 @@ public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
} }
public void setLoadMoreListener(Runnable loadMoreListener) { public void setLoadMoreListener(Runnable loadMoreListener) {
this.loadMoreListener = loadMoreListener; this.loadMoreListener = loadMoreListener;
} }
public void updateList(List<UserRepositories> list) { public void updateList(List<UserRepositories> list) {
forksList = list; forksList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -16,11 +16,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator; import com.amulyakhare.textdrawable.util.ColorGenerator;
import org.gitnex.tea4j.models.UserRepositories; import org.gitnex.tea4j.models.UserRepositories;
import org.gitnex.tea4j.models.WatchInfo;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.database.api.BaseApi; import org.mian.gitnex.database.api.BaseApi;
import org.mian.gitnex.database.api.RepositoriesApi; import org.mian.gitnex.database.api.RepositoriesApi;
import org.mian.gitnex.database.models.Repository; import org.mian.gitnex.database.models.Repository;
@ -29,7 +27,6 @@ import org.mian.gitnex.helpers.ClickListener;
import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.TimeHelper;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.contexts.RepositoryContext;
import org.ocpsoft.prettytime.PrettyTime; import org.ocpsoft.prettytime.PrettyTime;
import java.text.DateFormat; import java.text.DateFormat;
@ -37,8 +34,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import retrofit2.Call;
import retrofit2.Callback;
/** /**
* Author M M Arif * Author M M Arif

View File

@ -16,11 +16,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator; import com.amulyakhare.textdrawable.util.ColorGenerator;
import org.gitnex.tea4j.models.UserRepositories; import org.gitnex.tea4j.models.UserRepositories;
import org.gitnex.tea4j.models.WatchInfo;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.database.api.BaseApi; import org.mian.gitnex.database.api.BaseApi;
import org.mian.gitnex.database.api.RepositoriesApi; import org.mian.gitnex.database.api.RepositoriesApi;
import org.mian.gitnex.database.models.Repository; import org.mian.gitnex.database.models.Repository;
@ -29,7 +27,6 @@ import org.mian.gitnex.helpers.ClickListener;
import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper; import org.mian.gitnex.helpers.TimeHelper;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.contexts.RepositoryContext;
import org.ocpsoft.prettytime.PrettyTime; import org.ocpsoft.prettytime.PrettyTime;
import java.text.DateFormat; import java.text.DateFormat;
@ -37,8 +34,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import retrofit2.Call;
import retrofit2.Callback;
/** /**
* Author M M Arif * Author M M Arif

View File

@ -18,7 +18,6 @@ import org.mian.gitnex.R;
import org.mian.gitnex.activities.RepoDetailActivity; import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.Markdown; import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.TinyDB;
import java.util.List; import java.util.List;
/** /**

View File

@ -16,7 +16,6 @@ import androidx.appcompat.content.res.AppCompatResources;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.AddNewAccountActivity; import org.mian.gitnex.activities.AddNewAccountActivity;
import org.mian.gitnex.activities.LoginActivity;
import org.mian.gitnex.clients.PicassoService; import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.database.api.BaseApi; import org.mian.gitnex.database.api.BaseApi;
import org.mian.gitnex.database.api.UserAccountsApi; import org.mian.gitnex.database.api.UserAccountsApi;

View File

@ -19,7 +19,6 @@ import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.RoundedTransformation; import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import java.util.List; import java.util.List;
import retrofit2.Call; import retrofit2.Call;

View File

@ -26,7 +26,6 @@ import java.util.List;
public class UsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class UsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<UserInfo> followersList; private List<UserInfo> followersList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -40,13 +39,8 @@ public class UsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new UsersAdapter.UsersHolder(inflater.inflate(R.layout.list_users, parent, false)); return new UsersAdapter.UsersHolder(inflater.inflate(R.layout.list_users, parent, false));
} }
else {
return new UsersAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -54,20 +48,12 @@ public class UsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((UsersAdapter.UsersHolder) holder).bindData(followersList.get(position)); ((UsersAdapter.UsersHolder) holder).bindData(followersList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(followersList.get(position).getUsername() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -118,12 +104,6 @@ public class UsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }

View File

@ -19,13 +19,12 @@ import org.mian.gitnex.helpers.RoundedTransformation;
import java.util.List; import java.util.List;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class OrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class OrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<UserOrganizations> organizationsList; private List<UserOrganizations> organizationsList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -38,16 +37,9 @@ public class OrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.View
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new OrganizationsHolder(inflater.inflate(R.layout.list_organizations, parent, false)); return new OrganizationsHolder(inflater.inflate(R.layout.list_organizations, parent, false));
} }
else {
return new LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -56,20 +48,12 @@ public class OrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.View
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((OrganizationsHolder) holder).bindData(organizationsList.get(position)); ((OrganizationsHolder) holder).bindData(organizationsList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(organizationsList.get(position).getUsername() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -116,16 +100,11 @@ public class OrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.View
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
@ -137,6 +116,6 @@ public class OrganizationsAdapter extends RecyclerView.Adapter<RecyclerView.View
public void updateList(List<UserOrganizations> list) { public void updateList(List<UserOrganizations> list) {
organizationsList = list; organizationsList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -31,13 +31,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class RepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class RepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<UserRepositories> reposList; private List<UserRepositories> reposList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -52,14 +51,8 @@ public class RepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new RepositoriesAdapter.RepositoriesHolder(inflater.inflate(R.layout.list_repositories, parent, false)); return new RepositoriesAdapter.RepositoriesHolder(inflater.inflate(R.layout.list_repositories, parent, false));
} }
else {
return new RepositoriesAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -68,20 +61,12 @@ public class RepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((RepositoriesAdapter.RepositoriesHolder) holder).bindData(reposList.get(position)); ((RepositoriesAdapter.RepositoriesHolder) holder).bindData(reposList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(reposList.get(position).getFullName() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -196,16 +181,11 @@ public class RepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
@ -217,6 +197,6 @@ public class RepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
public void updateList(List<UserRepositories> list) { public void updateList(List<UserRepositories> list) {
reposList = list; reposList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -31,13 +31,12 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Author M M Arif * @author M M Arif
*/ */
public class StarredRepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class StarredRepositoriesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context; private final Context context;
private final int TYPE_LOAD = 0;
private List<UserRepositories> reposList; private List<UserRepositories> reposList;
private Runnable loadMoreListener; private Runnable loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true; private boolean isLoading = false, isMoreDataAvailable = true;
@ -52,14 +51,8 @@ public class StarredRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new StarredRepositoriesAdapter.StarredRepositoriesHolder(inflater.inflate(R.layout.list_repositories, parent, false)); return new StarredRepositoriesAdapter.StarredRepositoriesHolder(inflater.inflate(R.layout.list_repositories, parent, false));
} }
else {
return new StarredRepositoriesAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
@ -68,20 +61,12 @@ public class StarredRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie
isLoading = true; isLoading = true;
loadMoreListener.run(); loadMoreListener.run();
} }
if(getItemViewType(position) == TYPE_LOAD) {
((StarredRepositoriesAdapter.StarredRepositoriesHolder) holder).bindData(reposList.get(position)); ((StarredRepositoriesAdapter.StarredRepositoriesHolder) holder).bindData(reposList.get(position));
} }
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if(reposList.get(position).getFullName() != null) { return position;
return TYPE_LOAD;
}
else {
return 1;
}
} }
@Override @Override
@ -196,16 +181,11 @@ public class StarredRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie
} }
} }
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) { public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
@ -217,6 +197,6 @@ public class StarredRepositoriesAdapter extends RecyclerView.Adapter<RecyclerVie
public void updateList(List<UserRepositories> list) { public void updateList(List<UserRepositories> list) {
reposList = list; reposList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -3,7 +3,6 @@ package org.mian.gitnex.core;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import androidx.core.content.res.ResourcesCompat;
import org.acra.ACRA; import org.acra.ACRA;
import org.acra.BuildConfig; import org.acra.BuildConfig;
import org.acra.ReportField; import org.acra.ReportField;
@ -16,7 +15,6 @@ import org.acra.data.StringFormat;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.database.models.UserAccount;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.FontsOverride; import org.mian.gitnex.helpers.FontsOverride;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.contexts.AccountContext; import org.mian.gitnex.helpers.contexts.AccountContext;

View File

@ -3,13 +3,9 @@ package org.mian.gitnex.database.api;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.mian.gitnex.database.db.GitnexDatabase; import org.mian.gitnex.database.db.GitnexDatabase;
import org.mian.gitnex.helpers.Constants;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;

View File

@ -2,7 +2,6 @@ package org.mian.gitnex.database.api;
import android.content.Context; import android.content.Context;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Query;
import org.mian.gitnex.database.dao.UserAccountsDao; import org.mian.gitnex.database.dao.UserAccountsDao;
import org.mian.gitnex.database.models.UserAccount; import org.mian.gitnex.database.models.UserAccount;
import java.util.List; import java.util.List;

View File

@ -10,8 +10,6 @@ import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.activities.BaseActivity; import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.databinding.BottomSheetIssuesFilterBinding; import org.mian.gitnex.databinding.BottomSheetIssuesFilterBinding;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Version;
import org.mian.gitnex.structs.BottomSheetListener; import org.mian.gitnex.structs.BottomSheetListener;
/** /**

View File

@ -16,8 +16,8 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.actions.IssueActions; import org.mian.gitnex.actions.IssueActions;
import org.mian.gitnex.actions.PullRequestActions; import org.mian.gitnex.actions.PullRequestActions;
import org.mian.gitnex.activities.DiffActivity;
import org.mian.gitnex.activities.BaseActivity; import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.activities.DiffActivity;
import org.mian.gitnex.activities.EditIssueActivity; import org.mian.gitnex.activities.EditIssueActivity;
import org.mian.gitnex.activities.IssueDetailActivity; import org.mian.gitnex.activities.IssueDetailActivity;
import org.mian.gitnex.activities.MergePullRequestActivity; import org.mian.gitnex.activities.MergePullRequestActivity;

View File

@ -23,7 +23,14 @@ import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.CustomCommitHeaderBinding; import org.mian.gitnex.databinding.CustomCommitHeaderBinding;
import org.mian.gitnex.databinding.FragmentCommitDetailsBinding; 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.ParseDiff;
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.Version;
import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.contexts.RepositoryContext;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;

View File

@ -13,7 +13,9 @@ import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.adapters.DiffFilesAdapter; import org.mian.gitnex.adapters.DiffFilesAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentDiffFilesBinding; import org.mian.gitnex.databinding.FragmentDiffFilesBinding;
import org.mian.gitnex.helpers.*; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.ParseDiff;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.IssueContext; import org.mian.gitnex.helpers.contexts.IssueContext;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;

View File

@ -4,7 +4,6 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,6 +1,5 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,6 +1,5 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -21,7 +20,6 @@ import org.mian.gitnex.adapters.UserGridAdapter;
import org.mian.gitnex.databinding.FragmentMembersByOrgBinding; import org.mian.gitnex.databinding.FragmentMembersByOrgBinding;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.viewmodels.MembersByOrgViewModel; import org.mian.gitnex.viewmodels.MembersByOrgViewModel;
import java.util.Objects;
/** /**
* Author M M Arif * Author M M Arif

View File

@ -39,6 +39,7 @@ public class MyIssuesFragment extends Fragment {
fragmentIssuesBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { fragmentIssuesBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
page = 1;
fragmentIssuesBinding.pullToRefresh.setRefreshing(false); fragmentIssuesBinding.pullToRefresh.setRefreshing(false);
IssuesViewModel.loadIssuesList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), null, "issues", true, "open", getContext()); IssuesViewModel.loadIssuesList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), null, "issues", true, "open", getContext());
fragmentIssuesBinding.progressBar.setVisibility(View.VISIBLE); fragmentIssuesBinding.progressBar.setVisibility(View.VISIBLE);

View File

@ -1,6 +1,5 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View File

@ -1,6 +1,5 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,6 +1,5 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,7 +1,6 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,6 +1,5 @@
package org.mian.gitnex.fragments; package org.mian.gitnex.fragments;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View File

@ -1,6 +1,5 @@
package org.mian.gitnex.helpers; package org.mian.gitnex.helpers;
import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -15,9 +14,8 @@ import org.mian.gitnex.actions.PullRequestActions;
import org.mian.gitnex.actions.TeamActions; import org.mian.gitnex.actions.TeamActions;
import org.mian.gitnex.activities.BaseActivity; import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.activities.CreateLabelActivity; import org.mian.gitnex.activities.CreateLabelActivity;
import org.mian.gitnex.activities.LoginActivity;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;

View File

@ -17,16 +17,10 @@ import android.util.DisplayMetrics;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.View; import android.view.View;
import androidx.annotation.ColorInt; import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.browser.customtabs.CustomTabColorSchemeParams; import androidx.browser.customtabs.CustomTabColorSchemeParams;
import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.pm.PackageInfoCompat; import androidx.core.content.pm.PackageInfoCompat;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.activities.LoginActivity; import org.mian.gitnex.activities.LoginActivity;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.core.MainApplication; import org.mian.gitnex.core.MainApplication;

View File

@ -0,0 +1,40 @@
package org.mian.gitnex.helpers;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* @author M M Arif
*/
public class DividerItemDecorator extends RecyclerView.ItemDecoration {
private final Drawable rvDivider;
public DividerItemDecorator(Drawable divider) {
rvDivider = divider;
}
@Override
public void onDrawOver(@NonNull Canvas canvas, RecyclerView parent, @NonNull RecyclerView.State state) {
int dividerLeft = parent.getPaddingLeft();
int dividerRight = parent.getWidth() - parent.getPaddingRight();
int childCount = parent.getChildCount();
for (int i = 0; i <= childCount - 2; i++) {
View child = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int dividerTop = child.getBottom() + params.bottomMargin;
int dividerBottom = dividerTop + rvDivider.getIntrinsicHeight();
rvDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
rvDivider.draw(canvas);
}
}
}

View File

@ -35,6 +35,10 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import de.qwerty287.markwonprism4j.Prism4jTheme;
import de.qwerty287.markwonprism4j.Prism4jThemeDarkula;
import de.qwerty287.markwonprism4j.Prism4jThemeDefault;
import de.qwerty287.markwonprism4j.SyntaxHighlightPlugin;
import io.noties.markwon.AbstractMarkwonPlugin; import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon; import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration; import io.noties.markwon.MarkwonConfiguration;
@ -55,10 +59,6 @@ import io.noties.markwon.recycler.MarkwonAdapter;
import io.noties.markwon.recycler.SimpleEntry; import io.noties.markwon.recycler.SimpleEntry;
import io.noties.markwon.recycler.table.TableEntry; import io.noties.markwon.recycler.table.TableEntry;
import io.noties.markwon.recycler.table.TableEntryPlugin; import io.noties.markwon.recycler.table.TableEntryPlugin;
import de.qwerty287.markwonprism4j.Prism4jTheme;
import de.qwerty287.markwonprism4j.Prism4jThemeDarkula;
import de.qwerty287.markwonprism4j.Prism4jThemeDefault;
import de.qwerty287.markwonprism4j.SyntaxHighlightPlugin;
import io.noties.prism4j.Prism4j; import io.noties.prism4j.Prism4j;
import stormpot.Allocator; import stormpot.Allocator;
import stormpot.BlazePool; import stormpot.BlazePool;

View File

@ -6,7 +6,6 @@ import android.os.Bundle;
import org.gitnex.tea4j.models.Issues; import org.gitnex.tea4j.models.Issues;
import org.gitnex.tea4j.models.PullRequests; import org.gitnex.tea4j.models.PullRequests;
import org.gitnex.tea4j.models.UserRepositories; import org.gitnex.tea4j.models.UserRepositories;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.BaseActivity; import org.mian.gitnex.activities.BaseActivity;
import java.io.Serializable; import java.io.Serializable;

View File

@ -19,7 +19,6 @@ import androidx.annotation.Nullable;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.core.MainGrammarLocator; import org.mian.gitnex.core.MainGrammarLocator;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.TinyDB;
import de.qwerty287.markwonprism4j.Prism4jSyntaxHighlight; import de.qwerty287.markwonprism4j.Prism4jSyntaxHighlight;
import de.qwerty287.markwonprism4j.Prism4jTheme; import de.qwerty287.markwonprism4j.Prism4jTheme;
import de.qwerty287.markwonprism4j.Prism4jThemeDarkula; import de.qwerty287.markwonprism4j.Prism4jThemeDarkula;

View File

@ -19,8 +19,8 @@ import com.vdurmont.emoji.EmojiManager;
import org.gitnex.tea4j.models.IssueReaction; import org.gitnex.tea4j.models.IssueReaction;
import org.gitnex.tea4j.models.UserInfo; import org.gitnex.tea4j.models.UserInfo;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ReactionAuthorsAdapter;
import org.mian.gitnex.activities.BaseActivity; import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.adapters.ReactionAuthorsAdapter;
import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.helpers.AppUtil; import org.mian.gitnex.helpers.AppUtil;
import java.io.IOException; import java.io.IOException;

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/hintColor">
</solid>
<corners
android:radius="3dp">
</corners>
</shape>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:width="1px" android:height="1px" /> <size android:width="1dp" android:height="1dp" />
<solid android:color="@color/toastBackground" /> <solid android:color="?attr/dividerColor" />
</shape> </shape>

View File

@ -62,7 +62,6 @@
android:textColor="@color/colorWhite" android:textColor="@color/colorWhite"
android:backgroundTint="?attr/fabColor" android:backgroundTint="?attr/fabColor"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
app:iconTint="@color/colorWhite" app:iconTint="@color/colorWhite"
app:icon="@drawable/ic_reply" /> app:icon="@drawable/ic_reply" />
@ -256,6 +255,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor" android:background="?attr/primaryBackgroundColor"
android:paddingBottom="64dp"
android:clipToPadding="false"
android:scrollbars="vertical" /> android:scrollbars="vertical" />
</LinearLayout> </LinearLayout>

View File

@ -246,4 +246,47 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/labelsInListFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal"
android:padding="15dp"
android:layout_marginBottom="5dp">
<TextView
android:id="@+id/tvLabelsInListHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="72dp"
android:text="@string/settingsLabelsInListHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="18sp" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchLabelsInListBadge"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:layout_toEndOf="@+id/tvLabelsInListHeader"
android:gravity="end"
android:paddingStart="0dp"
android:paddingEnd="24dp"
android:switchMinWidth="56dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/switchLabelsInListBadge"
android:layout_marginStart="24dp"
android:layout_marginEnd="72dp"
android:text="@string/settingsLabelsInListHint"
android:textColor="?attr/hintColor"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@ -14,7 +14,6 @@
android:id="@+id/infoSection" android:id="@+id/infoSection"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal" android:orientation="horizontal"
tools:ignore="UseCompoundDrawables"> tools:ignore="UseCompoundDrawables">
@ -26,19 +25,65 @@
android:contentDescription="@string/generalImgContentText" android:contentDescription="@string/generalImgContentText"
tools:src="@tools:sample/avatars" /> tools:src="@tools:sample/avatars" />
<LinearLayout
android:id="@+id/titleLabelsSection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/issueTitle" android:id="@+id/issueTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="top|center_vertical" android:gravity="top|center_vertical"
android:text="@string/strFilter" android:text="@string/newIssueTitle"
android:textAlignment="gravity" android:textAlignment="gravity"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="16sp" android:textSize="16sp"
tools:text="Id illum odio repellat omnis fuga deserunt aut. Ut est aut similique qui incidunt quia et." /> tools:text="Id illum odio repellat omnis fuga deserunt aut. Ut est aut similique qui incidunt quia et." />
<HorizontalScrollView
android:id="@+id/labelsScrollViewDots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foregroundGravity="right"
android:layout_marginBottom="8dp"
android:scrollbarThumbHorizontal="@android:color/transparent"
android:visibility="gone"
android:fillViewport="true">
<LinearLayout
android:id="@+id/frameLabelsDots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp" />
</HorizontalScrollView>
</LinearLayout> </LinearLayout>
</LinearLayout>
<HorizontalScrollView
android:id="@+id/labelsScrollViewWithText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foregroundGravity="right"
android:layout_marginBottom="8dp"
android:scrollbarThumbHorizontal="@android:color/transparent"
android:visibility="gone"
android:fillViewport="true">
<LinearLayout
android:id="@+id/frameLabels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp" />
</HorizontalScrollView>
<LinearLayout <LinearLayout
android:id="@+id/issueInfoFrame" android:id="@+id/issueInfoFrame"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -12,7 +12,7 @@
android:id="@+id/labelView" android:id="@+id/labelView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="5dp" app:cardCornerRadius="18dp"
app:cardElevation="0dp" app:cardElevation="0dp"
app:contentPaddingBottom="3dp" app:contentPaddingBottom="3dp"
app:contentPaddingLeft="10dp" app:contentPaddingLeft="10dp"
@ -27,8 +27,10 @@
<ImageView <ImageView
android:id="@+id/labelIcon" android:id="@+id/labelIcon"
android:layout_width="wrap_content" android:layout_width="18dp"
android:layout_height="wrap_content" android:layout_height="18dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_weight="0" android:layout_weight="0"
android:contentDescription="@string/generalImgContentText" android:contentDescription="@string/generalImgContentText"
app:tint="@color/colorWhite" app:tint="@color/colorWhite"
@ -47,7 +49,7 @@
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<Space <androidx.legacy.widget.Space
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1" />

View File

@ -27,18 +27,62 @@
android:contentDescription="@string/generalImgContentText" android:contentDescription="@string/generalImgContentText"
android:src="@drawable/ic_android" /> android:src="@drawable/ic_android" />
<LinearLayout
android:id="@+id/titleLabelsSection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/prTitle" android:id="@+id/prTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="top|center_vertical" android:gravity="top|center_vertical"
android:textAlignment="gravity" android:textAlignment="gravity"
android:text="@string/strFilter" android:text="@string/newIssueTitle"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="16sp" /> android:textSize="16sp" />
<HorizontalScrollView
android:id="@+id/labelsScrollViewDots"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="right"
android:layout_marginBottom="8dp"
android:scrollbarThumbHorizontal="@android:color/transparent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/frameLabelsDots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp" />
</HorizontalScrollView>
</LinearLayout> </LinearLayout>
</LinearLayout>
<HorizontalScrollView
android:id="@+id/labelsScrollViewWithText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="right"
android:layout_marginBottom="8dp"
android:scrollbarThumbHorizontal="@android:color/transparent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/frameLabels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp" />
</HorizontalScrollView>
<LinearLayout <LinearLayout
android:id="@+id/issueInfoFrame" android:id="@+id/issueInfoFrame"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_gravity="center_horizontal" />
</LinearLayout>

View File

@ -246,6 +246,8 @@
<string name="generalDeepLinkSelectedText">N/A</string> <string name="generalDeepLinkSelectedText">N/A</string>
<string name="linkSelectorDialogTitle">Select Default Link Handler Screen</string> <string name="linkSelectorDialogTitle">Select Default Link Handler Screen</string>
<string name="settingsBiometricHeader">Biometric Support</string> <string name="settingsBiometricHeader">Biometric Support</string>
<string name="settingsLabelsInListHeader">Labels With Text Support</string>
<string name="settingsLabelsInListHint">Enabling this will show labels with text in issues and pr lists, default are color dots</string>
<!-- settings --> <!-- settings -->
<string name="noMoreData">No more data available</string> <string name="noMoreData">No more data available</string>

View File

@ -5,7 +5,6 @@ buildscript {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.1.2' classpath 'com.android.tools.build:gradle:7.1.2'
@ -17,7 +16,6 @@ allprojects {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
jcenter()
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
} }
} }