this commit fixes #591 fixes #590 fixes #588 fixes #583 fixes #578

this commit also includes WIP trending module which is fully written in kotlin.
This commit is contained in:
Kosh 2017-05-31 23:28:37 +08:00
parent 9e66424645
commit f5d606bce5
71 changed files with 873 additions and 92 deletions

View File

@ -1,5 +1,5 @@
apply plugin: 'com.android.application'
//apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android'
apply plugin: 'com.novoda.build-properties'
apply plugin: 'jacoco-android'
apply plugin: 'io.fabric'
@ -89,6 +89,7 @@ android {
testOptions {
unitTests.returnDefaultValues = true
}
compileOptions.incremental = false
}
repositories {
@ -100,6 +101,8 @@ repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:${supportVersion}"
@ -136,24 +139,20 @@ dependencies {
compile 'com.github.matthiasrobbers:shortbread:1.0.1'
compile 'com.atlassian.commonmark:commonmark:0.9.0'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile "com.google.firebase:firebase-ads:${gms}"
compile "com.google.firebase:firebase-messaging:${gms}"
compile "com.google.android.gms:play-services-auth:${gms}"
compile "com.github.florent37:retrojsoup:${retroJsoup}"
compile "com.github.florent37:rxjsoup:${retroJsoup}"
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
compile "org.jsoup:jsoup:1.10.2"
compile "com.github.miguelbcr:RxBillingService:0.0.3"
// compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:${kotlin_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
provided "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "com.github.florent37:retrojsoup-compiler:${retroJsoup}"
annotationProcessor "io.requery:requery-processor:${requery}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "frankiesardo:icepick-processor:${icepickVersion}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
annotationProcessor 'com.github.matthiasrobbers:shortbread-compiler:1.0.1'
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
// testCompile "net.grandcentrix.thirtyinch:thirtyinch-test:$thirtyinchVersion"
testCompile "junit:junit:${junitVersion}"
testCompile "org.mockito:mockito-core:${mockitoVersion}"

View File

@ -165,7 +165,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
</activity>
<activity android:name=".ui.modules.settings.SettingsActivity"/>
<activity android:name=".ui.modules.settings.category.SettingsCategoryActivity"/>
<activity
@ -176,7 +175,6 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
</activity>
<activity
android:name=".ui.modules.parser.LinksParserActivity"
android:configChanges="keyboard|orientation|screenSize"
@ -232,6 +230,10 @@
<meta-data
android:name="io.fabric.ApiKey"
android:value="6ed82b6e0756853d7d782a3f547f84f9ecba217e"/>
<activity android:name=".ui.modules.trending.TendingActivity">
</activity>
<activity android:name=".ui.modules.trending.TrendingActivity"/>
</application>
</manifest>

View File

@ -67,7 +67,11 @@ public class App extends Application {
}
private void init() {
Fabric.with(this, new Crashlytics());
Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics())
.debuggable(BuildConfig.DEBUG)
.build();
Fabric.with(fabric);
RxBillingService.register(this);
deleteDatabase("database.db");
getDataStore();//init requery before anything.

View File

@ -86,8 +86,7 @@ import lombok.Setter;
@NonNull String login, @NonNull String url,
@NonNull String defaultBranch) {
return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.readme), ViewerFragment.newInstance(url, true)),
new FragmentPagerAdapterModel(context.getString(R.string.files), RepoFilePathFragment.newInstance(login, repoId, null,
defaultBranch)),
new FragmentPagerAdapterModel(context.getString(R.string.files), RepoFilePathFragment.newInstance(login, repoId, null, defaultBranch)),
new FragmentPagerAdapterModel(context.getString(R.string.commits), RepoCommitsFragment.newInstance(repoId, login, defaultBranch)),
new FragmentPagerAdapterModel(context.getString(R.string.releases), RepoReleasesFragment.newInstance(repoId, login)),
new FragmentPagerAdapterModel(context.getString(R.string.contributors), RepoContributorsFragment.newInstance(repoId, login)))

View File

@ -23,7 +23,7 @@ public class Pageable<M extends Parcelable> implements Parcelable {
private int last;
private int totalCount;
private boolean incompleteResults;
private List<M> items;
public List<M> items;
@Override public int describeContents() { return 0; }

View File

@ -0,0 +1,73 @@
package com.fastaccess.data.dao.kot
import android.os.Parcel
import android.os.Parcelable
data class Owner(
val gistsUrl: String? = null,
val reposUrl: String? = null,
val followingUrl: String? = null,
val starredUrl: String? = null,
val login: String? = null,
val followersUrl: String? = null,
val type: String? = null,
val url: String? = null,
val subscriptionsUrl: String? = null,
val receivedEventsUrl: String? = null,
val avatarUrl: String? = null,
val eventsUrl: String? = null,
val htmlUrl: String? = null,
val siteAdmin: Boolean? = null,
val id: Int? = null,
val gravatarId: String? = null,
val organizationsUrl: String? = null
) : Parcelable {
companion object {
@JvmField val CREATOR: Parcelable.Creator<Owner> = object : Parcelable.Creator<Owner> {
override fun createFromParcel(source: Parcel): Owner = Owner(source)
override fun newArray(size: Int): Array<Owner?> = arrayOfNulls(size)
}
}
constructor(source: Parcel) : this(
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString()
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeString(gistsUrl)
dest.writeString(reposUrl)
dest.writeString(followingUrl)
dest.writeString(starredUrl)
dest.writeString(login)
dest.writeString(followersUrl)
dest.writeString(type)
dest.writeString(url)
dest.writeString(subscriptionsUrl)
dest.writeString(receivedEventsUrl)
dest.writeString(avatarUrl)
dest.writeString(eventsUrl)
dest.writeString(htmlUrl)
dest.writeValue(siteAdmin)
dest.writeValue(id)
dest.writeString(gravatarId)
dest.writeString(organizationsUrl)
}
}

View File

@ -0,0 +1,238 @@
package com.fastaccess.data.dao.kot
import android.os.Parcel
import android.os.Parcelable
data class TrendingResponse(
val stargazersCount: Int? = null,
val pushedAt: String? = null,
val subscriptionUrl: String? = null,
val language: String? = null,
val branchesUrl: String? = null,
val issueCommentUrl: String? = null,
val labelsUrl: String? = null,
val subscribersUrl: String? = null,
val releasesUrl: String? = null,
val svnUrl: String? = null,
val subscribersCount: Int? = null,
val id: Int? = null,
val forks: Int? = null,
val archiveUrl: String? = null,
val gitRefsUrl: String? = null,
val forksUrl: String? = null,
val statusesUrl: String? = null,
val networkCount: Int? = null,
val sshUrl: String? = null,
val fullName: String? = null,
val size: Int? = null,
val languagesUrl: String? = null,
val htmlUrl: String? = null,
val collaboratorsUrl: String? = null,
val cloneUrl: String? = null,
val name: String? = null,
val pullsUrl: String? = null,
val defaultBranch: String? = null,
val hooksUrl: String? = null,
val treesUrl: String? = null,
val tagsUrl: String? = null,
val jsonMemberPrivate: Boolean? = null,
val contributorsUrl: String? = null,
val hasDownloads: Boolean? = null,
val notificationsUrl: String? = null,
val openIssuesCount: Int? = null,
val description: String? = null,
val createdAt: String? = null,
val watchers: Int? = null,
val keysUrl: String? = null,
val deploymentsUrl: String? = null,
val hasProjects: Boolean? = null,
val hasWiki: Boolean? = null,
val updatedAt: String? = null,
val commentsUrl: String? = null,
val stargazersUrl: String? = null,
val gitUrl: String? = null,
val hasPages: Boolean? = null,
val owner: Owner? = null,
val organization: Owner? = null,
val commitsUrl: String? = null,
val compareUrl: String? = null,
val gitCommitsUrl: String? = null,
val blobsUrl: String? = null,
val gitTagsUrl: String? = null,
val mergesUrl: String? = null,
val downloadsUrl: String? = null,
val hasIssues: Boolean? = null,
val url: String? = null,
val contentsUrl: String? = null,
val mirrorUrl: String? = null,
val milestonesUrl: String? = null,
val teamsUrl: String? = null,
val fork: Boolean? = null,
val issuesUrl: String? = null,
val eventsUrl: String? = null,
val issueEventsUrl: String? = null,
val assigneesUrl: String? = null,
val openIssues: Int? = null,
val watchersCount: Int? = null,
val homepage: String? = null,
val forksCount: Int? = null
) : Parcelable {
companion object {
@JvmField val CREATOR: Parcelable.Creator<TrendingResponse> = object : Parcelable.Creator<TrendingResponse> {
override fun createFromParcel(source: Parcel): TrendingResponse = TrendingResponse(source)
override fun newArray(size: Int): Array<TrendingResponse?> = arrayOfNulls(size)
}
}
constructor(source: Parcel) : this(
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?,
source.readValue(Int::class.java.classLoader) as Int?,
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readParcelable<Owner>(Owner::class.java.classLoader) as Owner?,
source.readParcelable<Owner>(Owner::class.java.classLoader) as Owner?,
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Boolean::class.java.classLoader) as Boolean?,
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?,
source.readValue(Int::class.java.classLoader) as Int?,
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeValue(stargazersCount)
dest.writeString(pushedAt)
dest.writeString(subscriptionUrl)
dest.writeString(language)
dest.writeString(branchesUrl)
dest.writeString(issueCommentUrl)
dest.writeString(labelsUrl)
dest.writeString(subscribersUrl)
dest.writeString(releasesUrl)
dest.writeString(svnUrl)
dest.writeValue(subscribersCount)
dest.writeValue(id)
dest.writeValue(forks)
dest.writeString(archiveUrl)
dest.writeString(gitRefsUrl)
dest.writeString(forksUrl)
dest.writeString(statusesUrl)
dest.writeValue(networkCount)
dest.writeString(sshUrl)
dest.writeString(fullName)
dest.writeValue(size)
dest.writeString(languagesUrl)
dest.writeString(htmlUrl)
dest.writeString(collaboratorsUrl)
dest.writeString(cloneUrl)
dest.writeString(name)
dest.writeString(pullsUrl)
dest.writeString(defaultBranch)
dest.writeString(hooksUrl)
dest.writeString(treesUrl)
dest.writeString(tagsUrl)
dest.writeValue(jsonMemberPrivate)
dest.writeString(contributorsUrl)
dest.writeValue(hasDownloads)
dest.writeString(notificationsUrl)
dest.writeValue(openIssuesCount)
dest.writeString(description)
dest.writeString(createdAt)
dest.writeValue(watchers)
dest.writeString(keysUrl)
dest.writeString(deploymentsUrl)
dest.writeValue(hasProjects)
dest.writeValue(hasWiki)
dest.writeString(updatedAt)
dest.writeString(commentsUrl)
dest.writeString(stargazersUrl)
dest.writeString(gitUrl)
dest.writeValue(hasPages)
dest.writeParcelable(owner, flags)
dest.writeParcelable(organization, flags)
dest.writeString(commitsUrl)
dest.writeString(compareUrl)
dest.writeString(gitCommitsUrl)
dest.writeString(blobsUrl)
dest.writeString(gitTagsUrl)
dest.writeString(mergesUrl)
dest.writeString(downloadsUrl)
dest.writeValue(hasIssues)
dest.writeString(url)
dest.writeString(contentsUrl)
dest.writeString(mirrorUrl)
dest.writeString(milestonesUrl)
dest.writeString(teamsUrl)
dest.writeValue(fork)
dest.writeString(issuesUrl)
dest.writeString(eventsUrl)
dest.writeString(issueEventsUrl)
dest.writeString(assigneesUrl)
dest.writeValue(openIssues)
dest.writeValue(watchersCount)
dest.writeString(homepage)
dest.writeValue(forksCount)
}
}

View File

@ -0,0 +1,14 @@
package com.fastaccess.data.service.trending
import com.fastaccess.data.dao.kot.TrendingResponse
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Query
/**
* Created by Kosh on 30 May 2017, 11:20 PM
*/
interface TrendingService {
@GET("v2/trending") fun getTrending(@Query("lan") query: String, @Query("since") since: String): Observable<List<TrendingResponse>>
}

View File

@ -21,7 +21,7 @@ public class RxHelper {
public static <T> Observable<T> safeObservable(@NonNull Observable<T> observable) {
return getObserver(observable)
.onErrorReturn(throwable -> null)
.onErrorReturn(throwable -> (T) new Object())
.doOnError(Throwable::printStackTrace);
}

View File

@ -6,6 +6,8 @@ import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import com.fastaccess.App;
import com.fastaccess.data.dao.LanguageColorModel;
import com.fastaccess.helper.InputHelper;
@ -20,6 +22,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
@ -53,6 +56,13 @@ public class ColorsProvider {
}
}
@NonNull public static List<String> languages() {
return Stream.of(colors)
.map(Map.Entry::getKey)
.collect(Collectors.toList());
}
@Nullable public static LanguageColorModel getColor(@NonNull String lang) {
return colors.get(lang);
}

View File

@ -22,6 +22,7 @@ import com.fastaccess.data.service.ReviewService;
import com.fastaccess.data.service.SearchService;
import com.fastaccess.data.service.SlackService;
import com.fastaccess.data.service.UserRestService;
import com.fastaccess.data.service.trending.TrendingService;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.provider.rest.converters.GithubResponseConverter;
@ -212,6 +213,15 @@ public class RestProvider {
.create(SlackService.class);
}
@NonNull public static TrendingService getTrendingService() {
return new Retrofit.Builder()
.baseUrl("http://fast-for-github.appspot.com/")
.addConverterFactory(new GithubResponseConverter(gson))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
.create(TrendingService.class);
}
public static void clearHttpClient() {
okHttpClient = null;
}

View File

@ -1,6 +1,7 @@
package com.fastaccess.ui.base;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
@ -47,6 +48,7 @@ import com.fastaccess.ui.modules.main.orgs.OrgListDialogFragment;
import com.fastaccess.ui.modules.notification.NotificationActivity;
import com.fastaccess.ui.modules.pinned.PinnedReposActivity;
import com.fastaccess.ui.modules.settings.SettingsActivity;
import com.fastaccess.ui.modules.trending.TrendingActivity;
import com.fastaccess.ui.modules.user.UserPagerActivity;
import com.fastaccess.ui.widgets.AvatarLayout;
import com.fastaccess.ui.widgets.dialog.MessageDialogView;
@ -160,9 +162,15 @@ public abstract class BaseActivity<V extends BaseMvp.FAView, P extends BasePrese
@Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) {
hideProgress();
if (toast != null) toast.cancel();
toast = titleRes.equals(getString(R.string.error))
? Toasty.error(getApplicationContext(), msgRes, Toast.LENGTH_LONG)
: Toasty.info(getApplicationContext(), msgRes, Toast.LENGTH_LONG);
Context context;
if (!isFinishing()) {
context = this;
} else {
context = App.getInstance();
}
toast = titleRes.equals(context.getString(R.string.error))
? Toasty.error(context, msgRes, Toast.LENGTH_LONG)
: Toasty.info(context, msgRes, Toast.LENGTH_LONG);
toast.show();
}
@ -246,6 +254,8 @@ public abstract class BaseActivity<V extends BaseMvp.FAView, P extends BasePrese
onOpenOrgsDialog();
} else if (item.getItemId() == R.id.notifications) {
startActivity(new Intent(this, NotificationActivity.class));
} else if (item.getItemId() == R.id.trending) {
startActivity(new Intent(this, TrendingActivity.class));
}
}, 250);
return false;

View File

@ -6,7 +6,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.MotionEvent;
import android.view.View;
import com.fastaccess.R;
@ -14,7 +13,6 @@ import com.fastaccess.data.dao.SimpleUrlsModel;
import com.fastaccess.data.dao.model.Event;
import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.ViewHelper;
import com.fastaccess.provider.rest.loadmore.OnLoadMore;
import com.fastaccess.provider.scheme.SchemeParser;
import com.fastaccess.ui.adapter.FeedsAdapter;
@ -27,7 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt;
/**
* Created by Kosh on 11 Nov 2016, 12:36 PM
@ -48,7 +45,7 @@ public class FeedsFragment extends BaseFragment<FeedsMvp.View, FeedsPresenter> i
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -174,6 +174,7 @@ public class FilterIssuesActivity extends BaseActivity<FilterIssuesActivityMvp.V
}
@SuppressLint("InflateParams") @OnClick(R.id.labels) public void onLabelsClicked() {
if (hideWindow()) return;
ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null));
popupWindow = new PopupWindow(this);
popupWindow.setContentView(viewHolder.view);
@ -185,6 +186,7 @@ public class FilterIssuesActivity extends BaseActivity<FilterIssuesActivityMvp.V
}
@SuppressLint("InflateParams") @OnClick(R.id.milestone) public void onMilestoneClicked() {
if (hideWindow()) return;
ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null));
popupWindow = new PopupWindow(this);
popupWindow.setContentView(viewHolder.view);
@ -197,6 +199,7 @@ public class FilterIssuesActivity extends BaseActivity<FilterIssuesActivityMvp.V
}
@SuppressLint("InflateParams") @OnClick(R.id.assignee) public void onAssigneeClicked() {
if (hideWindow()) return;
ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null));
popupWindow = new PopupWindow(this);
popupWindow.setContentView(viewHolder.view);
@ -209,6 +212,7 @@ public class FilterIssuesActivity extends BaseActivity<FilterIssuesActivityMvp.V
}
@SuppressLint("InflateParams") @OnClick(R.id.sort) public void onSortClicked() {
if (hideWindow()) return;
ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null));
popupWindow = new PopupWindow(this);
popupWindow.setContentView(viewHolder.view);
@ -297,6 +301,14 @@ public class FilterIssuesActivity extends BaseActivity<FilterIssuesActivityMvp.V
}
}
private boolean hideWindow() {
if (popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
return true;
}
return false;
}
private void onSearch() {
if (!InputHelper.isEmpty(searchEditText)) {
getFilterFragment().onSearch(getRepoName() + InputHelper.toString(searchEditText), open.isSelected(), isIssue);

View File

@ -145,7 +145,7 @@ public class FilterIssueFragment extends BaseFragment<FilterIssuesMvp.View, Filt
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -88,6 +88,14 @@ public class GistsListActivity extends BaseActivity {
}
}
@OnClick(R.id.fab) public void onViewClicked() {
ActivityHelper.startReveal(this, new Intent(this, CreateGistActivity.class), fab);
}
private TabLayout.Tab getTab(int titleId) {
return tabs.newTab().setText(titleId);
}
private void setupTabs() {
TabLayout.Tab tab1 = getTab(R.string.my_gists);
TabLayout.Tab tab2 = getTab(R.string.public_gists);
@ -97,12 +105,4 @@ public class GistsListActivity extends BaseActivity {
FragmentPagerAdapterModel.buildForGists(this)));
tabs.setupWithViewPager(pager);
}
private TabLayout.Tab getTab(int titleId) {
return tabs.newTab().setText(titleId);
}
@OnClick(R.id.fab) public void onViewClicked() {
ActivityHelper.startReveal(this, new Intent(this, CreateGistActivity.class), fab);
}
}

View File

@ -54,7 +54,7 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
}
@Override protected int fragmentLayout() {
return R.layout.fab_small_grid_refresh_list;
return R.layout.fab_micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -116,7 +116,7 @@ public class MyIssuesFragment extends BaseFragment<MyIssuesMvp.View, MyIssuesPre
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -134,7 +134,7 @@ public class MyPullRequestFragment extends BaseFragment<MyPullRequestsMvp.View,
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -82,7 +82,7 @@ public class AllNotificationsFragment extends BaseFragment<AllNotificationsMvp.V
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -69,7 +69,7 @@ public class UnreadNotificationsFragment extends BaseFragment<UnreadNotification
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -55,7 +55,7 @@ public class PinnedReposFragment extends BaseFragment<PinnedReposMvp.View, Pinne
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -51,7 +51,7 @@ public class OrgFeedsFragment extends BaseFragment<OrgFeedsMvp.View, OrgFeedsPre
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -53,7 +53,7 @@ public class OrgReposFragment extends BaseFragment<OrgReposMvp.View, OrgReposPre
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -53,7 +53,7 @@ public class OrgTeamFragment extends BaseFragment<OrgTeamMvp.View, OrgTeamPresen
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -53,7 +53,7 @@ public class TeamReposFragment extends BaseFragment<TeamReposMvp.View, TeamRepos
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -267,7 +267,7 @@ public class ProfileOverviewFragment extends BaseFragment<ProfileOverviewMvp.Vie
}
@Override public void onUserNotFound() {
try {if (isSafe()) getActivity().finish();} catch (Exception ignored) {}
showMessage(R.string.error, R.string.no_user_found);
}
@Override public void onImagePosted(@Nullable String link) {

View File

@ -53,7 +53,7 @@ public class ProfileReposFragment extends BaseFragment<ProfileReposMvp.View, Pro
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -53,7 +53,7 @@ public class ProfileStarredFragment extends BaseFragment<ProfileStarredMvp.View,
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -313,7 +313,7 @@ public class RepoPagerActivity extends BaseActivity<RepoPagerMvp.View, RepoPager
}
@Override public void onFinishActivity() {
finish();
// finish();
}
@Override public void onInitRepo() {

View File

@ -60,7 +60,7 @@ public class CommitCommentsFragments extends BaseFragment<CommitCommentsMvp.View
}
@Override protected int fragmentLayout() {
return R.layout.fab_small_grid_refresh_list;
return R.layout.fab_micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -8,6 +8,7 @@ import android.view.View;
import com.fastaccess.R;
import com.fastaccess.data.dao.CommitFileListModel;
import com.fastaccess.data.dao.CommitFileModel;
import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.Bundler;
import com.fastaccess.ui.adapter.CommitFilesAdapter;
@ -56,7 +57,7 @@ public class CommitFilesFragment extends BaseFragment<CommitFilesMvp.View, Commi
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
@ -77,6 +78,9 @@ public class CommitFilesFragment extends BaseFragment<CommitFilesMvp.View, Commi
}
@Override public void onToggle(long position, boolean isCollapsed) {
if (adapter.getItem((int) position).getPatch() == null) {
ActivityHelper.openChooser(getContext(), adapter.getItem((int) position).getBlobUrl());
}
toggleMap.put(position, isCollapsed);
}

View File

@ -118,8 +118,7 @@ public class RepoReleasesFragment extends BaseFragment<RepoReleasesMvp.View, Rep
})
.show());
adapter.notifyDataSetChanged();// call it notify the adapter to show the guide immediately.
ActivityHelper.showDismissHints(getContext(), () -> {
});
ActivityHelper.showDismissHints(getContext(), () -> {});
}
}
}

View File

@ -86,7 +86,7 @@ public class RepoClosedIssuesFragment extends BaseFragment<RepoIssuesMvp.View, R
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -89,7 +89,7 @@ public class RepoOpenedIssuesFragment extends BaseFragment<RepoIssuesMvp.View, R
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -225,9 +225,8 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
menu.findItem(R.id.closeIssue).setVisible(isOwner || isCollaborator);
menu.findItem(R.id.lockIssue).setVisible(isOwner || isCollaborator);
menu.findItem(R.id.labels).setVisible(getPresenter().isRepoOwner() || isCollaborator);
if (isOwner) {
if (isOwner || isCollaborator) {
if (getPresenter().getIssue() == null) return super.onPrepareOptionsMenu(menu);
closeIssue.setTitle(getPresenter().getIssue().getState() == IssueState.closed ? getString(R.string.re_open) : getString(R.string.close));
lockIssue.setTitle(isLocked ? getString(R.string.unlock_issue) : getString(R.string.lock_issue));
}
return super.onPrepareOptionsMenu(menu);
@ -238,8 +237,8 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
if (getPresenter().getIssue() == null) {
return;
}
supportInvalidateOptionsMenu();
Issue issueModel = getPresenter().getIssue();
invalidateOptionsMenu();
setTitle(String.format("#%s", issueModel.getNumber()));
User userModel = issueModel.getUser();
title.setText(issueModel.getTitle());

View File

@ -84,7 +84,7 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
}
@Override protected int fragmentLayout() {
return R.layout.fab_small_grid_refresh_list;
return R.layout.fab_micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -79,7 +79,7 @@ public class RepoPullRequestFragment extends BaseFragment<RepoPullRequestMvp.Vie
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -169,7 +169,7 @@ class PullRequestPagerPresenter extends BasePresenter<PullRequestPagerMvp.View>
manageDisposable(RxHelper.getObserver(RestProvider.getPullRequestService().editPullRequest(login, repoId,
issueNumber, requestModel))
.doOnSubscribe(disposable -> sendToView(view -> view.showProgress(0)))
.doOnNext(issue -> {
.subscribe(issue -> {
if (issue != null) {
sendToView(view -> view.showSuccessIssueActionMsg(getPullRequest().getState() == IssueState.open));
issue.setRepoId(getPullRequest().getRepoId());
@ -177,9 +177,7 @@ class PullRequestPagerPresenter extends BasePresenter<PullRequestPagerMvp.View>
pullRequest = issue;
sendToView(PullRequestPagerMvp.View::onSetupIssue);
}
})
.subscribe(pullRequest1 -> {/**/},
throwable -> sendToView(view -> view.showErrorIssueActionMsg(getPullRequest().getState() == IssueState.open))));
}, throwable -> sendToView(view -> view.showErrorIssueActionMsg(getPullRequest().getState() == IssueState.open))));
}
}
@ -191,14 +189,13 @@ class PullRequestPagerPresenter extends BasePresenter<PullRequestPagerMvp.View>
manageDisposable(
RxHelper.getObserver(RestProvider.getRepoService().getLabels(login, repoId))
.doOnSubscribe(disposable -> onSubscribed())
.doOnNext(response -> {
.subscribe(response -> {
if (response.getItems() != null && !response.getItems().isEmpty()) {
sendToView(view -> view.onLabelsRetrieved(response.getItems()));
} else {
sendToView(view -> view.showMessage(R.string.error, R.string.no_labels));
}
})
.subscribe(labelModelPageable -> {/**/}, throwable -> {
}, throwable -> {
sendToView(view -> view.showMessage(R.string.error, R.string.no_labels));
})
);
@ -267,7 +264,7 @@ class PullRequestPagerPresenter extends BasePresenter<PullRequestPagerMvp.View>
manageDisposable(
RxHelper.getObserver(RestProvider.getPullRequestService().mergePullRequest(login, repoId, issueNumber, mergeRequestModel))
.doOnSubscribe(disposable -> sendToView(view -> view.showProgress(0)))
.doOnNext(mergeResponseModel -> {
.subscribe(mergeResponseModel -> {
if (mergeResponseModel.isMerged()) {
sendToView(view -> {
view.showMessage(R.string.success, R.string.success_merge);
@ -276,8 +273,7 @@ class PullRequestPagerPresenter extends BasePresenter<PullRequestPagerMvp.View>
} else {
sendToView(view -> view.showErrorMessage(mergeResponseModel.getMessage()));
}
})
.subscribe(mergeResponseModel -> {/**/}, throwable -> sendToView(view -> view.showErrorMessage(throwable.getMessage())))
}, throwable -> sendToView(view -> view.showErrorMessage(throwable.getMessage())))
);
}
}

View File

@ -58,7 +58,7 @@ public class PullRequestCommitsFragment extends BaseFragment<PullRequestCommitsM
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -65,7 +65,7 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
}
@Override protected int fragmentLayout() {
return R.layout.fab_small_grid_refresh_list;
return R.layout.fab_micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -72,7 +72,7 @@ public class SearchIssuesFragment extends BaseFragment<SearchIssuesMvp.View, Sea
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -71,7 +71,7 @@ public class SearchReposFragment extends BaseFragment<SearchReposMvp.View, Searc
}
@Override protected int fragmentLayout() {
return R.layout.small_grid_refresh_list;
return R.layout.micro_grid_refresh_list;
}
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

View File

@ -0,0 +1,105 @@
package com.fastaccess.ui.modules.trending
import android.os.Bundle
import android.os.PersistableBundle
import android.support.v4.widget.DrawerLayout
import android.view.Gravity
import android.view.Menu
import android.view.MenuItem
import com.fastaccess.R
import com.fastaccess.helper.Logger
import com.fastaccess.ui.base.BaseActivity
import com.fastaccess.ui.modules.trending.fragment.TrendingFragment
import com.fastaccess.ui.widgets.FontTextView
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
/**
* Created by Kosh on 30 May 2017, 10:57 PM
*/
class TrendingActivity : BaseActivity<TrendingMvp.View, TrendingPresenter>(), TrendingMvp.View {
private var trendingFragment: TrendingFragment? = null
val languageList by lazy { findViewById(R.id.languageList) as DynamicRecyclerView }
val daily by lazy { findViewById(R.id.daily) as FontTextView }
val weekly by lazy { findViewById(R.id.weekly) as FontTextView }
val monthly by lazy { findViewById(R.id.monthly) as FontTextView }
val drawerLayout by lazy { findViewById(R.id.drawer) as DrawerLayout }
fun onDailyClicked() {
Logger.e()
daily.isSelected = true
weekly.isSelected = false
monthly.isSelected = false
setValues()
}
fun onWeeklyClicked() {
weekly.isSelected = true
daily.isSelected = false
monthly.isSelected = false
setValues()
}
fun onMonthlyClicked() {
monthly.isSelected = true
weekly.isSelected = false
daily.isSelected = false
setValues()
}
private fun setValues() {
trendingFragment?.onSetQuery("java", getSince())
}
override fun layout(): Int {
return R.layout.trending_activity_layout
}
override fun isTransparent(): Boolean {
return true
}
override fun canBack(): Boolean {
return true
}
override fun isSecured(): Boolean {
return false
}
override fun providePresenter(): TrendingPresenter {
return TrendingPresenter()
}
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
trendingFragment = supportFragmentManager.findFragmentById(R.id.trendingFragment) as TrendingFragment?
daily.setOnClickListener { onDailyClicked() }
weekly.setOnClickListener { onWeeklyClicked() }
monthly.setOnClickListener { onMonthlyClicked() }
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.trending_menu, menu)
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (item?.itemId == R.id.menu) {
drawerLayout.openDrawer(Gravity.END)
return true
}
return super.onOptionsItemSelected(item)
}
fun getSince(): String {
when {
daily.isSelected -> return "daily"
weekly.isSelected -> return "weekly"
monthly.isSelected -> return "monthly"
else -> return "daily"
}
}
}

View File

@ -0,0 +1,13 @@
package com.fastaccess.ui.modules.trending
import com.fastaccess.ui.base.mvp.BaseMvp
/**
* Created by Kosh on 30 May 2017, 10:51 PM
*/
interface TrendingMvp {
interface View : BaseMvp.FAView
interface Presenter
}

View File

@ -0,0 +1,9 @@
package com.fastaccess.ui.modules.trending
import com.fastaccess.ui.base.mvp.presenter.BasePresenter
/**
* Created by Kosh on 30 May 2017, 10:55 PM
*/
class TrendingPresenter : BasePresenter<TrendingMvp.View>(), TrendingMvp.Presenter

View File

@ -0,0 +1,83 @@
package com.fastaccess.ui.modules.trending.fragment
import android.os.Bundle
import android.support.v4.widget.SwipeRefreshLayout
import android.view.View
import com.fastaccess.R
import com.fastaccess.data.dao.kot.TrendingResponse
import com.fastaccess.helper.Logger
import com.fastaccess.ui.base.BaseFragment
import com.fastaccess.ui.widgets.StateLayout
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
import icepick.State
/**
* Created by Kosh on 30 May 2017, 11:37 PM
*/
class TrendingFragment : BaseFragment<TrendingFragmentMvp.View, TrendingFragmentPresenter>(), TrendingFragmentMvp.View {
val recycler by lazy { view!!.findViewById(R.id.recycler) as DynamicRecyclerView }
val refresh by lazy { view!!.findViewById(R.id.refresh) as SwipeRefreshLayout }
val stateLayout by lazy { view!!.findViewById(R.id.stateLayout) as StateLayout }
@State var lang: String? = null
@State var since: String? = null
override fun providePresenter(): TrendingFragmentPresenter {
return TrendingFragmentPresenter()
}
override fun fragmentLayout(): Int {
return R.layout.micro_grid_refresh_list
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
stateLayout.setEmptyText(R.string.no_trending)
recycler.setEmptyView(stateLayout, refresh)
refresh.setOnRefreshListener { onCallApi() }
stateLayout.setOnReloadListener { onCallApi() }
//TODO
}
override fun onNotifyAdapter(items: List<TrendingResponse>) {
hideProgress()
Logger.e(items)
}
override fun onSetQuery(lang: String, since: String) {
this.lang = lang
this.since = since
//TODO CLEAR ADAPTER
presenter.onCallApi(lang, since)
}
override fun showProgress(resId: Int) {
refresh.isRefreshing = true
stateLayout.hideProgress()
}
override fun hideProgress() {
refresh.isRefreshing = false
stateLayout.hideProgress()
}
override fun showMessage(titleRes: Int, msgRes: Int) {
hideProgress()
super.showMessage(titleRes, msgRes)
}
override fun showMessage(titleRes: String, msgRes: String) {
hideProgress()
super.showMessage(titleRes, msgRes)
}
override fun showErrorMessage(msgRes: String) {
hideProgress()
super.showErrorMessage(msgRes)
}
private fun onCallApi() {
if (lang != null && since != null) presenter.onCallApi(lang!!, since!!)
}
}

View File

@ -0,0 +1,21 @@
package com.fastaccess.ui.modules.trending.fragment
import com.fastaccess.data.dao.kot.TrendingResponse
import com.fastaccess.ui.base.mvp.BaseMvp
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder
/**
* Created by Kosh on 30 May 2017, 11:03 PM
*/
interface TrendingFragmentMvp {
interface View : BaseMvp.FAView {
fun onNotifyAdapter(items: List<TrendingResponse>)
fun onSetQuery(lang: String, since: String)
}
interface Presenter : BaseViewHolder.OnItemClickListener<TrendingResponse> {
fun onCallApi(lang: String, since: String)
}
}

View File

@ -0,0 +1,28 @@
package com.fastaccess.ui.modules.trending.fragment
import android.view.View
import com.fastaccess.data.dao.kot.TrendingResponse
import com.fastaccess.provider.rest.RestProvider
import com.fastaccess.ui.base.mvp.presenter.BasePresenter
/**
* Created by Kosh on 30 May 2017, 11:04 PM
*/
class TrendingFragmentPresenter : BasePresenter<TrendingFragmentMvp.View>(), TrendingFragmentMvp.Presenter {
override fun onItemLongClick(position: Int, v: View?, item: TrendingResponse?) {
//TODO
}
override fun onItemClick(position: Int, v: View?, item: TrendingResponse?) {
//TODO
}
override fun onCallApi(lang: String, since: String) {
makeRestCall<List<TrendingResponse>>(RestProvider.getTrendingService().getTrending(lang, since)) { response ->
sendToView { view -> view.onNotifyAdapter(response) }
}
}
}

View File

@ -9,8 +9,8 @@
android:paddingBottom="@dimen/spacing_micro"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingTop="@dimen/spacing_micro"
tools:showIn="@layout/repo_file_layout"
tools:ignore="RtlSymmetry">
tools:ignore="RtlSymmetry"
tools:showIn="@layout/repo_file_layout">
<LinearLayout
android:layout_width="0dp"
@ -40,8 +40,8 @@
android:layout_weight="1"
android:orientation="horizontal"
app:layoutManager="@string/linear_layout_manager"
tools:listitem="@layout/file_path_row_item"
tools:ignore="NestedWeights"/>
tools:ignore="NestedWeights"
tools:listitem="@layout/file_path_row_item"/>
<com.fastaccess.ui.widgets.ForegroundImageView
android:id="@+id/downloadRepoFiles"
@ -67,7 +67,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:layout_weight="1"
android:background="@drawable/left_border"
android:orientation="horizontal">

View File

@ -47,7 +47,7 @@
</LinearLayout>
<include layout="@layout/small_grid_refresh_list"/>
<include layout="@layout/micro_grid_refresh_list"/>
</LinearLayout>

View File

@ -20,7 +20,7 @@
android:paddingBottom="@dimen/fab_spacing"
android:scrollbars="vertical"
app:layoutManager="@string/staggered_layout_manager"
app:spanCount="@integer/small_spans"/>
app:spanCount="@integer/micro_spans"/>
</com.fastaccess.ui.widgets.AppbarRefreshLayout>

View File

@ -194,7 +194,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/scroll_behavior"
tools:layout="@layout/small_grid_refresh_list"/>
tools:layout="@layout/micro_grid_refresh_list"/>
</android.support.design.widget.CoordinatorLayout>
<include layout="@layout/nav_menu_layout"/>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MergeRootFrame">
<com.fastaccess.ui.widgets.AppbarRefreshLayout
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:layoutManager="@string/staggered_layout_manager"
app:spanCount="@integer/micro_spans"/>
</com.fastaccess.ui.widgets.AppbarRefreshLayout>
<include layout="@layout/state_layout"/>
</FrameLayout>

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:layoutManager="@string/staggered_layout_manager"
app:layoutManager="@string/grid_layout_manager"
app:spanCount="@integer/small_spans"/>
</com.fastaccess.ui.widgets.AppbarRefreshLayout>

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/appbar_elevation_dark"/>
<fragment
android:id="@+id/trendingFragment"
android:name="com.fastaccess.ui.modules.trending.fragment.TrendingFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/scroll_behavior"
tools:layout="@layout/micro_grid_refresh_list"/>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navMenu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
android:fitsSystemWindows="true"
app:itemIconTint="?android:textColorSecondary"
app:itemTextColor="?android:textColorPrimary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?actionBarSize"
android:orientation="horizontal"
android:paddingTop="@dimen/spacing_large">
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/daily"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:padding="@dimen/spacing_normal"
android:text="@string/daily"
android:textColor="@color/search_tab_highlighter"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/weekly"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:clickable="true"
android:gravity="center"
android:padding="@dimen/spacing_normal"
android:text="@string/weekly"
android:textColor="@color/search_tab_highlighter"/>
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/monthly"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:clickable="true"
android:gravity="center"
android:padding="@dimen/spacing_normal"
android:text="@string/monthly"
android:textColor="@color/search_tab_highlighter"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="?dividerColor"/>
<com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView
android:id="@+id/languageList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scrollbars="vertical"
app:layoutManager="@string/linear_layout_manager"/>
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>

View File

@ -91,7 +91,7 @@
android:orientation="vertical"
android:visibility="gone"
app:layoutManager="@string/staggered_layout_manager"
app:spanCount="@integer/small_spans"
app:spanCount="@integer/micro_spans"
tools:listitem="@layout/review_comments_row_item"
tools:visibility="visible"/>

View File

@ -42,8 +42,7 @@
<item
android:id="@+id/trending"
android:icon="@drawable/ic_trending"
android:title="@string/trending"
android:visible="false"/>
android:title="@string/trending"/>
<item
android:id="@+id/gists"
android:icon="@drawable/ic_gists"

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu"
android:icon="@drawable/ic_filter"
android:title="@string/filter"
app:showAsAction="always"/>
</menu>

View File

@ -2,6 +2,7 @@
<resources>
<dimen name="layout_margin">52dp</dimen>
<dimen name="fab_margin">24dp</dimen>
<integer name="small_spans">2</integer>
<integer name="micro_spans">2</integer>
<dimen name="grid_spacing">@dimen/spacing_micro</dimen>
<integer name="small_spans">2</integer>
</resources>

View File

@ -2,5 +2,5 @@
<resources>
<dimen name="layout_margin">32dp</dimen>
<dimen name="fab_margin">24dp</dimen>
<integer name="small_spans">1</integer>
<integer name="micro_spans">1</integer>
</resources>

View File

@ -2,6 +2,7 @@
<resources>
<dimen name="layout_margin">82dp</dimen>
<dimen name="fab_margin">24dp</dimen>
<integer name="small_spans">2</integer>
<integer name="micro_spans">2</integer>
<dimen name="grid_spacing">@dimen/spacing_micro</dimen>
<integer name="small_spans">2</integer>
</resources>

View File

@ -2,5 +2,6 @@
<resources>
<dimen name="layout_margin">58dp</dimen>
<dimen name="fab_margin">24dp</dimen>
<integer name="small_spans">1</integer>
<integer name="micro_spans">1</integer>
<integer name="small_spans">2</integer>
</resources>

View File

@ -1,6 +1,7 @@
<resources>
<dimen name="layout_margin">84dp</dimen>
<dimen name="fab_margin">24dp</dimen>
<integer name="small_spans">3</integer>
<integer name="micro_spans">3</integer>
<dimen name="grid_spacing">@dimen/spacing_micro</dimen>
<integer name="small_spans">2</integer>
</resources>

View File

@ -1,6 +1,6 @@
<resources>
<dimen name="layout_margin">64dp</dimen>
<dimen name="fab_margin">24dp</dimen>
<integer name="small_spans">2</integer>
<integer name="micro_spans">2</integer>
<dimen name="grid_spacing">@dimen/spacing_micro</dimen>
</resources>

View File

@ -124,6 +124,12 @@
<item>@string/all</item>
</string-array>
<string-array name="trending_days_array">
<item>Daily</item>
<item>Weekly</item>
<item>Monthly</item>
</string-array>
<!-- EmojiCompat Downloadable Fonts Arrays -->
<array name="fonts_certificate" translatable="false">
<item>@array/com_google_android_gms_fonts_certs_dev</item>

View File

@ -12,7 +12,6 @@
<dimen name="keyline_2">76dp</dimen>
<dimen name="fab_spacing">86dp</dimen> <!-- keyline + fab margin -->
<dimen name="fab_margin">16dp</dimen>
<integer name="small_spans">1</integer>
<dimen name="grid_spacing">0dp</dimen>
<dimen name="large_icon_zie">48dp</dimen>
<dimen name="header_icon_zie">64dp</dimen>
@ -22,4 +21,6 @@
<dimen name="divider_height">1px</dimen>
<dimen name="avatar_margin">16dp</dimen>
<dimen name="avatar_margin_end">16dp</dimen>
<integer name="micro_spans">1</integer>
<integer name="small_spans">1</integer>
</resources>

View File

@ -464,4 +464,10 @@
<string name="todo_checked">Todo checked</string>
<string name="todo_unchecked">Todo unchecked</string>
<string name="divider">Divider</string>
<string name="no_user_found">No user found</string>
<string name="no_trending">No trending</string>
<string name="daily" translatable="false">Daily</string>
<string name="weekly" translatable="false">Weekly</string>
<string name="monthly" translatable="false">Monthly</string>
<string name="filter">Filter</string>
</resources>

View File

@ -14,8 +14,7 @@ buildscript {
assertjVersion = '2.5.0'
espresseVersion = '2.2.2'
requery = '1.3.2'
retroJsoup = '1.0.3'
// kotlin_version = '1.1.2-4'
ext.kotlin_version = '1.1.2-4'
}
repositories {
@ -24,12 +23,12 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.4.0-alpha7'
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.novoda:gradle-build-properties-plugin:0.3'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
classpath 'io.fabric.tools:gradle:1.+'
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}