From 01bb7774df19da4b7c96840f63a7c0f18c6e737d Mon Sep 17 00:00:00 2001
From: Kosh
Date: Sun, 25 Jun 2017 21:26:51 +0800
Subject: [PATCH] add PR reviews & comments, updated readme & contribution.md
---
.github/CONTRIBUTING.md | 4 +-
.github/ISSUE_TEMPLATE.md | 2 +-
README.md | 4 +-
app/src/main/AndroidManifest.xml | 7 +
.../data/dao/ReviewRequestModel.java | 8 +-
.../data/service/ReviewService.java | 11 +-
.../fastaccess/provider/theme/ThemeEngine.kt | 125 +++++++++++++++++-
.../handler/BetterLinkMovementExtended.java | 2 +-
.../details/files/CommitFilesFragment.java | 6 +-
.../details/PullRequestPagerActivity.java | 24 +++-
.../files/PullRequestFilesFragment.java | 6 +-
...etDialog.kt => AddReviewDialogFragment.kt} | 8 +-
.../reviews/changes/ReviewChangesActivity.kt | 106 +++++++++++++++
.../reviews/changes/ReviewChangesMvp.kt | 19 +++
.../reviews/changes/ReviewChangesPresenter.kt | 23 ++++
.../layout/add_review_dialog_layout.xml | 41 ++++++
...t.xml => review_comment_dialog_layout.xml} | 6 +-
app/src/main/res/menu/pull_request_menu.xml | 7 +
app/src/main/res/values/arrays.xml | 1 -
app/src/main/res/values/strings.xml | 1 +
app/src/main/res/values/theme_amlod.xml | 7 +
app/src/main/res/values/theme_bluish.xml | 7 +
app/src/main/res/values/theme_dark.xml | 7 +
app/src/main/res/values/theme_light.xml | 7 +
.../main/res/values/theme_midnight_blue.xml | 7 +
25 files changed, 409 insertions(+), 37 deletions(-)
rename app/src/main/java/com/fastaccess/ui/modules/reviews/{AddReviewBottomSheetDialog.kt => AddReviewDialogFragment.kt} (93%)
create mode 100644 app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesActivity.kt
create mode 100644 app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesMvp.kt
create mode 100644 app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesPresenter.kt
create mode 100644 app/src/main/res/layouts/main_layouts/layout/add_review_dialog_layout.xml
rename app/src/main/res/layouts/main_layouts/layout/{review_dialog_layout.xml => review_comment_dialog_layout.xml} (89%)
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 5f9bff85..44f7b2c1 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -4,14 +4,14 @@ If you have a question in mind, feel free to come our public [Slack](https://reb
### Optional
-- Please update debug_gradle.properties file and change below if you like to use your own keys:
+- Please update debug_gradle.properties file and change below if you like to use your own keys otherwise keep them as they're debug keys:
- github_client_id= your github clientId
- github_secret= your github secret
- redirect_url= (redirect_url must match the url defined in `AndroidManifest` under `LoginView`)
### Before you import the project to Android Studio:
-- Make sure you have Android Studio 2.3 & above.
+- Make sure you have Android Studio 3.0 C4 & above.
- Import Android Studio Settings (to ensure same code formatting) from this link [Click here](https://raw.githubusercontent.com/k0shk0sh/FastHub/master/fasthub_as_settings.jar)
- Install Lombok Plugin from Android Studio Plugins & enable Annotations Processors from (Android Studio Preference).
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 991b4368..4301a2c8 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -2,7 +2,7 @@
- Please provide as much as detail and example as you can.
- Add screenshots if appropriate.
- Make sure that you are always on the latest version.
- - Search issue before submitting new one.
+ - Search issue before submitting a new one.
Public Slack channel: https://rebrand.ly/fasthub
-->
diff --git a/README.md b/README.md
index ab35f9ae..fa22f55a 100644
--- a/README.md
+++ b/README.md
@@ -124,9 +124,9 @@ Read the [**contribution guide**](.github/CONTRIBUTING.md) for more detailed inf
## FAQ
- Why can't I see my **Organizations** either _Private_ or _Public ones_?
+ Why can't I see my Organizations either _Private_ or Public ones?
Open up https://github.com/settings/applications and look for FastHub, open it then scroll to Organization access and click on Grant Button,
- alternatively login via **Access Token** which will ease this setup.
+ alternatively login via Access Token which will ease this setup.
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index fcdb15ae..b1f5a8e0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -196,6 +196,13 @@
android:name=".ui.modules.main.donation.DonateActivity"
android:configChanges="keyboard|orientation|screenSize"
android:theme="@style/ThemeTranslucent"/>
+
+
+
comments;
+ public String commitId;
+ public String body;
+ public String event;
+ public List comments;
@Override public int describeContents() { return 0; }
diff --git a/app/src/main/java/com/fastaccess/data/service/ReviewService.java b/app/src/main/java/com/fastaccess/data/service/ReviewService.java
index 29fa5384..3d495bae 100644
--- a/app/src/main/java/com/fastaccess/data/service/ReviewService.java
+++ b/app/src/main/java/com/fastaccess/data/service/ReviewService.java
@@ -6,6 +6,7 @@ import com.fastaccess.data.dao.CommentRequestModel;
import com.fastaccess.data.dao.Pageable;
import com.fastaccess.data.dao.ReviewCommentModel;
import com.fastaccess.data.dao.ReviewModel;
+import com.fastaccess.data.dao.ReviewRequestModel;
import io.reactivex.Observable;
import retrofit2.Response;
@@ -63,9 +64,9 @@ public interface ReviewService {
@DELETE("repos/{owner}/{repo}/pulls/comments/{id}")
@Headers("Accept: application/vnd.github.black-cat-preview")
Observable> deleteComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id);
- //
-// @POST("repos/{owner}/{repo}/pulls/{number}/reviews")
-// @Headers("Accept: application/vnd.github.black-cat-preview")
-// Observable submitPrReview(@Path("owner") String owner, @Path("repo") String repo,
-// @Path("number") long number, @NonNull @Body ReviewRequestModel body);
+
+ @POST("repos/{owner}/{repo}/pulls/{number}/reviews")
+ @Headers("Accept: application/vnd.github.black-cat-preview")
+ Observable> submitPrReview(@Path("owner") String owner, @Path("repo") String repo,
+ @Path("number") long number, @NonNull @Body ReviewRequestModel body);
}
diff --git a/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt b/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt
index 219d0c18..46bdcbed 100644
--- a/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt
+++ b/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt
@@ -4,7 +4,6 @@ import android.app.ActivityManager
import android.graphics.BitmapFactory
import android.support.annotation.StyleRes
import com.danielstone.materialaboutlibrary.MaterialAboutActivity
-
import com.fastaccess.R
import com.fastaccess.helper.Logger
import com.fastaccess.helper.PrefGetter
@@ -12,6 +11,8 @@ import com.fastaccess.helper.ViewHelper
import com.fastaccess.ui.base.BaseActivity
import com.fastaccess.ui.modules.login.LoginActivity
import com.fastaccess.ui.modules.login.LoginChooserActivity
+import com.fastaccess.ui.modules.main.donation.DonateActivity
+import com.fastaccess.ui.modules.reviews.changes.ReviewChangesActivity
/**
* Created by Kosh on 07 Jun 2017, 6:52 PM
@@ -20,14 +21,13 @@ import com.fastaccess.ui.modules.login.LoginChooserActivity
object ThemeEngine {
fun apply(activity: BaseActivity<*, *>) {
- if (activity is LoginChooserActivity || activity is LoginActivity) {
+ if (hasTheme(activity)) {
return
}
val themeMode = PrefGetter.getThemeType(activity)
val themeColor = PrefGetter.getThemeColor(activity)
activity.setTheme(getTheme(themeMode, themeColor))
- activity.setTaskDescription(ActivityManager.TaskDescription(activity.getString(R.string.app_name),
- BitmapFactory.decodeResource(activity.getResources(), R.mipmap.ic_launcher), ViewHelper.getPrimaryColor(activity)))
+ setTaskDescription(activity)
}
fun applyForAbout(activity: MaterialAboutActivity) {
@@ -47,6 +47,14 @@ object ThemeEngine {
BitmapFactory.decodeResource(activity.resources, R.mipmap.ic_launcher), ViewHelper.getPrimaryColor(activity)))
}
+ fun applyDialogTheme(activity: BaseActivity<*, *>) {
+ val themeMode = PrefGetter.getThemeType(activity)
+ val themeColor = PrefGetter.getThemeColor(activity)
+ activity.setTheme(getDialogTheme(themeMode, themeColor))
+ setTaskDescription(activity)
+ }
+
+
@StyleRes fun getTheme(themeMode: Int, themeColor: Int): Int {
Logger.e(themeMode, themeColor)
// I wish if I could simplify this :'( too many cases for the love of god.
@@ -149,4 +157,113 @@ object ThemeEngine {
}
return R.style.ThemeLight
}
+
+ @StyleRes fun getDialogTheme(themeMode: Int, themeColor: Int): Int {
+ if (themeMode == PrefGetter.LIGHT) {
+ when (themeColor) {
+ PrefGetter.RED -> return R.style.DialogThemeLight_Red
+ PrefGetter.PINK -> return R.style.DialogThemeLight_Pink
+ PrefGetter.PURPLE -> return R.style.DialogThemeLight_Purple
+ PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeLight_DeepPurple
+ PrefGetter.INDIGO -> return R.style.DialogThemeLight_Indigo
+ PrefGetter.BLUE -> return R.style.DialogThemeLight
+ PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeLight_LightBlue
+ PrefGetter.CYAN -> return R.style.DialogThemeLight_Cyan
+ PrefGetter.TEAL -> return R.style.DialogThemeLight_Teal
+ PrefGetter.GREEN -> return R.style.DialogThemeLight_Green
+ PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeLight_LightGreen
+ PrefGetter.LIME -> return R.style.DialogThemeLight_Lime
+ PrefGetter.YELLOW -> return R.style.DialogThemeLight_Yellow
+ PrefGetter.AMBER -> return R.style.DialogThemeLight_Amber
+ PrefGetter.ORANGE -> return R.style.DialogThemeLight_Orange
+ PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeLight_DeepOrange
+ else -> return R.style.DialogThemeLight
+ }
+ } else if (themeMode == PrefGetter.DARK) {
+ when (themeColor) {
+ PrefGetter.RED -> return R.style.DialogThemeDark_Red
+ PrefGetter.PINK -> return R.style.DialogThemeDark_Pink
+ PrefGetter.PURPLE -> return R.style.DialogThemeDark_Purple
+ PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeDark_DeepPurple
+ PrefGetter.INDIGO -> return R.style.DialogThemeDark_Indigo
+ PrefGetter.BLUE -> return R.style.DialogThemeDark
+ PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeDark_LightBlue
+ PrefGetter.CYAN -> return R.style.DialogThemeDark_Cyan
+ PrefGetter.TEAL, PrefGetter.GREEN -> return R.style.DialogThemeDark_Green
+ PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeDark_LightGreen
+ PrefGetter.LIME -> return R.style.DialogThemeDark_Lime
+ PrefGetter.YELLOW -> return R.style.DialogThemeDark_Yellow
+ PrefGetter.AMBER -> return R.style.DialogThemeDark_Amber
+ PrefGetter.ORANGE -> return R.style.DialogThemeDark_Orange
+ PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeDark_DeepOrange
+ else -> return R.style.DialogThemeDark
+ }
+ } else if (themeMode == PrefGetter.AMLOD) {
+ when (themeColor) {
+ PrefGetter.RED -> return R.style.DialogThemeAmlod_Red
+ PrefGetter.PINK -> return R.style.DialogThemeAmlod_Pink
+ PrefGetter.PURPLE -> return R.style.DialogThemeAmlod_Purple
+ PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeAmlod_DeepPurple
+ PrefGetter.INDIGO -> return R.style.DialogThemeAmlod_Indigo
+ PrefGetter.BLUE -> return R.style.DialogThemeAmlod
+ PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeAmlod_LightBlue
+ PrefGetter.CYAN -> return R.style.DialogThemeAmlod_Cyan
+ PrefGetter.TEAL, PrefGetter.GREEN -> return R.style.DialogThemeAmlod_Green
+ PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeAmlod_LightGreen
+ PrefGetter.LIME -> return R.style.DialogThemeAmlod_Lime
+ PrefGetter.YELLOW -> return R.style.DialogThemeAmlod_Yellow
+ PrefGetter.AMBER -> return R.style.DialogThemeAmlod_Amber
+ PrefGetter.ORANGE -> return R.style.DialogThemeAmlod_Orange
+ PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeAmlod_DeepOrange
+ else -> return R.style.DialogThemeAmlod
+ }
+ } else if (themeMode == PrefGetter.MID_NIGHT_BLUE) {
+ when (themeColor) {
+ PrefGetter.RED -> return R.style.DialogThemeLight_Red
+ PrefGetter.PINK -> return R.style.DialogThemeLight_Pink
+ PrefGetter.PURPLE -> return R.style.DialogThemeLight_Purple
+ PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeLight_DeepPurple
+ PrefGetter.INDIGO -> return R.style.DialogThemeLight_Indigo
+ PrefGetter.BLUE -> return R.style.DialogThemeLight
+ PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeLight_LightBlue
+ PrefGetter.CYAN -> return R.style.DialogThemeLight_Cyan
+ PrefGetter.TEAL, PrefGetter.GREEN -> return R.style.DialogThemeLight_Green
+ PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeLight_LightGreen
+ PrefGetter.LIME -> return R.style.DialogThemeLight_Lime
+ PrefGetter.YELLOW -> return R.style.DialogThemeLight_Yellow
+ PrefGetter.AMBER -> return R.style.DialogThemeLight_Amber
+ PrefGetter.ORANGE -> return R.style.DialogThemeLight_Orange
+ PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeLight_DeepOrange
+ else -> return R.style.DialogThemeLight
+ }
+ } else if (themeMode == PrefGetter.BLUISH) {
+ when (themeColor) {
+ PrefGetter.RED -> return R.style.DialogThemeBluish_Red
+ PrefGetter.PINK -> return R.style.DialogThemeBluish_Pink
+ PrefGetter.PURPLE -> return R.style.DialogThemeBluish_Purple
+ PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeBluish_DeepPurple
+ PrefGetter.INDIGO -> return R.style.DialogThemeBluish_Indigo
+ PrefGetter.BLUE -> return R.style.DialogThemeBluish
+ PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeBluish_LightBlue
+ PrefGetter.CYAN -> return R.style.DialogThemeBluish_Cyan
+ PrefGetter.TEAL, PrefGetter.GREEN -> return R.style.DialogThemeBluish_Green
+ PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeBluish_LightGreen
+ PrefGetter.LIME -> return R.style.DialogThemeBluish_Lime
+ PrefGetter.YELLOW -> return R.style.DialogThemeBluish_Yellow
+ PrefGetter.AMBER -> return R.style.DialogThemeBluish_Amber
+ PrefGetter.ORANGE -> return R.style.DialogThemeBluish_Orange
+ PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeBluish_DeepOrange
+ else -> return R.style.DialogThemeBluish
+ }
+ }
+ return R.style.DialogThemeLight
+ }
+
+ private fun setTaskDescription(activity: BaseActivity<*, *>) {
+ activity.setTaskDescription(ActivityManager.TaskDescription(activity.getString(R.string.app_name),
+ BitmapFactory.decodeResource(activity.getResources(), R.mipmap.ic_launcher), ViewHelper.getPrimaryColor(activity)))
+ }
+
+ private fun hasTheme(activity: BaseActivity<*, *>) = (activity is LoginChooserActivity || activity is LoginActivity ||
+ activity is DonateActivity || activity is ReviewChangesActivity)
}
diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/BetterLinkMovementExtended.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/BetterLinkMovementExtended.java
index a7947bd0..dd2c9fbf 100644
--- a/app/src/main/java/com/fastaccess/provider/timeline/handler/BetterLinkMovementExtended.java
+++ b/app/src/main/java/com/fastaccess/provider/timeline/handler/BetterLinkMovementExtended.java
@@ -79,7 +79,7 @@ public class BetterLinkMovementExtended extends LinkMovementMethod {
public void setOnLinkClickListener(OnLinkClickListener onLinkClickListener) {
if (this == singleInstance) {
throw new UnsupportedOperationException("SettingsModel a click listener on the instance returned by getInstance() is not supported. Please " +
- "use newInstance() or any of the linkify() methods instead.");
+ "use startForResult() or any of the linkify() methods instead.");
} else {
this.onLinkClickListener = onLinkClickListener;
}
diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java
index 684f7940..7366e92f 100644
--- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java
+++ b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java
@@ -19,7 +19,7 @@ import com.fastaccess.helper.Bundler;
import com.fastaccess.ui.adapter.CommitFilesAdapter;
import com.fastaccess.ui.base.BaseFragment;
import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerMvp;
-import com.fastaccess.ui.modules.reviews.AddReviewBottomSheetDialog;
+import com.fastaccess.ui.modules.reviews.AddReviewDialogFragment;
import com.fastaccess.ui.widgets.AppbarRefreshLayout;
import com.fastaccess.ui.widgets.StateLayout;
import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView;
@@ -122,10 +122,10 @@ public class CommitFilesFragment extends BaseFragment>() {
+class AddReviewDialogFragment : BaseDialogFragment>() {
val toolbar: Toolbar by lazy { view!!.findViewById(R.id.toolbar) as Toolbar }
val textView: TextView by lazy { view!!.findViewById(R.id.text) as TextView }
@@ -48,7 +48,7 @@ class AddReviewBottomSheetDialog : BaseDialogFragment(BundleConstant.ITEM)
@@ -88,8 +88,8 @@ class AddReviewBottomSheetDialog : BaseDialogFragment = BasePresenter()
companion object {
- fun newInstance(commitLinesModel: CommitLinesModel, bundle: Bundle? = null): AddReviewBottomSheetDialog {
- val dialog = AddReviewBottomSheetDialog()
+ fun newInstance(commitLinesModel: CommitLinesModel, bundle: Bundle? = null): AddReviewDialogFragment {
+ val dialog = AddReviewDialogFragment()
dialog.arguments = Bundler.start()
.put(BundleConstant.ITEM, commitLinesModel)
.put(BundleConstant.EXTRA, bundle)
diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesActivity.kt
new file mode 100644
index 00000000..a547afd4
--- /dev/null
+++ b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesActivity.kt
@@ -0,0 +1,106 @@
+package com.fastaccess.ui.modules.reviews.changes
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.support.design.widget.TextInputLayout
+import android.support.v7.widget.Toolbar
+import android.view.Menu
+import android.view.MenuItem
+import android.view.View
+import android.widget.Spinner
+import com.evernote.android.state.State
+import com.fastaccess.R
+import com.fastaccess.data.dao.ReviewRequestModel
+import com.fastaccess.helper.ActivityHelper
+import com.fastaccess.helper.BundleConstant
+import com.fastaccess.helper.Bundler
+import com.fastaccess.helper.InputHelper
+import com.fastaccess.provider.theme.ThemeEngine
+import com.fastaccess.ui.base.BaseActivity
+
+/**
+ * Created by Kosh on 25 Jun 2017, 1:25 AM
+ */
+class ReviewChangesActivity : BaseActivity(), ReviewChangesMvp.View {
+
+ val toolbar: Toolbar by lazy { findViewById(R.id.toolbar) as Toolbar }
+ val spinner: Spinner by lazy { findViewById(R.id.reviewMethod) as Spinner }
+ val editText: TextInputLayout by lazy { findViewById(R.id.editText) as TextInputLayout }
+
+ @State var reviewRequest: ReviewRequestModel? = null
+ @State var repoId: String? = null
+ @State var owner: String? = null
+ @State var number: Long? = null
+
+ override fun layout(): Int = R.layout.add_review_dialog_layout
+
+ override fun isTransparent(): Boolean = true
+
+ override fun canBack(): Boolean = true
+
+ override fun isSecured(): Boolean = false
+
+ override fun providePresenter(): ReviewChangesPresenter = ReviewChangesPresenter()
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ ThemeEngine.applyDialogTheme(this)
+ super.onCreate(savedInstanceState)
+ val bundle = intent.extras!!
+ reviewRequest = bundle.getParcelable(BundleConstant.EXTRA)
+ repoId = bundle.getString(BundleConstant.EXTRA_TWO)
+ owner = bundle.getString(BundleConstant.EXTRA_THREE)
+ number = bundle.getLong(BundleConstant.ID)
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu?): Boolean {
+ menuInflater.inflate(R.menu.done_menu, menu)
+ return super.onCreateOptionsMenu(menu)
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem?): Boolean {
+ when (item?.itemId) {
+ R.id.submit -> {
+ if (editText.editText?.text.isNullOrEmpty()) {
+ editText.error = getString(R.string.required_field)
+ } else {
+ presenter.onSubmit(reviewRequest!!, repoId!!, owner!!, number!!, InputHelper.toString(editText), spinner.selectedItem as String)
+ }
+ return true
+ }
+ else -> {
+ return super.onOptionsItemSelected(item)
+ }
+ }
+ }
+
+ override fun onSuccessfullySubmitted() {
+ setResult(Activity.RESULT_OK)
+ finish()
+ }
+
+ override fun onErrorSubmitting() {
+ showErrorMessage(getString(R.string.network_error))
+ }
+
+ companion object {
+ /**
+ * val repoId = bundle.getString(BundleConstant.EXTRA_TWO)
+ * val owner = bundle.getString(BundleConstant.EXTRA_THREE)
+ * val number = bundle.getLong(BundleConstant.ID)
+ */
+ fun startForResult(activity: Activity, view: View, reviewChanges: ReviewRequestModel, repoId: String, owner: String, number: Long) {
+ val bundle = Bundler.start()
+ .put(BundleConstant.EXTRA, reviewChanges)
+ .put(BundleConstant.EXTRA_TWO, repoId)
+ .put(BundleConstant.EXTRA_THREE, owner)
+ .put(BundleConstant.ID, number)
+ .end()
+ val intent = Intent(activity, ReviewChangesActivity::class.java)
+ intent.putExtras(bundle)
+ ActivityHelper.startReveal(activity, intent, view, BundleConstant.REVIEW_REQUEST_CODE)
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesMvp.kt
new file mode 100644
index 00000000..a54b4f7b
--- /dev/null
+++ b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesMvp.kt
@@ -0,0 +1,19 @@
+package com.fastaccess.ui.modules.reviews.changes
+
+import com.fastaccess.data.dao.ReviewRequestModel
+import com.fastaccess.ui.base.mvp.BaseMvp
+
+/**
+ * Created by Kosh on 25 Jun 2017, 1:15 AM
+ */
+interface ReviewChangesMvp {
+
+ interface View : BaseMvp.FAView {
+ fun onSuccessfullySubmitted()
+ fun onErrorSubmitting()
+ }
+
+ interface Presenter {
+ fun onSubmit(reviewRequest: ReviewRequestModel, repoId: String, owner: String, number: Long, comment: String, method: String)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesPresenter.kt
new file mode 100644
index 00000000..4f3160d9
--- /dev/null
+++ b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesPresenter.kt
@@ -0,0 +1,23 @@
+package com.fastaccess.ui.modules.reviews.changes
+
+import com.fastaccess.data.dao.ReviewRequestModel
+import com.fastaccess.provider.rest.RestProvider
+import com.fastaccess.ui.base.mvp.presenter.BasePresenter
+
+/**
+ * Created by Kosh on 25 Jun 2017, 1:16 AM
+ */
+class ReviewChangesPresenter : BasePresenter(), ReviewChangesMvp.Presenter {
+
+ override fun onSubmit(reviewRequest: ReviewRequestModel, repoId: String, owner: String, number: Long, comment: String, method: String) {
+ reviewRequest.body = comment
+ reviewRequest.event = method
+ makeRestCall(RestProvider.getReviewService().submitPrReview(owner, repoId, number, reviewRequest), {
+ if (it.isSuccessful && it.code() == 200) {
+ sendToView { it.onSuccessfullySubmitted() }
+ } else {
+ sendToView { it.onErrorSubmitting()}
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layouts/main_layouts/layout/add_review_dialog_layout.xml b/app/src/main/res/layouts/main_layouts/layout/add_review_dialog_layout.xml
new file mode 100644
index 00000000..9b0de4b0
--- /dev/null
+++ b/app/src/main/res/layouts/main_layouts/layout/add_review_dialog_layout.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layouts/main_layouts/layout/review_dialog_layout.xml b/app/src/main/res/layouts/main_layouts/layout/review_comment_dialog_layout.xml
similarity index 89%
rename from app/src/main/res/layouts/main_layouts/layout/review_dialog_layout.xml
rename to app/src/main/res/layouts/main_layouts/layout/review_comment_dialog_layout.xml
index 6c01e055..16174b7a 100644
--- a/app/src/main/res/layouts/main_layouts/layout/review_dialog_layout.xml
+++ b/app/src/main/res/layouts/main_layouts/layout/review_comment_dialog_layout.xml
@@ -1,7 +1,6 @@
+ android:padding="@dimen/spacing_xs_large">
+
+
+
-
-
- PENDING
- APPROVE
- REQUEST CHANGES
- COMMENT
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ed9b7daf..072991c6 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -83,6 +83,7 @@
Squash
Rebase
Pull Request Reviews
+ Review Changes
Loading, please wait…
Action
diff --git a/app/src/main/res/values/theme_amlod.xml b/app/src/main/res/values/theme_amlod.xml
index 46aee623..6d2e6912 100644
--- a/app/src/main/res/values/theme_amlod.xml
+++ b/app/src/main/res/values/theme_amlod.xml
@@ -141,6 +141,13 @@