Explore users (#972)

Closes #960

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/972
Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-committed-by: M M Arif <mmarif@noreply.codeberg.org>
This commit is contained in:
M M Arif 2021-10-04 15:35:34 +02:00
parent f4cd3c9a4d
commit 22cd23525e
44 changed files with 591 additions and 301 deletions

View File

@ -62,7 +62,7 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03' implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
implementation 'com.google.android.material:material:1.4.0' implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.viewpager2:viewpager2:1.1.0-alpha01' implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation "androidx.legacy:legacy-support-v4:1.0.0" implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"

View File

@ -143,7 +143,7 @@ public class AddNewAccountActivity extends BaseActivity {
.setMessage(getResources().getString(R.string.versionUnsupportedOld, version.getVersion())).setIcon(R.drawable.ic_warning) .setMessage(getResources().getString(R.string.versionUnsupportedOld, version.getVersion())).setIcon(R.drawable.ic_warning)
.setCancelable(true); .setCancelable(true);
alertDialogBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> { alertDialogBuilder.setNeutralButton(getString(R.string.cancelButton), (dialog, which) -> {
dialog.dismiss(); dialog.dismiss();
}); });

View File

@ -280,7 +280,7 @@ public class LoginActivity extends BaseActivity {
.setIcon(R.drawable.ic_warning) .setIcon(R.drawable.ic_warning)
.setCancelable(true); .setCancelable(true);
alertDialogBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> { alertDialogBuilder.setNeutralButton(getString(R.string.cancelButton), (dialog, which) -> {
dialog.dismiss(); dialog.dismiss();
enableProcessButton(); enableProcessButton();

View File

@ -542,28 +542,22 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
tinyDB.putString("issueMilestoneFilterId", milestonesList.get(i)); tinyDB.putString("issueMilestoneFilterId", milestonesList.get(i));
if(getFragmentRefreshListenerFilterIssuesByMilestone() != null) { if(getFragmentRefreshListenerFilterIssuesByMilestone() != null) {
getFragmentRefreshListenerFilterIssuesByMilestone().onRefresh(milestonesList.get(i)); getFragmentRefreshListenerFilterIssuesByMilestone().onRefresh(milestonesList.get(i));
} }
dialogInterface.dismiss(); dialogInterface.dismiss();
}); });
pBuilder.setNeutralButton(R.string.cancelButton, null); pBuilder.setNeutralButton(R.string.cancelButton, null);
pBuilder.create().show(); pBuilder.create().show();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<List<Milestones>> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<List<Milestones>> call, @NonNull Throwable t) {
progressDialog.hide(); progressDialog.hide();
Log.e("onFailure", t.toString()); Log.e("onFailure", t.toString());
} }
}); });
} }
private void chooseBranch() { private void chooseBranch() {
@ -594,7 +588,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
branchesList.add(branches.getName()); branchesList.add(branches.getName());
if(tinyDB.getString("repoBranch").equals(branches.getName())) { if(tinyDB.getString("repoBranch").equals(branches.getName())) {
selectedBranch = i; selectedBranch = i;
} }
} }
@ -607,25 +600,22 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
tinyDB.putString("repoBranch", branchesList.get(i)); tinyDB.putString("repoBranch", branchesList.get(i));
if(getFragmentRefreshListenerFiles() != null) { if(getFragmentRefreshListenerFiles() != null) {
getFragmentRefreshListenerFiles().onRefresh(branchesList.get(i)); getFragmentRefreshListenerFiles().onRefresh(branchesList.get(i));
} }
dialogInterface.dismiss(); dialogInterface.dismiss();
}); });
pBuilder.setNeutralButton(R.string.cancelButton, null);
pBuilder.setNeutralButton(R.string.cancelButton, null);
pBuilder.create().show(); pBuilder.create().show();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<List<Branches>> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<List<Branches>> call, @NonNull Throwable t) {
progressDialog.hide(); progressDialog.hide();
Log.e("onFailure", t.toString()); Log.e("onFailure", t.toString());
} }
}); });
} }
public class SectionsPagerAdapter extends FragmentStatePagerAdapter { public class SectionsPagerAdapter extends FragmentStatePagerAdapter {

View File

@ -128,6 +128,7 @@ public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<Recy
isMoreDataAvailable = moreDataAvailable; isMoreDataAvailable = moreDataAvailable;
} }
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() { public void notifyDataChanged() {
notifyDataSetChanged(); notifyDataSetChanged();
isLoading = false; isLoading = false;
@ -143,6 +144,6 @@ public class ExplorePublicOrganizationsAdapter extends RecyclerView.Adapter<Recy
public void updateList(List<Organization> list) { public void updateList(List<Organization> list) {
organizationsList = list; organizationsList = list;
notifyDataSetChanged(); notifyDataChanged();
} }
} }

View File

@ -0,0 +1,154 @@
package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import org.gitnex.tea4j.models.UserInfo;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.ProfileActivity;
import org.mian.gitnex.clients.PicassoService;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.RoundedTransformation;
import java.util.List;
/**
* Author M M Arif
*/
public class ExploreUsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context context;
private final int TYPE_LOAD = 0;
private List<UserInfo> usersList;
private OnLoadMoreListener loadMoreListener;
private boolean isLoading = false, isMoreDataAvailable = true;
public ExploreUsersAdapter(Context ctx, List<UserInfo> usersListMain) {
this.context = ctx;
this.usersList = usersListMain;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context);
if(viewType == TYPE_LOAD) {
return new ExploreUsersAdapter.UsersHolder(inflater.inflate(R.layout.list_explore_users, parent, false));
}
else {
return new ExploreUsersAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
}
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) {
isLoading = true;
loadMoreListener.onLoadMore();
}
if(getItemViewType(position) == TYPE_LOAD) {
((ExploreUsersAdapter.UsersHolder) holder).bindData(usersList.get(position));
}
}
@Override
public int getItemViewType(int position) {
if(usersList.get(position).getUsername() != null) {
return TYPE_LOAD;
}
else {
return 1;
}
}
@Override
public int getItemCount() {
return usersList.size();
}
class UsersHolder extends RecyclerView.ViewHolder {
private UserInfo userInfo;
private final ImageView userAvatar;
private final TextView userFullName;
private final TextView userName;
UsersHolder(View itemView) {
super(itemView);
userAvatar = itemView.findViewById(R.id.userAvatar);
userFullName = itemView.findViewById(R.id.userFullName);
userName = itemView.findViewById(R.id.userName);
itemView.setOnClickListener(loginId -> {
Intent intent = new Intent(context, ProfileActivity.class);
intent.putExtra("username", userInfo.getLogin());
context.startActivity(intent);
});
itemView.setOnLongClickListener(loginId -> {
AppUtil.copyToClipboard(context, userInfo.getLogin(), context.getString(R.string.copyLoginIdToClipBoard, userInfo.getLogin()));
return true;
});
}
@SuppressLint("SetTextI18n")
void bindData(UserInfo userInfo) {
this.userInfo = userInfo;
int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
userName.setText(userInfo.getUsername());
PicassoService.getInstance(context).get()
.load(userInfo.getAvatar())
.placeholder(R.drawable.loader_animated)
.transform(new RoundedTransformation(imgRadius, 0))
.resize(120, 120)
.centerCrop()
.into(userAvatar);
if(!userInfo.getFullname().equals("")) {
userFullName.setText(Html.fromHtml(userInfo.getFullname()));
userName.setText(context.getResources().getString(R.string.usernameWithAt, userInfo.getUsername()));
}
else {
userFullName.setText(userInfo.getUsername());
userName.setVisibility(View.GONE);
}
}
}
static class LoadHolder extends RecyclerView.ViewHolder {
LoadHolder(View itemView) {
super(itemView);
}
}
public void setMoreDataAvailable(boolean moreDataAvailable) {
isMoreDataAvailable = moreDataAvailable;
}
@SuppressLint("NotifyDataSetChanged")
public void notifyDataChanged() {
notifyDataSetChanged();
isLoading = false;
}
public interface OnLoadMoreListener {
void onLoadMore();
}
public void setLoadMoreListener(OnLoadMoreListener loadMoreListener) {
this.loadMoreListener = loadMoreListener;
}
public void updateList(List<UserInfo> list) {
usersList = list;
notifyDataChanged();
}
}

View File

@ -6,6 +6,8 @@ import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
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;
@ -113,6 +115,11 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
dialog.show(); dialog.show();
LinearLayout linearLayout = vw.findViewById(R.id.commentReactionButtons); LinearLayout linearLayout = vw.findViewById(R.id.commentReactionButtons);
TextView loadReactions = new TextView(context);
loadReactions.setText(context.getString(R.string.genericWaitFor));
loadReactions.setGravity(Gravity.CENTER);
loadReactions.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 160));
linearLayout.addView(loadReactions);
Bundle bundle1 = new Bundle(); Bundle bundle1 = new Bundle();
bundle1.putAll(bundle); bundle1.putAll(bundle);
@ -126,7 +133,12 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
dialog.dismiss(); dialog.dismiss();
}); });
linearLayout.addView(reactionSpinner); Handler handler = new Handler();
handler.postDelayed(() -> {
linearLayout.removeView(loadReactions);
reactionSpinner.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 160));
linearLayout.addView(reactionSpinner);
}, 2500);
commentMenuEdit.setOnClickListener(v1 -> { commentMenuEdit.setOnClickListener(v1 -> {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();

View File

@ -5,6 +5,8 @@ import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
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;
@ -13,24 +15,19 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.gson.JsonElement;
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.EditIssueActivity; import org.mian.gitnex.activities.EditIssueActivity;
import org.mian.gitnex.activities.FileDiffActivity; import org.mian.gitnex.activities.FileDiffActivity;
import org.mian.gitnex.activities.MergePullRequestActivity; import org.mian.gitnex.activities.MergePullRequestActivity;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.BottomSheetSingleIssueBinding; import org.mian.gitnex.databinding.BottomSheetSingleIssueBinding;
import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.Version; import org.mian.gitnex.helpers.Version;
import org.mian.gitnex.views.ReactionSpinner; import org.mian.gitnex.views.ReactionSpinner;
import java.util.Objects; import java.util.Objects;
import retrofit2.Call;
import retrofit2.Callback;
/** /**
* Author M M Arif * Author M M Arif
@ -74,6 +71,12 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
bundle1.putString("repoName", parts[1]); bundle1.putString("repoName", parts[1]);
bundle1.putInt("issueId", Integer.parseInt(tinyDB.getString("issueNumber"))); bundle1.putInt("issueId", Integer.parseInt(tinyDB.getString("issueNumber")));
TextView loadReactions = new TextView(ctx);
loadReactions.setText(Objects.requireNonNull(ctx).getString(R.string.genericWaitFor));
loadReactions.setGravity(Gravity.CENTER);
loadReactions.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 160));
linearLayout.addView(loadReactions);
ReactionSpinner reactionSpinner = new ReactionSpinner(ctx, bundle1); ReactionSpinner reactionSpinner = new ReactionSpinner(ctx, bundle1);
reactionSpinner.setOnInteractedListener(() -> { reactionSpinner.setOnInteractedListener(() -> {
@ -81,10 +84,14 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
bmListener.onButtonClicked("onResume"); bmListener.onButtonClicked("onResume");
dismiss(); dismiss();
}); });
linearLayout.addView(reactionSpinner); Handler handler = new Handler();
handler.postDelayed(() -> {
linearLayout.removeView(loadReactions);
reactionSpinner.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 160));
linearLayout.addView(reactionSpinner);
}, 2500);
if(tinyDB.getString("issueType").equalsIgnoreCase("Pull")) { if(tinyDB.getString("issueType").equalsIgnoreCase("Pull")) {

View File

@ -10,10 +10,10 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager2.widget.ViewPager2;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import org.mian.gitnex.R; import org.mian.gitnex.R;
import org.mian.gitnex.activities.MainActivity; import org.mian.gitnex.activities.MainActivity;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
@ -24,9 +24,6 @@ import org.mian.gitnex.helpers.TinyDB;
public class ExploreFragment extends Fragment { public class ExploreFragment extends Fragment {
private int tabsCount;
public ViewPager mViewPager;
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@ -36,101 +33,81 @@ public class ExploreFragment extends Fragment {
Context ctx = getContext(); Context ctx = getContext();
TinyDB tinyDB = TinyDB.getInstance(ctx); TinyDB tinyDB = TinyDB.getInstance(ctx);
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navExplore)); ((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.pageTitleExplore));
ViewPager2 viewPager = view.findViewById(R.id.containerExplore);
viewPager.setOffscreenPageLimit(1);
TabLayout tabLayout = view.findViewById(R.id.tabsExplore); TabLayout tabLayout = view.findViewById(R.id.tabsExplore);
ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0); ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
tabsCount = viewGroup.getChildCount();
Typeface myTypeface; Typeface myTypeface;
switch(tinyDB.getInt("customFontId", -1)) { switch(tinyDB.getInt("customFontId", -1)) {
case 0: case 0:
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/roboto.ttf"); myTypeface = Typeface.createFromAsset(ctx != null ? ctx.getAssets() : null, "fonts/roboto.ttf");
break; break;
case 2: case 2:
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/sourcecodeproregular.ttf"); myTypeface = Typeface.createFromAsset(ctx != null ? ctx.getAssets() : null, "fonts/sourcecodeproregular.ttf");
break; break;
default: default:
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/manroperegular.ttf"); myTypeface = Typeface.createFromAsset(ctx != null ? ctx.getAssets() : null, "fonts/manroperegular.ttf");
break; break;
} }
for(int j = 0; j < tabsCount; j++) { viewPager.setAdapter(new ViewPagerAdapter(this));
ViewGroup vgTab = (ViewGroup) viewGroup.getChildAt(j); String[] tabTitles = {getResources().getString(R.string.pageTitleRepositories), getResources().getString(R.string.pageTitleIssues), getResources().getString(R.string.pageTitleOrganizations), getResources().getString(R.string.pageTitleUsers)};
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(tabTitles[position])).attach();
for (int j = 0; j < tabTitles.length; j++) {
ViewGroup vgTab = (ViewGroup) vg.getChildAt(j);
int tabChildCount = vgTab.getChildCount(); int tabChildCount = vgTab.getChildCount();
for(int i = 0; i < tabChildCount; i++) { for (int i = 0; i < tabChildCount; i++) {
View tabViewChild = vgTab.getChildAt(i); View tabViewChild = vgTab.getChildAt(i);
if (tabViewChild instanceof TextView) {
if(tabViewChild instanceof TextView) {
((TextView) tabViewChild).setTypeface(myTypeface); ((TextView) tabViewChild).setTypeface(myTypeface);
} }
} }
} }
mViewPager = view.findViewById(R.id.containerExplore);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(mSectionsPagerAdapter);
if(requireActivity().getIntent().getBooleanExtra("exploreOrgs", false)) {
mViewPager.setCurrentItem(2);
}
return view; return view;
} }
public class SectionsPagerAdapter extends FragmentPagerAdapter { public static class ViewPagerAdapter extends FragmentStateAdapter {
SectionsPagerAdapter(FragmentManager fm) { public ViewPagerAdapter(@NonNull ExploreFragment fa) { super(fa); }
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}
@NonNull @NonNull
@Override @Override
public Fragment getItem(int position) { public Fragment createFragment(int position) {
Fragment fragment = null; Fragment fragment = null;
switch(position) { switch(position) {
case 0: // Repositories case 0: // Repositories
fragment = new ExploreRepositoriesFragment(); fragment = new ExploreRepositoriesFragment();
break; break;
case 1: // Issues case 1: // Issues
fragment = new ExploreIssuesFragment(); fragment = new ExploreIssuesFragment();
break; break;
case 2: // Organizations case 2: // Organizations
fragment = new ExplorePublicOrganizationsFragment(); fragment = new ExplorePublicOrganizationsFragment();
break; break;
case 3: // Users
fragment = new ExploreUsersFragment();
break;
} }
assert fragment != null; assert fragment != null;
return fragment; return fragment;
} }
@Override @Override
public int getCount() { public int getItemCount() {
return 4;
return tabsCount;
} }
} }
} }

View File

@ -136,7 +136,7 @@ public class ExploreIssuesFragment extends Fragment {
private void loadMore(String searchKeyword, int resultLimit, int page) { private void loadMore(String searchKeyword, int resultLimit, int page) {
viewBinding.loadingMoreView.setVisibility(View.VISIBLE); viewBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<Issues>> call = RetrofitClient.getApiInterface(context) Call<List<Issues>> call = RetrofitClient.getApiInterface(context)
.queryIssues(Authorization.get(getContext()), searchKeyword, "issues", "open", resultLimit, page); .queryIssues(Authorization.get(getContext()), searchKeyword, "issues", "open", resultLimit, page);
call.enqueue(new Callback<List<Issues>>() { call.enqueue(new Callback<List<Issues>>() {
@ -154,7 +154,7 @@ public class ExploreIssuesFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
viewBinding.loadingMoreView.setVisibility(View.GONE); viewBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));

View File

@ -122,7 +122,7 @@ public class ExplorePublicOrganizationsFragment extends Fragment {
private void loadMore(String token, int page, int resultLimit) { private void loadMore(String token, int page, int resultLimit) {
fragmentPublicOrgBinding.progressLoadMore.setVisibility(View.VISIBLE); fragmentPublicOrgBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<Organization>> call = RetrofitClient.getApiInterface(context).getAllOrgs(token, page, resultLimit); Call<List<Organization>> call = RetrofitClient.getApiInterface(context).getAllOrgs(token, page, resultLimit);
call.enqueue(new Callback<List<Organization>>() { call.enqueue(new Callback<List<Organization>>() {
@Override @Override
@ -140,7 +140,7 @@ public class ExplorePublicOrganizationsFragment extends Fragment {
} }
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
fragmentPublicOrgBinding.progressLoadMore.setVisibility(View.GONE); fragmentPublicOrgBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));

View File

@ -165,7 +165,7 @@ public class ExploreRepositoriesFragment extends Fragment {
private void loadMore(String searchKeyword, boolean exploreRepoIncludeTopic, boolean exploreRepoIncludeDescription, boolean exploreRepoIncludeTemplate, boolean exploreRepoOnlyArchived, int resultLimit, int page) { private void loadMore(String searchKeyword, boolean exploreRepoIncludeTopic, boolean exploreRepoIncludeDescription, boolean exploreRepoIncludeTemplate, boolean exploreRepoOnlyArchived, int resultLimit, int page) {
viewBinding.loadingMoreView.setVisibility(View.VISIBLE); viewBinding.progressBar.setVisibility(View.VISIBLE);
Call<ExploreRepositories> call = RetrofitClient.getApiInterface(context) Call<ExploreRepositories> call = RetrofitClient.getApiInterface(context)
.queryRepos(Authorization.get(getContext()), searchKeyword, repoTypeInclude, sort, order, exploreRepoIncludeTopic, exploreRepoIncludeDescription, exploreRepoIncludeTemplate, exploreRepoOnlyArchived, resultLimit, page); .queryRepos(Authorization.get(getContext()), searchKeyword, repoTypeInclude, sort, order, exploreRepoIncludeTopic, exploreRepoIncludeDescription, exploreRepoIncludeTemplate, exploreRepoOnlyArchived, resultLimit, page);
call.enqueue(new Callback<ExploreRepositories>() { call.enqueue(new Callback<ExploreRepositories>() {
@ -183,7 +183,7 @@ public class ExploreRepositoriesFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
viewBinding.loadingMoreView.setVisibility(View.GONE); viewBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));

View File

@ -0,0 +1,176 @@
package org.mian.gitnex.fragments;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import org.gitnex.tea4j.models.UserInfo;
import org.gitnex.tea4j.models.UserSearch;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.ExploreUsersAdapter;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.FragmentExploreUsersBinding;
import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.SnackBar;
import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Version;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* Author M M Arif
*/
public class ExploreUsersFragment extends Fragment {
private FragmentExploreUsersBinding viewBinding;
private Context context;
private List<UserInfo> usersList;
private ExploreUsersAdapter adapter;
private int pageSize;
private final String TAG = Constants.exploreUsers;
private int resultLimit;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
viewBinding = FragmentExploreUsersBinding.inflate(inflater, container, false);
context = getContext();
resultLimit = Constants.getCurrentResultLimit(context);
usersList = new ArrayList<>();
adapter = new ExploreUsersAdapter(context, usersList);
viewBinding.searchKeyword.setOnEditorActionListener((v1, actionId, event) -> {
if(actionId == EditorInfo.IME_ACTION_SEND) {
if(!Objects.requireNonNull(viewBinding.searchKeyword.getText()).toString().equals("")) {
InputMethodManager imm = (InputMethodManager) requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(viewBinding.searchKeyword.getWindowToken(), 0);
viewBinding.progressBar.setVisibility(View.VISIBLE);
loadInitial(Authorization.get(context), String.valueOf(viewBinding.searchKeyword.getText()), resultLimit);
adapter.setLoadMoreListener(() -> viewBinding.recyclerViewExploreUsers.post(() -> {
if(usersList.size() == resultLimit || pageSize == resultLimit) {
int page = (usersList.size() + resultLimit) / resultLimit;
loadMore(Authorization.get(context), String.valueOf(viewBinding.searchKeyword.getText()), resultLimit, page);
}
}));
}
}
return false;
});
viewBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
viewBinding.pullToRefresh.setRefreshing(false);
loadInitial(Authorization.get(context), "", resultLimit);
adapter.notifyDataChanged();
}, 200));
adapter.setLoadMoreListener(() -> viewBinding.recyclerViewExploreUsers.post(() -> {
if(usersList.size() == resultLimit || pageSize == resultLimit) {
int page = (usersList.size() + resultLimit) / resultLimit;
loadMore(Authorization.get(context), "", resultLimit, page);
}
}));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL);
viewBinding.recyclerViewExploreUsers.setHasFixedSize(true);
viewBinding.recyclerViewExploreUsers.addItemDecoration(dividerItemDecoration);
viewBinding.recyclerViewExploreUsers.setLayoutManager(new LinearLayoutManager(context));
viewBinding.recyclerViewExploreUsers.setAdapter(adapter);
loadInitial(Authorization.get(context), "", resultLimit);
return viewBinding.getRoot();
}
private void loadInitial(String token, String searchKeyword, int resultLimit) {
Call<UserSearch> call = RetrofitClient
.getApiInterface(context).getUserBySearch(token, searchKeyword, resultLimit, 1);
call.enqueue(new Callback<UserSearch>() {
@Override
public void onResponse(@NonNull Call<UserSearch> call, @NonNull Response<UserSearch> response) {
if(response.isSuccessful()) {
if(response.body() != null && response.body().getData().size() > 0) {
usersList.clear();
usersList.addAll(response.body().getData());
adapter.notifyDataChanged();
viewBinding.noData.setVisibility(View.GONE);
}
else {
usersList.clear();
adapter.notifyDataChanged();
viewBinding.noData.setVisibility(View.VISIBLE);
}
viewBinding.progressBar.setVisibility(View.GONE);
}
else if(response.code() == 404) {
viewBinding.noData.setVisibility(View.VISIBLE);
viewBinding.progressBar.setVisibility(View.GONE);
}
else {
Log.e(TAG, String.valueOf(response.code()));
}
}
@Override
public void onFailure(@NonNull Call<UserSearch> call, @NonNull Throwable t) {
Log.e(TAG, t.toString());
}
});
}
private void loadMore(String token, String searchKeyword, int resultLimit, int page) {
viewBinding.progressBar.setVisibility(View.VISIBLE);
Call<UserSearch> call = RetrofitClient.getApiInterface(context).getUserBySearch(token, searchKeyword, resultLimit, page);
call.enqueue(new Callback<UserSearch>() {
@Override
public void onResponse(@NonNull Call<UserSearch> call, @NonNull Response<UserSearch> response) {
if(response.isSuccessful()) {
assert response.body() != null;
List<UserInfo> result = response.body().getData();
if(result != null) {
if(result.size() > 0) {
pageSize = result.size();
usersList.addAll(result);
}
else {
SnackBar.info(context, viewBinding.getRoot(), getString(R.string.noMoreData));
adapter.setMoreDataAvailable(false);
}
}
adapter.notifyDataChanged();
viewBinding.progressBar.setVisibility(View.GONE);
}
else {
Log.e(TAG, String.valueOf(response.code()));
}
}
@Override
public void onFailure(@NonNull Call<UserSearch> call, @NonNull Throwable t) {
Log.e(TAG, t.toString());
}
});
}
}

View File

@ -142,7 +142,7 @@ public class IssuesFragment extends Fragment {
fragmentIssuesBinding.progressBar.setVisibility(View.VISIBLE); fragmentIssuesBinding.progressBar.setVisibility(View.VISIBLE);
fragmentIssuesBinding.noDataIssues.setVisibility(View.GONE); fragmentIssuesBinding.noDataIssues.setVisibility(View.GONE);
loadInitial(Authorization.get(context), repoOwner, repoName, resultLimit, requestType, tinyDb.getString("repoIssuesState"), tinyDb.getString("issueMilestoneFilterId")); loadInitial(Authorization.get(context), repoOwner, repoName, resultLimit, requestType, tinyDb.getString("repoIssuesState"), filterIssueByMilestone);
fragmentIssuesBinding.recyclerView.setAdapter(adapter); fragmentIssuesBinding.recyclerView.setAdapter(adapter);
}); });
@ -209,7 +209,7 @@ public class IssuesFragment extends Fragment {
private void loadMore(String token, String repoOwner, String repoName, int page, int resultLimit, String requestType, String issueState, String filterByMilestone) { private void loadMore(String token, String repoOwner, String repoName, int page, int resultLimit, String requestType, String issueState, String filterByMilestone) {
fragmentIssuesBinding.progressLoadMore.setVisibility(View.VISIBLE); fragmentIssuesBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<Issues>> call = RetrofitClient.getApiInterface(context).getIssues(token, repoOwner, repoName, page, resultLimit, requestType, issueState, filterByMilestone); Call<List<Issues>> call = RetrofitClient.getApiInterface(context).getIssues(token, repoOwner, repoName, page, resultLimit, requestType, issueState, filterByMilestone);
@ -229,7 +229,7 @@ public class IssuesFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
fragmentIssuesBinding.progressLoadMore.setVisibility(View.GONE); fragmentIssuesBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));
@ -287,7 +287,7 @@ public class IssuesFragment extends Fragment {
if(d == null || d.getTitle() == null || d.getBody() == null) { if(d == null || d.getTitle() == null || d.getBody() == null) {
continue; continue;
} }
if(d.getTitle().toLowerCase().contains(text) || d.getBody().toLowerCase().contains(text)) { if(d.getTitle().toLowerCase().contains(text) || d.getBody().toLowerCase().contains(text) || d.getNumber() == Integer.parseInt(text)) {
arr.add(d); arr.add(d);
} }
} }

View File

@ -116,7 +116,7 @@ public class MyProfileFollowersFragment extends Fragment {
private void loadMore(int resultLimit, int page) { private void loadMore(int resultLimit, int page) {
viewBinding.progressLoadMore.setVisibility(View.VISIBLE); viewBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<UserInfo>> call = RetrofitClient.getApiInterface(context) Call<List<UserInfo>> call = RetrofitClient.getApiInterface(context)
.getFollowers(Authorization.get(getContext()), page, resultLimit); .getFollowers(Authorization.get(getContext()), page, resultLimit);
call.enqueue(new Callback<List<UserInfo>>() { call.enqueue(new Callback<List<UserInfo>>() {
@ -134,7 +134,7 @@ public class MyProfileFollowersFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
viewBinding.progressLoadMore.setVisibility(View.GONE); viewBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));

View File

@ -115,7 +115,7 @@ public class MyProfileFollowingFragment extends Fragment {
private void loadMore(int resultLimit, int page) { private void loadMore(int resultLimit, int page) {
viewBinding.progressLoadMore.setVisibility(View.VISIBLE); viewBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<UserInfo>> call = RetrofitClient.getApiInterface(context) Call<List<UserInfo>> call = RetrofitClient.getApiInterface(context)
.getFollowing(Authorization.get(getContext()), page, resultLimit); .getFollowing(Authorization.get(getContext()), page, resultLimit);
call.enqueue(new Callback<List<UserInfo>>() { call.enqueue(new Callback<List<UserInfo>>() {
@ -133,7 +133,7 @@ public class MyProfileFollowingFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
viewBinding.progressLoadMore.setVisibility(View.GONE); viewBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));

View File

@ -215,7 +215,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
new String[]{"pinned", "read"} : new String[]{"pinned", "read"} :
new String[]{"pinned", "unread"}; new String[]{"pinned", "unread"};
viewBinding.loadingMoreView.setVisibility(View.VISIBLE); viewBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<NotificationThread>> call = RetrofitClient.getApiInterface(context) Call<List<NotificationThread>> call = RetrofitClient.getApiInterface(context)
.getNotificationThreads(instanceToken, false, filter, .getNotificationThreads(instanceToken, false, filter,
Constants.defaultOldestTimestamp, "", Constants.defaultOldestTimestamp, "",
@ -236,7 +236,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
notificationsAdapter.setMoreDataAvailable(false); notificationsAdapter.setMoreDataAvailable(false);
} }
notificationsAdapter.notifyDataChanged(); notificationsAdapter.notifyDataChanged();
viewBinding.loadingMoreView.setVisibility(View.GONE); viewBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));
@ -254,7 +254,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
private void onCleanup() { private void onCleanup() {
AppUtil.setMultiVisibility(View.GONE, viewBinding.loadingMoreView, viewBinding.progressBar); AppUtil.setMultiVisibility(View.GONE, viewBinding.progressBar, viewBinding.progressBar);
viewBinding.pullToRefresh.setRefreshing(false); viewBinding.pullToRefresh.setRefreshing(false);
if(currentFilterMode.equalsIgnoreCase("unread")) { if(currentFilterMode.equalsIgnoreCase("unread")) {

View File

@ -12,14 +12,11 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.gitnex.tea4j.models.PullRequests; import org.gitnex.tea4j.models.PullRequests;
import org.mian.gitnex.R; import org.mian.gitnex.R;
@ -31,7 +28,6 @@ import org.mian.gitnex.helpers.Authorization;
import org.mian.gitnex.helpers.Constants; import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.Version;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import retrofit2.Call; import retrofit2.Call;
@ -44,24 +40,21 @@ import retrofit2.Response;
public class PullRequestsFragment extends Fragment { public class PullRequestsFragment extends Fragment {
private FragmentPullRequestsBinding fragmentPullRequestsBinding;
private Menu menu; private Menu menu;
private ProgressBar mProgressBar;
private RecyclerView recyclerView;
private List<PullRequests> prList; private List<PullRequests> prList;
private PullRequestsAdapter adapter; private PullRequestsAdapter adapter;
private String TAG = Constants.tagPullRequestsList; private final String TAG = Constants.tagPullRequestsList;
private Context context; private Context context;
private int pageSize = Constants.prPageInit; private int pageSize = Constants.prPageInit;
private TextView noData; private int resultLimit;
private int resultLimit = Constants.resultLimitOldGiteaInstances;
private ProgressBar progressLoadMore;
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
FragmentPullRequestsBinding fragmentPullRequestsBinding = FragmentPullRequestsBinding.inflate(inflater, container, false); fragmentPullRequestsBinding = FragmentPullRequestsBinding.inflate(inflater, container, false);
setHasOptionsMenu(true); setHasOptionsMenu(true);
context = getContext(); context = getContext();
@ -75,43 +68,30 @@ public class PullRequestsFragment extends Fragment {
final SwipeRefreshLayout swipeRefresh = fragmentPullRequestsBinding.pullToRefresh; final SwipeRefreshLayout swipeRefresh = fragmentPullRequestsBinding.pullToRefresh;
// if gitea is 1.12 or higher use the new limit resultLimit = Constants.getCurrentResultLimit(context);
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
resultLimit = Constants.resultLimitNewGiteaInstances;
}
recyclerView = fragmentPullRequestsBinding.recyclerView;
prList = new ArrayList<>(); prList = new ArrayList<>();
progressLoadMore = fragmentPullRequestsBinding.progressLoadMore;
mProgressBar = fragmentPullRequestsBinding.progressBar;
noData = fragmentPullRequestsBinding.noData;
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> { swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
swipeRefresh.setRefreshing(false); swipeRefresh.setRefreshing(false);
loadInitial(instanceToken, repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit); loadInitial(instanceToken, repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit);
adapter.notifyDataChanged(); adapter.notifyDataChanged();
}, 200)); }, 200));
adapter = new PullRequestsAdapter(getContext(), prList); adapter = new PullRequestsAdapter(getContext(), prList);
adapter.setLoadMoreListener(() -> recyclerView.post(() -> { adapter.setLoadMoreListener(() -> fragmentPullRequestsBinding.recyclerView.post(() -> {
if(prList.size() == resultLimit || pageSize == resultLimit) { if(prList.size() == resultLimit || pageSize == resultLimit) {
int page = (prList.size() + resultLimit) / resultLimit; int page = (prList.size() + resultLimit) / resultLimit;
loadMore(Authorization.get(getContext()), repoOwner, repoName, page, tinyDb.getString("repoPrState"), resultLimit); loadMore(Authorization.get(getContext()), repoOwner, repoName, page, tinyDb.getString("repoPrState"), resultLimit);
} }
})); }));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(fragmentPullRequestsBinding.recyclerView.getContext(), DividerItemDecoration.VERTICAL);
recyclerView.setHasFixedSize(true); fragmentPullRequestsBinding.recyclerView.setHasFixedSize(true);
recyclerView.addItemDecoration(dividerItemDecoration); fragmentPullRequestsBinding.recyclerView.addItemDecoration(dividerItemDecoration);
recyclerView.setLayoutManager(new LinearLayoutManager(context)); fragmentPullRequestsBinding.recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.setAdapter(adapter); fragmentPullRequestsBinding.recyclerView.setAdapter(adapter);
((RepoDetailActivity) requireActivity()).setFragmentRefreshListenerPr(prState -> { ((RepoDetailActivity) requireActivity()).setFragmentRefreshListenerPr(prState -> {
@ -125,31 +105,27 @@ public class PullRequestsFragment extends Fragment {
prList.clear(); prList.clear();
adapter = new PullRequestsAdapter(context, prList); adapter = new PullRequestsAdapter(context, prList);
adapter.setLoadMoreListener(() -> recyclerView.post(() -> { adapter.setLoadMoreListener(() -> fragmentPullRequestsBinding.recyclerView.post(() -> {
if(prList.size() == resultLimit || pageSize == resultLimit) { if(prList.size() == resultLimit || pageSize == resultLimit) {
int page = (prList.size() + resultLimit) / resultLimit; int page = (prList.size() + resultLimit) / resultLimit;
loadMore(Authorization.get(getContext()), repoOwner, repoName, page, tinyDb.getString("repoPrState"), resultLimit); loadMore(Authorization.get(getContext()), repoOwner, repoName, page, tinyDb.getString("repoPrState"), resultLimit);
} }
})); }));
tinyDb.putString("repoPrState", prState); tinyDb.putString("repoPrState", prState);
mProgressBar.setVisibility(View.VISIBLE); fragmentPullRequestsBinding.progressBar.setVisibility(View.VISIBLE);
noData.setVisibility(View.GONE); fragmentPullRequestsBinding.noData.setVisibility(View.GONE);
loadInitial(Authorization.get(context), repoOwner, repoName, pageSize, prState, resultLimit); loadInitial(Authorization.get(context), repoOwner, repoName, pageSize, prState, resultLimit);
recyclerView.setAdapter(adapter); fragmentPullRequestsBinding.recyclerView.setAdapter(adapter);
}); });
loadInitial(Authorization.get(getContext()), repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit); loadInitial(Authorization.get(getContext()), repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit);
return fragmentPullRequestsBinding.getRoot(); return fragmentPullRequestsBinding.getRoot();
} }
@Override @Override
@ -164,13 +140,10 @@ public class PullRequestsFragment extends Fragment {
final String repoName = parts[1]; final String repoName = parts[1];
if(tinyDb.getBoolean("resumePullRequests")) { if(tinyDb.getBoolean("resumePullRequests")) {
loadInitial(Authorization.get(getContext()), repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit); loadInitial(Authorization.get(getContext()), repoOwner, repoName, pageSize, tinyDb.getString("repoPrState"), resultLimit);
tinyDb.putBoolean("resumePullRequests", false); tinyDb.putBoolean("resumePullRequests", false);
tinyDb.putBoolean("prMerged", false); tinyDb.putBoolean("prMerged", false);
} }
} }
private void loadInitial(String token, String repoOwner, String repoName, int page, String prState, int resultLimit) { private void loadInitial(String token, String repoOwner, String repoName, int page, String prState, int resultLimit) {
@ -186,38 +159,26 @@ public class PullRequestsFragment extends Fragment {
assert response.body() != null; assert response.body() != null;
if(response.body().size() > 0) { if(response.body().size() > 0) {
prList.clear(); prList.clear();
prList.addAll(response.body()); prList.addAll(response.body());
adapter.notifyDataChanged(); adapter.notifyDataChanged();
noData.setVisibility(View.GONE); fragmentPullRequestsBinding.noData.setVisibility(View.GONE);
} }
else { else {
prList.clear(); prList.clear();
adapter.notifyDataChanged(); adapter.notifyDataChanged();
noData.setVisibility(View.VISIBLE); fragmentPullRequestsBinding.noData.setVisibility(View.VISIBLE);
} }
fragmentPullRequestsBinding.progressBar.setVisibility(View.GONE);
mProgressBar.setVisibility(View.GONE);
} }
else if(response.code() == 404) { else if(response.code() == 404) {
fragmentPullRequestsBinding.noData.setVisibility(View.VISIBLE);
noData.setVisibility(View.VISIBLE); fragmentPullRequestsBinding.progressBar.setVisibility(View.GONE);
mProgressBar.setVisibility(View.GONE);
} }
else { else {
Log.i(TAG, String.valueOf(response.code())); Log.i(TAG, String.valueOf(response.code()));
} }
Log.i(TAG, String.valueOf(response.code())); Log.i(TAG, String.valueOf(response.code()));
} }
@Override @Override
@ -225,14 +186,12 @@ public class PullRequestsFragment extends Fragment {
Log.e(TAG, t.toString()); Log.e(TAG, t.toString());
} }
}); });
} }
private void loadMore(String token, String repoOwner, String repoName, int page, String prState, int resultLimit) { private void loadMore(String token, String repoOwner, String repoName, int page, String prState, int resultLimit) {
progressLoadMore.setVisibility(View.VISIBLE); fragmentPullRequestsBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<PullRequests>> call = RetrofitClient.getApiInterface(context).getPullRequests(token, repoOwner, repoName, page, prState, resultLimit); Call<List<PullRequests>> call = RetrofitClient.getApiInterface(context).getPullRequests(token, repoOwner, repoName, page, prState, resultLimit);
@ -245,42 +204,30 @@ public class PullRequestsFragment extends Fragment {
//remove loading view //remove loading view
prList.remove(prList.size() - 1); prList.remove(prList.size() - 1);
List<PullRequests> result = response.body(); List<PullRequests> result = response.body();
assert result != null; assert result != null;
if(result.size() > 0) { if(result.size() > 0) {
pageSize = result.size(); pageSize = result.size();
prList.addAll(result); prList.addAll(result);
} }
else { else {
Toasty.info(context, getString(R.string.noMoreData)); Toasty.info(context, getString(R.string.noMoreData));
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
progressLoadMore.setVisibility(View.GONE); fragmentPullRequestsBinding.progressBar.setVisibility(View.GONE);
} }
else { else {
Log.e(TAG, String.valueOf(response.code())); Log.e(TAG, String.valueOf(response.code()));
} }
} }
@Override @Override
public void onFailure(@NonNull Call<List<PullRequests>> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<List<PullRequests>> call, @NonNull Throwable t) {
Log.e(TAG, t.toString()); Log.e(TAG, t.toString());
} }
}); });
} }
@ -309,20 +256,15 @@ public class PullRequestsFragment extends Fragment {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
return false; return false;
} }
@Override @Override
public boolean onQueryTextChange(String newText) { public boolean onQueryTextChange(String newText) {
filter(newText); filter(newText);
return false; return false;
} }
}); });
} }
private void filter(String text) { private void filter(String text) {
@ -333,12 +275,10 @@ public class PullRequestsFragment extends Fragment {
if(d == null || d.getTitle() == null || d.getBody() == null) { if(d == null || d.getTitle() == null || d.getBody() == null) {
continue; continue;
} }
if(d.getTitle().toLowerCase().contains(text) || d.getBody().toLowerCase().contains(text)) { if(d.getTitle().toLowerCase().contains(text) || d.getBody().toLowerCase().contains(text) || d.getNumber() == Integer.parseInt(text)) {
arr.add(d); arr.add(d);
} }
} }
adapter.updateList(arr); adapter.updateList(arr);
} }
} }

View File

@ -164,7 +164,7 @@ public class FollowersFragment extends Fragment {
private void loadMore(String token, String username, int page, int resultLimit) { private void loadMore(String token, String username, int page, int resultLimit) {
fragmentProfileFollowersFollowingBinding.progressLoadMore.setVisibility(View.VISIBLE); fragmentProfileFollowersFollowingBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<UserInfo>> call = RetrofitClient Call<List<UserInfo>> call = RetrofitClient
.getApiInterface(context) .getApiInterface(context)
@ -190,7 +190,7 @@ public class FollowersFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
fragmentProfileFollowersFollowingBinding.progressLoadMore.setVisibility(View.GONE); fragmentProfileFollowersFollowingBinding.progressBar.setVisibility(View.GONE);
break; break;
case 401: case 401:

View File

@ -164,7 +164,7 @@ public class FollowingFragment extends Fragment {
private void loadMore(String token, String username, int page, int resultLimit) { private void loadMore(String token, String username, int page, int resultLimit) {
fragmentProfileFollowersFollowingBinding.progressLoadMore.setVisibility(View.VISIBLE); fragmentProfileFollowersFollowingBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<UserInfo>> call = RetrofitClient Call<List<UserInfo>> call = RetrofitClient
.getApiInterface(context) .getApiInterface(context)
@ -190,7 +190,7 @@ public class FollowingFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
fragmentProfileFollowersFollowingBinding.progressLoadMore.setVisibility(View.GONE); fragmentProfileFollowersFollowingBinding.progressBar.setVisibility(View.GONE);
break; break;
case 401: case 401:

View File

@ -166,7 +166,7 @@ public class OrganizationsFragment extends Fragment {
private void loadMore(String token, String username, int page, int resultLimit) { private void loadMore(String token, String username, int page, int resultLimit) {
fragmentOrganizationsBinding.progressLoadMore.setVisibility(View.VISIBLE); fragmentOrganizationsBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<UserOrganizations>> call = RetrofitClient Call<List<UserOrganizations>> call = RetrofitClient
.getApiInterface(context) .getApiInterface(context)
@ -192,7 +192,7 @@ public class OrganizationsFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
fragmentOrganizationsBinding.progressLoadMore.setVisibility(View.GONE); fragmentOrganizationsBinding.progressBar.setVisibility(View.GONE);
break; break;
case 401: case 401:

View File

@ -165,7 +165,7 @@ public class RepositoriesFragment extends Fragment {
private void loadMore(String token, String username, int page, int resultLimit) { private void loadMore(String token, String username, int page, int resultLimit) {
fragmentRepositoriesBinding.progressLoadMore.setVisibility(View.VISIBLE); fragmentRepositoriesBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<UserRepositories>> call = RetrofitClient.getApiInterface(context).getUserProfileRepositories(token, username, page, resultLimit); Call<List<UserRepositories>> call = RetrofitClient.getApiInterface(context).getUserProfileRepositories(token, username, page, resultLimit);
@ -189,7 +189,7 @@ public class RepositoriesFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
fragmentRepositoriesBinding.progressLoadMore.setVisibility(View.GONE); fragmentRepositoriesBinding.progressBar.setVisibility(View.GONE);
break; break;
case 401: case 401:

View File

@ -166,7 +166,7 @@ public class StarredRepositoriesFragment extends Fragment {
private void loadMore(String token, String username, int page, int resultLimit) { private void loadMore(String token, String username, int page, int resultLimit) {
fragmentRepositoriesBinding.progressLoadMore.setVisibility(View.VISIBLE); fragmentRepositoriesBinding.progressBar.setVisibility(View.VISIBLE);
Call<List<UserRepositories>> call = RetrofitClient Call<List<UserRepositories>> call = RetrofitClient
.getApiInterface(context) .getApiInterface(context)
@ -192,7 +192,7 @@ public class StarredRepositoriesFragment extends Fragment {
adapter.setMoreDataAvailable(false); adapter.setMoreDataAvailable(false);
} }
adapter.notifyDataChanged(); adapter.notifyDataChanged();
fragmentRepositoriesBinding.progressLoadMore.setVisibility(View.GONE); fragmentRepositoriesBinding.progressBar.setVisibility(View.GONE);
break; break;
case 401: case 401:

View File

@ -20,7 +20,7 @@ public class Constants {
// tags // tags
public static final String tagMilestonesFragment = "MilestonesFragment"; public static final String tagMilestonesFragment = "MilestonesFragment";
public static final String tagPullRequestsList = "PullRequestsListFragment"; public static final String tagPullRequestsList = "PullRequestFragment";
public static final String tagIssuesList = "IssuesListFragment"; public static final String tagIssuesList = "IssuesListFragment";
public static final String tagMilestonesAdapter = "MilestonesAdapter"; public static final String tagMilestonesAdapter = "MilestonesAdapter";
public static final String draftsApi = "DraftsApi"; public static final String draftsApi = "DraftsApi";
@ -28,6 +28,7 @@ public class Constants {
public static final String tagDraftsBottomSheet = "BottomSheetDraftsFragment"; public static final String tagDraftsBottomSheet = "BottomSheetDraftsFragment";
public static final String userAccountsApi = "UserAccountsApi"; public static final String userAccountsApi = "UserAccountsApi";
public static final String publicOrganizations = "PublicOrganizations"; public static final String publicOrganizations = "PublicOrganizations";
public static final String exploreUsers = "ExploreUsers";
public static final String exploreIssues = "ExploreIssues"; public static final String exploreIssues = "ExploreIssues";
public static final String exploreRepositories = "ExploreRepositories"; public static final String exploreRepositories = "ExploreRepositories";
public static final String tagNotifications = "TagNotifications"; public static final String tagNotifications = "TagNotifications";

View File

@ -122,7 +122,7 @@
android:id="@+id/explore" android:id="@+id/explore"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:text="@string/navExplore" android:text="@string/pageTitleExplore"
android:textColor="@color/btnTextColor" android:textColor="@color/btnTextColor"
android:textSize="16sp" android:textSize="16sp"
android:layout_marginTop="8dp" /> android:layout_marginTop="8dp" />

View File

@ -16,40 +16,20 @@
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tabsExplore" android:id="@+id/tabsExplore"
app:tabMode="auto"
app:tabTextAppearance="@style/customTabLayout" app:tabTextAppearance="@style/customTabLayout"
android:layout_width="match_parent" app:tabMode="scrollable"
android:background="?attr/primaryBackgroundColor"
app:tabTextColor="?attr/primaryTextColor" app:tabTextColor="?attr/primaryTextColor"
android:background="?attr/primaryBackgroundColor"
app:tabIndicatorColor="?attr/pagerTabIndicatorColor" app:tabIndicatorColor="?attr/pagerTabIndicatorColor"
android:layout_height="wrap_content"> android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tabExploreRepositories"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pageTitleRepositories" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tabExploreIssues"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pageTitleIssues" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tabExplorePublicOrganizations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pageTitleOrganizations" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager <androidx.viewpager2.widget.ViewPager2
android:id="@+id/containerExplore" android:id="@+id/containerExplore"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -6,15 +6,6 @@
android:background="?attr/primaryBackgroundColor" android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/loadingMoreView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/primaryBackgroundColor"
android:orientation="vertical">
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/searchKeywordLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundColor="?attr/inputBackgroundColor"
android:textColorHint="?attr/hintColor"
app:hintTextColor="?attr/hintColor"
app:boxStrokeErrorColor="@color/darkRed"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:startIconDrawable="@drawable/ic_search"
app:startIconTint="?attr/iconsColor"
app:endIconMode="clear_text"
app:endIconTint="?attr/iconsColor"
android:hint="@string/exploreUsers">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/searchKeyword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:imeOptions="actionSend"
android:inputType="text"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<TextView
android:id="@+id/noData"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
android:gravity="center"
android:text="@string/noDataFound"
android:textColor="?attr/primaryTextColor"
android:textSize="20sp"
android:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/pullToRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewExploreUsers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor"
android:scrollbars="vertical" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>

View File

@ -21,22 +21,13 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator" style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" /> app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressLoadMore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<TextView <TextView
android:id="@+id/noDataIssues" android:id="@+id/noDataIssues"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -21,7 +21,7 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"

View File

@ -22,15 +22,6 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/loadingMoreView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -20,22 +20,13 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator" style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" /> app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressLoadMore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<TextView <TextView
android:id="@+id/noDataOrg" android:id="@+id/noDataOrg"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -26,15 +26,6 @@
style="@style/Widget.MaterialComponents.LinearProgressIndicator" style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" /> app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressLoadMore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<TextView <TextView
android:id="@+id/noData" android:id="@+id/noData"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -21,22 +21,13 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator" style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" /> app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressLoadMore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<TextView <TextView
android:id="@+id/noData" android:id="@+id/noData"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -22,22 +22,13 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator" style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" /> app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressLoadMore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<TextView <TextView
android:id="@+id/noData" android:id="@+id/noData"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -6,15 +6,6 @@
android:background="?attr/primaryBackgroundColor" android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/loadingMoreView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:indeterminate="true"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
app:indicatorColor="?attr/progressIndicatorColor" />
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressBar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -45,7 +36,7 @@
app:startIconTint="?attr/iconsColor" app:startIconTint="?attr/iconsColor"
app:endIconMode="clear_text" app:endIconMode="clear_text"
app:endIconTint="?attr/iconsColor" app:endIconTint="?attr/iconsColor"
android:hint="@string/navSearchIssuesPulls"> android:hint="@string/exploreIssues">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/searchKeyword" android:id="@+id/searchKeyword"

View File

@ -22,7 +22,7 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"

View File

@ -21,7 +21,7 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator <com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"

View File

@ -18,7 +18,7 @@
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="15sp" android:textSize="14sp"
tools:text="👍" /> tools:text="👍" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View File

@ -16,7 +16,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="20sp" android:textSize="18sp"
tools:text="👍" /> tools:text="👍" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="16dp">
<ImageView
android:id="@+id/userAvatar"
android:layout_width="@dimen/list_avatar_size"
android:layout_height="@dimen/list_avatar_size"
android:layout_marginEnd="10dp"
android:contentDescription="@string/generalImgContentText"
android:src="@drawable/ic_android" />
<LinearLayout
android:id="@+id/userInfoSection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/userFullName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/userName"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/userName"
android:textColor="?attr/primaryTextColor"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>

View File

@ -32,7 +32,7 @@
<item android:id="@+id/nav_explore" <item android:id="@+id/nav_explore"
android:icon="@drawable/ic_search" android:icon="@drawable/ic_search"
android:title="@string/navExplore" /> android:title="@string/pageTitleExplore" />
<item android:id="@+id/nav_comments_draft" <item android:id="@+id/nav_comments_draft"
android:icon="@drawable/ic_drafts" android:icon="@drawable/ic_drafts"

View File

@ -66,7 +66,7 @@
<item>@string/navRepos</item> <item>@string/navRepos</item>
<item>@string/navOrg</item> <item>@string/navOrg</item>
<item>@string/pageTitleNotifications</item> <item>@string/pageTitleNotifications</item>
<item>@string/navExplore</item> <item>@string/pageTitleExplore</item>
</string-array> </string-array>
<string-array name="cacheSizeList"> <string-array name="cacheSizeList">

View File

@ -28,9 +28,7 @@
<string name="navAbout">About</string> <string name="navAbout">About</string>
<string name="navRate">Rate GitNex</string> <string name="navRate">Rate GitNex</string>
<string name="navLogout">Logout</string> <string name="navLogout">Logout</string>
<string name="navExplore">Explore</string>
<string name="navAdministration">Administration</string> <string name="navAdministration">Administration</string>
<string name="navSearchIssuesPulls">Search Issues</string>
<!-- menu items --> <!-- menu items -->
<!-- page titles --> <!-- page titles -->
@ -58,6 +56,7 @@
<string name="pageTitleAdministration">Gitea Administration</string> <string name="pageTitleAdministration">Gitea Administration</string>
<string name="pageTitleUserAccounts">Manage Accounts</string> <string name="pageTitleUserAccounts">Manage Accounts</string>
<string name="pageTitleNewPullRequest">New Pull Request</string> <string name="pageTitleNewPullRequest">New Pull Request</string>
<string name="pageTitleUsers">Users</string>
<!-- page titles --> <!-- page titles -->
<string name="repoName">Demo repo</string> <string name="repoName">Demo repo</string>
@ -525,8 +524,11 @@
<string name="isClosed">Closed</string> <string name="isClosed">Closed</string>
<string name="genericServerResponseError">We cannot reach the server at the moment, please check your server status and try again</string> <string name="genericServerResponseError">We cannot reach the server at the moment, please check your server status and try again</string>
<string name="genericCopyUrl">Copy URL</string> <string name="genericCopyUrl">Copy URL</string>
<string name="genericWaitFor">Hold on ☕</string>
<!-- generic copy --> <!-- generic copy -->
<string name="exploreUsers">Explore users</string>
<string name="exploreIssues">Explore issues</string>
<string name="exploreTextBoxHint">Explore repositories</string> <string name="exploreTextBoxHint">Explore repositories</string>
<string name="starRepository">Star Repository</string> <string name="starRepository">Star Repository</string>
<string name="unStarRepository">Unstar Repository</string> <string name="unStarRepository">Unstar Repository</string>
@ -539,7 +541,7 @@
<string name="titleDrafts">Drafts</string> <string name="titleDrafts">Drafts</string>
<string name="filesBreadcrumbRoot" translatable="false">Root</string> <string name="filesBreadcrumbRoot" translatable="false">Root</string>
<string name="versionUnsupportedOld">Unsupported old version(%1$s) of Gitea detected. Please update to latest stable version. If you continue, the app may not function properly</string> <string name="versionUnsupportedOld">Unsupported old version(%1$s) of Gitea detected. Please update to latest stable version. If you continue, some features may not work.</string>
<string name="versionUnsupportedNew">New Gitea version detected! Please UPDATE GitNex!</string> <string name="versionUnsupportedNew">New Gitea version detected! Please UPDATE GitNex!</string>
<string name="versionUnknown">No Gitea detected!</string> <string name="versionUnknown">No Gitea detected!</string>
<string name="versionAlertDialogHeader">Unsupported Version of Gitea</string> <string name="versionAlertDialogHeader">Unsupported Version of Gitea</string>
@ -664,7 +666,7 @@
<!-- Notifications --> <!-- Notifications -->
<string name="pageTitleNotifications">Notifications</string> <string name="pageTitleNotifications">Notifications</string>
<string name="noDataNotifications">No notifications found</string> <string name="noDataNotifications">All caught up 🚀</string>
<string name="notificationsPollingHeaderText">Notifications Polling Delay</string> <string name="notificationsPollingHeaderText">Notifications Polling Delay</string>
<string name="pollingDelaySelectedText">%d Minutes</string> <string name="pollingDelaySelectedText">%d Minutes</string>
<string name="pollingDelayDialogHeaderText">Select Polling Delay</string> <string name="pollingDelayDialogHeaderText">Select Polling Delay</string>