mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
this commit fixes #735 and releases 4.0.0
This commit is contained in:
parent
1bf9e12667
commit
7b89d1ecd2
6
app/proguard-rules.pro
vendored
6
app/proguard-rules.pro
vendored
@ -121,4 +121,8 @@
|
||||
-dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor
|
||||
-dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor
|
||||
-dontwarn kotlin.reflect.jvm.internal.impl.types.TypeConstructor
|
||||
-keeppackagenames org.jsoup.nodes
|
||||
-keeppackagenames org.jsoup.nodes
|
||||
-keep class com.github.b3er.** { *; }
|
||||
-keep class com.memoizrlabs.** { *; }
|
||||
-dontwarn com.github.b3er.**
|
||||
-dontwarn com.memoizrlabs.**
|
||||
@ -16,8 +16,8 @@ import lombok.Setter;
|
||||
private String body;
|
||||
@SerializedName("in_reply_to") private Long inReplyTo;
|
||||
private String path;
|
||||
private int position;
|
||||
private int line;
|
||||
private Integer position;
|
||||
private Integer line;
|
||||
|
||||
public CommentRequestModel() {}
|
||||
|
||||
@ -40,16 +40,16 @@ import lombok.Setter;
|
||||
dest.writeString(this.body);
|
||||
dest.writeValue(this.inReplyTo);
|
||||
dest.writeString(this.path);
|
||||
dest.writeInt(this.position);
|
||||
dest.writeInt(this.line);
|
||||
dest.writeValue(this.position);
|
||||
dest.writeValue(this.line);
|
||||
}
|
||||
|
||||
protected CommentRequestModel(Parcel in) {
|
||||
this.body = in.readString();
|
||||
this.inReplyTo = (Long) in.readValue(Long.class.getClassLoader());
|
||||
this.path = in.readString();
|
||||
this.position = in.readInt();
|
||||
this.line = in.readInt();
|
||||
this.position = (Integer) in.readValue(Integer.class.getClassLoader());
|
||||
this.line = (Integer) in.readValue(Integer.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static final Creator<CommentRequestModel> CREATOR = new Creator<CommentRequestModel>() {
|
||||
|
||||
@ -49,7 +49,6 @@ import static com.fastaccess.ui.widgets.DiffLineSpan.HUNK_TITLE;
|
||||
boolean addLeft = false;
|
||||
boolean addRight = false;
|
||||
int color = TRANSPARENT;
|
||||
position++;
|
||||
if (token.startsWith("@@")) {
|
||||
color = PATCH;
|
||||
Matcher matcher = HUNK_TITLE.matcher(token.trim());
|
||||
@ -60,16 +59,19 @@ import static com.fastaccess.ui.widgets.DiffLineSpan.HUNK_TITLE;
|
||||
} catch (NumberFormatException e) {e.printStackTrace();}
|
||||
}
|
||||
} else if (firstChar == '+') {
|
||||
position++;
|
||||
color = ADDITION;
|
||||
++rightLineNo;
|
||||
addRight = true;
|
||||
addLeft = false;
|
||||
} else if (firstChar == '-') {
|
||||
position++;
|
||||
color = DELETION;
|
||||
++leftLineNo;
|
||||
addRight = false;
|
||||
addLeft = true;
|
||||
} else {
|
||||
position++;
|
||||
addLeft = true;
|
||||
addRight = true;
|
||||
++rightLineNo;
|
||||
|
||||
@ -5,7 +5,6 @@ import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.fastaccess.App;
|
||||
import com.fastaccess.helper.Logger;
|
||||
import com.fastaccess.helper.PrefGetter;
|
||||
import com.fastaccess.helper.RxHelper;
|
||||
|
||||
@ -114,7 +113,8 @@ import lombok.NoArgsConstructor;
|
||||
public static boolean hasNormalLogin() {
|
||||
return App.getInstance().getDataStore()
|
||||
.count(Login.class)
|
||||
.where(Login.IS_ENTERPRISE.eq(false))
|
||||
.where(Login.IS_ENTERPRISE.eq(false)
|
||||
.or(Login.IS_ENTERPRISE.isNull()))
|
||||
.get()
|
||||
.value() > 0;
|
||||
}
|
||||
@ -152,7 +152,6 @@ import lombok.NoArgsConstructor;
|
||||
PrefGetter.setTokenEnterprise(userModel.token);
|
||||
PrefGetter.setEnterpriseOtpCode(userModel.otpCode);
|
||||
PrefGetter.setEnterpriseUrl(userModel.enterpriseUrl);
|
||||
Logger.e(userModel.enterpriseUrl, PrefGetter.getEnterpriseUrl());
|
||||
} else {
|
||||
PrefGetter.resetEnterprise();
|
||||
PrefGetter.setToken(userModel.token);
|
||||
|
||||
@ -14,13 +14,13 @@ import java.util.List;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.requery.BlockingEntityStore;
|
||||
import io.requery.Column;
|
||||
import io.requery.Convert;
|
||||
import io.requery.Entity;
|
||||
import io.requery.Generated;
|
||||
import io.requery.Key;
|
||||
import io.requery.Persistable;
|
||||
import io.requery.reactivex.ReactiveEntityStore;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import static com.fastaccess.data.dao.model.PinnedRepos.ENTRY_COUNT;
|
||||
@ -90,7 +90,8 @@ import static com.fastaccess.data.dao.model.PinnedRepos.REPO_FULL_NAME;
|
||||
|
||||
@NonNull public static Single<List<PinnedRepos>> getMyPinnedRepos() {
|
||||
return App.getInstance().getDataStore().select(PinnedRepos.class)
|
||||
.where(LOGIN.eq(Login.getUser().getLogin()))
|
||||
.where(LOGIN.eq(Login.getUser().getLogin())
|
||||
.or(LOGIN.isNull()))
|
||||
.orderBy(ENTRY_COUNT.desc(), ID.desc())
|
||||
.get()
|
||||
.observable()
|
||||
@ -117,15 +118,15 @@ import static com.fastaccess.data.dao.model.PinnedRepos.REPO_FULL_NAME;
|
||||
e.onComplete();
|
||||
return;
|
||||
}
|
||||
ReactiveEntityStore<Persistable> reactiveEntityStore = App.getInstance().getDataStore();
|
||||
List<PinnedRepos> pinnedRepos = reactiveEntityStore.toBlocking().select(PinnedRepos.class)
|
||||
BlockingEntityStore<Persistable> reactiveEntityStore = App.getInstance().getDataStore().toBlocking();
|
||||
List<PinnedRepos> pinnedRepos = reactiveEntityStore.select(PinnedRepos.class)
|
||||
.where(LOGIN.isNull())
|
||||
.get()
|
||||
.toList();
|
||||
if (pinnedRepos != null) {
|
||||
for (PinnedRepos pinnedRepo : pinnedRepos) {
|
||||
pinnedRepo.setRepoFullName(login.getLogin());
|
||||
reactiveEntityStore.toBlocking().update(pinnedRepo);
|
||||
reactiveEntityStore.update(pinnedRepo);
|
||||
}
|
||||
}
|
||||
Logger.e("Hello");
|
||||
|
||||
@ -35,7 +35,6 @@ class AuthenticationInterceptor : Interceptor {
|
||||
}
|
||||
if (!isScrapping) builder.addHeader("User-Agent", "FastHub")
|
||||
val request = builder.build()
|
||||
Logger.e(request.headers())
|
||||
return chain.proceed(request)
|
||||
}
|
||||
}
|
||||
@ -30,22 +30,20 @@ public class PaginationInterceptor implements Interceptor {
|
||||
}
|
||||
json += String.format("\"items\":%s}", response.body().string());
|
||||
return response.newBuilder().body(ResponseBody.create(response.body().contentType(), json)).build();
|
||||
} else {
|
||||
} else if (response.header("link") != null) {
|
||||
String link = response.header("link");
|
||||
if (link != null) {
|
||||
String pagination = "";
|
||||
String[] links = link.split(",");
|
||||
for (String link1 : links) {
|
||||
String[] pageLink = link1.split(";");
|
||||
String page = Uri.parse(pageLink[0].replaceAll("[<>]", "")).getQueryParameter("page");
|
||||
String rel = pageLink[1].replaceAll("\"", "").replace("rel=", "");
|
||||
if (page != null) pagination += String.format("\"%s\":\"%s\",", rel.trim(), page);
|
||||
}
|
||||
if (!InputHelper.isEmpty(pagination)) {//hacking for search pagination.
|
||||
String body = response.body().string();
|
||||
return response.newBuilder().body(ResponseBody.create(response.body().contentType(),
|
||||
"{" + pagination + body.substring(1, body.length()))).build();
|
||||
}
|
||||
String pagination = "";
|
||||
String[] links = link.split(",");
|
||||
for (String link1 : links) {
|
||||
String[] pageLink = link1.split(";");
|
||||
String page = Uri.parse(pageLink[0].replaceAll("[<>]", "")).getQueryParameter("page");
|
||||
String rel = pageLink[1].replaceAll("\"", "").replace("rel=", "");
|
||||
if (page != null) pagination += String.format("\"%s\":\"%s\",", rel.trim(), page);
|
||||
}
|
||||
if (!InputHelper.isEmpty(pagination)) {//hacking for search pagination.
|
||||
String body = response.body().string();
|
||||
return response.newBuilder().body(ResponseBody.create(response.body().contentType(),
|
||||
"{" + pagination + body.substring(1, body.length()))).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.fastaccess.provider.scheme;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
@ -118,4 +119,20 @@ public class LinkParserHelper {
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
@Nullable public static String getGistId(@NonNull Uri uri) {
|
||||
String gistId = null;
|
||||
if (uri.toString().contains("raw/gist")) {
|
||||
if (uri.getPathSegments().size() > 5) {
|
||||
gistId = uri.getPathSegments().get(5);
|
||||
}
|
||||
} else if (uri.getPathSegments() != null) {
|
||||
if (TextUtils.equals(LinkParserHelper.HOST_GISTS_RAW, uri.getAuthority())) {
|
||||
if (uri.getPathSegments().size() > 1) {
|
||||
gistId = uri.getPathSegments().get(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return gistId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.CommitLinesModel;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.ViewHelper;
|
||||
import com.fastaccess.ui.widgets.SpannableBuilder;
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter;
|
||||
@ -25,7 +24,8 @@ import butterknife.BindView;
|
||||
public class CommitLinesViewHolder extends BaseViewHolder<CommitLinesModel> {
|
||||
|
||||
@BindView(R.id.textView) AppCompatTextView textView;
|
||||
@BindView(R.id.lineNo) AppCompatTextView lineNo;
|
||||
@BindView(R.id.leftLinNo) AppCompatTextView leftLinNo;
|
||||
@BindView(R.id.rightLinNo) AppCompatTextView rightLinNo;
|
||||
private final int patchAdditionColor;
|
||||
private final int patchDeletionColor;
|
||||
private final int patchRefColor;
|
||||
@ -42,10 +42,8 @@ public class CommitLinesViewHolder extends BaseViewHolder<CommitLinesModel> {
|
||||
}
|
||||
|
||||
@Override public void bind(@NonNull CommitLinesModel item) {
|
||||
lineNo.setText(SpannableBuilder.builder()
|
||||
.append(item.getLeftLineNo() >= 0 ? item.getLeftLineNo() + "." : "")
|
||||
.append(item.getRightLineNo() >= 0 ? item.getRightLineNo() + "." : ""));
|
||||
lineNo.setVisibility(InputHelper.isEmpty(lineNo) ? View.GONE : View.VISIBLE);
|
||||
leftLinNo.setText(item.getLeftLineNo() > 0 ? String.valueOf(item.getLeftLineNo()) : " ");
|
||||
rightLinNo.setText(item.getRightLineNo() > 0 ? String.valueOf(item.getRightLineNo()) : " ");
|
||||
switch (item.getColor()) {
|
||||
case CommitLinesModel.ADDITION:
|
||||
textView.setBackgroundColor(patchAdditionColor);
|
||||
@ -54,6 +52,8 @@ public class CommitLinesViewHolder extends BaseViewHolder<CommitLinesModel> {
|
||||
textView.setBackgroundColor(patchDeletionColor);
|
||||
break;
|
||||
case CommitLinesModel.PATCH:
|
||||
leftLinNo.setVisibility(View.GONE);
|
||||
rightLinNo.setVisibility(View.GONE);
|
||||
textView.setBackgroundColor(patchRefColor);
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -120,20 +120,9 @@ public class CodeViewerActivity extends BaseActivity {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
String gistId = null;
|
||||
if (uri.toString().contains("raw/gist")) {
|
||||
if (uri.getPathSegments().size() > 5) {
|
||||
gistId = uri.getPathSegments().get(5);
|
||||
}
|
||||
} else if (uri.getPathSegments() != null) {
|
||||
if (uri.getPathSegments().contains("gist")) {
|
||||
if (uri.getPathSegments() != null && !uri.getPathSegments().isEmpty() && uri.getPathSegments().size() >= 1) {
|
||||
gistId = uri.getPathSegments().get(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
String gistId = LinkParserHelper.getGistId(uri);
|
||||
if (!InputHelper.isEmpty(gistId)) {
|
||||
GistActivity.createIntent(this, gistId, isEnterprise());
|
||||
startActivity(GistActivity.createIntent(this, gistId, isEnterprise()));
|
||||
} else {
|
||||
RepoFilesActivity.startActivity(this, url, isEnterprise());
|
||||
}
|
||||
|
||||
@ -175,6 +175,7 @@ public class LoginActivity extends BaseActivity<LoginMvp.View, LoginPresenter> i
|
||||
if (savedInstanceState == null) {
|
||||
if (getIntent() != null && getIntent().getExtras() != null) {
|
||||
isBasicAuth = getIntent().getExtras().getBoolean(BundleConstant.YES_NO_EXTRA);
|
||||
password.setHint(isBasicAuth ? getString(R.string.password) : getString(R.string.access_token));
|
||||
if (getIntent().getExtras().getBoolean(BundleConstant.EXTRA_TWO)) {
|
||||
onOpenBrowser();
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ class DonateActivity : BaseActivity<BaseMvp.FAView, BasePresenter<BaseMvp.FAView
|
||||
.purchase(ProductType.IN_APP, productKey, "inapp:com.fastaccess.github:" + productKey))
|
||||
.subscribe({ p: Purchase?, throwable: Throwable? ->
|
||||
if (throwable == null) {
|
||||
Answers.getInstance().logPurchase(PurchaseEvent().putItemName(productKey))
|
||||
Answers.getInstance().logPurchase(PurchaseEvent().putItemName(productKey).putSuccess(true))
|
||||
showMessage(R.string.success, R.string.success_purchase_message)
|
||||
enableProduct(productKey, applicationContext)
|
||||
val intent = Intent()
|
||||
|
||||
@ -9,9 +9,13 @@ import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import butterknife.OnClick
|
||||
import butterknife.OnEditorAction
|
||||
import com.crashlytics.android.answers.Answers
|
||||
import com.crashlytics.android.answers.PurchaseEvent
|
||||
import com.fastaccess.BuildConfig
|
||||
import com.fastaccess.R
|
||||
import com.fastaccess.helper.InputHelper
|
||||
import com.fastaccess.helper.PrefGetter
|
||||
import com.fastaccess.helper.ViewHelper
|
||||
import com.fastaccess.ui.base.BaseActivity
|
||||
import com.fastaccess.ui.modules.main.donation.DonateActivity
|
||||
import com.fastaccess.ui.widgets.bindView
|
||||
@ -79,6 +83,7 @@ class PremiumActivity : BaseActivity<PremiumMvp.View, PremiumPresenter>(), Premi
|
||||
}
|
||||
|
||||
override fun onSuccessfullyActivated() {
|
||||
Answers.getInstance().logPurchase(PurchaseEvent().putItemName(InputHelper.toString(editText)).putSuccess(true))
|
||||
PrefGetter.setProItems()
|
||||
PrefGetter.setEnterpriseItem()
|
||||
showMessage(R.string.success, R.string.success)
|
||||
@ -90,6 +95,7 @@ class PremiumActivity : BaseActivity<PremiumMvp.View, PremiumPresenter>(), Premi
|
||||
}
|
||||
|
||||
override fun showProgress(resId: Int) {
|
||||
ViewHelper.hideKeyboard(editText)
|
||||
TransitionManager.beginDelayedTransition(viewGroup)
|
||||
progressLayout.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@ -71,8 +71,9 @@ class ProfileReposPresenter extends BasePresenter<ProfileReposMvp.View> implemen
|
||||
sendToView(ProfileReposMvp.View::hideProgress);
|
||||
return;
|
||||
}
|
||||
filterOptions.setIsPersonalProfile(TextUtils.equals(currentLoggedIn, username));
|
||||
makeRestCall(TextUtils.equals(currentLoggedIn, username)
|
||||
boolean isProfile = TextUtils.equals(currentLoggedIn, username);
|
||||
filterOptions.setIsPersonalProfile(isProfile);
|
||||
makeRestCall(isProfile
|
||||
? RestProvider.getUserService(isEnterprise()).getRepos(filterOptions.getQueryMap(), page)
|
||||
: RestProvider.getUserService(isEnterprise()).getRepos(parameter, filterOptions.getQueryMap(), page),
|
||||
repoModelPageable -> {
|
||||
|
||||
@ -115,7 +115,7 @@ public class CommitFilesFragment extends BaseFragment<CommitFilesMvp.View, Commi
|
||||
|
||||
@Override public void onToggle(long position, boolean isCollapsed) {
|
||||
if (adapter.getItem((int) position).getCommitFileModel().getPatch() == null) {
|
||||
ActivityHelper.openChooser(getContext(), adapter.getItem((int) position).getCommitFileModel().getBlobUrl());
|
||||
ActivityHelper.startCustomTab(getActivity(), adapter.getItem((int) position).getCommitFileModel().getBlobUrl());
|
||||
}
|
||||
toggleMap.put(position, isCollapsed);
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
@ -18,13 +17,12 @@ import com.fastaccess.helper.BundleConstant;
|
||||
import com.fastaccess.helper.Bundler;
|
||||
import com.fastaccess.helper.FileHelper;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.PrefGetter;
|
||||
import com.fastaccess.helper.ViewHelper;
|
||||
import com.fastaccess.provider.markdown.MarkDownProvider;
|
||||
import com.fastaccess.provider.rest.RestProvider;
|
||||
import com.fastaccess.ui.adapter.RepoFilesAdapter;
|
||||
import com.fastaccess.ui.base.BaseFragment;
|
||||
import com.fastaccess.ui.modules.code.CodeViewerActivity;
|
||||
import com.fastaccess.ui.modules.repos.code.files.activity.RepoFilesActivity;
|
||||
import com.fastaccess.ui.modules.repos.code.files.paths.RepoFilePathFragment;
|
||||
import com.fastaccess.ui.widgets.AppbarRefreshLayout;
|
||||
import com.fastaccess.ui.widgets.StateLayout;
|
||||
@ -57,17 +55,21 @@ public class RepoFilesFragment extends BaseFragment<RepoFilesMvp.View, RepoFiles
|
||||
getParent().onAppendPath(model);
|
||||
}
|
||||
} else {
|
||||
String url = InputHelper.isEmpty(model.getDownloadUrl()) ? model.getUrl() : model.getDownloadUrl();
|
||||
if (InputHelper.isEmpty(url)) return;
|
||||
if (model.getSize() > FileHelper.ONE_MB && !MarkDownProvider.isImage(url)) {
|
||||
MessageDialogView.newInstance(getString(R.string.big_file), getString(R.string.big_file_description),
|
||||
false, true, Bundler.start()
|
||||
.put(BundleConstant.EXTRA, model.getDownloadUrl())
|
||||
.put(BundleConstant.YES_NO_EXTRA, true)
|
||||
.end())
|
||||
.show(getChildFragmentManager(), "MessageDialogView");
|
||||
if (model.getSize() == 0 && InputHelper.isEmpty(model.getDownloadUrl()) && !InputHelper.isEmpty(model.getGitUrl())) {
|
||||
RepoFilesActivity.startActivity(getContext(), model.getGitUrl().replace("trees/", ""), isEnterprise());
|
||||
} else {
|
||||
CodeViewerActivity.startActivity(getContext(), url, model.getHtmlUrl());
|
||||
String url = InputHelper.isEmpty(model.getDownloadUrl()) ? model.getUrl() : model.getDownloadUrl();
|
||||
if (InputHelper.isEmpty(url)) return;
|
||||
if (model.getSize() > FileHelper.ONE_MB && !MarkDownProvider.isImage(url)) {
|
||||
MessageDialogView.newInstance(getString(R.string.big_file), getString(R.string.big_file_description),
|
||||
false, true, Bundler.start()
|
||||
.put(BundleConstant.EXTRA, model.getDownloadUrl())
|
||||
.put(BundleConstant.YES_NO_EXTRA, true)
|
||||
.end())
|
||||
.show(getChildFragmentManager(), "MessageDialogView");
|
||||
} else {
|
||||
CodeViewerActivity.startActivity(getContext(), url, model.getHtmlUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,6 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
@BindView(R.id.fab) FloatingActionButton fab;
|
||||
@BindView(R.id.detailsIcon) View detailsIcon;
|
||||
@BindView(R.id.reviewsCount) FontTextView reviewsCount;
|
||||
@BindView(R.id.submitReviews) FontTextView submitReviews;
|
||||
@BindView(R.id.prReviewHolder) CardView prReviewHolder;
|
||||
@State boolean isClosed;
|
||||
@State boolean isOpened;
|
||||
@ -118,10 +117,19 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.submitReviews) public void onSubmitReviews(View view) {
|
||||
@OnClick(R.id.submitReviews) void onSubmitReviews(View view) {
|
||||
addPrReview(view);
|
||||
}
|
||||
|
||||
@OnClick(R.id.cancelReview) void onCancelReviews(View view) {
|
||||
MessageDialogView.newInstance(getString(R.string.cancel_reviews), getString(R.string.confirm_message),
|
||||
false, Bundler.start()
|
||||
.put(BundleConstant.YES_NO_EXTRA, true)
|
||||
.put(BundleConstant.EXTRA_TYPE, true)
|
||||
.end())
|
||||
.show(getSupportFragmentManager(), MessageDialogView.TAG);
|
||||
}
|
||||
|
||||
@Override protected int layout() {
|
||||
return R.layout.issue_pager_activity;
|
||||
}
|
||||
@ -167,9 +175,8 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
getPresenter().onRefresh();
|
||||
}
|
||||
} else if (requestCode == BundleConstant.REVIEW_REQUEST_CODE) {
|
||||
onUpdateTimeline();
|
||||
getPresenter().getCommitComment().clear();
|
||||
AnimHelper.mimicFabVisibility(false, prReviewHolder, null);
|
||||
hideAndClearReviews();
|
||||
pager.setCurrentItem(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,6 +323,8 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
}
|
||||
initTabs(pullRequest);
|
||||
hideShowFab();
|
||||
AnimHelper.mimicFabVisibility(getPresenter().hasReviewComments(), prReviewHolder, null);
|
||||
reviewsCount.setText(String.format("%s", getPresenter().getCommitComment().size()));
|
||||
}
|
||||
|
||||
@Override public void onScrollTop(int index) {
|
||||
@ -329,6 +338,12 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
@Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) {
|
||||
super.onMessageDialogActionClicked(isOk, bundle);
|
||||
if (isOk) {
|
||||
if (bundle != null) {
|
||||
if (bundle.getBoolean(BundleConstant.EXTRA_TYPE)) {
|
||||
hideAndClearReviews();
|
||||
return;
|
||||
}
|
||||
}
|
||||
getPresenter().onHandleConfirmDialog(bundle);
|
||||
}
|
||||
}
|
||||
@ -420,6 +435,12 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
return getPresenter().getPullRequest();
|
||||
}
|
||||
|
||||
protected void hideAndClearReviews() {
|
||||
onUpdateTimeline();
|
||||
getPresenter().getCommitComment().clear();
|
||||
AnimHelper.mimicFabVisibility(false, prReviewHolder, null);
|
||||
}
|
||||
|
||||
private void addPrReview(@NonNull View view) {
|
||||
PullRequest pullRequest = getPresenter().getPullRequest();
|
||||
if (pullRequest == null) return;
|
||||
@ -430,7 +451,8 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
|
||||
requestModel.setCommitId(pullRequest.getHead().getSha());
|
||||
boolean isAuthor = author != null && Login.getUser().getLogin().equalsIgnoreCase(author.getLogin());
|
||||
ReviewChangesActivity.Companion.startForResult(this, view, requestModel, getPresenter().getRepoId(),
|
||||
getPresenter().getLogin(), pullRequest.getNumber(), isAuthor, isEnterprise());
|
||||
getPresenter().getLogin(), pullRequest.getNumber(), isAuthor, isEnterprise(), pullRequest.isMerged()
|
||||
|| pullRequest.getState() == IssueState.closed);
|
||||
}
|
||||
|
||||
private void initTabs(@NonNull PullRequest pullRequest) {
|
||||
|
||||
@ -17,7 +17,6 @@ import com.fastaccess.data.dao.CommitLinesModel;
|
||||
import com.fastaccess.helper.ActivityHelper;
|
||||
import com.fastaccess.helper.BundleConstant;
|
||||
import com.fastaccess.helper.Bundler;
|
||||
import com.fastaccess.helper.Logger;
|
||||
import com.fastaccess.helper.PrefGetter;
|
||||
import com.fastaccess.provider.rest.loadmore.OnLoadMore;
|
||||
import com.fastaccess.ui.adapter.CommitFilesAdapter;
|
||||
@ -151,7 +150,7 @@ public class PullRequestFilesFragment extends BaseFragment<PullRequestFilesMvp.V
|
||||
|
||||
@Override public void onToggle(long position, boolean isCollapsed) {
|
||||
if (adapter.getItem((int) position).getCommitFileModel().getPatch() == null) {
|
||||
ActivityHelper.openChooser(getContext(), adapter.getItem((int) position).getCommitFileModel().getBlobUrl());
|
||||
ActivityHelper.startCustomTab(getActivity(), adapter.getItem((int) position).getCommitFileModel().getBlobUrl());
|
||||
}
|
||||
toggleMap.put(position, isCollapsed);
|
||||
}
|
||||
@ -183,8 +182,12 @@ public class PullRequestFilesFragment extends BaseFragment<PullRequestFilesMvp.V
|
||||
CommentRequestModel commentRequestModel = new CommentRequestModel();
|
||||
commentRequestModel.setBody(comment);
|
||||
commentRequestModel.setPath(path);
|
||||
commentRequestModel.setPosition(item.getPosition());
|
||||
Logger.e(commentRequestModel.getPosition());
|
||||
if (item.getRightLineNo() > 0 && item.getLeftLineNo() > 0) {
|
||||
commentRequestModel.setPosition(item.getPosition());
|
||||
} else {
|
||||
commentRequestModel.setPosition(item.getPosition());
|
||||
// commentRequestModel.setLine(item.getRightLineNo() > 0 ? item.getRightLineNo() : item.getLeftLineNo());
|
||||
}
|
||||
if (viewCallback != null) viewCallback.onAddComment(commentRequestModel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ class ReviewChangesActivity : BaseActivity<ReviewChangesMvp.View, ReviewChangesP
|
||||
@State var owner: String? = null
|
||||
@State var number: Long? = null
|
||||
@State var isProgressShowing: Boolean = false
|
||||
@State var isClosed: Boolean = false
|
||||
|
||||
override fun layout(): Int = R.layout.add_review_dialog_layout
|
||||
|
||||
@ -54,8 +55,9 @@ class ReviewChangesActivity : BaseActivity<ReviewChangesMvp.View, ReviewChangesP
|
||||
repoId = bundle.getString(BundleConstant.EXTRA_TWO)
|
||||
owner = bundle.getString(BundleConstant.EXTRA_THREE)
|
||||
number = bundle.getLong(BundleConstant.ID)
|
||||
isClosed = bundle.getBoolean(BundleConstant.EXTRA_FIVE)
|
||||
val isAuthor = bundle.getBoolean(BundleConstant.EXTRA_FOUR)
|
||||
if (isAuthor) {
|
||||
if (isAuthor || isClosed) {
|
||||
spinner.setSelection(2, true)
|
||||
spinner.isEnabled = false
|
||||
}
|
||||
@ -69,9 +71,10 @@ class ReviewChangesActivity : BaseActivity<ReviewChangesMvp.View, ReviewChangesP
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
when (item?.itemId) {
|
||||
R.id.submit -> {
|
||||
if (editText.editText?.text.isNullOrEmpty()) {
|
||||
if (spinner.selectedItemPosition != 0 && editText.editText?.text.isNullOrEmpty()) {
|
||||
editText.error = getString(R.string.required_field)
|
||||
} else {
|
||||
editText.error = null
|
||||
presenter.onSubmit(reviewRequest!!, repoId!!, owner!!, number!!, InputHelper.toString(editText), spinner.selectedItem as String)
|
||||
}
|
||||
return true
|
||||
@ -131,13 +134,8 @@ class ReviewChangesActivity : BaseActivity<ReviewChangesMvp.View, ReviewChangesP
|
||||
}
|
||||
|
||||
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,
|
||||
isAuthor: Boolean, isEnterprise: Boolean) {
|
||||
isAuthor: Boolean, isEnterprise: Boolean, isClosed: Boolean) {
|
||||
val bundle = Bundler.start()
|
||||
.put(BundleConstant.EXTRA, reviewChanges)
|
||||
.put(BundleConstant.EXTRA_TWO, repoId)
|
||||
@ -145,6 +143,7 @@ class ReviewChangesActivity : BaseActivity<ReviewChangesMvp.View, ReviewChangesP
|
||||
.put(BundleConstant.EXTRA_FOUR, isAuthor)
|
||||
.put(BundleConstant.ID, number)
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
|
||||
.put(BundleConstant.EXTRA_FIVE, isClosed)
|
||||
.end()
|
||||
val intent = Intent(activity, ReviewChangesActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
|
||||
73
app/src/main/res/layout/review_changes_bottom_layout.xml
Normal file
73
app/src/main/res/layout/review_changes_bottom_layout.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/prReviewHolder"
|
||||
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="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"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
android:id="@+id/cancelReview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="@dimen/spacing_micro"
|
||||
android:src="@drawable/ic_clear"
|
||||
android:tint="@color/white"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.ForegroundImageView
|
||||
android:id="@+id/submitReviews"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="@dimen/spacing_micro"
|
||||
android:src="@drawable/ic_send"
|
||||
android:tint="@color/white"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
@ -77,66 +77,7 @@
|
||||
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="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"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
<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"
|
||||
android:textColor="@color/white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
<include layout="@layout/review_changes_bottom_layout"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/name"
|
||||
style="@style/TextAppearance.AppCompat.Subhead"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -5,25 +5,39 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingTop="2dp">
|
||||
|
||||
android:paddingBottom="@dimen/spacing_micro"
|
||||
android:paddingTop="@dimen/spacing_micro">
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/lineNo"
|
||||
android:id="@+id/leftLinNo"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:fontFamily="monospace"
|
||||
android:text="?android:textColorSecondary"
|
||||
tools:text="1."/>
|
||||
tools:text="1"/>
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/spacing_normal"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/rightLinNo"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:fontFamily="monospace"
|
||||
android:text="?android:textColorSecondary"
|
||||
tools:text="1"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/textView"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacing_micro"
|
||||
android:fontFamily="monospace"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="Per guest prepare a handfull teaspoons of soy sauce with squeezed sausages for dessert."/>
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/name"
|
||||
style="@style/TextAppearance.AppCompat.Subhead"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@ -56,12 +56,14 @@
|
||||
now has Nightly builds thanks (@dedepete)
|
||||
</li>
|
||||
<li>(New) Disabling Issues Tab if Issues disabled in Repo.</li>
|
||||
<li>(New) Added Share to Users & Organizations profiles</li>
|
||||
<li>(New) Czech language thanks to (@hejsekvojtech)</li>
|
||||
<li>(New) Spanish language thanks to (@alete)</li>
|
||||
<li>(Enhancement) Opening FastHub from other Apps should open FastHub in new document thanks to (@eygraber)</li>
|
||||
<li>(Enhancement) Wiki links</li>
|
||||
<li>(Enhancement) Issue & PRs grammar</li>
|
||||
<li>(Enhancement) Overall app layouts enhancements.</li>
|
||||
<li>(Fix) Opening Submodule.</li>
|
||||
<li>(Fix) Trending Language & today's stars.</li>
|
||||
<li>(Fix) Code wrapping.</li>
|
||||
<li>(Fix) PRs/Issues where the assigned user was a Team.</li>
|
||||
@ -79,11 +81,10 @@
|
||||
<li>There are more stuff are not mentioned, find them out :p</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>P.S: FastHub is still in development mode, things will evantually code, rating FastHub 1 or 5 stars in Play store to request a new
|
||||
feature or to report an issue they will’ll be ignored, the best place to report issues/FRs are in GitHub issue ticket, you could go to
|
||||
<em>About</em> & click on Report Issue and the issue will be posted directly to
|
||||
<strong>FastHub</strong>
|
||||
repo.
|
||||
<p>P.S: FastHub is still in development mode, things will eventually come, rating FastHub 1 or 5 stars in Play store to request a new
|
||||
feature or to report an issue they’ll be ignored, the best place to report issues/FRs are in GitHub issue ticket, you could go to
|
||||
<em>About</em> & click on <em>Report Issue</em> and the issue will be posted directly to
|
||||
<strong>FastHub</strong> repo.
|
||||
</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="MissingTranslation">
|
||||
<!-- DO NOT COPY! -->
|
||||
|
||||
<string name="app_name" translatable="false">FastHub</string>
|
||||
@ -90,7 +91,7 @@
|
||||
<string name="pro_features_list" translatable="false"><![CDATA[Get the PRO features of FastHub which includes:\n
|
||||
• All PRO Themes\n
|
||||
• PR Reviews & On-line code comments (PRs & Commits)\n
|
||||
• PR Merge methods (Rebase & Squash)\n
|
||||
• Support to other Merge methods (Rebase & Squash)\n
|
||||
• Login to unlimited accounts\n
|
||||
• New upcoming PRO features
|
||||
]]></string>
|
||||
@ -540,4 +541,5 @@
|
||||
<string name="warning">Warning</string>
|
||||
<string name="owner">Owner</string>
|
||||
<string name="original_poster">Original Poster</string>
|
||||
<string name="cancel_reviews">Cancel Reviews</string>
|
||||
</resources>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user