released 3.2.0

This commit is contained in:
Kosh 2017-06-18 17:41:08 +08:00
parent 943a126d51
commit 5e1fcc484b
17 changed files with 103 additions and 74 deletions

View File

@ -28,8 +28,8 @@ android {
applicationId "com.fastaccess.github"
minSdkVersion 21
targetSdkVersion 26
versionCode 310
versionName "3.1.0"
versionCode 320
versionName "3.2.0"
signingConfig signingConfigs.signing
buildConfigString "GITHUB_CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string
buildConfigString "GITHUB_SECRET", (buildProperties.secrets['github_secret'] | buildProperties.notThere['github_secret']).string

View File

@ -195,10 +195,10 @@
<activity
android:name=".ui.modules.repos.wiki.WikiActivity"
android:label="@string/gollum"
android:parentActivityName=".ui.modules.main.MainActivity">
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.main.MainActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity"/>
</activity>
<activity

View File

@ -121,6 +121,12 @@ body h1 {
border-bottom: 1px solid #eee
}
.gh-header-meta {
padding-bottom: .3em;
margin-bottom: 6px;
border-bottom: 1px solid #eee
}
body h2 {
padding-bottom: .3em;
font-size: 1.5em;

View File

@ -126,6 +126,12 @@ body h1 {
border-bottom: 1px solid #656d78
}
.gh-header-meta {
padding-bottom: .3em;
margin-bottom: 6px;
border-bottom: 1px solid #656d78
}
body h2 {
padding-bottom: .3em;
font-size: 1.5em;

View File

@ -6,6 +6,7 @@ import android.net.Uri;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import com.fastaccess.BuildConfig;
import com.fastaccess.R;
@ -105,8 +106,12 @@ public class RestProvider {
DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(uri);
File direct = new File(Environment.getExternalStorageDirectory() + File.separator + context.getString(R.string.app_name));
if (!direct.exists()) {
direct.mkdirs();
if (!direct.isDirectory() || !direct.exists()) {
boolean isCreated = direct.mkdirs();
if (!isCreated) {
Toast.makeText(context, "Unable to create directory to download file", Toast.LENGTH_SHORT).show();
return;
}
}
String fileName = "";
NameParser nameParser = new NameParser(url);

View File

@ -74,11 +74,17 @@ public class PullStatusViewHolder extends BaseViewHolder<PullRequestStatusModel>
SpannableBuilder builder = SpannableBuilder.builder();
Stream.of(pullRequestStatusModel.getStatuses())
.filter(statusesModel -> statusesModel.getState() != null)
.forEach(statusesModel -> builder
.append(ContextCompat.getDrawable(statuses.getContext(), statusesModel.getState().getDrawableRes()))
.append(" ")
.url(statusesModel.getDescription(), v -> SchemeParser.launchUri(v.getContext(), Uri.parse(statusesModel.getTargetUrl())))
.append("\n"));
.forEach(statusesModel -> {
builder.append(ContextCompat.getDrawable(statuses.getContext(), statusesModel.getState().getDrawableRes()));
if (!InputHelper.isEmpty(statusesModel.getTargetUrl())) {
builder.append(" ")
.url(statusesModel.getDescription(), v -> SchemeParser.launchUri(v.getContext(),
Uri.parse(statusesModel.getTargetUrl())))
.append("\n");
} else {
builder.append("\n");
}
});
if (!InputHelper.isEmpty(builder)) {
statuses.setMovementMethod(LinkMovementMethod.getInstance());
statuses.setText(builder);

View File

@ -62,11 +62,12 @@ public class ChangelogBottomSheetDialog extends BaseMvpBottomSheetDialogFragment
}
private void showChangelog(String html) {
if (prettifyWebView == null) return;
webProgress.setVisibility(View.GONE);
if (html != null) {
message.setVisibility(View.GONE);
prettifyWebView.setVisibility(View.VISIBLE);
prettifyWebView.setGithubContent(html, null);
prettifyWebView.setGithubContent(html, null, false, false);
prettifyWebView.setNestedScrollingEnabled(false);
}
}

View File

@ -113,7 +113,7 @@ public class EditorActivity extends BaseActivity<EditorMvp.View, EditorPresenter
int end = editText.getSelectionEnd();
editText.getText().replace(inMentionMode, end, complete, 0, complete.length());
inMentionMode = -1;
} catch (IndexOutOfBoundsException ignored) {}
} catch (Exception ignored) {}
mention.setVisibility(GONE);
listDivider.setVisibility(GONE);
}
@ -339,9 +339,8 @@ public class EditorActivity extends BaseActivity<EditorMvp.View, EditorPresenter
for (String participant : participants)
if (participant.toLowerCase().startsWith(mentioning.replace("@", "").toLowerCase()))
mentions.add(participant);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, mentions.subList(0, Math.min(mentions.size(), 3)));
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
android.R.id.text1, mentions.subList(0, Math.min(mentions.size(), 3)));
mention.setAdapter(adapter);
Log.d(getLoggingTag(), mentions.toString());
}
@ -378,7 +377,7 @@ public class EditorActivity extends BaseActivity<EditorMvp.View, EditorPresenter
mention.setVisibility(inMentionMode > 0 ? View.VISIBLE : GONE);
listDivider.setVisibility(mention.getVisibility());
}
} catch (ArrayIndexOutOfBoundsException ignored) {}
} catch (Exception ignored) {}
}
}

View File

@ -206,6 +206,7 @@ public class LoginActivity extends BaseActivity<LoginMvp.View, LoginPresenter> i
@Override public void onBackPressed() {
if (!(this instanceof LoginChooserActivity)) {
startActivity(new Intent(this, LoginChooserActivity.class));
finish();
} else {
finish();
}

View File

@ -58,13 +58,17 @@ class DonateActivity : BaseActivity<BaseMvp.FAView, BasePresenter<BaseMvp.FAView
Answers.getInstance().logPurchase(PurchaseEvent().putItemName(productKey))
showMessage(R.string.success, R.string.success_purchase_message)
enableProduct(productKey)
setResult(Activity.RESULT_OK)
val intent = Intent()
intent.putExtra(BundleConstant.ITEM, productKey)
setResult(Activity.RESULT_OK, intent)
} else {
if (throwable is RxBillingServiceException) {
val code = throwable.code
if (code == RxBillingServiceError.ITEM_ALREADY_OWNED) {
enableProduct(productKey)
setResult(Activity.RESULT_OK)
val intent = Intent()
intent.putExtra(BundleConstant.ITEM, productKey)
setResult(Activity.RESULT_OK, intent)
} else {
showErrorMessage(throwable.message!!)
Logger.e(code)

View File

@ -16,7 +16,7 @@ import com.fastaccess.data.dao.wiki.WikiContentModel
import com.fastaccess.helper.BundleConstant
import com.fastaccess.helper.Bundler
import com.fastaccess.ui.base.BaseActivity
import com.fastaccess.ui.modules.main.MainActivity
import com.fastaccess.ui.modules.repos.RepoPagerActivity
import com.fastaccess.ui.widgets.StateLayout
import com.fastaccess.ui.widgets.bindView
import com.prettifier.pretty.PrettifyWebView
@ -104,7 +104,9 @@ class WikiActivity : BaseActivity<WikiMvp.View, WikiPresenter>(), WikiMvp.View {
return true
}
android.R.id.home -> {
startActivity(Intent(this, MainActivity::class.java))
if (!presenter.login.isNullOrEmpty() && !presenter.repoId.isNullOrEmpty()) {
startActivity(RepoPagerActivity.createIntent(this, presenter.repoId!!, presenter.login!!))
}
finish()
return true
}

View File

@ -4,6 +4,7 @@ import android.content.Intent
import com.fastaccess.data.dao.wiki.WikiContentModel
import com.fastaccess.data.dao.wiki.WikiSideBarModel
import com.fastaccess.helper.BundleConstant
import com.fastaccess.helper.Logger
import com.fastaccess.helper.RxHelper
import com.fastaccess.provider.rest.jsoup.JsoupProvider
import com.fastaccess.ui.base.mvp.presenter.BasePresenter
@ -51,12 +52,12 @@ class WikiPresenter : BasePresenter<WikiMvp.View>(), WikiMvp.Presenter {
if (bottomRightBar.isNotEmpty()) {
bottomRightBar.remove()
}
val headerHtml = wikiWrapper.select(".gh-header")
val headerHtml = wikiWrapper.select(".gh-header .gh-header-meta")
val revision = headerHtml.select("a.history")
if (revision.isNotEmpty()) {
revision.remove()
}
val header = headerHtml.html() + "<h1></h1>"
val header = "<div class='gh-header-meta'>${headerHtml.html()}</div>"
val wikiContent = wikiWrapper.select(".wiki-content")
val content = header + wikiContent.select(".markdown-body").html()
val rightBarList = wikiContent.select(".wiki-pages").select("li")
@ -68,6 +69,7 @@ class WikiPresenter : BasePresenter<WikiMvp.View>(), WikiMvp.Presenter {
sidebarList.add(WikiSideBarModel(sidebarTitle, sidebarLink))
}
}
Logger.d(header)
s.onNext(WikiContentModel(content, "", sidebarList))
} else {
s.onNext(WikiContentModel("<h2 align='center'>No Wiki</h4>", "", arrayListOf()))

View File

@ -7,12 +7,11 @@ import android.support.design.widget.AppBarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.evernote.android.state.State;
import com.fastaccess.R;
import com.fastaccess.data.dao.FragmentPagerAdapterModel;
import com.fastaccess.data.dao.TabsCountStateModel;
@ -34,7 +33,6 @@ import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnEditorAction;
import butterknife.OnTextChanged;
import com.evernote.android.state.State;
/**
* Created by Kosh on 08 Dec 2016, 8:22 PM
@ -62,13 +60,9 @@ public class SearchActivity extends BaseActivity<SearchMvp.View, SearchPresenter
}
}
@OnEditorAction(R.id.searchEditText) boolean onEditor(int actionId, KeyEvent keyEvent) {
if (keyEvent != null && keyEvent.getAction() == KeyEvent.KEYCODE_SEARCH) {
getPresenter().onSearchClicked(pager, searchEditText);
} else if (actionId == EditorInfo.IME_ACTION_SEARCH) {
getPresenter().onSearchClicked(pager, searchEditText);
}
return false;
@OnEditorAction(R.id.searchEditText) boolean onEditor() {
getPresenter().onSearchClicked(pager, searchEditText);
return true;
}
@OnClick(value = {R.id.clear}) void onClear(View view) {

View File

@ -83,7 +83,14 @@ class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter
if (resultCode == Activity.RESULT_OK) {
if (PrefGetter.isProEnabled() || PrefGetter.isMidNightBlueThemeEnabled()
|| PrefGetter.isAmlodEnabled() || PrefGetter.isBluishEnabled()) {
themeListener?.onThemeApplied()
val productKey = data?.getStringExtra(BundleConstant.ITEM)
productKey?.let {
when (it) {
getString(R.string.amlod_theme_purchase) -> setTheme(getString(R.string.amlod_theme_mode))
getString(R.string.midnight_blue_theme_purchase) -> setTheme(getString(R.string.mid_night_blue_theme_mode))
getString(R.string.theme_bluish_purchase) -> setTheme(getString(R.string.bluish_theme))
}
}
}
}
}
@ -101,33 +108,28 @@ class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter
private fun setTheme() {
when (theme) {
R.style.ThemeLight -> {
PrefHelper.set(THEME, getString(R.string.light_theme_mode))
themeListener?.onThemeApplied()
setTheme(getString(R.string.light_theme_mode))
}
R.style.ThemeDark -> {
PrefHelper.set(THEME, getString(R.string.dark_theme_mode))
themeListener?.onThemeApplied()
setTheme(getString(R.string.dark_theme_mode))
}
R.style.ThemeAmlod -> {
if (PrefGetter.isAmlodEnabled() || PrefGetter.isProEnabled()) {
PrefHelper.set(THEME, getString(R.string.amlod_theme_mode))
themeListener?.onThemeApplied()
setTheme(getString(R.string.amlod_theme_mode))
} else {
DonateActivity.start(this, getString(R.string.amlod_theme_purchase))
}
}
R.style.ThemeMidNighBlue -> {
if (PrefGetter.isMidNightBlueThemeEnabled() || PrefGetter.isProEnabled()) {
PrefHelper.set(THEME, getString(R.string.mid_night_blue_theme_mode))
themeListener?.onThemeApplied()
setTheme(getString(R.string.mid_night_blue_theme_mode))
} else {
DonateActivity.start(this, getString(R.string.midnight_blue_theme_purchase))
}
}
R.style.ThemeBluish -> {
if (PrefGetter.isBluishEnabled() || PrefGetter.isProEnabled()) {
PrefHelper.set(THEME, getString(R.string.bluish_theme))
themeListener?.onThemeApplied()
setTheme(getString(R.string.bluish_theme))
} else {
DonateActivity.start(this, getString(R.string.theme_bluish_purchase))
}
@ -135,6 +137,11 @@ class ThemeFragment : BaseFragment<ThemeFragmentMvp.View, ThemeFragmentPresenter
}
}
private fun setTheme(theme: String) {
PrefHelper.set(THEME, theme)
themeListener?.onThemeApplied()
}
private fun isPremiumTheme(): Boolean = theme != R.style.ThemeLight && theme != R.style.ThemeDark
}

View File

@ -76,7 +76,7 @@ public class MessageDialogView extends BaseBottomSheetDialog {
if (msg != null) {
message.setVisibility(View.GONE);
prettifyWebView.setVisibility(View.VISIBLE);
prettifyWebView.setGithubContent(msg, null);
prettifyWebView.setGithubContent(msg, null, false, false);
prettifyWebView.setNestedScrollingEnabled(false);
return;
}

View File

@ -165,7 +165,11 @@ public class PrettifyWebView extends NestedWebView {
}
public void setGithubContent(@NonNull String source, @Nullable String baseUrl, boolean toggleNestScrolling) {
addJavascriptInterface(new MarkDownInterceptorInterface(this, toggleNestScrolling), "Android");
setGithubContent(source, baseUrl, toggleNestScrolling, true);
}
public void setGithubContent(@NonNull String source, @Nullable String baseUrl, boolean toggleNestScrolling, boolean enableBridge) {
if (enableBridge) addJavascriptInterface(new MarkDownInterceptorInterface(this, toggleNestScrolling), "Android");
String page = GithubHelper.generateContent(getContext(), source, baseUrl, AppHelper.isNightMode(getResources()));
post(() -> loadDataWithBaseURL("file:///android_asset/md/", page, "text/html", "utf-8", null));
}

View File

@ -1,40 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document.md</title>
<style></style>
</head>
<body id="preview">
<h2><a id="FastHub_changelog_0"></a>FastHub changelog
</h2>
<h3><a id="Version__310_Amlod_Theme_font_colorredPremiumfont_2"></a>Version 3.1.0 (Amlod Theme <font color="red">Premium</font>)
</h3>
<h4><a id="Bugs__Enhancements__new_Features_301_4"></a>Bugs , Enhancements &amp; New Features (3.1.0)
</h4>
<h2><a id="FastHub_changelog_0"></a>FastHub changelog</h2>
<h3><a id="Version__320_Wiki_Support_2"></a>Version 3.2.0 (Wiki Support)</h3>
<h4><a id="Bugs__Enhancements__new_Features_320_4"></a>Bugs , Enhancements &amp; new Features (3.2.0)</h4>
<ul>
<li>(New) Amlod Theme (those who has supported FastHub development will get it for free 😉 ).</li>
<li>(New) Youll be seeing a heart next to your name in the drawer menu to indicates that you supported FastHub before.</li>
<li>(New) Repo readme header & footer now will disappear on scroll & only appear when you reach top to improve reading experience.</li>
<li>(Enhancement) Feeds now should be displaying the feed almost like GitHub website.</li>
<li>(Enhancement) Issue tab should be disabled if the Repo doesnt have issues enabled.</li>
<li>(Enhancement) Revamp of the whole code syntax highlighting, also now the auto scrolled line number would be highlighted.</li>
<li>(Enhancement) Revamp of selecting Themes UI, now you should have proper display of what you going to see before applying the theme.
</li>
<li>(Enhancement) Display accent color theme instead of text when selecting accent color. thanks to @Dreamersoul</li>
<li>(Fix) No newline showing in wrong place.
<em>(again)</em>
</li>
<li>(Fix) Clicking version number now should make a proper API call to determine if there is new update for FastHub.</li>
<li>(New) Wiki Support</li>
<li>(New) Bluish Theme (Premium)</li>
<li>(New) Search Trending language</li>
<li>(New) Traditional Chinese Language support (thanks to @maple3142)</li>
<li>(New) Brazilian Portuguese language support (thanks to @caiorrs)</li>
<li>(Enhancement) Amlod Theme code highlighting</li>
<li>(Enhancement) Overall layouts improvements</li>
<li>(Enhancement) Animate Repo Header on show/hide</li>
<li>(Enhancement) About screen to follow overall selected theme</li>
<li>(Fix) Gists deeplinks</li>
<li>(Fix) Release description scrolling</li>
<li>(Fix) Filter repos for orgs shows in other tabs</li>
<li>(Fix) Readme images disappeared two days ago, due to GitHub changing implementation for relative paths!</li>
<li>(Fix) PR reviews sort order</li>
<li>(Fix) Auto scrolling line for small files may cause the file to not be scrollable</li>
<li>(Fix) Some crashes from the crash report</li>
<li>There are more stuff are not mentioned, find them out :p</li>
<li>(Fix) Lots of bug fixes</li>
</ul>
<blockquote>
<p>Thanks to everyone who contributed either via reporting bugs or via code contribution</p>
</blockquote>
<p>
<strong>Thank you very much</strong>
</p>
<p><strong>Thank you very much</strong></p>
</body>
</html>