mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2026-01-25 14:47:05 +00:00
this commit adds in place commenting & tagging users while editing comments will remain in the editor screen.
This commit is contained in:
parent
74614bf1c1
commit
7eb6da91c2
@ -164,6 +164,7 @@ dependencies {
|
||||
implementation "petrov.kristiyan:colorpicker-library:1.1.4"
|
||||
implementation 'com.apollographql.apollo:apollo-rx2-support:0.4.0'
|
||||
implementation 'com.jaredrummler:android-device-names:1.1.4'
|
||||
implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
|
||||
compileOnly "org.projectlombok:lombok:${lombokVersion}"
|
||||
kapt "org.projectlombok:lombok:${lombokVersion}"
|
||||
kapt "com.evernote:android-state-processor:${state_version}"
|
||||
|
||||
@ -83,7 +83,8 @@
|
||||
<activity
|
||||
android:name=".ui.modules.repos.issues.issue.details.IssuePagerActivity"
|
||||
android:label="@string/issue"
|
||||
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
|
||||
android:parentActivityName=".ui.modules.repos.RepoPagerActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.modules.repos.RepoPagerActivity"/>
|
||||
@ -103,7 +104,8 @@
|
||||
<activity
|
||||
android:name=".ui.modules.repos.code.commit.details.CommitPagerActivity"
|
||||
android:label="@string/commit"
|
||||
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
|
||||
android:parentActivityName=".ui.modules.repos.RepoPagerActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.modules.repos.RepoPagerActivity"/>
|
||||
@ -124,7 +126,8 @@
|
||||
<activity
|
||||
android:name=".ui.modules.gists.gist.GistActivity"
|
||||
android:label="@string/gist"
|
||||
android:parentActivityName=".ui.modules.main.MainActivity">
|
||||
android:parentActivityName=".ui.modules.main.MainActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.modules.main.MainActivity"/>
|
||||
|
||||
@ -5,9 +5,15 @@ import android.support.annotation.StringDef;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraTYpe.EDIT_GIST_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraTYpe.FOR_RESULT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraTYpe.NEW_GIST_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_COMMIT_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_GIST_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_ISSUE_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_REVIEW_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.FOR_RESULT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_COMMIT_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_GIST_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_ISSUE_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_REVIEW_COMMENT_EXTRA;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 12 Nov 2016, 3:55 PM
|
||||
@ -35,12 +41,18 @@ public class BundleConstant {
|
||||
|
||||
|
||||
@StringDef({
|
||||
NEW_GIST_COMMENT_EXTRA,
|
||||
FOR_RESULT_EXTRA,
|
||||
EDIT_GIST_COMMENT_EXTRA,
|
||||
FOR_RESULT_EXTRA
|
||||
NEW_GIST_COMMENT_EXTRA,
|
||||
EDIT_ISSUE_COMMENT_EXTRA,
|
||||
NEW_ISSUE_COMMENT_EXTRA,
|
||||
EDIT_COMMIT_COMMENT_EXTRA,
|
||||
NEW_COMMIT_COMMENT_EXTRA,
|
||||
NEW_REVIEW_COMMENT_EXTRA,
|
||||
EDIT_REVIEW_COMMENT_EXTRA
|
||||
})
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE) public @interface ExtraTYpe {
|
||||
@Retention(RetentionPolicy.SOURCE) public @interface ExtraType {
|
||||
String FOR_RESULT_EXTRA = "for_result_extra";
|
||||
String EDIT_GIST_COMMENT_EXTRA = "edit_comment_extra";
|
||||
String NEW_GIST_COMMENT_EXTRA = "new_gist_comment_extra";
|
||||
|
||||
@ -30,13 +30,13 @@ public class EmojiDelimiterProcessor implements DelimiterProcessor {
|
||||
}
|
||||
|
||||
@Override public void process(Text opener, Text closer, int delimiterCount) {
|
||||
Node ins = new Emoji();
|
||||
Node emoji = new Emoji();
|
||||
Node tmp = opener.getNext();
|
||||
while (tmp != null && tmp != closer) {
|
||||
Node next = tmp.getNext();
|
||||
ins.appendChild(tmp);
|
||||
emoji.appendChild(tmp);
|
||||
tmp = next;
|
||||
}
|
||||
opener.insertAfter(ins);
|
||||
opener.insertAfter(emoji);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity;
|
||||
import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerActivity;
|
||||
import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.PullRequestPagerActivity;
|
||||
import com.fastaccess.ui.modules.repos.wiki.WikiActivity;
|
||||
import com.fastaccess.ui.modules.search.SearchActivity;
|
||||
import com.fastaccess.ui.modules.trending.TrendingActivity;
|
||||
import com.fastaccess.ui.modules.user.UserPagerActivity;
|
||||
|
||||
@ -338,6 +339,9 @@ public class SchemeParser {
|
||||
} else if (segments != null && !segments.isEmpty() && segments.size() > 1 && segments.get(0).equalsIgnoreCase("orgs")) {
|
||||
if ("invitation".equalsIgnoreCase(uri.getLastPathSegment())) {
|
||||
return null;
|
||||
} else if ("search".equalsIgnoreCase(uri.getLastPathSegment())) {
|
||||
String query = uri.getQueryParameter("q");
|
||||
return SearchActivity.getIntent(context, query);
|
||||
} else {
|
||||
return UserPagerActivity.createIntent(context, segments.get(1), true);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class EditorActivity : BaseActivity<EditorMvp.View, EditorPresenter>(), EditorMv
|
||||
@BindView(R.id.autocomplete) lateinit var mention: ListView
|
||||
|
||||
@State
|
||||
@BundleConstant.ExtraTYpe
|
||||
@BundleConstant.ExtraType
|
||||
var extraType: String? = null
|
||||
@State
|
||||
var itemId: String? = null
|
||||
@ -153,7 +153,7 @@ class EditorActivity : BaseActivity<EditorMvp.View, EditorPresenter>(), EditorMv
|
||||
if (menu.findItem(R.id.submit) != null) {
|
||||
menu.findItem(R.id.submit).isEnabled = true
|
||||
}
|
||||
if (BundleConstant.ExtraTYpe.FOR_RESULT_EXTRA.equals(extraType, ignoreCase = true)) {
|
||||
if (BundleConstant.ExtraType.FOR_RESULT_EXTRA.equals(extraType, ignoreCase = true)) {
|
||||
menu.findItem(R.id.submit).setIcon(R.drawable.ic_done)
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu)
|
||||
@ -172,7 +172,6 @@ class EditorActivity : BaseActivity<EditorMvp.View, EditorPresenter>(), EditorMv
|
||||
override fun onBackPressed() {
|
||||
if (!InputHelper.isEmpty(editText)) {
|
||||
ViewHelper.hideKeyboard(editText)
|
||||
CachedComments.instance.put(itemId, login, issueNumber, editText.savedText)
|
||||
}
|
||||
super.onBackPressed()
|
||||
}
|
||||
@ -195,7 +194,7 @@ class EditorActivity : BaseActivity<EditorMvp.View, EditorPresenter>(), EditorMv
|
||||
|
||||
override fun getEditText(): EditText = editText
|
||||
|
||||
override fun getSavedText(): CharSequence = editText.savedText
|
||||
override fun getSavedText(): CharSequence? = editText.savedText
|
||||
|
||||
override fun fragmentManager(): FragmentManager = supportFragmentManager
|
||||
|
||||
@ -209,11 +208,11 @@ class EditorActivity : BaseActivity<EditorMvp.View, EditorPresenter>(), EditorMv
|
||||
if (intent != null && intent.extras != null) {
|
||||
val bundle = intent.extras
|
||||
extraType = bundle.getString(BundleConstant.EXTRA_TYPE)
|
||||
reviewComment = bundle.getParcelable<EditReviewCommentModel>(BundleConstant.REVIEW_EXTRA)
|
||||
reviewComment = bundle.getParcelable(BundleConstant.REVIEW_EXTRA)
|
||||
itemId = bundle.getString(BundleConstant.ID)
|
||||
login = bundle.getString(BundleConstant.EXTRA_TWO)
|
||||
if (extraType.equals(BundleConstant.ExtraTYpe.EDIT_COMMIT_COMMENT_EXTRA, ignoreCase = true)
|
||||
|| extraType.equals(BundleConstant.ExtraTYpe.NEW_COMMIT_COMMENT_EXTRA, ignoreCase = true)) {
|
||||
if (extraType.equals(BundleConstant.ExtraType.EDIT_COMMIT_COMMENT_EXTRA, ignoreCase = true)
|
||||
|| extraType.equals(BundleConstant.ExtraType.NEW_COMMIT_COMMENT_EXTRA, ignoreCase = true)) {
|
||||
sha = bundle.getString(BundleConstant.EXTRA_THREE)
|
||||
} else {
|
||||
issueNumber = bundle.getInt(BundleConstant.EXTRA_THREE)
|
||||
@ -231,8 +230,5 @@ class EditorActivity : BaseActivity<EditorMvp.View, EditorPresenter>(), EditorMv
|
||||
}
|
||||
participants = bundle.getStringArrayList("participants")
|
||||
}
|
||||
if (InputHelper.isEmpty(editText)) {
|
||||
editText.setText(CachedComments.instance.get(itemId, login, issueNumber))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37,7 +37,7 @@ interface EditorMvp {
|
||||
|
||||
fun onEditCommitComment(savedText: CharSequence, itemId: String, login: String, id: Long)
|
||||
|
||||
fun onHandleSubmission(savedText: CharSequence?, @BundleConstant.ExtraTYpe extraType: String?,
|
||||
fun onHandleSubmission(savedText: CharSequence?, @BundleConstant.ExtraType extraType: String?,
|
||||
itemId: String?, id: Long, login: String?, issueNumber: Int, sha: String?,
|
||||
reviewComment: EditReviewCommentModel?)
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import com.fastaccess.data.dao.CommentRequestModel
|
||||
import com.fastaccess.data.dao.EditReviewCommentModel
|
||||
import com.fastaccess.data.dao.model.Comment
|
||||
import com.fastaccess.helper.BundleConstant
|
||||
import com.fastaccess.helper.BundleConstant.ExtraTYpe.*
|
||||
import com.fastaccess.helper.BundleConstant.ExtraType.*
|
||||
import com.fastaccess.helper.InputHelper
|
||||
import com.fastaccess.provider.rest.RestProvider
|
||||
import com.fastaccess.ui.base.mvp.presenter.BasePresenter
|
||||
@ -33,7 +33,7 @@ class EditorPresenter : BasePresenter<EditorMvp.View>(), EditorMvp.Presenter {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onHandleSubmission(savedText: CharSequence?, @BundleConstant.ExtraTYpe extraType: String?,
|
||||
override fun onHandleSubmission(savedText: CharSequence?, @BundleConstant.ExtraType extraType: String?,
|
||||
itemId: String?, id: Long, login: String?, issueNumber: Int,
|
||||
sha: String?, reviewComment: EditReviewCommentModel?) {
|
||||
if (extraType == null) {
|
||||
|
||||
@ -0,0 +1,121 @@
|
||||
package com.fastaccess.ui.modules.editor.comment
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.FragmentManager
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import com.fastaccess.R
|
||||
import com.fastaccess.helper.BundleConstant
|
||||
import com.fastaccess.helper.Bundler
|
||||
import com.fastaccess.helper.InputHelper
|
||||
import com.fastaccess.helper.ViewHelper
|
||||
import com.fastaccess.provider.emoji.Emoji
|
||||
import com.fastaccess.ui.base.BaseFragment
|
||||
import com.fastaccess.ui.base.mvp.BaseMvp
|
||||
import com.fastaccess.ui.base.mvp.presenter.BasePresenter
|
||||
import com.fastaccess.ui.modules.editor.EditorActivity
|
||||
import com.fastaccess.ui.modules.editor.emoji.EmojiMvp
|
||||
import com.fastaccess.ui.widgets.markdown.MarkDownLayout
|
||||
import com.fastaccess.ui.widgets.markdown.MarkdownEditText
|
||||
|
||||
/**
|
||||
* Created by kosh on 21/08/2017.
|
||||
*/
|
||||
class CommentEditorFragment : BaseFragment<BaseMvp.FAView, BasePresenter<BaseMvp.FAView>>(), MarkDownLayout.MarkdownListener,
|
||||
EmojiMvp.EmojiCallback {
|
||||
|
||||
@BindView(R.id.commentBox) lateinit var commentBox: View
|
||||
@BindView(R.id.markdDownLayout) lateinit var markdDownLayout: MarkDownLayout
|
||||
@BindView(R.id.commentText) lateinit var commentText: MarkdownEditText
|
||||
private var commentListener: CommentListener? = null
|
||||
|
||||
@OnClick(R.id.sendComment) internal fun onComment() {
|
||||
if (!InputHelper.isEmpty(getEditText())) {
|
||||
commentListener?.onSendActionClicked(InputHelper.toString(getEditText()), arguments?.getBundle(BundleConstant.ITEM))
|
||||
getEditText().setText("")
|
||||
ViewHelper.hideKeyboard(getEditText())
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.fullScreenComment) internal fun onExpandScreen() {
|
||||
val intent = Intent(context, EditorActivity::class.java)
|
||||
intent.putExtras(Bundler.start()
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.FOR_RESULT_EXTRA)
|
||||
.put(BundleConstant.EXTRA, getEditText().text.toString())
|
||||
.end())
|
||||
startActivityForResult(intent, BundleConstant.REQUEST_CODE)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context?) {
|
||||
super.onAttach(context)
|
||||
if (parentFragment is CommentListener) {
|
||||
commentListener = parentFragment as CommentListener
|
||||
} else if (context is CommentListener) {
|
||||
commentListener = context
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetach() {
|
||||
commentListener = null
|
||||
super.onDetach()
|
||||
}
|
||||
|
||||
override fun providePresenter(): BasePresenter<BaseMvp.FAView> = BasePresenter()
|
||||
|
||||
override fun fragmentLayout(): Int = R.layout.comment_box_layout
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
markdDownLayout.markdownListener = this
|
||||
if (savedInstanceState == null) {
|
||||
commentText.setText(arguments?.getBundle(BundleConstant.ITEM)?.getString(BundleConstant.EXTRA))
|
||||
}
|
||||
}
|
||||
|
||||
override fun getEditText(): EditText = commentText
|
||||
|
||||
override fun fragmentManager(): FragmentManager = childFragmentManager
|
||||
|
||||
override fun getSavedText(): CharSequence? = commentText.savedText
|
||||
|
||||
override fun onEmojiAdded(emoji: Emoji?) = markdDownLayout.onEmojiAdded(emoji)
|
||||
|
||||
fun onAddUserName(username: String) {
|
||||
getEditText().setText(if (getEditText().text.isNullOrBlank()) {
|
||||
"@$username"
|
||||
} else {
|
||||
"${getEditText().text} @$username"
|
||||
})
|
||||
getEditText().setSelection(getEditText().text.length)
|
||||
}
|
||||
|
||||
interface CommentListener {
|
||||
fun onSendActionClicked(text: String, bundle: Bundle?)
|
||||
fun onTagUser(username: String)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
if (requestCode == BundleConstant.REQUEST_CODE) {
|
||||
val text = data?.extras?.getCharSequence(BundleConstant.EXTRA)
|
||||
getEditText().setText(text)
|
||||
getEditText().setSelection(getEditText().text.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(bundle: Bundle?): CommentEditorFragment {
|
||||
val fragment = CommentEditorFragment()
|
||||
bundle?.let {
|
||||
fragment.arguments = Bundler.start().put(BundleConstant.ITEM, bundle).end()
|
||||
}
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,7 @@ class AddGistBottomSheetDialog : BaseDialogFragment<AddGistMvp.View, AddGistPres
|
||||
|
||||
override fun fragmentManager(): FragmentManager = childFragmentManager
|
||||
|
||||
override fun getSavedText(): CharSequence = editText.savedText
|
||||
override fun getSavedText(): CharSequence? = editText.savedText
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
markDownLayout.markdownListener = this
|
||||
|
||||
@ -30,6 +30,7 @@ import com.fastaccess.provider.tasks.git.GithubActionService;
|
||||
import com.fastaccess.ui.adapter.FragmentsPagerAdapter;
|
||||
import com.fastaccess.ui.base.BaseActivity;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.gists.create.CreateGistActivity;
|
||||
import com.fastaccess.ui.modules.gists.gist.comments.GistCommentsFragment;
|
||||
import com.fastaccess.ui.modules.main.premium.PremiumActivity;
|
||||
@ -62,6 +63,7 @@ public class GistActivity extends BaseActivity<GistMvp.View, GistPresenter>
|
||||
@BindView(R.id.edit) View edit;
|
||||
private int accentColor;
|
||||
private int iconColor;
|
||||
private CommentEditorFragment commentEditorFragment;
|
||||
|
||||
public static Intent createIntent(@NonNull Context context, @NonNull String gistId, boolean isEnterprise) {
|
||||
Intent intent = new Intent(context, GistActivity.class);
|
||||
@ -72,17 +74,6 @@ public class GistActivity extends BaseActivity<GistMvp.View, GistPresenter>
|
||||
return intent;
|
||||
}
|
||||
|
||||
@OnClick(R.id.fab) void onAddComment() {
|
||||
if (pager != null && pager.getAdapter() != null) {
|
||||
GistCommentsFragment view = (GistCommentsFragment) pager.getAdapter().instantiateItem(pager, 1);
|
||||
if (view != null) {
|
||||
view.onStartNewComment();
|
||||
} else {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.detailsIcon) void onTitleClick() {
|
||||
if (getPresenter().getGist() != null && !InputHelper.isEmpty(getPresenter().getGist().getDescription()))
|
||||
MessageDialogView.newInstance(getString(R.string.details), getPresenter().getGist().getDescription(), false, true)
|
||||
@ -141,6 +132,8 @@ public class GistActivity extends BaseActivity<GistMvp.View, GistPresenter>
|
||||
|
||||
@Override protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
fab.hide();
|
||||
commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment);
|
||||
accentColor = ViewHelper.getAccentColor(this);
|
||||
iconColor = ViewHelper.getIconColor(this);
|
||||
if (savedInstanceState == null) {
|
||||
@ -273,11 +266,24 @@ public class GistActivity extends BaseActivity<GistMvp.View, GistPresenter>
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onSendActionClicked(@NonNull String text, Bundle bundle) {
|
||||
if (pager == null || pager.getAdapter() == null) return;
|
||||
GistCommentsFragment view = (GistCommentsFragment) pager.getAdapter().instantiateItem(pager, 1);
|
||||
if (view != null) {
|
||||
view.onHandleComment(text, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onTagUser(@NonNull String username) {
|
||||
commentEditorFragment.onAddUserName(username);
|
||||
}
|
||||
|
||||
|
||||
private void hideShowFab() {
|
||||
if (pager.getCurrentItem() == 1) {
|
||||
fab.show();
|
||||
getSupportFragmentManager().beginTransaction().show(commentEditorFragment).commit();
|
||||
} else {
|
||||
fab.hide();
|
||||
getSupportFragmentManager().beginTransaction().hide(commentEditorFragment).commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
|
||||
|
||||
import com.fastaccess.data.dao.model.Gist;
|
||||
import com.fastaccess.ui.base.mvp.BaseMvp;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 12 Nov 2016, 12:17 PM
|
||||
@ -13,7 +14,7 @@ import com.fastaccess.ui.base.mvp.BaseMvp;
|
||||
|
||||
interface GistMvp {
|
||||
|
||||
interface View extends BaseMvp.FAView {
|
||||
interface View extends BaseMvp.FAView, CommentEditorFragment.CommentListener {
|
||||
void onSuccessDeleted();
|
||||
|
||||
void onErrorDeleting();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.fastaccess.ui.modules.gists.gist.comments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -22,6 +23,7 @@ import com.fastaccess.provider.timeline.CommentsHelper;
|
||||
import com.fastaccess.ui.adapter.CommentsAdapter;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.editor.EditorActivity;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.widgets.StateLayout;
|
||||
import com.fastaccess.ui.widgets.dialog.MessageDialogView;
|
||||
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView;
|
||||
@ -31,8 +33,7 @@ import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraTYpe.EDIT_GIST_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraTYpe.NEW_GIST_COMMENT_EXTRA;
|
||||
import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_GIST_COMMENT_EXTRA;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 11 Nov 2016, 12:36 PM
|
||||
@ -45,6 +46,7 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
|
||||
@BindView(R.id.stateLayout) StateLayout stateLayout;
|
||||
@BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller;
|
||||
@State SparseBooleanArrayParcelable sparseBooleanArray;
|
||||
private CommentEditorFragment.CommentListener commentsCallback;
|
||||
private String gistId;
|
||||
private CommentsAdapter adapter;
|
||||
private OnLoadMore<String> onLoadMore;
|
||||
@ -55,6 +57,23 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
|
||||
return view;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") @Override public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (getParentFragment() instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment();
|
||||
} else if (context instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) context;
|
||||
} else {
|
||||
throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener",
|
||||
context.getClass().getSimpleName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onDetach() {
|
||||
commentsCallback = null;
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
@Override protected int fragmentLayout() {
|
||||
return R.layout.fab_micro_grid_refresh_list;
|
||||
}
|
||||
@ -152,19 +171,6 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
|
||||
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
|
||||
}
|
||||
|
||||
@Override public void onStartNewComment() {
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, gistId)
|
||||
.put(BundleConstant.EXTRA_TYPE, NEW_GIST_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsers(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.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);
|
||||
}
|
||||
|
||||
@Override public void onShowDeleteMsg(long id) {
|
||||
MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message),
|
||||
Bundler.start()
|
||||
@ -176,33 +182,23 @@ public class GistCommentsFragment extends BaseFragment<GistCommentsMvp.View, Gis
|
||||
.show(getChildFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
@Override public void onTagUser(@NonNull User user) {
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, gistId)
|
||||
.put(BundleConstant.EXTRA, "@" + user.getLogin())
|
||||
.put(BundleConstant.EXTRA_TYPE, NEW_GIST_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsers(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.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);
|
||||
@Override public void onTagUser(@Nullable User user) {
|
||||
if (commentsCallback != null && user != null) {
|
||||
commentsCallback.onTagUser(user.getLogin());
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onReply(User user, String message) {
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, gistId)
|
||||
.put(BundleConstant.EXTRA, "@" + user.getLogin())
|
||||
.put(BundleConstant.EXTRA_TYPE, NEW_GIST_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsers(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.put("message", message)
|
||||
.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);
|
||||
onTagUser(user);
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
|
||||
getPresenter().onHandleComment(text, bundle, gistId);
|
||||
}
|
||||
|
||||
@Override public void onAddNewComment(@NonNull Comment comment) {
|
||||
hideProgress();
|
||||
adapter.addItem(comment);
|
||||
}
|
||||
|
||||
@Override public void onDestroyView() {
|
||||
|
||||
@ -31,13 +31,15 @@ interface GistCommentsMvp {
|
||||
|
||||
void onEditComment(@NonNull Comment item);
|
||||
|
||||
void onStartNewComment();
|
||||
|
||||
void onShowDeleteMsg(long id);
|
||||
|
||||
void onTagUser(@NonNull User user);
|
||||
|
||||
void onReply(User user, String message);
|
||||
|
||||
void onHandleComment(@NonNull String text, @Nullable Bundle bundle);
|
||||
|
||||
void onAddNewComment(@NonNull Comment comment);
|
||||
}
|
||||
|
||||
interface Presenter extends BaseMvp.FAPresenter,
|
||||
@ -49,6 +51,8 @@ interface GistCommentsMvp {
|
||||
void onHandleDeletion(@Nullable Bundle bundle);
|
||||
|
||||
void onWorkOffline(@NonNull String gistId);
|
||||
|
||||
void onHandleComment(@NonNull String text, @Nullable Bundle bundle, String gistId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.CommentRequestModel;
|
||||
import com.fastaccess.data.dao.model.Comment;
|
||||
import com.fastaccess.data.dao.model.Login;
|
||||
import com.fastaccess.helper.BundleConstant;
|
||||
@ -103,6 +104,13 @@ class GistCommentsPresenter extends BasePresenter<GistCommentsMvp.View> implemen
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle, String gistId) {
|
||||
CommentRequestModel model = new CommentRequestModel();
|
||||
model.setBody(text);
|
||||
makeRestCall(RestProvider.getGistService(isEnterprise()).createGistComment(gistId, model),
|
||||
comment -> sendToView(view -> view.onAddNewComment(comment)));
|
||||
}
|
||||
|
||||
@Override public void onItemClick(int position, View v, Comment item) {
|
||||
if (getView() == null) return;
|
||||
if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder) {
|
||||
|
||||
@ -31,6 +31,7 @@ import com.fastaccess.provider.timeline.HtmlHelper;
|
||||
import com.fastaccess.ui.adapter.FragmentsPagerAdapter;
|
||||
import com.fastaccess.ui.base.BaseActivity;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerActivity;
|
||||
import com.fastaccess.ui.modules.repos.code.commit.details.comments.CommitCommentsFragment;
|
||||
import com.fastaccess.ui.widgets.AvatarLayout;
|
||||
@ -63,6 +64,7 @@ public class CommitPagerActivity extends BaseActivity<CommitPagerMvp.View, Commi
|
||||
@BindView(R.id.deletion) FontTextView deletion;
|
||||
@BindView(R.id.coordinatorLayout) CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.detailsIcon) View detailsIcon;
|
||||
private CommentEditorFragment commentEditorFragment;
|
||||
|
||||
public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, @NonNull String sha) {
|
||||
return createIntent(context, repoId, login, sha, false);
|
||||
@ -98,14 +100,6 @@ public class CommitPagerActivity extends BaseActivity<CommitPagerMvp.View, Commi
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
@OnClick(R.id.fab) void onAddComment() {
|
||||
if (pager == null || pager.getAdapter() == null) return;
|
||||
CommitCommentsFragment view = (CommitCommentsFragment) pager.getAdapter().instantiateItem(pager, 1);
|
||||
if (view != null) {
|
||||
view.onStartNewComment();
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected int layout() {
|
||||
return R.layout.commit_pager_activity;
|
||||
}
|
||||
@ -128,6 +122,8 @@ public class CommitPagerActivity extends BaseActivity<CommitPagerMvp.View, Commi
|
||||
|
||||
@Override protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
fab.hide();
|
||||
commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment);
|
||||
setTitle("");
|
||||
if (savedInstanceState == null) {
|
||||
getPresenter().onActivityCreated(getIntent());
|
||||
@ -249,11 +245,23 @@ public class CommitPagerActivity extends BaseActivity<CommitPagerMvp.View, Commi
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override public void onSendActionClicked(@NonNull String text, Bundle bundle) {
|
||||
if (pager == null || pager.getAdapter() == null) return;
|
||||
CommitCommentsFragment view = (CommitCommentsFragment) pager.getAdapter().instantiateItem(pager, 1);
|
||||
if (view != null) {
|
||||
view.onHandleComment(text, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onTagUser(@NonNull String username) {
|
||||
commentEditorFragment.onAddUserName(username);
|
||||
}
|
||||
|
||||
private void hideShowFab() {
|
||||
if (pager.getCurrentItem() == 1) {
|
||||
fab.show();
|
||||
getSupportFragmentManager().beginTransaction().show(commentEditorFragment).commit();
|
||||
} else {
|
||||
fab.hide();
|
||||
getSupportFragmentManager().beginTransaction().hide(commentEditorFragment).commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import android.support.annotation.Nullable;
|
||||
import com.fastaccess.data.dao.model.Comment;
|
||||
import com.fastaccess.data.dao.model.Commit;
|
||||
import com.fastaccess.ui.base.mvp.BaseMvp;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 10 Dec 2016, 9:21 AM
|
||||
@ -14,7 +15,7 @@ import com.fastaccess.ui.base.mvp.BaseMvp;
|
||||
|
||||
public interface CommitPagerMvp {
|
||||
|
||||
interface View extends BaseMvp.FAView {
|
||||
interface View extends BaseMvp.FAView, CommentEditorFragment.CommentListener {
|
||||
|
||||
void onSetup();
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.fastaccess.ui.modules.repos.code.commit.details.comments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -24,6 +25,7 @@ import com.fastaccess.provider.timeline.ReactionsProvider;
|
||||
import com.fastaccess.ui.adapter.IssuesTimelineAdapter;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.editor.EditorActivity;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.repos.reactions.ReactionsDialogFragment;
|
||||
import com.fastaccess.ui.widgets.StateLayout;
|
||||
import com.fastaccess.ui.widgets.dialog.MessageDialogView;
|
||||
@ -47,7 +49,7 @@ public class CommitCommentsFragment extends BaseFragment<CommitCommentsMvp.View,
|
||||
@BindView(R.id.stateLayout) StateLayout stateLayout;
|
||||
@BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller;
|
||||
@State HashMap<Long, Boolean> toggleMap = new LinkedHashMap<>();
|
||||
|
||||
private CommentEditorFragment.CommentListener commentsCallback;
|
||||
private IssuesTimelineAdapter adapter;
|
||||
private OnLoadMore onLoadMore;
|
||||
|
||||
@ -61,6 +63,23 @@ public class CommitCommentsFragment extends BaseFragment<CommitCommentsMvp.View,
|
||||
return view;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") @Override public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (getParentFragment() instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment();
|
||||
} else if (context instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) context;
|
||||
} else {
|
||||
throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener",
|
||||
context.getClass().getSimpleName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onDetach() {
|
||||
commentsCallback = null;
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
@Override protected int fragmentLayout() {
|
||||
return R.layout.fab_micro_grid_refresh_list;
|
||||
}
|
||||
@ -150,7 +169,7 @@ public class CommitCommentsFragment extends BaseFragment<CommitCommentsMvp.View,
|
||||
.put(BundleConstant.EXTRA_THREE, getPresenter().sha())
|
||||
.put(BundleConstant.EXTRA_FOUR, item.getId())
|
||||
.put(BundleConstant.EXTRA, item.getBody())
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.EDIT_COMMIT_COMMENT_EXTRA)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_COMMIT_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.end());
|
||||
@ -158,10 +177,6 @@ public class CommitCommentsFragment extends BaseFragment<CommitCommentsMvp.View,
|
||||
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
|
||||
}
|
||||
|
||||
@Override public void onStartNewComment() {
|
||||
onTagUser(null);
|
||||
}
|
||||
|
||||
@Override public void onShowDeleteMsg(long id) {
|
||||
MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message),
|
||||
Bundler.start()
|
||||
@ -172,36 +187,13 @@ public class CommitCommentsFragment extends BaseFragment<CommitCommentsMvp.View,
|
||||
}
|
||||
|
||||
@Override public void onTagUser(@Nullable User user) {
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, getPresenter().repoId())
|
||||
.put(BundleConstant.EXTRA_TWO, getPresenter().login())
|
||||
.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", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.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);
|
||||
if (commentsCallback != null && user != null) {
|
||||
commentsCallback.onTagUser(user.getLogin());
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onReply(User user, String message) {
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, getPresenter().repoId())
|
||||
.put(BundleConstant.EXTRA_TWO, getPresenter().login())
|
||||
.put(BundleConstant.EXTRA_THREE, getPresenter().sha())
|
||||
.put(BundleConstant.EXTRA, "@" + user.getLogin())
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_COMMIT_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.put("message", message)
|
||||
.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);
|
||||
onTagUser(user);
|
||||
}
|
||||
|
||||
@Override public void showReactionsPopup(@NonNull ReactionTypes reactionTypes, @NonNull String login, @NonNull String repoId, long commentId) {
|
||||
@ -210,6 +202,7 @@ public class CommitCommentsFragment extends BaseFragment<CommitCommentsMvp.View,
|
||||
}
|
||||
|
||||
@Override public void addComment(@NonNull Comment newComment) {
|
||||
hideProgress();
|
||||
if (adapter != null) {
|
||||
adapter.addItem(TimelineModel.constructComment(newComment));
|
||||
}
|
||||
@ -294,4 +287,8 @@ public class CommitCommentsFragment extends BaseFragment<CommitCommentsMvp.View,
|
||||
hideProgress();
|
||||
stateLayout.showReload(adapter.getItemCount());
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
|
||||
getPresenter().onHandleComment(text, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,8 +35,6 @@ interface CommitCommentsMvp {
|
||||
|
||||
void onEditComment(@NonNull Comment item);
|
||||
|
||||
void onStartNewComment();
|
||||
|
||||
void onShowDeleteMsg(long id);
|
||||
|
||||
void onTagUser(@Nullable User user);
|
||||
@ -48,6 +46,8 @@ interface CommitCommentsMvp {
|
||||
void addComment(@NonNull Comment newComment);
|
||||
|
||||
void showReload();
|
||||
|
||||
void onHandleComment(@NonNull String text, @Nullable Bundle bundle);
|
||||
}
|
||||
|
||||
interface Presenter extends BaseMvp.FAPresenter,
|
||||
@ -70,6 +70,8 @@ interface CommitCommentsMvp {
|
||||
boolean isPreviouslyReacted(long commentId, int vId);
|
||||
|
||||
boolean isCallingApi(long id, int vId);
|
||||
|
||||
void onHandleComment(@NonNull String text, @Nullable Bundle bundle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.CommentRequestModel;
|
||||
import com.fastaccess.data.dao.TimelineModel;
|
||||
import com.fastaccess.data.dao.model.Comment;
|
||||
import com.fastaccess.data.dao.model.Login;
|
||||
@ -137,6 +138,13 @@ class CommitCommentsPresenter extends BasePresenter<CommitCommentsMvp.View> impl
|
||||
return getReactionsProvider().isCallingApi(id, vId);
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
|
||||
CommentRequestModel model = new CommentRequestModel();
|
||||
model.setBody(text);
|
||||
makeRestCall(RestProvider.getRepoService(isEnterprise()).postCommitComment(login, repoId, sha, model),
|
||||
comment -> sendToView(view -> view.addComment(comment)));
|
||||
}
|
||||
|
||||
@Override public void onItemClick(int position, View v, TimelineModel timelineModel) {
|
||||
if (getView() != null) {
|
||||
Comment item = timelineModel.getComment();
|
||||
|
||||
@ -285,7 +285,7 @@ public class CreateIssueActivity extends BaseActivity<CreateIssueMvp.View, Creat
|
||||
Intent intent = new Intent(this, EditorActivity.class);
|
||||
intent.putExtras(Bundler.start()
|
||||
.put(BundleConstant.EXTRA, InputHelper.toString(savedText))
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.FOR_RESULT_EXTRA)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.FOR_RESULT_EXTRA)
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.end());
|
||||
ActivityHelper.startReveal(this, intent, submit, BundleConstant.REQUEST_CODE);
|
||||
|
||||
@ -25,12 +25,12 @@ import com.fastaccess.helper.ActivityHelper;
|
||||
import com.fastaccess.helper.BundleConstant;
|
||||
import com.fastaccess.helper.Bundler;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.Logger;
|
||||
import com.fastaccess.helper.ParseDateFormat;
|
||||
import com.fastaccess.helper.ViewHelper;
|
||||
import com.fastaccess.provider.scheme.LinkParserHelper;
|
||||
import com.fastaccess.ui.adapter.FragmentsPagerAdapter;
|
||||
import com.fastaccess.ui.base.BaseActivity;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerActivity;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerMvp;
|
||||
import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesDialogFragment;
|
||||
@ -68,6 +68,7 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
|
||||
@BindView(R.id.detailsIcon) View detailsIcon;
|
||||
@State boolean isClosed;
|
||||
@State boolean isOpened;
|
||||
private CommentEditorFragment commentEditorFragment;
|
||||
|
||||
public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, int number) {
|
||||
return createIntent(context, repoId, login, number, false);
|
||||
@ -102,15 +103,6 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
@OnClick(R.id.fab) void onAddComment() {
|
||||
if (pager != null && pager.getAdapter() != null) {
|
||||
IssueTimelineFragment view = (IssueTimelineFragment) pager.getAdapter().instantiateItem(pager, 0);
|
||||
if (view != null) {
|
||||
view.onStartNewComment();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected int layout() {
|
||||
return R.layout.issue_pager_activity;
|
||||
}
|
||||
@ -133,7 +125,7 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
|
||||
|
||||
@Override protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Logger.e(isEnterprise());
|
||||
commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment);
|
||||
tabs.setVisibility(View.GONE);
|
||||
if (savedInstanceState == null) {
|
||||
getPresenter().onActivityCreated(getIntent());
|
||||
@ -142,6 +134,7 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
|
||||
}
|
||||
startGist.setVisibility(View.GONE);
|
||||
forkGist.setVisibility(View.GONE);
|
||||
fab.hide();
|
||||
if (getPresenter().showToRepoBtn()) showNavToRepoItem();
|
||||
}
|
||||
|
||||
@ -368,12 +361,25 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
|
||||
super.finish();
|
||||
}
|
||||
|
||||
@Override public void onSendActionClicked(@NonNull String text, @Nullable Bundle bundle) {
|
||||
if (pager != null && pager.getAdapter() != null) {
|
||||
IssueTimelineFragment fragment = (IssueTimelineFragment) pager.getAdapter().instantiateItem(pager, 0);
|
||||
if (fragment != null) {
|
||||
fragment.onHandleComment(text, bundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onTagUser(@NonNull String username) {
|
||||
commentEditorFragment.onAddUserName(username);
|
||||
}
|
||||
|
||||
private void hideShowFab() {
|
||||
if (getPresenter().isLocked() && !getPresenter().isOwner()) {
|
||||
fab.hide();
|
||||
getSupportFragmentManager().beginTransaction().hide(commentEditorFragment).commit();
|
||||
return;
|
||||
}
|
||||
fab.show();
|
||||
getSupportFragmentManager().beginTransaction().show(commentEditorFragment).commit();
|
||||
}
|
||||
|
||||
private void updateViews(@NonNull Issue issueModel) {
|
||||
|
||||
@ -10,6 +10,7 @@ import com.fastaccess.data.dao.MilestoneModel;
|
||||
import com.fastaccess.data.dao.model.Issue;
|
||||
import com.fastaccess.data.dao.model.User;
|
||||
import com.fastaccess.ui.base.mvp.BaseMvp;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesMvp;
|
||||
import com.fastaccess.ui.modules.repos.extras.labels.LabelsMvp;
|
||||
|
||||
@ -22,7 +23,8 @@ import java.util.ArrayList;
|
||||
public interface IssuePagerMvp {
|
||||
|
||||
interface View extends BaseMvp.FAView, LabelsMvp.SelectedLabelsListener,
|
||||
AssigneesMvp.SelectedAssigneesListener, IssuePrCallback<Issue> {
|
||||
AssigneesMvp.SelectedAssigneesListener, IssuePrCallback<Issue>,
|
||||
CommentEditorFragment.CommentListener {
|
||||
void onSetupIssue(boolean isUpdate);
|
||||
|
||||
void showSuccessIssueActionMsg(boolean isClose);
|
||||
@ -81,5 +83,4 @@ public interface IssuePagerMvp {
|
||||
interface IssuePrCallback<T> {
|
||||
@Nullable T getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import com.fastaccess.ui.adapter.IssuesTimelineAdapter;
|
||||
import com.fastaccess.ui.adapter.viewholder.TimelineCommentsViewHolder;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.editor.EditorActivity;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp;
|
||||
import com.fastaccess.ui.modules.repos.reactions.ReactionsDialogFragment;
|
||||
import com.fastaccess.ui.widgets.AppbarRefreshLayout;
|
||||
@ -55,6 +56,7 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
private IssuesTimelineAdapter adapter;
|
||||
private OnLoadMore<Issue> onLoadMore;
|
||||
private IssuePagerMvp.IssuePrCallback<Issue> issueCallback;
|
||||
private CommentEditorFragment.CommentListener commentsCallback;
|
||||
|
||||
@NonNull public static IssueTimelineFragment newInstance() {
|
||||
return new IssueTimelineFragment();
|
||||
@ -67,13 +69,22 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
} else if (context instanceof IssuePagerMvp.IssuePrCallback) {
|
||||
issueCallback = (IssuePagerMvp.IssuePrCallback) context;
|
||||
} else {
|
||||
throw new IllegalArgumentException(String.format("%s or parent fragment must implement IssuePagerMvp.IssuePrCallback", context.getClass()
|
||||
.getSimpleName()));
|
||||
throw new IllegalArgumentException(String.format("%s or parent fragment must implement IssuePagerMvp.IssuePrCallback",
|
||||
context.getClass().getSimpleName()));
|
||||
}
|
||||
if (getParentFragment() instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment();
|
||||
} else if (context instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) context;
|
||||
} else {
|
||||
throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener",
|
||||
context.getClass().getSimpleName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onDetach() {
|
||||
issueCallback = null;
|
||||
commentsCallback = null;
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
@ -103,7 +114,7 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
}
|
||||
|
||||
@Override protected int fragmentLayout() {
|
||||
return R.layout.fab_micro_grid_refresh_list;
|
||||
return R.layout.micro_grid_refresh_list;
|
||||
}
|
||||
|
||||
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
@ -173,7 +184,7 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
.put(BundleConstant.EXTRA_THREE, getIssue().getNumber())
|
||||
.put(BundleConstant.EXTRA_FOUR, item.getId())
|
||||
.put(BundleConstant.EXTRA, item.getBody())
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.EDIT_ISSUE_COMMENT_EXTRA)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_ISSUE_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.end());
|
||||
@ -186,7 +197,7 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
adapter.removeItem(timelineModel);
|
||||
}
|
||||
|
||||
@Override public void onStartNewComment() {
|
||||
@Override public void onStartNewComment(String text) {
|
||||
onTagUser(null);
|
||||
}
|
||||
|
||||
@ -200,38 +211,13 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
}
|
||||
|
||||
@Override public void onTagUser(@Nullable User user) {
|
||||
if (getIssue() == null) return;
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, getIssue().getRepoId())
|
||||
.put(BundleConstant.EXTRA_TWO, getIssue().getLogin())
|
||||
.put(BundleConstant.EXTRA_THREE, getIssue().getNumber())
|
||||
.put(BundleConstant.EXTRA, user != null ? "@" + user.getLogin() : "")
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.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);
|
||||
if (commentsCallback != null) if (user != null) {
|
||||
commentsCallback.onTagUser(user.getLogin());
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onReply(User user, String message) {
|
||||
if (getIssue() == null) return;
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, getIssue().getRepoId())
|
||||
.put(BundleConstant.EXTRA_TWO, getIssue().getLogin())
|
||||
.put(BundleConstant.EXTRA_THREE, getIssue().getNumber())
|
||||
.put(BundleConstant.EXTRA, "@" + user.getLogin())
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
|
||||
.putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.put("message", message)
|
||||
.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);
|
||||
onTagUser(user);
|
||||
}
|
||||
|
||||
@Override public void showReactionsPopup(@NonNull ReactionTypes type, @NonNull String login,
|
||||
@ -259,6 +245,15 @@ public class IssueTimelineFragment extends BaseFragment<IssueTimelineMvp.View, I
|
||||
onSetHeader(TimelineModel.constructHeader(getIssue()));
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
|
||||
getPresenter().onHandleComment(text, bundle);
|
||||
}
|
||||
|
||||
@Override public void addNewComment(@NonNull TimelineModel timelineModel) {
|
||||
hideProgress();
|
||||
adapter.addItem(timelineModel);
|
||||
}
|
||||
|
||||
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
|
||||
@ -38,7 +38,7 @@ public interface IssueTimelineMvp {
|
||||
|
||||
void onRemove(@NonNull TimelineModel timelineModel);
|
||||
|
||||
void onStartNewComment();
|
||||
void onStartNewComment(String text);
|
||||
|
||||
void onShowDeleteMsg(long id);
|
||||
|
||||
@ -53,6 +53,10 @@ public interface IssueTimelineMvp {
|
||||
@Nullable Issue getIssue();
|
||||
|
||||
void onUpdateHeader();
|
||||
|
||||
void onHandleComment(String text, @Nullable Bundle bundle);
|
||||
|
||||
void addNewComment(@NonNull TimelineModel timelineModel);
|
||||
}
|
||||
|
||||
interface Presenter extends BaseMvp.FAPresenter, BaseViewHolder.OnItemClickListener<TimelineModel>,
|
||||
@ -69,5 +73,7 @@ public interface IssueTimelineMvp {
|
||||
void onHandleReaction(@IdRes int viewId, long id, @ReactionsProvider.ReactionType int reactionType);
|
||||
|
||||
boolean isCallingApi(long id, int vId);
|
||||
|
||||
void onHandleComment(@NonNull String text, @Nullable Bundle bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.CommentRequestModel;
|
||||
import com.fastaccess.data.dao.TimelineModel;
|
||||
import com.fastaccess.data.dao.model.Comment;
|
||||
import com.fastaccess.data.dao.model.Issue;
|
||||
@ -205,6 +206,20 @@ import lombok.Getter;
|
||||
return getReactionsProvider().isCallingApi(id, vId);
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
|
||||
if (getView() == null) return;
|
||||
Issue issue = getView().getIssue();
|
||||
if (issue != null) {
|
||||
if (bundle == null) {
|
||||
CommentRequestModel commentRequestModel = new CommentRequestModel();
|
||||
commentRequestModel.setBody(text);
|
||||
makeRestCall(RestProvider.getIssueService(isEnterprise()).createIssueComment(issue.getLogin(), issue.getRepoId(),
|
||||
issue.getNumber(), commentRequestModel),
|
||||
comment -> sendToView(view -> view.addNewComment(TimelineModel.constructComment(comment))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull private ReactionsProvider getReactionsProvider() {
|
||||
if (reactionsProvider == null) {
|
||||
reactionsProvider = new ReactionsProvider();
|
||||
|
||||
@ -36,6 +36,7 @@ import com.fastaccess.provider.scheme.LinkParserHelper;
|
||||
import com.fastaccess.ui.adapter.FragmentsPagerAdapter;
|
||||
import com.fastaccess.ui.base.BaseActivity;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.main.premium.PremiumActivity;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerActivity;
|
||||
import com.fastaccess.ui.modules.repos.RepoPagerMvp;
|
||||
@ -79,6 +80,7 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
@BindView(R.id.prReviewHolder) CardView prReviewHolder;
|
||||
@State boolean isClosed;
|
||||
@State boolean isOpened;
|
||||
private CommentEditorFragment commentEditorFragment;
|
||||
|
||||
public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, int number) {
|
||||
return createIntent(context, repoId, login, number, false);
|
||||
@ -108,13 +110,6 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
@OnClick(R.id.fab) void onAddComment() {
|
||||
if (pager == null || pager.getAdapter() == null) return;
|
||||
PullRequestTimelineFragment view = (PullRequestTimelineFragment) pager.getAdapter().instantiateItem(pager, 0);
|
||||
if (view != null) {
|
||||
view.onStartNewComment();
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.submitReviews) void onSubmitReviews(View view) {
|
||||
addPrReview(view);
|
||||
@ -151,11 +146,13 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
|
||||
@Override protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment);
|
||||
if (savedInstanceState == null) {
|
||||
getPresenter().onActivityCreated(getIntent());
|
||||
} else {
|
||||
if (getPresenter().getPullRequest() != null) onSetupIssue(false);
|
||||
}
|
||||
fab.hide();
|
||||
startGist.setVisibility(View.GONE);
|
||||
forkGist.setVisibility(View.GONE);
|
||||
if (getPresenter().showToRepoBtn()) showNavToRepoItem();
|
||||
@ -314,14 +311,13 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
onUpdateTimeline();
|
||||
}
|
||||
}
|
||||
if (!getPresenter().isLocked() || getPresenter().isOwner()) {
|
||||
pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||
@Override public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||
@Override public void onPageSelected(int position) {
|
||||
hideShowFab();
|
||||
super.onPageSelected(position);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
initTabs(pullRequest);
|
||||
hideShowFab();
|
||||
AnimHelper.mimicFabVisibility(getPresenter().hasReviewComments(), prReviewHolder, null);
|
||||
@ -429,6 +425,19 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
return getPresenter().getPullRequest();
|
||||
}
|
||||
|
||||
@Override public void onSendActionClicked(@NonNull String text, Bundle bundle) {
|
||||
if (pager != null && pager.getAdapter() != null) {
|
||||
PullRequestTimelineFragment fragment = (PullRequestTimelineFragment) pager.getAdapter().instantiateItem(pager, 0);
|
||||
if (fragment != null) {
|
||||
fragment.onHandleComment(text, bundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onTagUser(@NonNull String username) {
|
||||
commentEditorFragment.onAddUserName(username);
|
||||
}
|
||||
|
||||
protected void hideAndClearReviews() {
|
||||
onUpdateTimeline();
|
||||
getPresenter().getCommitComment().clear();
|
||||
@ -499,13 +508,19 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
|
||||
private void hideShowFab() {
|
||||
if (getPresenter().isLocked() && !getPresenter().isOwner()) {
|
||||
fab.hide();
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
.hide(commentEditorFragment).commit();
|
||||
return;
|
||||
}
|
||||
if (pager.getCurrentItem() == 0) {
|
||||
fab.show();
|
||||
getSupportFragmentManager().beginTransaction().show(commentEditorFragment)
|
||||
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
.commit();
|
||||
} else {
|
||||
fab.hide();
|
||||
getSupportFragmentManager().beginTransaction().hide(commentEditorFragment)
|
||||
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.fastaccess.data.dao.MilestoneModel;
|
||||
import com.fastaccess.data.dao.model.PullRequest;
|
||||
import com.fastaccess.data.dao.model.User;
|
||||
import com.fastaccess.ui.base.mvp.BaseMvp;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesMvp;
|
||||
import com.fastaccess.ui.modules.repos.extras.labels.LabelsMvp;
|
||||
import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp;
|
||||
@ -28,7 +29,8 @@ public interface PullRequestPagerMvp {
|
||||
|
||||
interface View extends BaseMvp.FAView, LabelsMvp.SelectedLabelsListener,
|
||||
AssigneesMvp.SelectedAssigneesListener, MergePullReqeustMvp.MergeCallback,
|
||||
IssuePagerMvp.IssuePrCallback<PullRequest>, PullRequestFilesMvp.PatchCallback {
|
||||
IssuePagerMvp.IssuePrCallback<PullRequest>, PullRequestFilesMvp.PatchCallback,
|
||||
CommentEditorFragment.CommentListener {
|
||||
|
||||
void onSetupIssue(boolean update);
|
||||
|
||||
@ -70,6 +72,7 @@ public interface PullRequestPagerMvp {
|
||||
@NonNull SpannableBuilder getMergeBy(@NonNull PullRequest pullRequest, @NonNull Context context);
|
||||
|
||||
void onMerge(String s, String msg);
|
||||
|
||||
void onPutLabels(@NonNull ArrayList<LabelModel> labels);
|
||||
|
||||
void onPutMilestones(@NonNull MilestoneModel milestone);
|
||||
|
||||
@ -26,6 +26,7 @@ import com.fastaccess.ui.adapter.PullRequestTimelineAdapter;
|
||||
import com.fastaccess.ui.adapter.viewholder.TimelineCommentsViewHolder;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.editor.EditorActivity;
|
||||
import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment;
|
||||
import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp;
|
||||
import com.fastaccess.ui.modules.repos.reactions.ReactionsDialogFragment;
|
||||
import com.fastaccess.ui.widgets.AppbarRefreshLayout;
|
||||
@ -54,6 +55,7 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
@State HashMap<Long, Boolean> toggleMap = new LinkedHashMap<>();
|
||||
private PullRequestTimelineAdapter adapter;
|
||||
private OnLoadMore<PullRequest> onLoadMore;
|
||||
private CommentEditorFragment.CommentListener commentsCallback;
|
||||
|
||||
private IssuePagerMvp.IssuePrCallback<PullRequest> issueCallback;
|
||||
|
||||
@ -71,10 +73,19 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
throw new IllegalArgumentException(String.format("%s or parent fragment must implement IssuePagerMvp.IssuePrCallback", context.getClass()
|
||||
.getSimpleName()));
|
||||
}
|
||||
if (getParentFragment() instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment();
|
||||
} else if (context instanceof CommentEditorFragment.CommentListener) {
|
||||
commentsCallback = (CommentEditorFragment.CommentListener) context;
|
||||
} else {
|
||||
throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener",
|
||||
context.getClass().getSimpleName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onDetach() {
|
||||
issueCallback = null;
|
||||
commentsCallback = null;
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
@ -83,7 +94,7 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
}
|
||||
|
||||
@Override protected int fragmentLayout() {
|
||||
return R.layout.fab_micro_grid_refresh_list;
|
||||
return R.layout.micro_grid_refresh_list;
|
||||
}
|
||||
|
||||
@Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
@ -177,7 +188,7 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
.put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber())
|
||||
.put(BundleConstant.EXTRA_FOUR, item.getId())
|
||||
.put(BundleConstant.EXTRA, item.getBody())
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.EDIT_ISSUE_COMMENT_EXTRA)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_ISSUE_COMMENT_EXTRA)
|
||||
// .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.end());
|
||||
@ -200,7 +211,7 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
.put(BundleConstant.EXTRA_FOUR, item.getId())
|
||||
.put(BundleConstant.EXTRA, item.getBody())
|
||||
.put(BundleConstant.REVIEW_EXTRA, model)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.EDIT_REVIEW_COMMENT_EXTRA)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_REVIEW_COMMENT_EXTRA)
|
||||
// .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.end());
|
||||
@ -213,22 +224,6 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
adapter.removeItem(timelineModel);
|
||||
}
|
||||
|
||||
@Override public void onStartNewComment() {
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
if (getPullRequest() == null) return;
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, getPullRequest().getRepoId())
|
||||
.put(BundleConstant.EXTRA_TWO, getPullRequest().getLogin())
|
||||
.put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber())
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
|
||||
// .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.end());
|
||||
View view = getFromView();
|
||||
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
|
||||
}
|
||||
|
||||
@Override public void onShowDeleteMsg(long id) {
|
||||
MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message),
|
||||
Bundler.start()
|
||||
@ -239,21 +234,13 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
}
|
||||
|
||||
@Override public void onReply(User user, String message) {
|
||||
Intent intent = new Intent(getContext(), EditorActivity.class);
|
||||
if (getPullRequest() == null) return;
|
||||
intent.putExtras(Bundler
|
||||
.start()
|
||||
.put(BundleConstant.ID, getPullRequest().getRepoId())
|
||||
.put(BundleConstant.EXTRA_TWO, getPullRequest().getLogin())
|
||||
.put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber())
|
||||
.put(BundleConstant.EXTRA, "@" + user.getLogin())
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_ISSUE_COMMENT_EXTRA)
|
||||
// .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.put("message", message)
|
||||
.end());
|
||||
View view = getFromView();
|
||||
ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE);
|
||||
if (commentsCallback != null && user != null) {
|
||||
commentsCallback.onTagUser(user.getLogin());
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
|
||||
getPresenter().onHandleComment(text, bundle);
|
||||
}
|
||||
|
||||
@Override public void onReplyOrCreateReview(@Nullable User user, String message, int groupPosition, int childPosition,
|
||||
@ -267,7 +254,7 @@ public class PullRequestTimelineFragment extends BaseFragment<PullRequestTimelin
|
||||
.put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber())
|
||||
.put(BundleConstant.EXTRA, user != null ? "@" + user.getLogin() : "")
|
||||
.put(BundleConstant.REVIEW_EXTRA, model)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraTYpe.NEW_REVIEW_COMMENT_EXTRA)
|
||||
.put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.NEW_REVIEW_COMMENT_EXTRA)
|
||||
// .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData()))
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise())
|
||||
.put("message", message)
|
||||
|
||||
@ -50,8 +50,6 @@ public interface PullRequestTimelineMvp {
|
||||
|
||||
void onRemove(@NonNull PullRequestTimelineModel timelineModel);
|
||||
|
||||
void onStartNewComment();
|
||||
|
||||
void onShowDeleteMsg(long id);
|
||||
|
||||
void onReply(User user, String message);
|
||||
@ -73,6 +71,8 @@ public interface PullRequestTimelineMvp {
|
||||
void onUpdateHeader();
|
||||
|
||||
@CallOnMainThread void showReload();
|
||||
|
||||
void onHandleComment(String text, @Nullable Bundle bundle);
|
||||
}
|
||||
|
||||
interface Presenter extends BaseMvp.FAPresenter, BaseViewHolder.OnItemClickListener<PullRequestTimelineModel>,
|
||||
@ -91,5 +91,7 @@ public interface PullRequestTimelineMvp {
|
||||
boolean isMerged(PullRequest pullRequest);
|
||||
|
||||
boolean isCallingApi(long id, int vId);
|
||||
|
||||
void onHandleComment(@NonNull String text, @Nullable Bundle bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import com.apollographql.apollo.api.Response;
|
||||
import com.apollographql.apollo.rx2.Rx2Apollo;
|
||||
import com.fastaccess.App;
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.CommentRequestModel;
|
||||
import com.fastaccess.data.dao.EditReviewCommentModel;
|
||||
import com.fastaccess.data.dao.ReviewCommentModel;
|
||||
import com.fastaccess.data.dao.model.Comment;
|
||||
@ -210,6 +211,22 @@ public class PullRequestTimelinePresenter extends BasePresenter<PullRequestTimel
|
||||
return getReactionsProvider().isCallingApi(id, vId);
|
||||
}
|
||||
|
||||
@Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) {
|
||||
if (getView() == null) return;
|
||||
PullRequest pullRequest = getView().getPullRequest();
|
||||
if (pullRequest != null) {
|
||||
if (bundle == null) {
|
||||
CommentRequestModel commentRequestModel = new CommentRequestModel();
|
||||
commentRequestModel.setBody(text);
|
||||
makeRestCall(RestProvider.getIssueService(isEnterprise()).createIssueComment(pullRequest.getLogin(), pullRequest.getRepoId(),
|
||||
pullRequest.getNumber(), commentRequestModel), comment -> {
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean isPreviouslyReacted(long commentId, int vId) {
|
||||
return getReactionsProvider().isPreviouslyReacted(commentId, vId);
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.fastaccess.ui.modules.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -45,11 +47,18 @@ public class SearchActivity extends BaseActivity<SearchMvp.View, SearchPresenter
|
||||
@BindView(R.id.tabs) TabLayout tabs;
|
||||
@BindView(R.id.appbar) AppBarLayout appbar;
|
||||
@BindView(R.id.pager) ViewPagerView pager;
|
||||
private NumberFormat numberFormat = NumberFormat.getNumberInstance();
|
||||
@State HashSet<TabsCountStateModel> tabsCountSet = new LinkedHashSet<>();
|
||||
|
||||
private NumberFormat numberFormat = NumberFormat.getNumberInstance();
|
||||
private ArrayAdapter<SearchHistory> adapter;
|
||||
|
||||
|
||||
public static Intent getIntent(@NonNull Context context, @Nullable String query) {
|
||||
Intent intent = new Intent(context, SearchActivity.class);
|
||||
intent.putExtra("search", query);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@OnTextChanged(value = R.id.searchEditText, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
|
||||
void onTextChange(Editable s) {
|
||||
String text = s.toString();
|
||||
@ -105,11 +114,11 @@ public class SearchActivity extends BaseActivity<SearchMvp.View, SearchPresenter
|
||||
if (!tabsCountSet.isEmpty()) {
|
||||
setupTab();
|
||||
}
|
||||
|
||||
if (getIntent().hasExtra("search")) {
|
||||
searchEditText.setText(getIntent().getStringExtra("search"));
|
||||
onTextChange(searchEditText.getEditableText());
|
||||
getPresenter().onSearchClicked(pager, searchEditText);
|
||||
if (savedInstanceState == null && getIntent() != null) {
|
||||
if (getIntent().hasExtra("search")) {
|
||||
searchEditText.setText(getIntent().getStringExtra("search"));
|
||||
getPresenter().onSearchClicked(pager, searchEditText);
|
||||
}
|
||||
}
|
||||
tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) {
|
||||
@Override public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
@ -13,6 +13,8 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ProgressBar
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.Unbinder
|
||||
import com.fastaccess.R
|
||||
import com.fastaccess.helper.*
|
||||
import com.fastaccess.ui.base.BaseFragment
|
||||
@ -28,6 +30,8 @@ class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter
|
||||
@BindView(R.id.apply) lateinit var apply: FloatingActionButton
|
||||
@BindView(R.id.toolbar) lateinit var toolbar: Toolbar
|
||||
|
||||
private var unbinder: Unbinder? = null
|
||||
|
||||
private val THEME = "appTheme"
|
||||
private var primaryDarkColor: Int = 0
|
||||
private var theme: Int = 0
|
||||
@ -43,9 +47,7 @@ class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter
|
||||
super.onDetach()
|
||||
}
|
||||
|
||||
override fun fragmentLayout(): Int {
|
||||
return 0
|
||||
}
|
||||
override fun fragmentLayout(): Int = 0
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
apply.setOnClickListener {
|
||||
@ -57,13 +59,14 @@ class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter
|
||||
toolbar.setNavigationOnClickListener { activity.onBackPressed() }
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
theme = arguments.getInt(BundleConstant.ITEM)
|
||||
val contextThemeWrapper = ContextThemeWrapper(activity, theme)
|
||||
primaryDarkColor = ViewHelper.getPrimaryDarkColor(contextThemeWrapper)
|
||||
val localInflater = inflater?.cloneInContext(contextThemeWrapper)
|
||||
val view = localInflater?.inflate(R.layout.theme_layout, container, false)
|
||||
val localInflater = inflater.cloneInContext(contextThemeWrapper)
|
||||
val view = localInflater.inflate(R.layout.theme_layout, container, false)!!
|
||||
unbinder = ButterKnife.bind(this, view)
|
||||
return view
|
||||
}
|
||||
|
||||
@ -142,7 +145,12 @@ class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter
|
||||
if (AppHelper.isGoogleAvailable(context)) {
|
||||
return true
|
||||
}
|
||||
showErrorMessage(getString(R.string.google_play_service_error, getString(R.string.app_name)))
|
||||
showErrorMessage(getString(R.string.common_google_play_services_unsupported_text))
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
unbinder?.unbind()
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ class MarkDownLayout : LinearLayout {
|
||||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
orientation = HORIZONTAL
|
||||
View.inflate(context, R.layout.markdown_buttons_layout, this)
|
||||
if (isInEditMode) return
|
||||
ButterKnife.bind(this)
|
||||
@ -63,7 +64,7 @@ class MarkDownLayout : LinearLayout {
|
||||
ViewHelper.hideKeyboard(editText)
|
||||
} else {
|
||||
editText.setText(it.getSavedText())
|
||||
editText.setSelection(it.getSavedText().length)
|
||||
editText.setSelection(editText.text.length)
|
||||
editText.isEnabled = true
|
||||
editorIconsHolder.visibility = View.VISIBLE
|
||||
ViewHelper.showKeyboard(editText)
|
||||
@ -139,6 +140,7 @@ class MarkDownLayout : LinearLayout {
|
||||
} else {
|
||||
"${editText.text} :${it.aliases[0]}:"
|
||||
})
|
||||
editText.setSelection(editText.text.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,6 +148,6 @@ class MarkDownLayout : LinearLayout {
|
||||
interface MarkdownListener {
|
||||
fun getEditText(): EditText
|
||||
fun fragmentManager(): FragmentManager
|
||||
fun getSavedText(): CharSequence
|
||||
fun getSavedText(): CharSequence?
|
||||
}
|
||||
}
|
||||
@ -5,26 +5,25 @@ import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.ListView
|
||||
import com.fastaccess.R
|
||||
import com.fastaccess.ui.widgets.FontEditText
|
||||
import java.util.*
|
||||
|
||||
|
||||
/**
|
||||
* Created by kosh on 14/08/2017.
|
||||
*/
|
||||
class MarkdownEditText : FontEditText {
|
||||
|
||||
var savedText: CharSequence = ""
|
||||
var savedText: CharSequence? = ""
|
||||
private var mention: ListView? = null
|
||||
private var listDivider: View? = null
|
||||
internal var inMentionMode = -1
|
||||
private var inMentionMode = -1
|
||||
private var participants: ArrayList<String>? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||
|
||||
|
||||
fun initListView(mention: ListView?, listDivider: View?, participants: ArrayList<String>?) {
|
||||
this.mention = mention
|
||||
this.listDivider = listDivider
|
||||
@ -48,9 +47,9 @@ class MarkdownEditText : FontEditText {
|
||||
|
||||
override fun onTextChanged(text: CharSequence?, start: Int, lengthBefore: Int, lengthAfter: Int) {
|
||||
super.onTextChanged(text, start, lengthBefore, lengthAfter)
|
||||
text?.let {
|
||||
if (isEnabled) {
|
||||
savedText = it
|
||||
if (isEnabled) {
|
||||
savedText = text
|
||||
text?.let {
|
||||
mention(it)
|
||||
}
|
||||
}
|
||||
@ -86,7 +85,8 @@ class MarkdownEditText : FontEditText {
|
||||
it.visibility = if (inMentionMode > 0) View.VISIBLE else GONE
|
||||
listDivider!!.visibility = it.visibility
|
||||
}
|
||||
} catch (ignored: Exception) { }
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateMentionList(mentioning: String) {
|
||||
@ -97,4 +97,5 @@ class MarkdownEditText : FontEditText {
|
||||
mention?.setAdapter(adapter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
9
app/src/main/res/drawable/ic_fullscreen.xml
Normal file
9
app/src/main/res/drawable/ic_fullscreen.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="?icon_color"
|
||||
android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z"/>
|
||||
</vector>
|
||||
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/commentBox"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@drawable/bbn_top_shadow"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bottom_border"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.fastaccess.ui.widgets.markdown.MarkDownLayout
|
||||
android:id="@+id/markdDownLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="24dp"
|
||||
android:paddingBottom="@dimen/spacing_micro"
|
||||
android:paddingTop="@dimen/spacing_micro"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/fullScreenComment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@color/transparent"
|
||||
android:contentDescription="@string/Expand"
|
||||
android:foreground="?selectableItemBackgroundBorderless"
|
||||
android:padding="@dimen/spacing_micro"
|
||||
android:src="@drawable/ic_fullscreen"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:orientation="horizontal"
|
||||
tools:showIn="@layout/issue_pager_activity">
|
||||
|
||||
<com.fastaccess.ui.widgets.markdown.MarkdownEditText
|
||||
android:id="@+id/commentText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/transparent"
|
||||
android:hint="@string/comment"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLines="5"
|
||||
android:paddingEnd="@dimen/spacing_normal"
|
||||
android:paddingStart="@dimen/spacing_normal"
|
||||
android:scrollbars="vertical"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/sendComment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?colorPrimaryDark"
|
||||
android:contentDescription="@string/comment"
|
||||
android:foreground="?selectableItemBackgroundBorderless"
|
||||
android:paddingEnd="@dimen/spacing_xs_large"
|
||||
android:paddingStart="@dimen/spacing_xs_large"
|
||||
android:src="@drawable/ic_send"
|
||||
android:tint="?colorAccent"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@ -8,163 +8,178 @@
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/coordinatorLayout"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/coordinatorLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="?android:toolbarStyle">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<include layout="@layout/title_header_layout"/>
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
android:minHeight="?actionBarSize"
|
||||
android:theme="?android:toolbarStyle">
|
||||
|
||||
<include layout="@layout/title_header_layout"/>
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
android:minHeight="?actionBarSize"
|
||||
android:theme="?android:toolbarStyle">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/spacing_normal">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/changes"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:drawablePadding="@dimen/spacing_micro"
|
||||
android:drawableTop="@drawable/ic_file_multi"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/addition"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:drawablePadding="@dimen/spacing_micro"
|
||||
android:drawableTop="@drawable/ic_add"
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/deletion"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:drawablePadding="@dimen/spacing_micro"
|
||||
android:drawableTop="@drawable/ic_clear"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
app:tabSelectedTextColor="?colorAccent"
|
||||
app:tabTextColor="?android:textColorTertiary"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<com.fastaccess.ui.widgets.ViewPagerView
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/scroll_behavior"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/prReviewHolder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_spacing"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginTop="@dimen/fab_margin"
|
||||
android:focusable="true"
|
||||
android:visibility="gone"
|
||||
app:cardBackgroundColor="?colorAccent"
|
||||
app:contentPadding="@dimen/spacing_normal"
|
||||
app:layout_anchor="@+id/fab"
|
||||
app:layout_anchorGravity="start|center"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/spacing_normal">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/changes"
|
||||
android:id="@+id/reviewsCount"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:drawablePadding="@dimen/spacing_micro"
|
||||
android:drawableTop="@drawable/ic_file_multi"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle_shape"
|
||||
android:backgroundTint="?colorPrimary"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
android:minHeight="24dp"
|
||||
android:minWidth="24dp"
|
||||
android:padding="@dimen/spacing_micro"
|
||||
tools:text="1"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/addition"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:drawablePadding="@dimen/spacing_micro"
|
||||
android:drawableTop="@drawable/ic_add"
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
tools:text="100"/>
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/spacing_normal"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/pull_request_reviews"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/deletion"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:id="@+id/submitReviews"
|
||||
style="@style/Widget.AppCompat.ButtonBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:drawablePadding="@dimen/spacing_micro"
|
||||
android:drawableTop="@drawable/ic_clear"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
android:padding="@dimen/spacing_normal"
|
||||
android:text="@string/submit"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"/>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
app:tabSelectedTextColor="?colorAccent"
|
||||
app:tabTextColor="?android:textColorTertiary"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_comment"
|
||||
android:tint="@color/white"
|
||||
app:fabSize="auto"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.ViewPagerView
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/scroll_behavior"/>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/prReviewHolder"
|
||||
<fragment
|
||||
android:id="@+id/commentFragment"
|
||||
android:name="com.fastaccess.ui.modules.editor.comment.CommentEditorFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_spacing"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginTop="@dimen/fab_margin"
|
||||
android:focusable="true"
|
||||
android:visibility="gone"
|
||||
app:cardBackgroundColor="?colorAccent"
|
||||
app:contentPadding="@dimen/spacing_normal"
|
||||
app:layout_anchor="@+id/fab"
|
||||
app:layout_anchorGravity="start|center"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/reviewsCount"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle_shape"
|
||||
android:backgroundTint="?colorPrimary"
|
||||
android:gravity="center"
|
||||
android:minHeight="24dp"
|
||||
android:minWidth="24dp"
|
||||
android:padding="@dimen/spacing_micro"
|
||||
tools:text="1"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/spacing_normal"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/pull_request_reviews"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/submitReviews"
|
||||
style="@style/Widget.AppCompat.ButtonBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="@dimen/spacing_normal"
|
||||
android:text="@string/submit"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_comment"
|
||||
android:tint="@color/white"
|
||||
app:fabSize="auto"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
tools:layout="@layout/comment_box_layout"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/nav_menu_layout"/>
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
@ -3,6 +3,7 @@
|
||||
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">
|
||||
@ -10,6 +11,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
@ -108,7 +110,12 @@
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<include layout="@layout/add_banner_layout"/>
|
||||
<fragment
|
||||
android:id="@+id/commentFragment"
|
||||
android:name="com.fastaccess.ui.modules.editor.comment.CommentEditorFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/comment_box_layout"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/nav_menu_layout"/>
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
<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">
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
@ -91,8 +91,15 @@
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<include layout="@layout/add_banner_layout"/>
|
||||
<fragment
|
||||
android:id="@+id/commentFragment"
|
||||
android:name="com.fastaccess.ui.modules.editor.comment.CommentEditorFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/comment_box_layout"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/nav_menu_layout"/>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
@ -1,8 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:showIn="@layout/editor_layout">
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/editorIconsHolder"
|
||||
|
||||
@ -555,4 +555,5 @@
|
||||
<string name="google_play_service_error">Google Play Service unavailable</string>
|
||||
<string name="edit_gist">Edit Gist</string>
|
||||
<string name="content">Content</string>
|
||||
<string name="Expand">expand</string>
|
||||
</resources>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user