mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2026-01-25 14:47:05 +00:00
this commit updates some layouts text size, fixes repo language color in pinnedRepos, and updates supportLibs to 26 to target 26
This commit is contained in:
parent
dbb1d639a7
commit
fcb2e556b6
@ -22,7 +22,7 @@ android {
|
||||
storePassword((buildProperties.secrets['android_store_password'] | buildProperties.notThere['android_store_password']).string)
|
||||
}
|
||||
}
|
||||
compileSdkVersion 25
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion "26.0.0"
|
||||
defaultConfig {
|
||||
applicationId "com.fastaccess.github"
|
||||
|
||||
@ -20,13 +20,6 @@ public class OnLoadMore<P> extends InfiniteScroll {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
@Override protected void onLoadMore(int page, int previousTotal) {
|
||||
super.onLoadMore(page, previousTotal);
|
||||
if (presenter != null) {
|
||||
presenter.setPreviousTotal(previousTotal);
|
||||
presenter.onCallApi(page + 1, parameter);
|
||||
}
|
||||
}
|
||||
|
||||
public void setParameter(@Nullable P parameter) {
|
||||
this.parameter = parameter;
|
||||
@ -35,4 +28,11 @@ public class OnLoadMore<P> extends InfiniteScroll {
|
||||
@Nullable public P getParameter() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
@Override public void onLoadMore(int page, int totalItemsCount) {
|
||||
if (presenter != null) {
|
||||
presenter.setPreviousTotal(totalItemsCount);
|
||||
presenter.onCallApi(page + 1, parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,11 +11,11 @@ import com.fastaccess.data.dao.model.PinnedRepos;
|
||||
import com.fastaccess.data.dao.model.Repo;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.ParseDateFormat;
|
||||
import com.fastaccess.provider.colors.ColorsProvider;
|
||||
import com.fastaccess.ui.widgets.AvatarLayout;
|
||||
import com.fastaccess.ui.widgets.FontTextView;
|
||||
import com.fastaccess.ui.widgets.LabelSpan;
|
||||
import com.fastaccess.ui.widgets.SpannableBuilder;
|
||||
import com.fastaccess.ui.widgets.color.ColorGenerator;
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter;
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder;
|
||||
|
||||
@ -79,7 +79,7 @@ public class PinnedReposViewHolder extends BaseViewHolder<PinnedRepos> {
|
||||
date.setText(ParseDateFormat.getTimeAgo(repo.getUpdatedAt()));
|
||||
if (!InputHelper.isEmpty(repo.getLanguage())) {
|
||||
language.setText(repo.getLanguage());
|
||||
language.setTextColor(ColorGenerator.getColor(itemView.getContext(), repo.getLanguage()));
|
||||
language.setTextColor(ColorsProvider.getColorAsColor(repo.getLanguage(), language.getContext()));
|
||||
language.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,9 +29,9 @@ import java.util.*
|
||||
|
||||
open class ProfileEventsFragment : BaseFragment<ProfileEventsMvp.View, ProfileEventsPresenter>(), ProfileEventsMvp.View {
|
||||
|
||||
val recycler: DynamicRecyclerView by lazy { view!!.findViewById(R.id.recycler) as DynamicRecyclerView }
|
||||
val refresh: SwipeRefreshLayout by lazy { view!!.findViewById(R.id.refresh) as SwipeRefreshLayout }
|
||||
val stateLayout: StateLayout by lazy { view!!.findViewById(R.id.stateLayout) as StateLayout }
|
||||
val recycler: DynamicRecyclerView by lazy { view!!.findViewById<DynamicRecyclerView>(R.id.recycler) }
|
||||
val refresh: SwipeRefreshLayout by lazy { view!!.findViewById<SwipeRefreshLayout>(R.id.refresh) }
|
||||
val stateLayout: StateLayout by lazy { view!!.findViewById<StateLayout>(R.id.stateLayout) }
|
||||
|
||||
val adapter by lazy { FeedsAdapter(presenter.getEvents(), true) }
|
||||
private var onLoadMore: OnLoadMore<String>? = null
|
||||
|
||||
@ -189,7 +189,7 @@ public class RepoPagerActivity extends BaseActivity<RepoPagerMvp.View, RepoPager
|
||||
@OnClick(R.id.detailsIcon) void onTitleClick() {
|
||||
Repo repoModel = getPresenter().getRepo();
|
||||
if (repoModel != null && !InputHelper.isEmpty(repoModel.getDescription())) {
|
||||
MessageDialogView.newInstance(getString(R.string.details), repoModel.getDescription(), false, true)
|
||||
MessageDialogView.newInstance(repoModel.getFullName(), repoModel.getDescription(), false, true)
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,8 @@ public class CommitPagerActivity extends BaseActivity<CommitPagerMvp.View, Commi
|
||||
|
||||
@OnClick(R.id.detailsIcon) void onTitleClick() {
|
||||
if (getPresenter().getCommit() != null && !InputHelper.isEmpty(getPresenter().getCommit().getGitCommit().getMessage()))
|
||||
MessageDialogView.newInstance(getString(R.string.details), getPresenter().getCommit().getGitCommit().getMessage(), true, false)
|
||||
MessageDialogView.newInstance(String.format("%s/%s", getPresenter().getLogin(), getPresenter().getRepoId()),
|
||||
getPresenter().getCommit().getGitCommit().getMessage(), true, false)
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
|
||||
@ -62,8 +62,9 @@ public class RepoFilesFragment extends BaseFragment<RepoFilesMvp.View, RepoFiles
|
||||
String url = InputHelper.isEmpty(model.getDownloadUrl()) ? model.getUrl() : model.getDownloadUrl();
|
||||
if (InputHelper.isEmpty(url)) return;
|
||||
if (model.getSize() > FileHelper.ONE_MB && !MarkDownProvider.isImage(url)) {
|
||||
MessageDialogView.newInstance(getString(R.string.big_file), getString(R.string.big_file_description), false, true,
|
||||
Bundler.start().put(BundleConstant.EXTRA, model.getDownloadUrl())
|
||||
MessageDialogView.newInstance(getString(R.string.big_file), getString(R.string.big_file_description),
|
||||
false, true, Bundler.start()
|
||||
.put(BundleConstant.EXTRA, model.getDownloadUrl())
|
||||
.put(BundleConstant.YES_NO_EXTRA, true)
|
||||
.end())
|
||||
.show(getChildFragmentManager(), "MessageDialogView");
|
||||
|
||||
@ -153,7 +153,7 @@ public class ViewerFragment extends BaseFragment<ViewerMvp.View, ViewerPresenter
|
||||
if (getPresenter().isRepo()) {
|
||||
if (appBarLayout != null && bottomNavigation != null) {
|
||||
Logger.e(scroll, appBarLayout.getTotalScrollRange());
|
||||
if (scroll == 0) {
|
||||
if (scroll <= (appBarLayout.getTotalScrollRange() / 2)) {
|
||||
scrolledTop = true;
|
||||
bottomNavigation.setExpanded(true, true);
|
||||
appBarLayout.setExpanded(true, true);
|
||||
@ -162,7 +162,7 @@ public class ViewerFragment extends BaseFragment<ViewerMvp.View, ViewerPresenter
|
||||
appBarLayout.setExpanded(false, true);
|
||||
scrolledTop = false;
|
||||
}
|
||||
webView.setNestedScrollingEnabled(scroll < 800);
|
||||
webView.setNestedScrollingEnabled(scroll <= (appBarLayout.getTotalScrollRange() * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,8 +189,8 @@ public class ViewerFragment extends BaseFragment<ViewerMvp.View, ViewerPresenter
|
||||
}
|
||||
stateLayout.setOnReloadListener(view1 -> getPresenter().onHandleIntent(getArguments()));
|
||||
if (getPresenter().isRepo()) {
|
||||
appBarLayout = (AppBarLayout) getActivity().findViewById(R.id.appbar);
|
||||
bottomNavigation = (BottomNavigation) getActivity().findViewById(R.id.bottomNavigation);
|
||||
appBarLayout = getActivity().findViewById(R.id.appbar);
|
||||
bottomNavigation = getActivity().findViewById(R.id.bottomNavigation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +87,8 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
|
||||
|
||||
@OnClick(R.id.detailsIcon) void onTitleClick() {
|
||||
if (getPresenter().getIssue() != null && !InputHelper.isEmpty(getPresenter().getIssue().getTitle()))
|
||||
MessageDialogView.newInstance(getString(R.string.details), getPresenter().getIssue().getTitle(), false, true)
|
||||
MessageDialogView.newInstance(String.format("%s/%s", getPresenter().getLogin(), getPresenter().getRepoId()),
|
||||
getPresenter().getIssue().getTitle(), false, true)
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
|
||||
@ -99,7 +99,8 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
|
||||
@OnClick(R.id.detailsIcon) void onTitleClick() {
|
||||
if (getPresenter().getPullRequest() != null && !InputHelper.isEmpty(getPresenter().getPullRequest().getTitle()))
|
||||
MessageDialogView.newInstance(getString(R.string.details), getPresenter().getPullRequest().getTitle(), false, true)
|
||||
MessageDialogView.newInstance(String.format("%s/%s", getPresenter().getLogin(), getPresenter().getRepoId()),
|
||||
getPresenter().getPullRequest().getTitle(), false, true)
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ import com.fastaccess.ui.widgets.SpannableBuilder
|
||||
*/
|
||||
class AddReviewDialogFragment : BaseDialogFragment<BaseMvp.FAView, BasePresenter<BaseMvp.FAView>>() {
|
||||
|
||||
val toolbar: Toolbar by lazy { view!!.findViewById(R.id.toolbar) as Toolbar }
|
||||
val textView: TextView by lazy { view!!.findViewById(R.id.text) as TextView }
|
||||
val lineNo: TextView by lazy { view!!.findViewById(R.id.lineNo) as TextView }
|
||||
val editText: TextInputLayout by lazy { view!!.findViewById(R.id.editText) as TextInputLayout }
|
||||
val toolbar: Toolbar by lazy { view!!.findViewById<Toolbar>(R.id.toolbar) }
|
||||
val textView: TextView by lazy { view!!.findViewById<TextView>(R.id.text) }
|
||||
val lineNo: TextView by lazy { view!!.findViewById<TextView>(R.id.lineNo) }
|
||||
val editText: TextInputLayout by lazy { view!!.findViewById<TextInputLayout>(R.id.editText) }
|
||||
val spacePattern = "\\s+".toRegex()
|
||||
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ import com.fastaccess.data.dao.ReviewRequestModel
|
||||
import com.fastaccess.helper.*
|
||||
import com.fastaccess.provider.theme.ThemeEngine
|
||||
import com.fastaccess.ui.base.BaseActivity
|
||||
import com.fastaccess.ui.widgets.bindView
|
||||
import com.fastaccess.ui.widgets.dialog.ProgressDialogFragment
|
||||
|
||||
/**
|
||||
@ -24,9 +25,9 @@ import com.fastaccess.ui.widgets.dialog.ProgressDialogFragment
|
||||
class ReviewChangesActivity : BaseActivity<ReviewChangesMvp.View, ReviewChangesPresenter>(), ReviewChangesMvp.View {
|
||||
|
||||
|
||||
val toolbar: Toolbar by lazy { findViewById(R.id.toolbar) as Toolbar }
|
||||
val spinner: Spinner by lazy { findViewById(R.id.reviewMethod) as Spinner }
|
||||
val editText: TextInputLayout by lazy { findViewById(R.id.editText) as TextInputLayout }
|
||||
val toolbar: Toolbar by bindView(R.id.toolbar)
|
||||
val spinner: Spinner by bindView(R.id.reviewMethod)
|
||||
val editText: TextInputLayout by bindView(R.id.editText)
|
||||
|
||||
@State var reviewRequest: ReviewRequestModel? = null
|
||||
@State var repoId: String? = null
|
||||
|
||||
@ -124,7 +124,6 @@ public class SearchCodeFragment extends BaseFragment<SearchCodeMvp.View, SearchC
|
||||
this.searchQuery = query;
|
||||
this.showRepoName = showRepoName;
|
||||
getLoadMore().reset();
|
||||
recycler.scrollToPosition(0);
|
||||
adapter.clear();
|
||||
adapter.showRepoName(showRepoName);
|
||||
if (!InputHelper.isEmpty(query)) {
|
||||
|
||||
@ -122,7 +122,6 @@ public class SearchIssuesFragment extends BaseFragment<SearchIssuesMvp.View, Sea
|
||||
@Override public void onSetSearchQuery(@NonNull String query) {
|
||||
this.searchQuery = query;
|
||||
getLoadMore().reset();
|
||||
recycler.scrollToPosition(0);
|
||||
adapter.clear();
|
||||
if (!InputHelper.isEmpty(query)) {
|
||||
recycler.removeOnScrollListener(getLoadMore());
|
||||
|
||||
@ -122,7 +122,6 @@ public class SearchReposFragment extends BaseFragment<SearchReposMvp.View, Searc
|
||||
@Override public void onSetSearchQuery(@NonNull String query) {
|
||||
this.searchQuery = query;
|
||||
getLoadMore().reset();
|
||||
recycler.scrollToPosition(0);
|
||||
adapter.clear();
|
||||
if (!InputHelper.isEmpty(query)) {
|
||||
recycler.removeOnScrollListener(getLoadMore());
|
||||
|
||||
@ -120,7 +120,6 @@ public class SearchUsersFragment extends BaseFragment<SearchUsersMvp.View, Searc
|
||||
@Override public void onSetSearchQuery(@NonNull String query) {
|
||||
this.searchQuery = query;
|
||||
getLoadMore().reset();
|
||||
recycler.scrollToPosition(0);
|
||||
adapter.clear();
|
||||
if (!InputHelper.isEmpty(query)) {
|
||||
recycler.removeOnScrollListener(getLoadMore());
|
||||
|
||||
@ -23,8 +23,8 @@ import com.fastaccess.ui.widgets.SpannableBuilder
|
||||
|
||||
class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter>(), ThemeFragmentMvp.View {
|
||||
|
||||
val apply: FloatingActionButton by lazy { view!!.findViewById(R.id.apply) as FloatingActionButton }
|
||||
val toolbar: Toolbar by lazy { view!!.findViewById(R.id.toolbar) as Toolbar }
|
||||
val apply: FloatingActionButton by lazy { view!!.findViewById<FloatingActionButton>(R.id.apply) }
|
||||
val toolbar: Toolbar by lazy { view!!.findViewById<Toolbar>(R.id.toolbar) }
|
||||
|
||||
private val THEME = "appTheme"
|
||||
private var primaryDarkColor: Int = 0
|
||||
|
||||
@ -17,9 +17,9 @@ import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
|
||||
|
||||
class TrendingFragment : BaseFragment<TrendingFragmentMvp.View, TrendingFragmentPresenter>(), TrendingFragmentMvp.View {
|
||||
|
||||
val recycler: DynamicRecyclerView by lazy { view!!.findViewById(R.id.recycler) as DynamicRecyclerView }
|
||||
val refresh: SwipeRefreshLayout by lazy { view!!.findViewById(R.id.refresh) as SwipeRefreshLayout }
|
||||
val stateLayout: StateLayout by lazy { view!!.findViewById(R.id.stateLayout) as StateLayout }
|
||||
val recycler: DynamicRecyclerView by lazy { view!!.findViewById<DynamicRecyclerView>(R.id.recycler) }
|
||||
val refresh: SwipeRefreshLayout by lazy { view!!.findViewById<SwipeRefreshLayout>(R.id.refresh) }
|
||||
val stateLayout: StateLayout by lazy { view!!.findViewById<StateLayout>(R.id.stateLayout) }
|
||||
val adapter by lazy { TrendingAdapter(presenter.getTendingList()) }
|
||||
|
||||
@State var lang: String = ""
|
||||
|
||||
@ -1,85 +1,93 @@
|
||||
package com.fastaccess.ui.widgets.recyclerview.scroll;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.StaggeredGridLayoutManager;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 8/2/2015. copyrights are reserved @
|
||||
*/
|
||||
@SuppressWarnings("FieldCanBeLocal") public abstract class InfiniteScroll extends RecyclerView.OnScrollListener {
|
||||
private int previousTotal = 0;
|
||||
public abstract class InfiniteScroll extends RecyclerView.OnScrollListener {
|
||||
private int visibleThreshold = 3;
|
||||
private int currentPage = 0;
|
||||
private int previousTotalItemCount = 0;
|
||||
private boolean loading = true;
|
||||
private int visibleThreshold = 2;
|
||||
private int firstVisibleItem;
|
||||
private int visibleItemCount;
|
||||
private int totalItemCount;
|
||||
private int current_page = 0;
|
||||
private RecyclerViewPositionHelper mRecyclerViewHelper;
|
||||
private static final int HIDE_THRESHOLD = 20;
|
||||
private int scrolledDistance = 0;
|
||||
private boolean controlsVisible = true;
|
||||
private int startingPageIndex = 0;
|
||||
private RecyclerView.LayoutManager mLayoutManager;
|
||||
|
||||
public InfiniteScroll() {}
|
||||
|
||||
@Override public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
mRecyclerViewHelper = RecyclerViewPositionHelper.createHelper(recyclerView);
|
||||
visibleItemCount = recyclerView.getChildCount();
|
||||
totalItemCount = mRecyclerViewHelper.getItemCount();
|
||||
firstVisibleItem = mRecyclerViewHelper.findFirstVisibleItemPosition();
|
||||
if (loading) {
|
||||
if (totalItemCount > previousTotal) {
|
||||
loading = false;
|
||||
previousTotal = totalItemCount;
|
||||
public InfiniteScroll(RecyclerView.LayoutManager layoutManager) {
|
||||
initLayoutManager(layoutManager);
|
||||
}
|
||||
|
||||
private void initLayoutManager(RecyclerView.LayoutManager layoutManager) {
|
||||
this.mLayoutManager = layoutManager;
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
visibleThreshold = visibleThreshold * ((GridLayoutManager) layoutManager).getSpanCount();
|
||||
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||
visibleThreshold = visibleThreshold * ((StaggeredGridLayoutManager) layoutManager).getSpanCount();
|
||||
}
|
||||
}
|
||||
|
||||
private int getLastVisibleItem(int[] lastVisibleItemPositions) {
|
||||
int maxSize = 0;
|
||||
for (int i = 0; i < lastVisibleItemPositions.length; i++) {
|
||||
if (i == 0) {
|
||||
maxSize = lastVisibleItemPositions[i];
|
||||
} else if (lastVisibleItemPositions[i] > maxSize) {
|
||||
maxSize = lastVisibleItemPositions[i];
|
||||
}
|
||||
}
|
||||
if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
|
||||
current_page++;
|
||||
onLoadMore(current_page, previousTotal);
|
||||
loading = true;
|
||||
}
|
||||
if (firstVisibleItem + visibleItemCount >= totalItemCount) {
|
||||
onScrollToLast(recyclerView);
|
||||
}
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
@Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
if (scrolledDistance > HIDE_THRESHOLD && controlsVisible) {
|
||||
onHide(recyclerView);
|
||||
controlsVisible = false;
|
||||
scrolledDistance = 0;
|
||||
} else if (scrolledDistance < -HIDE_THRESHOLD && !controlsVisible) {
|
||||
onShow(recyclerView);
|
||||
controlsVisible = true;
|
||||
scrolledDistance = 0;
|
||||
if (mLayoutManager == null) {
|
||||
initLayoutManager(recyclerView.getLayoutManager());
|
||||
}
|
||||
if ((controlsVisible && dy > 0) || (!controlsVisible && dy < 0)) {
|
||||
scrolledDistance += dy;
|
||||
int lastVisibleItemPosition = 0;
|
||||
int totalItemCount = mLayoutManager.getItemCount();
|
||||
if (mLayoutManager instanceof StaggeredGridLayoutManager) {
|
||||
int[] lastVisibleItemPositions = ((StaggeredGridLayoutManager) mLayoutManager).findLastVisibleItemPositions(null);
|
||||
lastVisibleItemPosition = getLastVisibleItem(lastVisibleItemPositions);
|
||||
} else if (mLayoutManager instanceof GridLayoutManager) {
|
||||
lastVisibleItemPosition = ((GridLayoutManager) mLayoutManager).findLastVisibleItemPosition();
|
||||
} else if (mLayoutManager instanceof LinearLayoutManager) {
|
||||
lastVisibleItemPosition = ((LinearLayoutManager) mLayoutManager).findLastVisibleItemPosition();
|
||||
}
|
||||
if (totalItemCount < previousTotalItemCount) {
|
||||
this.currentPage = this.startingPageIndex;
|
||||
this.previousTotalItemCount = totalItemCount;
|
||||
if (totalItemCount == 0) {
|
||||
this.loading = true;
|
||||
}
|
||||
}
|
||||
if (loading && (totalItemCount > previousTotalItemCount)) {
|
||||
loading = false;
|
||||
previousTotalItemCount = totalItemCount;
|
||||
}
|
||||
if (!loading && (lastVisibleItemPosition + visibleThreshold) > totalItemCount) {
|
||||
currentPage++;
|
||||
onLoadMore(currentPage, totalItemCount);
|
||||
loading = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("WeakerAccess") protected void onScrollToLast(RecyclerView recyclerView) {}
|
||||
|
||||
@SuppressWarnings("WeakerAccess") protected void onShow(RecyclerView recyclerView) {}
|
||||
|
||||
@SuppressWarnings("WeakerAccess") protected void onHide(RecyclerView recyclerView) {
|
||||
|
||||
}
|
||||
|
||||
protected void onLoadMore(int page, int previousTotal) {}
|
||||
|
||||
public void reset() {
|
||||
this.previousTotal = 0;
|
||||
this.currentPage = this.startingPageIndex;
|
||||
this.previousTotalItemCount = 0;
|
||||
this.loading = true;
|
||||
this.current_page = 0;
|
||||
}
|
||||
|
||||
public void setCurrent_page(int page, int previousTotal) {
|
||||
this.current_page = page;
|
||||
this.previousTotal = previousTotal;
|
||||
this.currentPage = page;
|
||||
this.previousTotalItemCount = previousTotal;
|
||||
this.loading = true;
|
||||
|
||||
}
|
||||
|
||||
public abstract void onLoadMore(int page, int totalItemsCount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
package com.fastaccess.ui.widgets.recyclerview.scroll;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.OrientationHelper;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 8/2/2015. copyrights are reserved @
|
||||
*/
|
||||
class RecyclerViewPositionHelper {
|
||||
@NonNull private final RecyclerView recyclerView;
|
||||
private final RecyclerView.LayoutManager layoutManager;
|
||||
|
||||
private RecyclerViewPositionHelper(@NonNull RecyclerView recyclerView) {
|
||||
this.recyclerView = recyclerView;
|
||||
this.layoutManager = recyclerView.getLayoutManager();
|
||||
}
|
||||
|
||||
static RecyclerViewPositionHelper createHelper(@Nullable RecyclerView recyclerView) {
|
||||
if (recyclerView == null) {
|
||||
throw new NullPointerException("Recycler View is null");
|
||||
}
|
||||
return new RecyclerViewPositionHelper(recyclerView);
|
||||
}
|
||||
|
||||
int getItemCount() {
|
||||
return layoutManager == null ? 0 : layoutManager.getItemCount();
|
||||
}
|
||||
|
||||
int findFirstVisibleItemPosition() {
|
||||
final View child = findOneVisibleChild(0, layoutManager.getChildCount(), false, true);
|
||||
return child == null ? RecyclerView.NO_POSITION : recyclerView.getChildAdapterPosition(child);
|
||||
}
|
||||
|
||||
public int findFirstCompletelyVisibleItemPosition() {
|
||||
final View child = findOneVisibleChild(0, layoutManager.getChildCount(), true, false);
|
||||
return child == null ? RecyclerView.NO_POSITION : recyclerView.getChildAdapterPosition(child);
|
||||
}
|
||||
|
||||
public int findLastVisibleItemPosition() {
|
||||
final View child = findOneVisibleChild(layoutManager.getChildCount() - 1, -1, false, true);
|
||||
return child == null ? RecyclerView.NO_POSITION : recyclerView.getChildAdapterPosition(child);
|
||||
}
|
||||
|
||||
public int findLastCompletelyVisibleItemPosition() {
|
||||
final View child = findOneVisibleChild(layoutManager.getChildCount() - 1, -1, true, false);
|
||||
return child == null ? RecyclerView.NO_POSITION : recyclerView.getChildAdapterPosition(child);
|
||||
}
|
||||
|
||||
@Nullable private View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) {
|
||||
OrientationHelper helper;
|
||||
if (layoutManager.canScrollVertically()) {
|
||||
helper = OrientationHelper.createVerticalHelper(layoutManager);
|
||||
} else {
|
||||
helper = OrientationHelper.createHorizontalHelper(layoutManager);
|
||||
}
|
||||
|
||||
final int start = helper.getStartAfterPadding();
|
||||
final int end = helper.getEndAfterPadding();
|
||||
final int next = toIndex > fromIndex ? 1 : -1;
|
||||
View partiallyVisible = null;
|
||||
for (int i = fromIndex; i != toIndex; i += next) {
|
||||
final View child = layoutManager.getChildAt(i);
|
||||
final int childStart = helper.getDecoratedStart(child);
|
||||
final int childEnd = helper.getDecoratedEnd(child);
|
||||
if (childStart < end && childEnd > start) {
|
||||
if (completelyVisible) {
|
||||
if (childStart >= start && childEnd <= end) {
|
||||
return child;
|
||||
} else if (acceptPartiallyVisible && partiallyVisible == null) {
|
||||
partiallyVisible = child;
|
||||
}
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
return partiallyVisible;
|
||||
}
|
||||
}
|
||||
@ -71,13 +71,17 @@
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_micro"
|
||||
android:background="@drawable/bottom_border"
|
||||
android:paddingBottom="@dimen/spacing_normal"
|
||||
tools:text="Hello world"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/body"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/spacing_normal"
|
||||
tools:text="Hello world"/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center"
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/size"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -84,7 +84,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/language"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/changes"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
@ -85,7 +85,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/addition"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
@ -94,7 +94,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/deletion"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/status"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
|
||||
@ -55,10 +55,11 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:gravity="center|start"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
tools:drawableStart="@drawable/ic_notification"
|
||||
tools:text="50 minutes ago"/>
|
||||
|
||||
@ -41,10 +41,11 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:gravity="center|start"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
tools:drawableStart="@drawable/ic_notification"
|
||||
tools:text="50 minutes ago"/>
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/details"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/commentsNo"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/details"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/commentsNo"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/notificationTitle"
|
||||
style="@style/TextAppearance.AppCompat.Body1"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/headerTitle"
|
||||
style="@style/TextAppearance.AppCompat.Title"
|
||||
style="@style/TextAppearance.AppCompat.Subhead"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?colorAccent"
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/repoName"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -77,7 +77,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="@dimen/spacing_normal"
|
||||
android:layout_marginTop="@dimen/spacing_micro"
|
||||
android:autoLink="all"
|
||||
tools:text="What’s the secret to large and cold peanut butter? Always use quartered szechuan pepper."/>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/name"
|
||||
style="@style/Base.TextAppearance.AppCompat.Body1"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/changes"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
@ -85,7 +85,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/addition"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
@ -94,7 +94,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/deletion"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/status"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/stars"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/forks"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -95,7 +95,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/size"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -110,7 +110,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/language"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/stars"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/forks"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/size"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -95,7 +95,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/language"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/stars"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/forks"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/todayStars"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -55,10 +55,11 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/date"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="@dimen/spacing_normal"
|
||||
android:gravity="center|start"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
tools:drawableStart="@drawable/ic_notification"
|
||||
tools:text="50 minutes ago"/>
|
||||
|
||||
@ -177,7 +177,7 @@
|
||||
<string name="code_viewer">Code viewer</string>
|
||||
<string name="open_in_browser">Open in browser</string>
|
||||
<string name="big_file">Large file</string>
|
||||
<string name="big_file_description">The file is too big to open.\nPress "OK" to download it instead.</string>
|
||||
<string name="big_file_description">The file is too big to open.\nPress "Yes" to download it instead.</string>
|
||||
<string name="viewer">Viewer</string>
|
||||
<string name="submit">Submit</string>
|
||||
<string name="type_here">Type here</string>
|
||||
|
||||
@ -5,7 +5,7 @@ buildscript {
|
||||
butterKnifeVersion = '8.5.1'
|
||||
state_version = '1.1.0'
|
||||
lombokVersion = '1.12.6'
|
||||
supportVersion = "25.4.0"
|
||||
supportVersion = "26.0.0-beta2"
|
||||
gms = "11.0.1"
|
||||
thirtyinchVersion = '0.8.0'
|
||||
retrofit = '2.3.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user