FR Prepping.

Preparation for future commit.
This commit is contained in:
Jedi Burrell 2017-05-15 10:27:02 -04:00
parent b27ec0c555
commit 6d2ffe0048
8 changed files with 164 additions and 7 deletions

View File

@ -148,6 +148,7 @@ dependencies {
compile 'com.github.nightwhistler:HtmlSpanner:0.4'
compile 'net.sourceforge.htmlcleaner:htmlcleaner:2.2'
compile 'com.github.matthiasrobbers:shortbread:1.0.1'
compile 'com.linkedin.android.spyglass:spyglass:1.4.0'
provided "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor 'io.requery:requery-processor:1.2.0'
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"

View File

@ -11,9 +11,10 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.fastaccess.BuildConfig;
import com.fastaccess.R;
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.helper.ActivityHelper;
@ -28,14 +29,16 @@ import com.fastaccess.helper.ViewHelper;
import com.fastaccess.provider.markdown.MarkDownProvider;
import com.fastaccess.ui.base.BaseActivity;
import com.fastaccess.ui.modules.editor.popup.EditorLinkImageDialogFragment;
import com.fastaccess.ui.widgets.FontEditText;
import com.fastaccess.ui.widgets.FontTextView;
import com.fastaccess.ui.widgets.ForegroundImageView;
import com.fastaccess.ui.widgets.dialog.MessageDialogView;
import com.linkedin.android.spyglass.tokenization.impl.WordTokenizerConfig;
import com.linkedin.android.spyglass.ui.MentionsEditText;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import es.dmoral.toasty.Toasty;
import icepick.State;
import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt;
@ -49,13 +52,20 @@ public class EditorActivity extends BaseActivity<EditorMvp.View, EditorPresenter
private String sentFromFastHub;
private static final WordTokenizerConfig tokenizerConfig = new WordTokenizerConfig
.Builder()
.setThreshold(1)
.build();
private CharSequence savedText = "";
@BindView(R.id.replyQuote) LinearLayout replyQuote;
@BindView(R.id.replyQuoteText) FontTextView quote;
@BindView(R.id.view) ForegroundImageView viewCode;
@BindView(R.id.editText) FontEditText editText;
@BindView(R.id.editText) MentionsEditText editText;
@BindView(R.id.editorIconsHolder) View editorIconsHolder;
@BindView(R.id.sentVia) CheckBox sentVia;
@BindView(R.id.autocomplete)
ListView mention;
@State @BundleConstant.ExtraTYpe String extraType;
@State String itemId;
@ -118,6 +128,9 @@ public class EditorActivity extends BaseActivity<EditorMvp.View, EditorPresenter
EditorLinkImageDialogFragment.newInstance(true).show(getSupportFragmentManager(), "EditorLinkImageDialogFragment");
} else if (v.getId() == R.id.image) {
EditorLinkImageDialogFragment.newInstance(false).show(getSupportFragmentManager(), "EditorLinkImageDialogFragment");
if(BuildConfig.DEBUG)
// Doesn't need a string, will only show up in debug.
Toasty.warning(this, "Image upload won't work unless you've entered your Imgur keys. You are on a debug build.").show();
} else {
getPresenter().onActionClicked(editText, v.getId());
}
@ -156,8 +169,9 @@ public class EditorActivity extends BaseActivity<EditorMvp.View, EditorPresenter
}
if(bundle.getString("message", "").isEmpty())
replyQuote.setVisibility(GONE);
else
else {
MarkDownProvider.setMdText(quote, bundle.getString("message", ""));
}
}
}
if (!PrefGetter.isEditorHintShowed()) {
@ -260,6 +274,7 @@ public class EditorActivity extends BaseActivity<EditorMvp.View, EditorPresenter
if (isLink) {
MarkDownProvider.addLink(editText, InputHelper.toString(title), InputHelper.toString(link));
} else {
editText.append("\n");
MarkDownProvider.addPhoto(editText, InputHelper.toString(title), InputHelper.toString(link));
}
}

View File

@ -2,6 +2,7 @@ package com.fastaccess.ui.modules.gists.gist.comments;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -9,8 +10,11 @@ import android.support.annotation.StringRes;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.View;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import com.fastaccess.R;
import com.fastaccess.data.dao.SparseBooleanArrayParcelable;
import com.fastaccess.data.dao.TimelineModel;
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.data.dao.model.User;
import com.fastaccess.helper.ActivityHelper;
@ -24,6 +28,9 @@ import com.fastaccess.ui.widgets.StateLayout;
import com.fastaccess.ui.widgets.dialog.MessageDialogView;
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import butterknife.BindView;
@ -46,6 +53,8 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
private CommentsAdapter adapter;
private OnLoadMore<String> onLoadMore;
private ArrayList<String> participants;
public static GistCommentsFragment newInstance(@NonNull String gistId) {
GistCommentsFragment view = new GistCommentsFragment();
view.setArguments(Bundler.start().put("gistId", gistId).end());
@ -83,6 +92,16 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
@Override public void onNotifyAdapter(@Nullable List<Comment> items, int page) {
hideProgress();
participants = null;
participants = (ArrayList<String>) Stream.of(items)
.map(comment -> comment.getUser().getLogin())
.collect(Collectors.toList());
HashSet<String> hashSet = new HashSet<String>();
hashSet.addAll(participants);
participants.clear();
participants.addAll(hashSet);
if (items == null || items.isEmpty()) {
adapter.clear();
return;
@ -107,7 +126,7 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
@Override public void showProgress(@StringRes int resId) {
refresh.setRefreshing(true);
refresh.setRefreshing(true);
stateLayout.showProgress();
}
@ -141,6 +160,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA, item.getBody())
.put(BundleConstant.EXTRA_FOUR, item.getId())
.put(BundleConstant.EXTRA_TYPE, EDIT_GIST_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -152,6 +172,7 @@ refresh.setRefreshing(true);
.start()
.put(BundleConstant.ID, gistId)
.put(BundleConstant.EXTRA_TYPE, NEW_GIST_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -163,6 +184,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA, id)
.put(BundleConstant.ID, gistId)
.put(BundleConstant.YES_NO_EXTRA, true)
.putStringArrayList("participants", participants)
.end())
.show(getChildFragmentManager(), MessageDialogView.TAG);
}
@ -174,6 +196,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.ID, gistId)
.put(BundleConstant.EXTRA, "@" + user.getLogin())
.put(BundleConstant.EXTRA_TYPE, NEW_GIST_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -186,6 +209,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.ID, gistId)
.put(BundleConstant.EXTRA, "@" + user.getLogin())
.put(BundleConstant.EXTRA_TYPE, NEW_GIST_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.put("message", message)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;

View File

@ -2,6 +2,7 @@ package com.fastaccess.ui.modules.repos.code.commit.details.comments;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -9,6 +10,8 @@ import android.support.annotation.StringRes;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.View;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import com.fastaccess.R;
import com.fastaccess.data.dao.SparseBooleanArrayParcelable;
import com.fastaccess.data.dao.TimelineModel;
@ -28,6 +31,9 @@ import com.fastaccess.ui.widgets.StateLayout;
import com.fastaccess.ui.widgets.dialog.MessageDialogView;
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import butterknife.BindView;
@ -47,6 +53,8 @@ public class CommitCommentsFragments extends BaseFragment<CommitCommentsMvp.View
private IssuePullsTimelineAdapter adapter;
private OnLoadMore onLoadMore;
private ArrayList<String> participants;
public static CommitCommentsFragments newInstance(@NonNull String login, @NonNull String repoId, @NonNull String sha) {
CommitCommentsFragments view = new CommitCommentsFragments();
view.setArguments(Bundler.start()
@ -87,6 +95,17 @@ public class CommitCommentsFragments extends BaseFragment<CommitCommentsMvp.View
@Override public void onNotifyAdapter(@Nullable List<TimelineModel> items, int page) {
hideProgress();
participants = null;
participants = (ArrayList<String>) Stream.of(items)
.filter(value -> value.getType() == TimelineModel.COMMENT)
.map(value -> value.getComment()).map(comment-> comment.getUser().getLogin())
.collect(Collectors.toList());
HashSet<String> hashSet = new HashSet<String>();
hashSet.addAll(participants);
participants.clear();
participants.addAll(hashSet);
if (items == null || items.isEmpty()) {
adapter.clear();
return;
@ -147,6 +166,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_FOUR, item.getId())
.put(BundleConstant.EXTRA, item.getBody())
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.EDIT_COMMIT_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -174,6 +194,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_THREE, getPresenter().sha())
.put(BundleConstant.EXTRA, user != null ? "@" + user.getLogin() : "")
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_COMMIT_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -188,6 +209,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_THREE, getPresenter().sha())
.put(BundleConstant.EXTRA, "@" + user.getLogin())
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_COMMIT_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.put("message", message)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;

View File

@ -2,12 +2,15 @@ package com.fastaccess.ui.modules.repos.issues.issue.details.timeline;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.view.View;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import com.fastaccess.R;
import com.fastaccess.data.dao.SparseBooleanArrayParcelable;
import com.fastaccess.data.dao.TimelineModel;
@ -30,6 +33,9 @@ import com.fastaccess.ui.widgets.dialog.MessageDialogView;
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView;
import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerFastScroller;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import butterknife.BindView;
@ -48,6 +54,8 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
private IssuePullsTimelineAdapter adapter;
@State SparseBooleanArrayParcelable sparseBooleanArray;
private ArrayList<String> participants;
public static IssueTimelineFragment newInstance(@NonNull Issue issueModel) {
IssueTimelineFragment view = new IssueTimelineFragment();
view.setArguments(Bundler.start().put(BundleConstant.ITEM, issueModel).end());//TODO fix this
@ -60,6 +68,19 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
@Override public void onNotifyAdapter(@Nullable List<TimelineModel> items) {
hideProgress();
participants = null;
participants = (ArrayList<String>) Stream.of(items)
.filter(value -> value.getType() == TimelineModel.COMMENT)
.map(value -> value.getComment()).map(comment-> comment.getUser().getLogin())
.collect(Collectors.toList());
HashSet<String> hashSet = new HashSet<String>();
hashSet.addAll(participants);
participants.clear();
participants.addAll(hashSet);
System.out.println("READ THIS: " + participants);
if (items == null || items.isEmpty()) {
adapter.clear();
return;
@ -96,7 +117,7 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
@Override public void showProgress(@StringRes int resId) {
refresh.setRefreshing(true);
refresh.setRefreshing(true);
stateLayout.showProgress();
}
@ -126,6 +147,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_FOUR, item.getId())
.put(BundleConstant.EXTRA, item.getBody())
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.EDIT_ISSUE_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -145,6 +167,7 @@ refresh.setRefreshing(true);
Bundler.start()
.put(BundleConstant.EXTRA, id)
.put(BundleConstant.YES_NO_EXTRA, true)
.putStringArrayList("participants", participants)
.end())
.show(getChildFragmentManager(), MessageDialogView.TAG);
}
@ -158,6 +181,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_THREE, getPresenter().number())
.put(BundleConstant.EXTRA, user != null ? "@" + user.getLogin() : "")
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -172,6 +196,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_THREE, getPresenter().number())
.put(BundleConstant.EXTRA, "@" + user.getLogin())
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.put("message", message)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;

View File

@ -2,12 +2,15 @@ package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timel
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.view.View;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import com.fastaccess.R;
import com.fastaccess.data.dao.ReviewCommentModel;
import com.fastaccess.data.dao.SparseBooleanArrayParcelable;
@ -30,6 +33,9 @@ import com.fastaccess.ui.widgets.dialog.MessageDialogView;
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView;
import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerFastScroller;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import butterknife.BindView;
@ -49,6 +55,8 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
private IssuePullsTimelineAdapter adapter;
@State SparseBooleanArrayParcelable sparseBooleanArray;
private ArrayList<String> participants;
public static PullRequestTimelineFragment newInstance(@NonNull PullRequest pullRequest) {
PullRequestTimelineFragment view = new PullRequestTimelineFragment();
view.setArguments(Bundler.start().put(BundleConstant.ITEM, pullRequest).end());//TODO fix this
@ -61,6 +69,17 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
@Override public void onNotifyAdapter(@Nullable List<TimelineModel> items) {
hideProgress();
participants = null;
participants = (ArrayList<String>) Stream.of(items)
.filter(value -> value.getType() == TimelineModel.COMMENT)
.map(value -> value.getComment()).map(comment-> comment.getUser().getLogin())
.collect(Collectors.toList());
HashSet<String> hashSet = new HashSet<String>();
hashSet.addAll(participants);
participants.clear();
participants.addAll(hashSet);
if (items == null || items.isEmpty()) {
adapter.clear();
return;
@ -141,6 +160,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_FOUR, item.getId())
.put(BundleConstant.EXTRA, item.getBody())
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.EDIT_ISSUE_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -165,6 +185,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA, id)
.put(BundleConstant.YES_NO_EXTRA, true)
.put(BundleConstant.EXTRA_TWO, isReviewComment)
.putStringArrayList("participants", participants)
.end())
.show(getChildFragmentManager(), MessageDialogView.TAG);
}
@ -178,6 +199,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_THREE, getPresenter().number())
.put(BundleConstant.EXTRA, user != null ? "@" + user.getLogin() : "")
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
@ -192,6 +214,7 @@ refresh.setRefreshing(true);
.put(BundleConstant.EXTRA_THREE, getPresenter().number())
.put(BundleConstant.EXTRA, "@" + user.getLogin())
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
.putStringArrayList("participants", participants)
.put("message", message)
.end());
View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler;

View File

@ -0,0 +1,41 @@
package com.fastaccess.ui.widgets;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.inputmethod.EditorInfo;
import com.fastaccess.helper.TypeFaceHelper;
import com.linkedin.android.spyglass.tokenization.impl.WordTokenizer;
import com.linkedin.android.spyglass.ui.MentionsEditText;
import com.linkedin.android.spyglass.ui.RichEditorView;
/**
* Created by JediB on 5/15/2017.
*/
public class MentionsFontEditText extends MentionsEditText{
public MentionsFontEditText(@NonNull Context context) {
super(context);
init();
}
public MentionsFontEditText(@NonNull Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MentionsFontEditText(@NonNull Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
if (isInEditMode()) return;
setInputType(getInputType() | EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN);
setImeOptions(getImeOptions() | EditorInfo.IME_FLAG_NO_FULLSCREEN);
TypeFaceHelper.applyTypeface(this);
}
}

View File

@ -39,7 +39,7 @@
android:background="?dividerColor"/>
</LinearLayout>
<com.fastaccess.ui.widgets.FontEditText
<com.linkedin.android.spyglass.ui.MentionsEditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -56,6 +56,12 @@
</ScrollView>
<ListView
android:id="@+id/autocomplete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:visibility="gone"/>
<View
android:layout_width="match_parent"
android:layout_height="4dp"