mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-11-12 14:39:35 -06:00
Move starred repos and clean ups
This commit is contained in:
@@ -37,7 +37,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class ReposListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements Filterable {
|
||||
@@ -217,7 +217,6 @@ public class ReposListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
||||
isRepoAdmin = new CheckBox(context);
|
||||
}
|
||||
isRepoAdmin.setChecked(repositories.getPermissions().isAdmin());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,154 +226,6 @@ public class ReposListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
||||
}
|
||||
}
|
||||
|
||||
/*static class ReposViewHolder 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 ReposViewHolder(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();
|
||||
RepositoryContext repo = new RepositoryContext(userRepositories, context);
|
||||
Intent intent = repo.getIntent(context, RepoDetailActivity.class);
|
||||
|
||||
int currentActiveAccountId = TinyDB.getInstance(context).getInt("currentActiveAccountId");
|
||||
RepositoriesApi repositoryData = BaseApi.getInstance(context, RepositoriesApi.class);
|
||||
|
||||
assert repositoryData != null;
|
||||
Integer count = repositoryData.checkRepository(currentActiveAccountId, repo.getOwner(), repo.getName());
|
||||
|
||||
if(count == 0) {
|
||||
long id = repositoryData.insertRepository(currentActiveAccountId, repo.getOwner(), repo.getName());
|
||||
repo.setRepositoryId((int) id);
|
||||
}
|
||||
else {
|
||||
Repository data = repositoryData.getRepository(currentActiveAccountId, repo.getOwner(), repo.getName());
|
||||
repo.setRepositoryId(data.getRepositoryId());
|
||||
}
|
||||
|
||||
context.startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
/*public ReposListAdapter(Context ctx, List<UserRepositories> reposListMain) {
|
||||
|
||||
this.context = ctx;
|
||||
this.reposList = reposListMain;
|
||||
reposListFull = new ArrayList<>(reposList);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ReposViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_repositories, parent, false);
|
||||
return new ReposViewHolder(v);
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public void onBindViewHolder(@NonNull ReposViewHolder 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", "pretty");
|
||||
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();
|
||||
}*/
|
||||
|
||||
public void setMoreDataAvailable(boolean moreDataAvailable) {
|
||||
isMoreDataAvailable = moreDataAvailable;
|
||||
if(!isMoreDataAvailable) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -12,31 +11,102 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.BaseActivity;
|
||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.ReposListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentMyRepositoriesBinding;
|
||||
import org.mian.gitnex.viewmodels.MyRepositoriesViewModel;
|
||||
import org.mian.gitnex.databinding.FragmentRepositoriesBinding;
|
||||
import org.mian.gitnex.helpers.Constants;
|
||||
import org.mian.gitnex.viewmodels.RepositoriesViewModel;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class MyRepositoriesFragment extends Fragment {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private FragmentRepositoriesBinding fragmentRepositoriesBinding;
|
||||
private ReposListAdapter adapter;
|
||||
private int page = 1;
|
||||
private final int resultLimit = Constants.resultLimitOldGiteaInstances;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
fragmentRepositoriesBinding = FragmentRepositoriesBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navMyRepos));
|
||||
final String userLogin = ((BaseActivity) requireActivity()).getAccount().getAccount().getUserName();
|
||||
|
||||
fragmentRepositoriesBinding.addNewRepo.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
fragmentRepositoriesBinding.recyclerView.setHasFixedSize(true);
|
||||
fragmentRepositoriesBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(fragmentRepositoriesBinding.recyclerView.getContext(),
|
||||
DividerItemDecoration.VERTICAL);
|
||||
fragmentRepositoriesBinding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
fragmentRepositoriesBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
fragmentRepositoriesBinding.pullToRefresh.setRefreshing(false);
|
||||
fetchDataAsync(((BaseActivity) requireActivity()).getAccount().getAuthorization(), userLogin);
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.VISIBLE);
|
||||
}, 50));
|
||||
|
||||
fetchDataAsync(((BaseActivity) requireActivity()).getAccount().getAuthorization(), userLogin);
|
||||
|
||||
return fragmentRepositoriesBinding.getRoot();
|
||||
};
|
||||
|
||||
private void fetchDataAsync(String instanceToken, String userLogin) {
|
||||
|
||||
RepositoriesViewModel reposModel = new ViewModelProvider(this).get(RepositoriesViewModel.class);
|
||||
|
||||
reposModel.getRepositories(instanceToken, page, resultLimit, userLogin, "myRepos", getContext()).observe(getViewLifecycleOwner(), reposListMain -> {
|
||||
|
||||
adapter = new ReposListAdapter(reposListMain, getContext());
|
||||
adapter.setLoadMoreListener(new ReposListAdapter.OnLoadMoreListener() {
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
|
||||
page += 1;
|
||||
RepositoriesViewModel.loadMoreRepos(instanceToken, page, resultLimit, userLogin, "myRepos", getContext(), adapter);
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished() {
|
||||
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
if(adapter.getItemCount() > 0) {
|
||||
fragmentRepositoriesBinding.recyclerView.setAdapter(adapter);
|
||||
fragmentRepositoriesBinding.noData.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataChanged();
|
||||
fragmentRepositoriesBinding.recyclerView.setAdapter(adapter);
|
||||
fragmentRepositoriesBinding.noData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/*private ProgressBar mProgressBar;
|
||||
private RecyclerView mRecyclerView;
|
||||
private ReposListAdapter adapter;
|
||||
private ExtendedFloatingActionButton createNewRepo;
|
||||
@@ -144,7 +214,7 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
@@ -164,7 +234,7 @@ public class MyRepositoriesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
if(fragmentRepositoriesBinding.recyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.mian.gitnex.helpers.Constants;
|
||||
import org.mian.gitnex.viewmodels.RepositoriesViewModel;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class RepositoriesFragment extends Fragment {
|
||||
@@ -34,7 +34,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
private FragmentRepositoriesBinding fragmentRepositoriesBinding;
|
||||
private ReposListAdapter adapter;
|
||||
private int page = 1;
|
||||
private int resultLimit = Constants.resultLimitOldGiteaInstances;
|
||||
private final int resultLimit = Constants.resultLimitOldGiteaInstances;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
@@ -44,11 +44,6 @@ public class RepositoriesFragment extends Fragment {
|
||||
setHasOptionsMenu(true);
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navRepos));
|
||||
|
||||
// if gitea is 1.12 or higher use the new limit
|
||||
if(((BaseActivity) requireActivity()).getAccount().requiresVersion("1.12.0")) {
|
||||
resultLimit = Constants.resultLimitNewGiteaInstances;
|
||||
}
|
||||
|
||||
fragmentRepositoriesBinding.addNewRepo.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||
startActivity(intent);
|
||||
@@ -76,7 +71,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
|
||||
RepositoriesViewModel reposModel = new ViewModelProvider(this).get(RepositoriesViewModel.class);
|
||||
|
||||
reposModel.getRepositories(instanceToken, page, resultLimit, getContext()).observe(getViewLifecycleOwner(), reposListMain -> {
|
||||
reposModel.getRepositories(instanceToken, page, resultLimit, "", "repos", getContext()).observe(getViewLifecycleOwner(), reposListMain -> {
|
||||
|
||||
adapter = new ReposListAdapter(reposListMain, getContext());
|
||||
adapter.setLoadMoreListener(new ReposListAdapter.OnLoadMoreListener() {
|
||||
@@ -85,7 +80,7 @@ public class RepositoriesFragment extends Fragment {
|
||||
public void onLoadMore() {
|
||||
|
||||
page += 1;
|
||||
RepositoriesViewModel.loadMoreRepos(instanceToken, page, resultLimit, getContext(), adapter);
|
||||
RepositoriesViewModel.loadMoreRepos(instanceToken, page, resultLimit, "", "repos", getContext(), adapter);
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -110,102 +105,16 @@ public class RepositoriesFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
/*private ProgressBar mProgressBar;
|
||||
private RecyclerView mRecyclerView;
|
||||
private ReposListAdapter adapter;
|
||||
private ExtendedFloatingActionButton createNewRepo;
|
||||
private TextView noDataRepo;
|
||||
private final int pageSize = 1;
|
||||
private final int resultLimit = 50;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
FragmentRepositoriesBinding fragmentRepositoriesBinding = FragmentRepositoriesBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentRepositoriesBinding.pullToRefresh;
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navRepos));
|
||||
|
||||
noDataRepo = fragmentRepositoriesBinding.noData;
|
||||
mProgressBar = fragmentRepositoriesBinding.progressBar;
|
||||
mRecyclerView = fragmentRepositoriesBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
createNewRepo = fragmentRepositoriesBinding.addNewRepo;
|
||||
|
||||
createNewRepo.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy > 0 && createNewRepo.isShown()) {
|
||||
createNewRepo.setVisibility(View.GONE);
|
||||
}
|
||||
else if (dy < 0 ) {
|
||||
createNewRepo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
}
|
||||
});
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
swipeRefresh.setRefreshing(false);
|
||||
RepositoriesListViewModel.loadReposList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), getContext(), pageSize, resultLimit);
|
||||
|
||||
}, 50));
|
||||
|
||||
fetchDataAsync(((BaseActivity) requireActivity()).getAccount().getAuthorization(), pageSize, resultLimit);
|
||||
return fragmentRepositoriesBinding.getRoot();
|
||||
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if(MainActivity.repoCreated) {
|
||||
RepositoriesViewModel.loadReposList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), page, resultLimit, getContext());
|
||||
RepositoriesViewModel.loadReposList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), page, resultLimit, "", "repos", getContext());
|
||||
MainActivity.repoCreated = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*private void fetchDataAsync(String instanceToken, int pageSize, int resultLimit) {
|
||||
|
||||
RepositoriesListViewModel repoModel = new ViewModelProvider(this).get(RepositoriesListViewModel.class);
|
||||
|
||||
repoModel.getUserRepositories(instanceToken, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(),
|
||||
reposListMain -> {
|
||||
|
||||
adapter = new ReposListAdapter(getContext(), reposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataRepo.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noDataRepo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
});
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
@@ -231,5 +140,4 @@ public class RepositoriesFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -12,119 +11,101 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.BaseActivity;
|
||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||
import org.mian.gitnex.activities.MainActivity;
|
||||
import org.mian.gitnex.adapters.ReposListAdapter;
|
||||
import org.mian.gitnex.databinding.FragmentStarredRepositoriesBinding;
|
||||
import org.mian.gitnex.viewmodels.StarredRepositoriesViewModel;
|
||||
import org.mian.gitnex.databinding.FragmentRepositoriesBinding;
|
||||
import org.mian.gitnex.helpers.Constants;
|
||||
import org.mian.gitnex.viewmodels.RepositoriesViewModel;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class StarredRepositoriesFragment extends Fragment {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private RecyclerView mRecyclerView;
|
||||
private ReposListAdapter adapter;
|
||||
private ExtendedFloatingActionButton createNewRepo;
|
||||
private TextView noData;
|
||||
private int pageSize = 1;
|
||||
private int resultLimit = 50;
|
||||
private FragmentRepositoriesBinding fragmentRepositoriesBinding;
|
||||
private ReposListAdapter adapter;
|
||||
private int page = 1;
|
||||
private final int resultLimit = Constants.resultLimitOldGiteaInstances;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
fragmentRepositoriesBinding = FragmentRepositoriesBinding.inflate(inflater, container, false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navStarredRepos));
|
||||
|
||||
fragmentRepositoriesBinding.addNewRepo.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
fragmentRepositoriesBinding.recyclerView.setHasFixedSize(true);
|
||||
fragmentRepositoriesBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(fragmentRepositoriesBinding.recyclerView.getContext(),
|
||||
DividerItemDecoration.VERTICAL);
|
||||
fragmentRepositoriesBinding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
fragmentRepositoriesBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
fragmentRepositoriesBinding.pullToRefresh.setRefreshing(false);
|
||||
fetchDataAsync(((BaseActivity) requireActivity()).getAccount().getAuthorization());
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.VISIBLE);
|
||||
}, 50));
|
||||
|
||||
fetchDataAsync(((BaseActivity) requireActivity()).getAccount().getAuthorization());
|
||||
|
||||
return fragmentRepositoriesBinding.getRoot();
|
||||
};
|
||||
|
||||
private void fetchDataAsync(String instanceToken) {
|
||||
|
||||
RepositoriesViewModel reposModel = new ViewModelProvider(this).get(RepositoriesViewModel.class);
|
||||
|
||||
reposModel.getRepositories(instanceToken, page, resultLimit, "", "starredRepos", getContext()).observe(getViewLifecycleOwner(), reposListMain -> {
|
||||
|
||||
adapter = new ReposListAdapter(reposListMain, getContext());
|
||||
adapter.setLoadMoreListener(new ReposListAdapter.OnLoadMoreListener() {
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
|
||||
page += 1;
|
||||
RepositoriesViewModel.loadMoreRepos(instanceToken, page, resultLimit, "", "starredRepos", getContext(), adapter);
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished() {
|
||||
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
if(adapter.getItemCount() > 0) {
|
||||
fragmentRepositoriesBinding.recyclerView.setAdapter(adapter);
|
||||
fragmentRepositoriesBinding.noData.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataChanged();
|
||||
fragmentRepositoriesBinding.recyclerView.setAdapter(adapter);
|
||||
fragmentRepositoriesBinding.noData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
fragmentRepositoriesBinding.progressBar.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
FragmentStarredRepositoriesBinding fragmentStarredRepositoriesBinding = FragmentStarredRepositoriesBinding.inflate(inflater, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
final SwipeRefreshLayout swipeRefresh = fragmentStarredRepositoriesBinding.pullToRefresh;
|
||||
|
||||
((MainActivity) requireActivity()).setActionBarTitle(getResources().getString(R.string.navStarredRepos));
|
||||
|
||||
noData = fragmentStarredRepositoriesBinding.noData;
|
||||
mProgressBar = fragmentStarredRepositoriesBinding.progressBar;
|
||||
mRecyclerView = fragmentStarredRepositoriesBinding.recyclerView;
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
|
||||
DividerItemDecoration.VERTICAL);
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
createNewRepo = fragmentStarredRepositoriesBinding.addNewRepo;
|
||||
|
||||
createNewRepo.setOnClickListener(view -> {
|
||||
|
||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy > 0 && createNewRepo.isShown()) {
|
||||
createNewRepo.setVisibility(View.GONE);
|
||||
} else if (dy < 0 ) {
|
||||
createNewRepo.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
}
|
||||
});
|
||||
|
||||
swipeRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
swipeRefresh.setRefreshing(false);
|
||||
StarredRepositoriesViewModel.loadStarredReposList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), getContext(), pageSize, resultLimit);
|
||||
|
||||
}, 50));
|
||||
|
||||
//fetchDataAsync(((BaseActivity) requireActivity()).getAccount().getAuthorization(), pageSize, resultLimit);
|
||||
|
||||
return fragmentStarredRepositoriesBinding.getRoot();
|
||||
}
|
||||
|
||||
/*private void fetchDataAsync(String instanceToken, int pageSize, int resultLimit) {
|
||||
|
||||
StarredRepositoriesViewModel starredRepoModel = new ViewModelProvider(this).get(StarredRepositoriesViewModel.class);
|
||||
|
||||
starredRepoModel.getUserStarredRepositories(instanceToken, getContext(), pageSize, resultLimit).observe(getViewLifecycleOwner(),
|
||||
starredReposListMain -> {
|
||||
|
||||
adapter = new ReposListAdapter(getContext(), starredReposListMain);
|
||||
if(adapter.getItemCount() > 0) {
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
adapter.notifyDataSetChanged();
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
noData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
|
||||
inflater.inflate(R.menu.search_menu, menu);
|
||||
@@ -142,21 +123,21 @@ public class StarredRepositoriesFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if(mRecyclerView.getAdapter() != null) {
|
||||
if(fragmentRepositoriesBinding.recyclerView.getAdapter() != null) {
|
||||
adapter.getFilter().filter(newText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if(MainActivity.repoCreated) {
|
||||
StarredRepositoriesViewModel.loadStarredReposList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), getContext(), pageSize, resultLimit);
|
||||
RepositoriesViewModel.loadReposList(((BaseActivity) requireActivity()).getAccount().getAuthorization(), page, resultLimit, "", "starredRepos", getContext());
|
||||
MainActivity.repoCreated = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
package org.mian.gitnex.viewmodels;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import org.gitnex.tea4j.models.UserRepositories;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class MyRepositoriesViewModel extends ViewModel {
|
||||
|
||||
private static MutableLiveData<List<UserRepositories>> myReposList;
|
||||
|
||||
public LiveData<List<UserRepositories>> getCurrentUserRepositories(String token, String username, Context ctx, int page, int limit) {
|
||||
|
||||
//if (myReposList == null) {
|
||||
myReposList = new MutableLiveData<>();
|
||||
loadMyReposList(token, username, ctx, page, limit);
|
||||
//}
|
||||
|
||||
return myReposList;
|
||||
}
|
||||
|
||||
public static void loadMyReposList(String token, String username, Context ctx, int page, int limit) {
|
||||
|
||||
Call<List<UserRepositories>> call = RetrofitClient
|
||||
.getApiInterface(ctx)
|
||||
.getCurrentUserRepositories(token, username, page, limit);
|
||||
|
||||
call.enqueue(new Callback<List<UserRepositories>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<UserRepositories>> call, @NonNull Response<List<UserRepositories>> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
myReposList.postValue(response.body());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,9 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import org.gitnex.tea4j.models.Releases;
|
||||
import org.gitnex.tea4j.models.UserRepositories;
|
||||
import org.mian.gitnex.adapters.ReleasesAdapter;
|
||||
import org.mian.gitnex.adapters.ReposListAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import java.util.List;
|
||||
@@ -17,26 +15,34 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class RepositoriesViewModel extends ViewModel {
|
||||
|
||||
private static MutableLiveData<List<UserRepositories>> reposList;
|
||||
|
||||
public LiveData<List<UserRepositories>> getRepositories(String token, int page, int resultLimit, Context ctx) {
|
||||
public LiveData<List<UserRepositories>> getRepositories(String token, int page, int resultLimit, String userLogin, String type, Context ctx) {
|
||||
|
||||
reposList = new MutableLiveData<>();
|
||||
loadReposList(token, page, resultLimit, ctx);
|
||||
loadReposList(token, page, resultLimit, userLogin, type, ctx);
|
||||
|
||||
return reposList;
|
||||
}
|
||||
|
||||
public static void loadReposList(String token, int page, int resultLimit, Context ctx) {
|
||||
public static void loadReposList(String token, int page, int resultLimit, String userLogin, String type, Context ctx) {
|
||||
|
||||
Call<List<UserRepositories>> call = RetrofitClient
|
||||
.getApiInterface(ctx)
|
||||
.getUserRepositories(token, page, resultLimit);
|
||||
Call<List<UserRepositories>> call;
|
||||
|
||||
if(type.equals("starredRepos")) {
|
||||
call = RetrofitClient.getApiInterface(ctx).getUserStarredRepos(token, page, resultLimit);
|
||||
}
|
||||
else if(type.equals("myRepos")) {
|
||||
call = RetrofitClient.getApiInterface(ctx).getCurrentUserRepositories(token, userLogin, page, resultLimit);
|
||||
}
|
||||
else {
|
||||
call = RetrofitClient.getApiInterface(ctx).getUserRepositories(token, page, resultLimit);
|
||||
}
|
||||
|
||||
call.enqueue(new Callback<List<UserRepositories>>() {
|
||||
|
||||
@@ -51,16 +57,26 @@ public class RepositoriesViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public static void loadMoreRepos(String token, int page, int resultLimit, Context ctx, ReposListAdapter adapter) {
|
||||
public static void loadMoreRepos(String token, int page, int resultLimit, String userLogin, String type, Context ctx, ReposListAdapter adapter) {
|
||||
|
||||
Call<List<UserRepositories>> call = RetrofitClient.getApiInterface(ctx).getUserRepositories(token, page, resultLimit);
|
||||
Call<List<UserRepositories>> call;
|
||||
|
||||
if(type.equals("starredRepos")) {
|
||||
call = RetrofitClient.getApiInterface(ctx).getUserStarredRepos(token, page, resultLimit);
|
||||
}
|
||||
else if(type.equals("myRepos")) {
|
||||
call = RetrofitClient.getApiInterface(ctx).getCurrentUserRepositories(token, userLogin, page, resultLimit);
|
||||
}
|
||||
else {
|
||||
call = RetrofitClient.getApiInterface(ctx).getUserRepositories(token, page, resultLimit);
|
||||
}
|
||||
|
||||
call.enqueue(new Callback<List<UserRepositories>>() {
|
||||
|
||||
@@ -81,41 +97,15 @@ public class RepositoriesViewModel extends ViewModel {
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.i("onResponse", String.valueOf(response.code()));
|
||||
Log.e("onResponse", String.valueOf(response.code()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
||||
|
||||
Log.i("onFailure", t.toString());
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*public static void loadReposList(String token, Context ctx, int page, int limit) {
|
||||
|
||||
Call<List<UserRepositories>> call = RetrofitClient
|
||||
.getApiInterface(ctx)
|
||||
.getUserRepositories(token, page, limit);
|
||||
|
||||
call.enqueue(new Callback<List<UserRepositories>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<UserRepositories>> call, @NonNull Response<List<UserRepositories>> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
reposList.postValue(response.body());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
package org.mian.gitnex.viewmodels;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import org.gitnex.tea4j.models.UserRepositories;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class StarredRepositoriesViewModel extends ViewModel {
|
||||
|
||||
private static MutableLiveData<List<UserRepositories>> reposList;
|
||||
|
||||
public LiveData<List<UserRepositories>> getUserStarredRepositories(String token, Context ctx, int page, int limit) {
|
||||
|
||||
reposList = new MutableLiveData<>();
|
||||
loadStarredReposList(token, ctx, page, limit);
|
||||
|
||||
return reposList;
|
||||
}
|
||||
|
||||
public static void loadStarredReposList(String token, Context ctx, int page, int limit) {
|
||||
|
||||
Call<List<UserRepositories>> call = RetrofitClient
|
||||
.getApiInterface(ctx)
|
||||
.getUserStarredRepos(token, page, limit);
|
||||
|
||||
call.enqueue(new Callback<List<UserRepositories>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<UserRepositories>> call, @NonNull Response<List<UserRepositories>> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
reposList.postValue(response.body());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".activities.MainActivity">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/pullToRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
|
||||
app:indicatorColor="?attr/progressIndicatorColor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/noDataMyRepo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp"
|
||||
android:text="@string/noData"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/addNewRepo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/pageTitleNewRepo"
|
||||
android:contentDescription="@string/pageTitleNewRepo"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
|
||||
app:iconTint="@color/colorWhite"
|
||||
app:icon="@drawable/ic_add" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".activities.MainActivity">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/pullToRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
|
||||
app:indicatorColor="?attr/progressIndicatorColor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/noData"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/noData"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/addNewRepo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/pageTitleNewRepo"
|
||||
android:contentDescription="@string/pageTitleNewRepo"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
|
||||
app:iconTint="@color/colorWhite"
|
||||
app:icon="@drawable/ic_add" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
Reference in New Issue
Block a user