Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
added changelog view & ready to release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosh committed Mar 26, 2017
1 parent 7a1df22 commit 28fd3e0
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 58 deletions.
11 changes: 10 additions & 1 deletion app/src/main/java/com/fastaccess/helper/PrefGetter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;

import com.fastaccess.BuildConfig;
import com.fastaccess.R;

import java.lang.annotation.Retention;
Expand All @@ -27,7 +28,7 @@ public class PrefGetter {
})
@Retention(RetentionPolicy.SOURCE) @interface ThemeType {}


private static final String WHATS_NEW_VERSION = "whats_new";
private static final String ADS = "enable_ads";
private static final String TOKEN = "token";
private static final String USER_ICON_GUIDE = "user_icon_guide";
Expand Down Expand Up @@ -146,4 +147,12 @@ public static boolean isMarkAsReadEnabled() {
}
return LIGHT;
}

public static void setWhatsNewVersion() {
PrefHelper.set(WHATS_NEW_VERSION, BuildConfig.VERSION_CODE);
}

public static boolean showWhatsNew() {
return PrefHelper.getInt(WHATS_NEW_VERSION) != BuildConfig.VERSION_CODE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.fastaccess.provider.changelog;

import android.content.Context;
import android.support.annotation.NonNull;

import com.fastaccess.R;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import rx.Observable;

/**
* Created by Kosh on 26 Mar 2017, 10:07 PM
*/

public class ChangelogProvider {

@SuppressWarnings("ResultOfMethodCallIgnored") public static Observable<String> getChangelog(@NonNull Context context) {
return Observable.fromCallable(() -> {
InputStream is = context.getResources().openRawResource(R.raw.changelog);
try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) {
byte[] buffer = new byte[is.available()];
is.read(buffer);
byteStream.write(buffer);
byteStream.close();
is.close();
return byteStream.toString();
} catch (IOException e) {
e.printStackTrace();
}
return null;
});
}
}
4 changes: 4 additions & 0 deletions app/src/main/java/com/fastaccess/ui/base/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.fastaccess.helper.ViewHelper;
import com.fastaccess.ui.base.mvp.BaseMvp;
import com.fastaccess.ui.base.mvp.presenter.BasePresenter;
import com.fastaccess.ui.modules.changelog.ChangelogView;
import com.fastaccess.ui.modules.login.LoginView;
import com.fastaccess.ui.widgets.dialog.ProgressDialogFragment;
import com.google.android.gms.ads.AdRequest;
Expand Down Expand Up @@ -86,6 +87,9 @@ public abstract class BaseActivity<V extends BaseMvp.FAView, P extends BasePrese
}
setupToolbarAndStatusBar(toolbar);
showHideAds();
if (savedInstanceState == null && PrefGetter.showWhatsNew()) {
new ChangelogView().show(getSupportFragmentManager(), "ChangelogView");
}
}

@Override protected void onResume() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package com.fastaccess.ui.modules.changelog;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ProgressBar;

import com.fastaccess.BuildConfig;
import com.fastaccess.R;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.RxHelper;
import com.fastaccess.provider.changelog.ChangelogProvider;
import com.fastaccess.ui.base.BaseBottomSheetDialog;
import com.fastaccess.ui.widgets.FontButton;
import com.fastaccess.ui.widgets.FontTextView;
import com.prettifier.pretty.PrettifyWebView;

import butterknife.BindView;
import butterknife.OnClick;
import icepick.State;
import rx.Subscription;

/**
* Created by Kosh on 26 Mar 2017, 10:15 PM
*/

public class ChangelogView extends BaseBottomSheetDialog {

@BindView(R.id.title) FontTextView title;
@BindView(R.id.message) FontTextView message;
@BindView(R.id.cancel) FontButton cancel;
@BindView(R.id.messageLayout) View messageLayout;
@BindView(R.id.prettifyWebView) PrettifyWebView prettifyWebView;
@BindView(R.id.webProgress) ProgressBar webProgress;
@State String html;

private Subscription subscription;

@OnClick(R.id.ok) void onOk() {
dismiss();
}

@Override protected int layoutRes() {
return R.layout.message_dialog;
}

@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
messageLayout.setBackgroundColor(Color.WHITE);
if (savedInstanceState == null) {
if (!BuildConfig.DEBUG) {
PrefGetter.setWhatsNewVersion();
}
}
webProgress.setVisibility(View.VISIBLE);
cancel.setVisibility(View.GONE);
title.setText(R.string.changelog);
if (html == null) {
subscription = RxHelper.getObserver(ChangelogProvider.getChangelog(getContext()))
.subscribe(s -> {
this.html = s;
showChangelog();
});
} else {
showChangelog();
}
}

private void showChangelog() {
webProgress.setVisibility(View.GONE);
if (html != null) {
message.setVisibility(View.GONE);
prettifyWebView.setVisibility(View.VISIBLE);
prettifyWebView.setGithubContent(html, null, true);
prettifyWebView.setNestedScrollingEnabled(false);
}
}

@Override public void onDestroyView() {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
super.onDestroyView();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:elevation="@dimen/spacing_micro"
app:tabGravity="fill"
app:tabSelectedTextColor="?colorAccent"
app:tabTextColor="@color/dark_gray"/>

Expand Down
129 changes: 72 additions & 57 deletions app/src/main/res/layouts/other_layouts/layout/message_dialog.xml
Original file line number Diff line number Diff line change
@@ -1,81 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<FrameLayout
android:id="@+id/messageLayout"
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="@color/card_background"
android:orientation="vertical">

<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/title"
style="@style/TextAppearance.AppCompat.Title"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/spacing_xs_large"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"
tools:text="How jolly. You loot like a mast."/>


<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:orientation="vertical">

<LinearLayout
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/title"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingStart="@dimen/spacing_xs_large">
android:padding="@dimen/spacing_xs_large"
android:textColor="?android:textColorPrimary"
android:textStyle="bold"
tools:text="How jolly. You loot like a mast."/>

<com.prettifier.pretty.PrettifyWebView
android:id="@+id/prettifyWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="200dp"
android:visibility="gone"/>

<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/message"
style="@style/TextAppearance.AppCompat.Medium"
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="all"
android:textColor="?android:attr/textColorSecondary"
tools:text="Hello World"/>
</LinearLayout>
android:orientation="vertical"
android:paddingEnd="@dimen/spacing_xs_large"
android:paddingStart="@dimen/spacing_xs_large">

</android.support.v4.widget.NestedScrollView>
<com.prettifier.pretty.PrettifyWebView
android:id="@+id/prettifyWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="200dp"
android:visibility="gone"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="end"
android:paddingBottom="@dimen/spacing_normal"
android:paddingTop="@dimen/spacing_normal">
<com.fastaccess.ui.widgets.FontTextView
android:id="@+id/message"
style="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="all"
android:textColor="?android:attr/textColorSecondary"
tools:text="Hello World"/>
</LinearLayout>

<com.fastaccess.ui.widgets.FontButton
android:id="@+id/cancel"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/cancel"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/material_pink_700"/>
</android.support.v4.widget.NestedScrollView>

<com.fastaccess.ui.widgets.FontButton
android:id="@+id/ok"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/ok"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?colorAccent"/>
android:layout_gravity="center"
android:gravity="end"
android:paddingBottom="@dimen/spacing_normal"
android:paddingTop="@dimen/spacing_normal">

<com.fastaccess.ui.widgets.FontButton
android:id="@+id/cancel"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/cancel"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/material_pink_700"/>

<com.fastaccess.ui.widgets.FontButton
android:id="@+id/ok"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/ok"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?colorAccent"/>

</LinearLayout>
</LinearLayout>
</LinearLayout>

<ProgressBar
android:id="@+id/webProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end|center"
android:visibility="gone"
tools:visibility="visible"/>
</FrameLayout>
57 changes: 57 additions & 0 deletions app/src/main/res/raw/changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!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_2"></a>Version 1.4.0</h3>
<h4><a id="New_4"></a>New</h4>
<ul>
<li>Introduction new enhanced <strong><strong>FastHub</strong> Main Screen</strong> showing you what matters the most to you:
<ul>
<li>My Feeds</li>
<li>Pull Requests</li>
<li>Issues</li>
</ul>
</li>
<li><strong>Notifications</strong>, the notifications in (notification panel) is now enhanced as: <a href="https://github.com/k0shk0sh/FastHub/issues/111">#111</a>
<ul>
<li>Grouped Notifications, all under one notification.</li>
<li>Showing comments within the notification. Yaay.</li>
<li>Opening the specific view from within the notification, no more extra clicks.</li>
<li>Upon clicking a notification, it will be auto-magically marked as read unless if you disable it from the settings screen.</li>
</ul>
</li>
<li><strong>Pinned Repos</strong>, is a place that lives outside of GitHub and only exists in <strong>FastHub</strong>, you could pin any repo you
like and access it faster from
within the <strong>Pinned</strong> tab from MenuDrawer (works <strong>Offline</strong>). <a href="https://github.com/k0shk0sh/FastHub/issues/184">#184</a></li>
<li>Menu Drawer now has more options, and there will be more in the future:
<ul>
<li>Pinned</li>
<li>Public Gists (Previously in BottomBar)</li>
<li>Your own Gists</li>
<li>More items</li>
</ul>
</li>
<li><strong>Issues</strong> &amp; <strong>Pull Requests</strong> count, <strong>Please be aware that this rely on the Search API which mean it has API limit</strong> for more info please<br>
visit. <a href="https://developer.github.com/v3/search/#rate-limit">GitHub Developer Rate Limit</a> <a href="https://github.com/k0shk0sh/FastHub/issues/185">#185</a></li>
<li>Now Downloaded files are going to be downloaded into your <strong>sdcard/FastHub</strong> folder which results in asking a new <strong>Permission</strong>.</li>
</ul>
<h4><a id="Fixes_25"></a>Fixes</h4>
<ul>
<li>Those who uses custom build.properties in their phone to modify the display density, now the app should behave like it should and show you the<br>
right layout for your screen.<a href="https://github.com/k0shk0sh/FastHub/issues/189">#189</a></li>
<li>Files and Branches now should be downloaded in <strong>FastHub</strong> Folder. <a href="https://github.com/k0shk0sh/FastHub/issues/188">#188</a></li>
<li>Enable ads not saved upon restarting app.<a href="https://github.com/k0shk0sh/FastHub/issues/176">#176</a></li>
<li>Commit files font style. <a href="https://github.com/k0shk0sh/FastHub/issues/187">#187</a></li>
<li>And More fixed internally that I can’t really remember them.</li>
</ul>
<blockquote>
<p>Please notice: if you are using Android 7 &amp; above, you might have a problem with the NightMode. its something out of FastHub league as its OS bug<br>
than <strong>FastHub</strong> due to this &amp; as per request we will end up with a <strong>Themes Engine</strong> very soon.</p>
</blockquote>
<blockquote>
<p>Please notice: Organization is my highest priority for the next release, please stay tuned &amp; patience.</p>
</blockquote>
<blockquote>
<p><strong>FastHub</strong> in a month has closed 176 issues &amp; feature requests, its a one man job, so please bare with me.</p>
</blockquote>
<p><strong>Thank you very much</strong></p>

</body></html>
Loading

0 comments on commit 28fd3e0

Please sign in to comment.