mirror of https://codeberg.org/gitnex/GitNex.git
Remove duplicated code (#1020)
* merge user grid adapters * merge user list adapter * merge repo list adapters if they don't use pagination * move `BottomSheetListener` to new package `structs` (there isn't any package that fits) Addresses #1000 Co-authored-by: qwerty287 <ndev@web.de> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1020 Reviewed-by: 6543 <6543@noreply.codeberg.org> Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org> Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
parent
a4dee6a179
commit
3559f9c8bd
|
@ -25,13 +25,14 @@ import org.mian.gitnex.databinding.ActivityAdminGetUsersBinding;
|
|||
import org.mian.gitnex.fragments.BottomSheetAdminUsersFragment;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import org.mian.gitnex.viewmodels.AdminGetUsersViewModel;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class AdminGetUsersActivity extends BaseActivity implements BottomSheetAdminUsersFragment.BottomSheetListener {
|
||||
public class AdminGetUsersActivity extends BaseActivity implements BottomSheetListener {
|
||||
|
||||
private View.OnClickListener onClickListener;
|
||||
private AdminGetUsersAdapter adapter;
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.mian.gitnex.helpers.Images;
|
|||
import org.mian.gitnex.helpers.Markdown;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.notifications.Notifications;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
|
@ -41,7 +42,7 @@ import retrofit2.Response;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class FileViewActivity extends BaseActivity implements BottomSheetFileViewerFragment.BottomSheetListener {
|
||||
public class FileViewActivity extends BaseActivity implements BottomSheetListener {
|
||||
|
||||
private ActivityFileViewBinding binding;
|
||||
private Files file;
|
||||
|
|
|
@ -59,6 +59,7 @@ 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.structs.BottomSheetListener;
|
||||
import org.mian.gitnex.viewmodels.IssueCommentsViewModel;
|
||||
import org.mian.gitnex.views.ReactionList;
|
||||
import java.text.DateFormat;
|
||||
|
@ -77,7 +78,7 @@ import retrofit2.Response;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class IssueDetailActivity extends BaseActivity implements LabelsListAdapter.LabelsListAdapterListener, AssigneesListAdapter.AssigneesListAdapterListener, BottomSheetSingleIssueFragment.BottomSheetListener {
|
||||
public class IssueDetailActivity extends BaseActivity implements LabelsListAdapter.LabelsListAdapterListener, AssigneesListAdapter.AssigneesListAdapterListener, BottomSheetListener {
|
||||
|
||||
private IssueCommentsAdapter adapter;
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ import org.mian.gitnex.helpers.RoundedTransformation;
|
|||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import jp.wasabeef.picasso.transformations.BlurTransformation;
|
||||
|
@ -66,7 +67,7 @@ import retrofit2.Callback;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class MainActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener, BottomSheetDraftsFragment.BottomSheetListener {
|
||||
public class MainActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener, BottomSheetListener {
|
||||
|
||||
private DrawerLayout drawer;
|
||||
private TextView toolbarTitle;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.mian.gitnex.fragments.OrganizationLabelsFragment;
|
|||
import org.mian.gitnex.fragments.RepositoriesByOrgFragment;
|
||||
import org.mian.gitnex.fragments.TeamsByOrgFragment;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import java.util.Objects;
|
||||
import io.mikael.urlbuilder.UrlBuilder;
|
||||
|
||||
|
@ -34,7 +35,7 @@ import io.mikael.urlbuilder.UrlBuilder;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class OrganizationDetailActivity extends BaseActivity implements BottomSheetOrganizationFragment.BottomSheetListener {
|
||||
public class OrganizationDetailActivity extends BaseActivity implements BottomSheetListener {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
|
|
@ -13,11 +13,12 @@ import android.widget.TextView;
|
|||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.TeamMembersByOrgAdapter;
|
||||
import org.mian.gitnex.adapters.UserGridAdapter;
|
||||
import org.mian.gitnex.databinding.ActivityOrgTeamMembersBinding;
|
||||
import org.mian.gitnex.fragments.BottomSheetOrganizationTeamsFragment;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import org.mian.gitnex.viewmodels.TeamMembersByOrgViewModel;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -25,11 +26,11 @@ import java.util.Objects;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class OrganizationTeamMembersActivity extends BaseActivity implements BottomSheetOrganizationTeamsFragment.BottomSheetListener {
|
||||
public class OrganizationTeamMembersActivity extends BaseActivity implements BottomSheetListener {
|
||||
|
||||
private TextView noDataMembers;
|
||||
private View.OnClickListener onClickListener;
|
||||
private TeamMembersByOrgAdapter adapter;
|
||||
private UserGridAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
|
@ -96,7 +97,7 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
|
|||
|
||||
teamMembersModel.getMembersByOrgList(instanceToken, teamId, ctx).observe(this, teamMembersListMain -> {
|
||||
|
||||
adapter = new TeamMembersByOrgAdapter(ctx, teamMembersListMain);
|
||||
adapter = new UserGridAdapter(ctx, teamMembersListMain);
|
||||
|
||||
if(adapter.getCount() > 0) {
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.mian.gitnex.fragments.profile.RepositoriesFragment;
|
|||
import org.mian.gitnex.fragments.profile.StarredRepositoriesFragment;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import java.util.Objects;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
@ -37,7 +38,7 @@ import retrofit2.Response;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class ProfileActivity extends BaseActivity implements BottomSheetUserProfileFragment.BottomSheetListener {
|
||||
public class ProfileActivity extends BaseActivity implements BottomSheetListener {
|
||||
|
||||
private String username;
|
||||
private boolean following;
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.mian.gitnex.fragments.RepoInfoFragment;
|
|||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -60,8 +61,7 @@ import retrofit2.Response;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoFragment.BottomSheetListener, BottomSheetIssuesFilterFragment.BottomSheetListener,
|
||||
BottomSheetPullRequestFilterFragment.BottomSheetListener, BottomSheetMilestonesFilterFragment.BottomSheetListener {
|
||||
public class RepoDetailActivity extends BaseActivity implements BottomSheetListener {
|
||||
|
||||
private TextView textViewBadgeIssue;
|
||||
private TextView textViewBadgePull;
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.RepoStargazersAdapter;
|
||||
import org.mian.gitnex.adapters.UserGridAdapter;
|
||||
import org.mian.gitnex.databinding.ActivityRepoStargazersBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
|
||||
|
@ -21,7 +21,7 @@ public class RepoStargazersActivity extends BaseActivity {
|
|||
|
||||
private TextView noDataStargazers;
|
||||
private View.OnClickListener onClickListener;
|
||||
private RepoStargazersAdapter adapter;
|
||||
private UserGridAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class RepoStargazersActivity extends BaseActivity {
|
|||
|
||||
repoStargazersModel.getRepoStargazers(instanceToken, repoOwner, repoName, ctx).observe(this, stargazersListMain -> {
|
||||
|
||||
adapter = new RepoStargazersAdapter(ctx, stargazersListMain);
|
||||
adapter = new UserGridAdapter(ctx, stargazersListMain);
|
||||
|
||||
if(adapter.getCount() > 0) {
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.RepoWatchersAdapter;
|
||||
import org.mian.gitnex.adapters.UserGridAdapter;
|
||||
import org.mian.gitnex.databinding.ActivityRepoWatchersBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
|
||||
|
@ -21,7 +21,7 @@ public class RepoWatchersActivity extends BaseActivity {
|
|||
|
||||
private TextView noDataWatchers;
|
||||
private View.OnClickListener onClickListener;
|
||||
private RepoWatchersAdapter adapter;
|
||||
private UserGridAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class RepoWatchersActivity extends BaseActivity {
|
|||
|
||||
repoWatchersModel.getRepoWatchers(instanceToken, repoOwner, repoName, ctx).observe(this, watchersListMain -> {
|
||||
|
||||
adapter = new RepoWatchersAdapter(ctx, watchersListMain);
|
||||
adapter = new UserGridAdapter(ctx, watchersListMain);
|
||||
|
||||
if(adapter.getCount() > 0) {
|
||||
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
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();
|
||||
}
|
||||
}
|
|
@ -1,149 +0,0 @@
|
|||
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 MyProfileFollowingAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final Context context;
|
||||
private final int TYPE_LOAD = 0;
|
||||
private List<UserInfo> followingList;
|
||||
private OnLoadMoreListener loadMoreListener;
|
||||
private boolean isLoading = false, isMoreDataAvailable = true;
|
||||
|
||||
public MyProfileFollowingAdapter(List<UserInfo> dataList, Context ctx) {
|
||||
this.context = ctx;
|
||||
this.followingList = dataList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
if(viewType == TYPE_LOAD) {
|
||||
return new MyProfileFollowingAdapter.FollowingHolder(inflater.inflate(R.layout.list_profile_followers_following, parent, false));
|
||||
}
|
||||
else {
|
||||
return new MyProfileFollowingAdapter.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) {
|
||||
((MyProfileFollowingAdapter.FollowingHolder) holder).bindData(followingList.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if(followingList.get(position).getUsername() != null) {
|
||||
return TYPE_LOAD;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return followingList.size();
|
||||
}
|
||||
|
||||
class FollowingHolder extends RecyclerView.ViewHolder {
|
||||
private UserInfo userInfo;
|
||||
private final ImageView userAvatar;
|
||||
private final TextView userFullName;
|
||||
private final TextView userName;
|
||||
|
||||
FollowingHolder(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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
PicassoService.getInstance(context).get().load(userInfo.getAvatar()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)).resize(120, 120).centerCrop().into(userAvatar);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
followingList = list;
|
||||
notifyDataChanged();
|
||||
}
|
||||
}
|
|
@ -1,311 +0,0 @@
|
|||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import org.gitnex.tea4j.models.UserRepositories;
|
||||
import org.gitnex.tea4j.models.WatchInfo;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
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.RepositoriesApi;
|
||||
import org.mian.gitnex.database.models.Repository;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.MyReposViewHolder> implements Filterable {
|
||||
|
||||
private final List<UserRepositories> reposList;
|
||||
private final Context context;
|
||||
private final List<UserRepositories> reposListFull;
|
||||
|
||||
static class MyReposViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private UserRepositories userRepositories;
|
||||
|
||||
private final ImageView image;
|
||||
private final TextView repoName;
|
||||
private final TextView orgName;
|
||||
private final TextView repoDescription;
|
||||
private CheckBox isRepoAdmin;
|
||||
private final TextView repoStars;
|
||||
private final TextView repoLastUpdated;
|
||||
private final View spacerView;
|
||||
|
||||
private MyReposViewHolder(View itemView) {
|
||||
|
||||
super(itemView);
|
||||
repoName = itemView.findViewById(R.id.repoName);
|
||||
orgName = itemView.findViewById(R.id.orgName);
|
||||
repoDescription = itemView.findViewById(R.id.repoDescription);
|
||||
isRepoAdmin = itemView.findViewById(R.id.repoIsAdmin);
|
||||
image = itemView.findViewById(R.id.imageAvatar);
|
||||
repoStars = itemView.findViewById(R.id.repoStars);
|
||||
repoLastUpdated = itemView.findViewById(R.id.repoLastUpdated);
|
||||
spacerView = itemView.findViewById(R.id.spacerView);
|
||||
|
||||
itemView.setOnClickListener(v -> {
|
||||
|
||||
Context context = v.getContext();
|
||||
TinyDB tinyDb = TinyDB.getInstance(context);
|
||||
|
||||
Intent intent = new Intent(context, RepoDetailActivity.class);
|
||||
intent.putExtra("repoFullName", userRepositories.getFullName());
|
||||
|
||||
tinyDb.putString("repoFullName", userRepositories.getFullName());
|
||||
//tinyDb.putBoolean("resumeIssues", true);
|
||||
tinyDb.putBoolean("isRepoAdmin", isRepoAdmin.isChecked());
|
||||
tinyDb.putString("repoBranch", userRepositories.getDefault_branch());
|
||||
|
||||
if(userRepositories.getPrivateFlag()) {
|
||||
tinyDb.putString("repoType", context.getResources().getString(R.string.strPrivate));
|
||||
}
|
||||
else {
|
||||
tinyDb.putString("repoType", context.getResources().getString(R.string.strPublic));
|
||||
}
|
||||
|
||||
String[] parts = userRepositories.getFullName().split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
int currentActiveAccountId = tinyDb.getInt("currentActiveAccountId");
|
||||
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
|
||||
|
||||
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
|
||||
assert repositoryData != null;
|
||||
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
|
||||
|
||||
if(count == 0) {
|
||||
|
||||
long id = repositoryData.insertRepository(currentActiveAccountId, repoOwner, repoName);
|
||||
tinyDb.putLong("repositoryId", id);
|
||||
}
|
||||
else {
|
||||
|
||||
Repository data = repositoryData.getRepository(currentActiveAccountId, repoOwner, repoName);
|
||||
tinyDb.putLong("repositoryId", data.getRepositoryId());
|
||||
}
|
||||
|
||||
//store if user is watching this repo
|
||||
{
|
||||
|
||||
final String token = "token " + tinyDb.getString(tinyDb.getString("loginUid") + "-token");
|
||||
|
||||
WatchInfo watch = new WatchInfo();
|
||||
|
||||
Call<WatchInfo> call;
|
||||
|
||||
call = RetrofitClient.getApiInterface(context).checkRepoWatchStatus(token, repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<WatchInfo>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<WatchInfo> call, @NonNull retrofit2.Response<WatchInfo> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
assert response.body() != null;
|
||||
tinyDb.putBoolean("repoWatch", response.body().getSubscribed());
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
tinyDb.putBoolean("repoWatch", false);
|
||||
|
||||
if(response.code() != 404) {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||
|
||||
tinyDb.putBoolean("repoWatch", false);
|
||||
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
context.startActivity(intent);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MyReposListAdapter(Context ctx, List<UserRepositories> reposListMain) {
|
||||
|
||||
this.context = ctx;
|
||||
this.reposList = reposListMain;
|
||||
reposListFull = new ArrayList<>(reposList);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyReposListAdapter.MyReposViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_repositories, parent, false);
|
||||
return new MyReposListAdapter.MyReposViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyReposListAdapter.MyReposViewHolder holder, int position) {
|
||||
|
||||
TinyDB tinyDb = TinyDB.getInstance(context);
|
||||
UserRepositories currentItem = reposList.get(position);
|
||||
int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
|
||||
|
||||
Locale locale = context.getResources().getConfiguration().locale;
|
||||
String timeFormat = tinyDb.getString("dateFormat");
|
||||
holder.userRepositories = currentItem;
|
||||
holder.orgName.setText(currentItem.getFullName().split("/")[0]);
|
||||
holder.repoName.setText(currentItem.getFullName().split("/")[1]);
|
||||
holder.repoStars.setText(currentItem.getStars_count());
|
||||
|
||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||
int color = generator.getColor(currentItem.getName());
|
||||
String firstCharacter = String.valueOf(currentItem.getFullName().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28).endConfig().buildRoundRect(firstCharacter, color, 3);
|
||||
|
||||
if(currentItem.getAvatar_url() != null) {
|
||||
if(!currentItem.getAvatar_url().equals("")) {
|
||||
PicassoService.getInstance(context).get().load(currentItem.getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)).resize(120, 120).centerCrop().into(holder.image);
|
||||
}
|
||||
else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
if(currentItem.getUpdated_at() != null) {
|
||||
|
||||
switch(timeFormat) {
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(locale);
|
||||
String createdTime = prettyTime.format(currentItem.getUpdated_at());
|
||||
holder.repoLastUpdated.setText(context.getString(R.string.lastUpdatedAt, createdTime));
|
||||
holder.repoLastUpdated.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(currentItem.getUpdated_at()), context));
|
||||
break;
|
||||
}
|
||||
case "normal": {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + context.getResources().getString(R.string.timeAtText) + "' HH:mm", locale);
|
||||
String createdTime = formatter.format(currentItem.getUpdated_at());
|
||||
holder.repoLastUpdated.setText(context.getString(R.string.lastUpdatedAt, createdTime));
|
||||
break;
|
||||
}
|
||||
case "normal1": {
|
||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + context.getResources().getString(R.string.timeAtText) + "' HH:mm", locale);
|
||||
String createdTime = formatter.format(currentItem.getUpdated_at());
|
||||
holder.repoLastUpdated.setText(context.getString(R.string.lastUpdatedAt, createdTime));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.repoLastUpdated.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!currentItem.getDescription().equals("")) {
|
||||
holder.repoDescription.setVisibility(View.VISIBLE);
|
||||
holder.repoDescription.setText(currentItem.getDescription());
|
||||
holder.spacerView.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
holder.repoDescription.setVisibility(View.GONE);
|
||||
holder.spacerView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(holder.isRepoAdmin == null) {
|
||||
holder.isRepoAdmin = new CheckBox(context);
|
||||
}
|
||||
holder.isRepoAdmin.setChecked(currentItem.getPermissions().isAdmin());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
|
||||
return reposList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
|
||||
return myReposFilter;
|
||||
}
|
||||
|
||||
private final Filter myReposFilter = new Filter() {
|
||||
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
|
||||
List<UserRepositories> filteredList = new ArrayList<>();
|
||||
|
||||
if(constraint == null || constraint.length() == 0) {
|
||||
filteredList.addAll(reposListFull);
|
||||
}
|
||||
else {
|
||||
String filterPattern = constraint.toString().toLowerCase().trim();
|
||||
|
||||
for(UserRepositories item : reposListFull) {
|
||||
if(item.getFullName().toLowerCase().contains(filterPattern) || item.getDescription().toLowerCase().contains(filterPattern)) {
|
||||
filteredList.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FilterResults results = new FilterResults();
|
||||
results.values = filteredList;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
|
||||
reposList.clear();
|
||||
reposList.addAll((List) results.values);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
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 org.mian.gitnex.helpers.TinyDB;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoStargazersAdapter extends BaseAdapter {
|
||||
|
||||
private final List<UserInfo> stargazersList;
|
||||
private final Context context;
|
||||
|
||||
private class ViewHolder {
|
||||
|
||||
private UserInfo userInfo;
|
||||
|
||||
private final ImageView memberAvatar;
|
||||
private final TextView memberName;
|
||||
|
||||
ViewHolder(View v) {
|
||||
memberAvatar = v.findViewById(R.id.memberAvatar);
|
||||
memberName = v.findViewById(R.id.memberName);
|
||||
|
||||
memberAvatar.setOnClickListener(loginId -> {
|
||||
Intent intent = new Intent(context, ProfileActivity.class);
|
||||
intent.putExtra("username", userInfo.getLogin());
|
||||
context.startActivity(intent);
|
||||
});
|
||||
|
||||
memberAvatar.setOnLongClickListener(loginId -> {
|
||||
AppUtil.copyToClipboard(context, userInfo.getLogin(), context.getString(R.string.copyLoginIdToClipBoard, userInfo.getLogin()));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public RepoStargazersAdapter(Context ctx, List<UserInfo> membersListMain) {
|
||||
this.context = ctx;
|
||||
this.stargazersList = membersListMain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return stargazersList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View getView(int position, View finalView, ViewGroup parent) {
|
||||
|
||||
RepoStargazersAdapter.ViewHolder viewHolder;
|
||||
|
||||
if (finalView == null) {
|
||||
finalView = LayoutInflater.from(context).inflate(R.layout.list_repo_stargazers, null);
|
||||
viewHolder = new ViewHolder(finalView);
|
||||
finalView.setTag(viewHolder);
|
||||
}
|
||||
else {
|
||||
viewHolder = (RepoStargazersAdapter.ViewHolder) finalView.getTag();
|
||||
}
|
||||
|
||||
initData(viewHolder, position);
|
||||
return finalView;
|
||||
|
||||
}
|
||||
|
||||
private void initData(RepoStargazersAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = stargazersList.get(position);
|
||||
viewHolder.userInfo = currentItem;
|
||||
int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
|
||||
|
||||
PicassoService.getInstance(context).get().load(currentItem.getAvatar()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)).resize(180, 180).centerCrop().into(viewHolder.memberAvatar);
|
||||
|
||||
final TinyDB tinyDb = TinyDB.getInstance(context);
|
||||
Typeface myTypeface;
|
||||
|
||||
switch(tinyDb.getInt("customFontId", -1)) {
|
||||
|
||||
case 0:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/roboto.ttf");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||
break;
|
||||
|
||||
default:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/manroperegular.ttf");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(!currentItem.getFullname().equals("")) {
|
||||
viewHolder.memberName.setText(currentItem.getFullname());
|
||||
viewHolder.memberName.setTypeface(myTypeface);
|
||||
}
|
||||
else {
|
||||
viewHolder.memberName.setText(currentItem.getLogin());
|
||||
viewHolder.memberName.setTypeface(myTypeface);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
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 org.mian.gitnex.helpers.TinyDB;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class RepoWatchersAdapter extends BaseAdapter {
|
||||
|
||||
private final List<UserInfo> watchersList;
|
||||
private final Context context;
|
||||
|
||||
private class ViewHolder {
|
||||
|
||||
private UserInfo userInfo;
|
||||
|
||||
private final ImageView memberAvatar;
|
||||
private final TextView memberName;
|
||||
|
||||
ViewHolder(View v) {
|
||||
memberAvatar = v.findViewById(R.id.memberAvatar);
|
||||
memberName = v.findViewById(R.id.memberName);
|
||||
|
||||
memberAvatar.setOnClickListener(loginId -> {
|
||||
Intent intent = new Intent(context, ProfileActivity.class);
|
||||
intent.putExtra("username", userInfo.getLogin());
|
||||
context.startActivity(intent);
|
||||
});
|
||||
|
||||
memberAvatar.setOnLongClickListener(loginId -> {
|
||||
AppUtil.copyToClipboard(context, userInfo.getLogin(), context.getString(R.string.copyLoginIdToClipBoard, userInfo.getLogin()));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public RepoWatchersAdapter(Context ctx, List<UserInfo> membersListMain) {
|
||||
this.context = ctx;
|
||||
this.watchersList = membersListMain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return watchersList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View getView(int position, View finalView, ViewGroup parent) {
|
||||
|
||||
RepoWatchersAdapter.ViewHolder viewHolder;
|
||||
|
||||
if (finalView == null) {
|
||||
finalView = LayoutInflater.from(context).inflate(R.layout.list_repo_watchers, null);
|
||||
viewHolder = new ViewHolder(finalView);
|
||||
finalView.setTag(viewHolder);
|
||||
}
|
||||
else {
|
||||
viewHolder = (RepoWatchersAdapter.ViewHolder) finalView.getTag();
|
||||
}
|
||||
|
||||
initData(viewHolder, position);
|
||||
return finalView;
|
||||
|
||||
}
|
||||
|
||||
private void initData(RepoWatchersAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = watchersList.get(position);
|
||||
viewHolder.userInfo = currentItem;
|
||||
int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
|
||||
|
||||
PicassoService.getInstance(context).get().load(currentItem.getAvatar()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)).resize(180, 180).centerCrop().into(viewHolder.memberAvatar);
|
||||
|
||||
final TinyDB tinyDb = TinyDB.getInstance(context);
|
||||
Typeface myTypeface;
|
||||
|
||||
switch(tinyDb.getInt("customFontId", -1)) {
|
||||
|
||||
case 0:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/roboto.ttf");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||
break;
|
||||
|
||||
default:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/manroperegular.ttf");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(!currentItem.getFullname().equals("")) {
|
||||
viewHolder.memberName.setText(currentItem.getFullname());
|
||||
viewHolder.memberName.setTypeface(myTypeface);
|
||||
}
|
||||
else {
|
||||
viewHolder.memberName.setText(currentItem.getLogin());
|
||||
viewHolder.memberName.setTypeface(myTypeface);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,309 +0,0 @@
|
|||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import org.gitnex.tea4j.models.UserRepositories;
|
||||
import org.gitnex.tea4j.models.WatchInfo;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||
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.RepositoriesApi;
|
||||
import org.mian.gitnex.database.models.Repository;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.ocpsoft.prettytime.PrettyTime;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposListAdapter.StarredReposViewHolder> implements Filterable {
|
||||
|
||||
private final List<UserRepositories> reposList;
|
||||
private final Context context;
|
||||
private final List<UserRepositories> reposListFull;
|
||||
|
||||
static class StarredReposViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private UserRepositories userRepositories;
|
||||
|
||||
private final ImageView image;
|
||||
private final TextView repoName;
|
||||
private final TextView orgName;
|
||||
private final TextView repoDescription;
|
||||
private CheckBox isRepoAdmin;
|
||||
private final TextView repoStars;
|
||||
private final TextView repoLastUpdated;
|
||||
private final View spacerView;
|
||||
|
||||
private StarredReposViewHolder(View itemView) {
|
||||
|
||||
super(itemView);
|
||||
repoName = itemView.findViewById(R.id.repoName);
|
||||
orgName = itemView.findViewById(R.id.orgName);
|
||||
repoDescription = itemView.findViewById(R.id.repoDescription);
|
||||
isRepoAdmin = itemView.findViewById(R.id.repoIsAdmin);
|
||||
image = itemView.findViewById(R.id.imageAvatar);
|
||||
repoStars = itemView.findViewById(R.id.repoStars);
|
||||
repoLastUpdated = itemView.findViewById(R.id.repoLastUpdated);
|
||||
spacerView = itemView.findViewById(R.id.spacerView);
|
||||
|
||||
itemView.setOnClickListener(v -> {
|
||||
|
||||
Context context = v.getContext();
|
||||
TinyDB tinyDb = TinyDB.getInstance(context);
|
||||
|
||||
Intent intent = new Intent(context, RepoDetailActivity.class);
|
||||
intent.putExtra("repoFullName", userRepositories.getFullName());
|
||||
|
||||
tinyDb.putString("repoFullName", userRepositories.getFullName());
|
||||
//tinyDb.putBoolean("resumeIssues", true);
|
||||
tinyDb.putBoolean("isRepoAdmin", isRepoAdmin.isChecked());
|
||||
tinyDb.putString("repoBranch", userRepositories.getDefault_branch());
|
||||
|
||||
if(userRepositories.getPrivateFlag()) {
|
||||
tinyDb.putString("repoType", context.getResources().getString(R.string.strPrivate));
|
||||
}
|
||||
else {
|
||||
tinyDb.putString("repoType", context.getResources().getString(R.string.strPublic));
|
||||
}
|
||||
|
||||
String[] parts = userRepositories.getFullName().split("/");
|
||||
final String repoOwner = parts[0];
|
||||
final String repoName = parts[1];
|
||||
|
||||
int currentActiveAccountId = tinyDb.getInt("currentActiveAccountId");
|
||||
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
|
||||
|
||||
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
|
||||
assert repositoryData != null;
|
||||
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
|
||||
|
||||
if(count == 0) {
|
||||
|
||||
long id = repositoryData.insertRepository(currentActiveAccountId, repoOwner, repoName);
|
||||
tinyDb.putLong("repositoryId", id);
|
||||
}
|
||||
else {
|
||||
|
||||
Repository data = repositoryData.getRepository(currentActiveAccountId, repoOwner, repoName);
|
||||
tinyDb.putLong("repositoryId", data.getRepositoryId());
|
||||
}
|
||||
|
||||
//store if user is watching this repo
|
||||
{
|
||||
|
||||
final String token = "token " + tinyDb.getString(tinyDb.getString("loginUid") + "-token");
|
||||
|
||||
WatchInfo watch = new WatchInfo();
|
||||
|
||||
Call<WatchInfo> call;
|
||||
|
||||
call = RetrofitClient.getApiInterface(context).checkRepoWatchStatus(token, repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<WatchInfo>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<WatchInfo> call, @NonNull retrofit2.Response<WatchInfo> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
assert response.body() != null;
|
||||
tinyDb.putBoolean("repoWatch", response.body().getSubscribed());
|
||||
|
||||
} else {
|
||||
|
||||
tinyDb.putBoolean("repoWatch", false);
|
||||
|
||||
if(response.code() != 404) {
|
||||
|
||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||
|
||||
tinyDb.putBoolean("repoWatch", false);
|
||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
context.startActivity(intent);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public StarredReposListAdapter(Context ctx, List<UserRepositories> reposListMain) {
|
||||
this.context = ctx;
|
||||
this.reposList = reposListMain;
|
||||
reposListFull = new ArrayList<>(reposList);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public StarredReposListAdapter.StarredReposViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_repositories, parent, false);
|
||||
return new StarredReposListAdapter.StarredReposViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull StarredReposListAdapter.StarredReposViewHolder holder, int position) {
|
||||
|
||||
TinyDB tinyDb = TinyDB.getInstance(context);
|
||||
UserRepositories currentItem = reposList.get(position);
|
||||
int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
|
||||
|
||||
Locale locale = context.getResources().getConfiguration().locale;
|
||||
String timeFormat = tinyDb.getString("dateFormat");
|
||||
holder.userRepositories = currentItem;
|
||||
holder.orgName.setText(currentItem.getFullName().split("/")[0]);
|
||||
holder.repoName.setText(currentItem.getFullName().split("/")[1]);
|
||||
holder.repoStars.setText(currentItem.getStars_count());
|
||||
|
||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||
int color = generator.getColor(currentItem.getName());
|
||||
String firstCharacter = String.valueOf(currentItem.getFullName().charAt(0));
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.useFont(Typeface.DEFAULT)
|
||||
.fontSize(18)
|
||||
.toUpperCase()
|
||||
.width(28)
|
||||
.height(28)
|
||||
.endConfig()
|
||||
.buildRoundRect(firstCharacter, color, 3);
|
||||
|
||||
if (currentItem.getAvatar_url() != null) {
|
||||
if (!currentItem.getAvatar_url().equals("")) {
|
||||
PicassoService.getInstance(context).get().load(currentItem.getAvatar_url()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)).resize(120, 120).centerCrop().into(holder.image);
|
||||
} else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.image.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
if(currentItem.getUpdated_at() != null) {
|
||||
|
||||
switch(timeFormat) {
|
||||
case "pretty": {
|
||||
PrettyTime prettyTime = new PrettyTime(locale);
|
||||
String createdTime = prettyTime.format(currentItem.getUpdated_at());
|
||||
holder.repoLastUpdated.setText(context.getString(R.string.lastUpdatedAt, createdTime));
|
||||
holder.repoLastUpdated.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(currentItem.getUpdated_at()), context));
|
||||
break;
|
||||
}
|
||||
case "normal": {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd '" + context.getResources().getString(R.string.timeAtText) + "' HH:mm", locale);
|
||||
String createdTime = formatter.format(currentItem.getUpdated_at());
|
||||
holder.repoLastUpdated.setText(context.getString(R.string.lastUpdatedAt, createdTime));
|
||||
break;
|
||||
}
|
||||
case "normal1": {
|
||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy '" + context.getResources().getString(R.string.timeAtText) + "' HH:mm", locale);
|
||||
String createdTime = formatter.format(currentItem.getUpdated_at());
|
||||
holder.repoLastUpdated.setText(context.getString(R.string.lastUpdatedAt, createdTime));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
holder.repoLastUpdated.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!currentItem.getDescription().equals("")) {
|
||||
holder.repoDescription.setVisibility(View.VISIBLE);
|
||||
holder.repoDescription.setText(currentItem.getDescription());
|
||||
holder.spacerView.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
holder.repoDescription.setVisibility(View.GONE);
|
||||
holder.spacerView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(holder.isRepoAdmin == null) {
|
||||
holder.isRepoAdmin = new CheckBox(context);
|
||||
}
|
||||
holder.isRepoAdmin.setChecked(currentItem.getPermissions().isAdmin());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return reposList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
return starredReposFilter;
|
||||
}
|
||||
|
||||
private final Filter starredReposFilter = new Filter() {
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
List<UserRepositories> filteredList = new ArrayList<>();
|
||||
|
||||
if (constraint == null || constraint.length() == 0) {
|
||||
filteredList.addAll(reposListFull);
|
||||
} else {
|
||||
String filterPattern = constraint.toString().toLowerCase().trim();
|
||||
|
||||
for (UserRepositories item : reposListFull) {
|
||||
if (item.getFullName().toLowerCase().contains(filterPattern) || item.getDescription().toLowerCase().contains(filterPattern)) {
|
||||
filteredList.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FilterResults results = new FilterResults();
|
||||
results.values = filteredList;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
reposList.clear();
|
||||
reposList.addAll((List) results.values);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package org.mian.gitnex.adapters;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
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 org.mian.gitnex.helpers.TinyDB;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class TeamMembersByOrgAdapter extends BaseAdapter {
|
||||
|
||||
private final List<UserInfo> teamMembersList;
|
||||
private final Context context;
|
||||
|
||||
private class ViewHolder {
|
||||
|
||||
private String userLoginId;
|
||||
|
||||
private final ImageView memberAvatar;
|
||||
private final TextView memberName;
|
||||
|
||||
ViewHolder(View v) {
|
||||
|
||||
memberAvatar = v.findViewById(R.id.memberAvatar);
|
||||
memberName = v.findViewById(R.id.memberName);
|
||||
|
||||
memberAvatar.setOnClickListener(loginId -> {
|
||||
Intent intent = new Intent(context, ProfileActivity.class);
|
||||
intent.putExtra("username", userLoginId);
|
||||
context.startActivity(intent);
|
||||
});
|
||||
|
||||
memberAvatar.setOnLongClickListener(loginId -> {
|
||||
AppUtil.copyToClipboard(context, userLoginId, context.getString(R.string.copyLoginIdToClipBoard, userLoginId));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public TeamMembersByOrgAdapter(Context ctx, List<UserInfo> membersListMain) {
|
||||
|
||||
this.context = ctx;
|
||||
this.teamMembersList = membersListMain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return teamMembersList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View getView(int position, View finalView, ViewGroup parent) {
|
||||
|
||||
TeamMembersByOrgAdapter.ViewHolder viewHolder = null;
|
||||
|
||||
if (finalView == null) {
|
||||
|
||||
finalView = LayoutInflater.from(context).inflate(R.layout.list_members_by_team_by_org, null);
|
||||
viewHolder = new ViewHolder(finalView);
|
||||
finalView.setTag(viewHolder);
|
||||
}
|
||||
else {
|
||||
|
||||
viewHolder = (TeamMembersByOrgAdapter.ViewHolder) finalView.getTag();
|
||||
}
|
||||
|
||||
initData(viewHolder, position);
|
||||
return finalView;
|
||||
}
|
||||
|
||||
private void initData(TeamMembersByOrgAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = teamMembersList.get(position);
|
||||
int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
|
||||
|
||||
PicassoService.getInstance(context).get().load(currentItem.getAvatar()).placeholder(R.drawable.loader_animated).transform(new RoundedTransformation(imgRadius, 0)).resize(180, 180).centerCrop().into(viewHolder.memberAvatar);
|
||||
|
||||
viewHolder.userLoginId = currentItem.getLogin();
|
||||
|
||||
final TinyDB tinyDb = TinyDB.getInstance(context);
|
||||
Typeface myTypeface;
|
||||
|
||||
switch(tinyDb.getInt("customFontId", -1)) {
|
||||
|
||||
case 0:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/roboto.ttf");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||
break;
|
||||
|
||||
default:
|
||||
myTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/manroperegular.ttf");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(!currentItem.getFullname().equals("")) {
|
||||
|
||||
viewHolder.memberName.setText(Html.fromHtml(currentItem.getFullname()));
|
||||
}
|
||||
else {
|
||||
|
||||
viewHolder.memberName.setText(currentItem.getLogin());
|
||||
}
|
||||
|
||||
viewHolder.memberName.setTypeface(myTypeface);
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class MembersByOrgAdapter extends BaseAdapter implements Filterable {
|
||||
public class UserGridAdapter extends BaseAdapter implements Filterable {
|
||||
|
||||
private final List<UserInfo> membersList;
|
||||
private final Context context;
|
||||
|
@ -40,23 +40,23 @@ public class MembersByOrgAdapter extends BaseAdapter implements Filterable {
|
|||
|
||||
ViewHolder(View v) {
|
||||
|
||||
memberAvatar = v.findViewById(R.id.memberAvatar);
|
||||
memberName = v.findViewById(R.id.memberName);
|
||||
memberAvatar = v.findViewById(R.id.userAvatarImageView);
|
||||
memberName = v.findViewById(R.id.userNameTv);
|
||||
|
||||
memberAvatar.setOnClickListener(loginId -> {
|
||||
v.setOnClickListener(loginId -> {
|
||||
Intent intent = new Intent(context, ProfileActivity.class);
|
||||
intent.putExtra("username", userLoginId);
|
||||
context.startActivity(intent);
|
||||
});
|
||||
|
||||
memberAvatar.setOnLongClickListener(loginId -> {
|
||||
v.setOnLongClickListener(loginId -> {
|
||||
AppUtil.copyToClipboard(context, userLoginId, context.getString(R.string.copyLoginIdToClipBoard, userLoginId));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public MembersByOrgAdapter(Context ctx, List<UserInfo> membersListMain) {
|
||||
public UserGridAdapter(Context ctx, List<UserInfo> membersListMain) {
|
||||
|
||||
this.context = ctx;
|
||||
this.membersList = membersListMain;
|
||||
|
@ -82,24 +82,24 @@ public class MembersByOrgAdapter extends BaseAdapter implements Filterable {
|
|||
@Override
|
||||
public View getView(int position, View finalView, ViewGroup parent) {
|
||||
|
||||
MembersByOrgAdapter.ViewHolder viewHolder = null;
|
||||
UserGridAdapter.ViewHolder viewHolder = null;
|
||||
|
||||
if (finalView == null) {
|
||||
|
||||
finalView = LayoutInflater.from(context).inflate(R.layout.list_members_by_org, null);
|
||||
finalView = LayoutInflater.from(context).inflate(R.layout.list_users_grid, null);
|
||||
viewHolder = new ViewHolder(finalView);
|
||||
finalView.setTag(viewHolder);
|
||||
}
|
||||
else {
|
||||
|
||||
viewHolder = (MembersByOrgAdapter.ViewHolder) finalView.getTag();
|
||||
viewHolder = (UserGridAdapter.ViewHolder) finalView.getTag();
|
||||
}
|
||||
|
||||
initData(viewHolder, position);
|
||||
return finalView;
|
||||
}
|
||||
|
||||
private void initData(MembersByOrgAdapter.ViewHolder viewHolder, int position) {
|
||||
private void initData(UserGridAdapter.ViewHolder viewHolder, int position) {
|
||||
|
||||
UserInfo currentItem = membersList.get(position);
|
||||
int imgRadius = AppUtil.getPixelsFromDensity(context, 3);
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class MyProfileFollowersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
public class UsersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final Context context;
|
||||
private final int TYPE_LOAD = 0;
|
||||
|
@ -31,7 +31,7 @@ public class MyProfileFollowersAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
private OnLoadMoreListener loadMoreListener;
|
||||
private boolean isLoading = false, isMoreDataAvailable = true;
|
||||
|
||||
public MyProfileFollowersAdapter(List<UserInfo> dataList, Context ctx) {
|
||||
public UsersAdapter(List<UserInfo> dataList, Context ctx) {
|
||||
this.context = ctx;
|
||||
this.followersList = dataList;
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ public class MyProfileFollowersAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
if(viewType == TYPE_LOAD) {
|
||||
return new MyProfileFollowersAdapter.FollowersHolder(inflater.inflate(R.layout.list_profile_followers_following, parent, false));
|
||||
return new UsersAdapter.UsersHolder(inflater.inflate(R.layout.list_users, parent, false));
|
||||
}
|
||||
else {
|
||||
return new MyProfileFollowersAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
|
||||
return new UsersAdapter.LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class MyProfileFollowersAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
}
|
||||
|
||||
if(getItemViewType(position) == TYPE_LOAD) {
|
||||
((MyProfileFollowersAdapter.FollowersHolder) holder).bindData(followersList.get(position));
|
||||
((UsersAdapter.UsersHolder) holder).bindData(followersList.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,13 +75,13 @@ public class MyProfileFollowersAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
return followersList.size();
|
||||
}
|
||||
|
||||
class FollowersHolder extends RecyclerView.ViewHolder {
|
||||
class UsersHolder extends RecyclerView.ViewHolder {
|
||||
private UserInfo userInfo;
|
||||
private final ImageView userAvatar;
|
||||
private final TextView userFullName;
|
||||
private final TextView userName;
|
||||
|
||||
FollowersHolder(View itemView) {
|
||||
UsersHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
userAvatar = itemView.findViewById(R.id.userAvatar);
|
|
@ -1,166 +0,0 @@
|
|||
package org.mian.gitnex.adapters.profile;
|
||||
|
||||
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 FollowersAdapter 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 FollowersAdapter(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 UsersHolder(inflater.inflate(R.layout.list_profile_followers_following, parent, false));
|
||||
}
|
||||
else {
|
||||
return new 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) {
|
||||
((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);
|
||||
Context context = itemView.getContext();
|
||||
|
||||
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);
|
||||
|
||||
//Locale locale = context.getResources().getConfiguration().locale;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
PicassoService.getInstance(context)
|
||||
.get()
|
||||
.load(userInfo.getAvatar())
|
||||
.placeholder(R.drawable.loader_animated)
|
||||
.transform(new RoundedTransformation(imgRadius, 0))
|
||||
.resize(120, 120)
|
||||
.centerCrop()
|
||||
.into(userAvatar);
|
||||
}
|
||||
}
|
||||
|
||||
static class LoadHolder extends RecyclerView.ViewHolder {
|
||||
LoadHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoreDataAvailable(boolean moreDataAvailable) {
|
||||
isMoreDataAvailable = moreDataAvailable;
|
||||
}
|
||||
|
||||
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;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
package org.mian.gitnex.adapters.profile;
|
||||
|
||||
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 FollowingAdapter 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 FollowingAdapter(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 UsersHolder(inflater.inflate(R.layout.list_profile_followers_following, parent, false));
|
||||
}
|
||||
else {
|
||||
return new 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) {
|
||||
((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);
|
||||
Context context = itemView.getContext();
|
||||
|
||||
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);
|
||||
|
||||
//Locale locale = context.getResources().getConfiguration().locale;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
PicassoService
|
||||
.getInstance(context)
|
||||
.get()
|
||||
.load(userInfo.getAvatar())
|
||||
.placeholder(R.drawable.loader_animated)
|
||||
.transform(new RoundedTransformation(imgRadius, 0))
|
||||
.resize(120, 120)
|
||||
.centerCrop()
|
||||
.into(userAvatar);
|
||||
}
|
||||
}
|
||||
|
||||
static class LoadHolder extends RecyclerView.ViewHolder {
|
||||
LoadHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoreDataAvailable(boolean moreDataAvailable) {
|
||||
isMoreDataAvailable = moreDataAvailable;
|
||||
}
|
||||
|
||||
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;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetAdminUsersBinding;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -16,7 +17,7 @@ import org.mian.gitnex.databinding.BottomSheetAdminUsersBinding;
|
|||
|
||||
public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetAdminUsersFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -34,16 +35,12 @@ public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetAdminUsersBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetAdminUsersFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||
|
|
|
@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetDraftsBinding;
|
||||
import org.mian.gitnex.helpers.Constants;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -19,7 +20,7 @@ import org.mian.gitnex.helpers.Constants;
|
|||
public class BottomSheetDraftsFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private String TAG = Constants.tagDraftsBottomSheet;
|
||||
private BottomSheetDraftsFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -37,16 +38,12 @@ public class BottomSheetDraftsFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetDraftsBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetDraftsFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
Log.e(TAG, e.toString());
|
||||
|
|
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetFileViewerBinding;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -16,7 +17,7 @@ import org.mian.gitnex.databinding.BottomSheetFileViewerBinding;
|
|||
|
||||
public class BottomSheetFileViewerFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetFileViewerFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -45,17 +46,13 @@ public class BottomSheetFileViewerFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetFileViewerBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
|
||||
bmListener = (BottomSheetFileViewerFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|||
import org.mian.gitnex.databinding.BottomSheetIssuesFilterBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -18,7 +19,7 @@ import org.mian.gitnex.helpers.Version;
|
|||
|
||||
public class BottomSheetIssuesFilterFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetIssuesFilterFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -48,19 +49,13 @@ public class BottomSheetIssuesFilterFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetIssuesFilterBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
void onButtonClicked(String text);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetIssuesFilterFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch(ClassCastException e) {
|
||||
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||
|
|
|
@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetMilestonesFilterBinding;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -17,7 +18,7 @@ import org.mian.gitnex.databinding.BottomSheetMilestonesFilterBinding;
|
|||
|
||||
public class BottomSheetMilestonesFilterFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetMilestonesFilterFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -38,19 +39,13 @@ public class BottomSheetMilestonesFilterFragment extends BottomSheetDialogFragme
|
|||
return bottomSheetMilestonesFilterBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
void onButtonClicked(String text);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetMilestonesFilterFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch(ClassCastException e) {
|
||||
Log.e("MilestonesFilterBs", e.toString());
|
||||
|
|
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetOrganizationBinding;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -16,7 +17,7 @@ import org.mian.gitnex.databinding.BottomSheetOrganizationBinding;
|
|||
|
||||
public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetOrganizationFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -51,18 +52,13 @@ public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetOrganizationBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetOrganizationFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||
|
|
|
@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetOrganizationTeamsBinding;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -17,7 +18,7 @@ import org.mian.gitnex.databinding.BottomSheetOrganizationTeamsBinding;
|
|||
|
||||
public class BottomSheetOrganizationTeamsFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetOrganizationTeamsFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -36,16 +37,12 @@ public class BottomSheetOrganizationTeamsFragment extends BottomSheetDialogFragm
|
|||
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetOrganizationTeamsFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
Log.e("BsOrganizationTeams", e.toString());
|
||||
|
|
|
@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.databinding.BottomSheetPullRequestFilterBinding;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -16,7 +17,7 @@ import org.mian.gitnex.databinding.BottomSheetPullRequestFilterBinding;
|
|||
|
||||
public class BottomSheetPullRequestFilterFragment extends BottomSheetDialogFragment {
|
||||
|
||||
private BottomSheetPullRequestFilterFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -37,19 +38,13 @@ public class BottomSheetPullRequestFilterFragment extends BottomSheetDialogFragm
|
|||
return bottomSheetPullRequestFilterBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
void onButtonClicked(String text);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetPullRequestFilterFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch(ClassCastException e) {
|
||||
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|||
import org.mian.gitnex.actions.RepositoryActions;
|
||||
import org.mian.gitnex.databinding.BottomSheetRepoBinding;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
|
@ -190,10 +191,6 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetRepoBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.mian.gitnex.helpers.AlertDialogs;
|
|||
import org.mian.gitnex.helpers.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
import org.mian.gitnex.views.ReactionSpinner;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -263,11 +264,6 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetSingleIssueBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.appcompat.content.res.AppCompatResources;
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.databinding.BottomSheetUserProfileBinding;
|
||||
import org.mian.gitnex.structs.BottomSheetListener;
|
||||
|
||||
/**
|
||||
* Template Author M M Arif
|
||||
|
@ -26,7 +27,7 @@ public class BottomSheetUserProfileFragment extends BottomSheetDialogFragment {
|
|||
this.following = following;
|
||||
}
|
||||
|
||||
private BottomSheetUserProfileFragment.BottomSheetListener bmListener;
|
||||
private BottomSheetListener bmListener;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -51,16 +52,12 @@ public class BottomSheetUserProfileFragment extends BottomSheetDialogFragment {
|
|||
return bottomSheetUserProfileBinding.getRoot();
|
||||
}
|
||||
|
||||
public interface BottomSheetListener {
|
||||
void onButtonClicked(String text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
try {
|
||||
bmListener = (BottomSheetUserProfileFragment.BottomSheetListener) context;
|
||||
bmListener = (BottomSheetListener) context;
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||
|
|
|
@ -17,14 +17,12 @@ 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.adapters.UsersAdapter;
|
||||
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;
|
||||
|
@ -42,7 +40,7 @@ public class ExploreUsersFragment extends Fragment {
|
|||
private Context context;
|
||||
|
||||
private List<UserInfo> usersList;
|
||||
private ExploreUsersAdapter adapter;
|
||||
private UsersAdapter adapter;
|
||||
private int pageSize;
|
||||
private final String TAG = Constants.exploreUsers;
|
||||
private int resultLimit;
|
||||
|
@ -56,7 +54,7 @@ public class ExploreUsersFragment extends Fragment {
|
|||
resultLimit = Constants.getCurrentResultLimit(context);
|
||||
|
||||
usersList = new ArrayList<>();
|
||||
adapter = new ExploreUsersAdapter(context, usersList);
|
||||
adapter = new UsersAdapter(usersList, context);
|
||||
|
||||
viewBinding.searchKeyword.setOnEditorActionListener((v1, actionId, event) -> {
|
||||
if(actionId == EditorInfo.IME_ACTION_SEND) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import androidx.lifecycle.Observer;
|
|||
import androidx.lifecycle.ViewModelProvider;
|
||||
import org.gitnex.tea4j.models.UserInfo;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.MembersByOrgAdapter;
|
||||
import org.mian.gitnex.adapters.UserGridAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentMembersByOrgBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
|
@ -39,7 +39,7 @@ public class MembersByOrgFragment extends Fragment {
|
|||
private TextView noDataMembers;
|
||||
private static String orgNameF = "param2";
|
||||
private String orgName;
|
||||
private MembersByOrgAdapter adapter;
|
||||
private UserGridAdapter adapter;
|
||||
private GridView mGridView;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class MembersByOrgFragment extends Fragment {
|
|||
membersModel.getMembersList(instanceToken, owner, getContext()).observe(getViewLifecycleOwner(), new Observer<List<UserInfo>>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable List<UserInfo> membersListMain) {
|
||||
adapter = new MembersByOrgAdapter(getContext(), membersListMain);
|
||||
adapter = new UserGridAdapter(getContext(), membersListMain);
|
||||
if(adapter.getCount() > 0) {
|
||||
mGridView.setAdapter(adapter);
|
||||
noDataMembers.setVisibility(View.GONE);
|
||||
|
|
|
@ -14,7 +14,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import org.gitnex.tea4j.models.UserInfo;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.MyProfileFollowersAdapter;
|
||||
import org.mian.gitnex.adapters.UsersAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentProfileFollowersFollowingBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
|
@ -36,7 +36,7 @@ public class MyProfileFollowersFragment extends Fragment {
|
|||
private Context context;
|
||||
|
||||
private List<UserInfo> dataList;
|
||||
private MyProfileFollowersAdapter adapter;
|
||||
private UsersAdapter adapter;
|
||||
private int pageSize;
|
||||
private final String TAG = Constants.tagFollowers;
|
||||
private int resultLimit;
|
||||
|
@ -49,7 +49,7 @@ public class MyProfileFollowersFragment extends Fragment {
|
|||
context = getContext();
|
||||
|
||||
dataList = new ArrayList<>();
|
||||
adapter = new MyProfileFollowersAdapter(dataList, context);
|
||||
adapter = new UsersAdapter(dataList, context);
|
||||
resultLimit = Constants.getCurrentResultLimit(context);
|
||||
|
||||
viewBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
|
|
@ -14,7 +14,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import org.gitnex.tea4j.models.UserInfo;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.MyProfileFollowingAdapter;
|
||||
import org.mian.gitnex.adapters.UsersAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentProfileFollowersFollowingBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
|
@ -36,7 +36,7 @@ public class MyProfileFollowingFragment extends Fragment {
|
|||
private Context context;
|
||||
|
||||
private List<UserInfo> dataList;
|
||||
private MyProfileFollowingAdapter adapter;
|
||||
private UsersAdapter adapter;
|
||||
private int pageSize;
|
||||
private final String TAG = Constants.tagFollowing;
|
||||
private int resultLimit;
|
||||
|
@ -48,7 +48,7 @@ public class MyProfileFollowingFragment extends Fragment {
|
|||
context = getContext();
|
||||
|
||||
dataList = new ArrayList<>();
|
||||
adapter = new MyProfileFollowingAdapter(dataList, context);
|
||||
adapter = new UsersAdapter(dataList, context);
|
||||
resultLimit = Constants.getCurrentResultLimit(context);
|
||||
|
||||
viewBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.android.material.floatingactionbutton.ExtendedFloatingActionBu
|
|||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.MyReposListAdapter;
|
||||
import org.mian.gitnex.adapters.ReposListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentMyRepositoriesBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
|
@ -41,7 +41,7 @@ public class MyRepositoriesFragment extends Fragment {
|
|||
private static final String ARG_PARAM2 = "param2";
|
||||
private ProgressBar mProgressBar;
|
||||
private RecyclerView mRecyclerView;
|
||||
private MyReposListAdapter adapter;
|
||||
private ReposListAdapter adapter;
|
||||
private ExtendedFloatingActionButton createNewRepo;
|
||||
private TextView noDataMyRepo;
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class MyRepositoriesFragment extends Fragment {
|
|||
myRepoModel.getCurrentUserRepositories(instanceToken, userLogin, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(),
|
||||
myReposListMain -> {
|
||||
|
||||
adapter = new MyReposListAdapter(getContext(), myReposListMain);
|
||||
adapter = new ReposListAdapter(getContext(), myReposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataMyRepo.setVisibility(View.GONE);
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.android.material.floatingactionbutton.ExtendedFloatingActionBu
|
|||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.StarredReposListAdapter;
|
||||
import org.mian.gitnex.adapters.ReposListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentStarredRepositoriesBinding;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.TinyDB;
|
||||
|
@ -41,7 +41,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
|||
private static final String ARG_PARAM2 = "param2";
|
||||
private ProgressBar mProgressBar;
|
||||
private RecyclerView mRecyclerView;
|
||||
private StarredReposListAdapter adapter;
|
||||
private ReposListAdapter adapter;
|
||||
private ExtendedFloatingActionButton createNewRepo;
|
||||
private TextView noData;
|
||||
private int pageSize = 1;
|
||||
|
@ -149,7 +149,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
|||
starredRepoModel.getUserStarredRepositories(instanceToken, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(),
|
||||
starredReposListMain -> {
|
||||
|
||||
adapter = new StarredReposListAdapter(getContext(), starredReposListMain);
|
||||
adapter = new ReposListAdapter(getContext(), starredReposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.GONE);
|
||||
|
|
|
@ -18,7 +18,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import org.gitnex.tea4j.models.UserInfo;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.profile.FollowersAdapter;
|
||||
import org.mian.gitnex.adapters.UsersAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentProfileFollowersFollowingBinding;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
|
@ -42,7 +42,7 @@ public class FollowersFragment extends Fragment {
|
|||
private FragmentProfileFollowersFollowingBinding fragmentProfileFollowersFollowingBinding;
|
||||
|
||||
private List<UserInfo> usersList;
|
||||
private FollowersAdapter adapter;
|
||||
private UsersAdapter adapter;
|
||||
|
||||
private int pageSize;
|
||||
private int resultLimit;
|
||||
|
@ -85,7 +85,7 @@ public class FollowersFragment extends Fragment {
|
|||
adapter.notifyDataChanged();
|
||||
}, 200));
|
||||
|
||||
adapter = new FollowersAdapter(context, usersList);
|
||||
adapter = new UsersAdapter(usersList, context);
|
||||
adapter.setLoadMoreListener(() -> fragmentProfileFollowersFollowingBinding.recyclerView.post(() -> {
|
||||
if(usersList.size() == resultLimit || pageSize == resultLimit) {
|
||||
int page = (usersList.size() + resultLimit) / resultLimit;
|
||||
|
|
|
@ -18,7 +18,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import org.gitnex.tea4j.models.UserInfo;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.profile.FollowingAdapter;
|
||||
import org.mian.gitnex.adapters.UsersAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.FragmentProfileFollowersFollowingBinding;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
|
@ -42,7 +42,7 @@ public class FollowingFragment extends Fragment {
|
|||
private FragmentProfileFollowersFollowingBinding fragmentProfileFollowersFollowingBinding;
|
||||
|
||||
private List<UserInfo> usersList;
|
||||
private FollowingAdapter adapter;
|
||||
private UsersAdapter adapter;
|
||||
|
||||
private int pageSize;
|
||||
private int resultLimit;
|
||||
|
@ -85,7 +85,7 @@ public class FollowingFragment extends Fragment {
|
|||
adapter.notifyDataChanged();
|
||||
}, 200));
|
||||
|
||||
adapter = new FollowingAdapter(context, usersList);
|
||||
adapter = new UsersAdapter(usersList, context);
|
||||
adapter.setLoadMoreListener(() -> fragmentProfileFollowersFollowingBinding.recyclerView.post(() -> {
|
||||
if(usersList.size() == resultLimit || pageSize == resultLimit) {
|
||||
int page = (usersList.size() + resultLimit) / resultLimit;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package org.mian.gitnex.structs;
|
||||
|
||||
public interface BottomSheetListener {
|
||||
void onButtonClicked(String text);
|
||||
}
|
|
@ -47,6 +47,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<GridView
|
||||
android:padding="10dp"
|
||||
android:id="@+id/gridView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<GridView
|
||||
android:padding="10dp"
|
||||
android:id="@+id/gridView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/gridViewData"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/memberAvatar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="110dp"
|
||||
android:contentDescription="@string/orgMember"
|
||||
android:src="@drawable/ic_person" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/memberName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:layout_marginTop="1dp"
|
||||
android:text="@string/orgMember"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,41 +0,0 @@
|
|||
<?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>
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/gridViewData"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/memberAvatar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="110dp"
|
||||
android:contentDescription="@string/starMember"
|
||||
android:src="@drawable/ic_person" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/memberName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:layout_marginTop="1dp"
|
||||
android:text="@string/starMember"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/gridViewData"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/memberAvatar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="110dp"
|
||||
android:contentDescription="@string/watcherMember"
|
||||
android:src="@drawable/ic_person" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/memberName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:layout_marginTop="1dp"
|
||||
android:text="@string/watcherMember"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -8,19 +8,19 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/memberAvatar"
|
||||
android:id="@+id/userAvatarImageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="110dp"
|
||||
android:contentDescription="@string/orgMember"
|
||||
android:contentDescription="@string/userAvatar"
|
||||
android:src="@drawable/ic_person" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/memberName"
|
||||
android:id="@+id/userNameTv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:layout_marginTop="1dp"
|
||||
android:text="@string/orgMember"
|
||||
android:text="@string/userName"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
|
@ -769,4 +769,5 @@
|
|||
<string name="updateStrategyMerge">Merge</string>
|
||||
<string name="updateStrategyRebase">Rebase</string>
|
||||
<string name="selectUpdateStrategy">Select Update Strategy</string>
|
||||
<string name="userAvatar">Avatar</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue