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

Commit

Permalink
released 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosh committed Jun 12, 2017
1 parent 80be36a commit 5953acb
Show file tree
Hide file tree
Showing 32 changed files with 541 additions and 273 deletions.
9 changes: 4 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ android {
storePassword((buildProperties.secrets['android_store_password'] | buildProperties.notThere['android_store_password']).string)
}
}
compileSdkVersion 26
buildToolsVersion "26.0.0"
compileSdkVersion 25
buildToolsVersion "26.0.0-rc2"
defaultConfig {
applicationId "com.fastaccess.github"
minSdkVersion 21
targetSdkVersion 26
versionCode 301
versionName "3.0.1"
versionCode 310
versionName "3.1.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
Expand Down Expand Up @@ -148,7 +148,6 @@ dependencies {
implementation "com.github.miguelbcr:RxBillingService:0.0.3"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'org.jsoup:jsoup:1.10.2'
implementation 'com.jakewharton:kotterknife:0.1.0-SNAPSHOT'
implementation "com.evernote:android-state:${state_version}"
implementation "petrov.kristiyan:colorpicker-library:1.1.4"
compileOnly "org.projectlombok:lombok:${lombokVersion}"
Expand Down
1 change: 1 addition & 0 deletions app/src/debug/res/values/secrets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<string name="donation_product_3" translatable="false">android.test.refunded</string>
<string name="donation_product_4" translatable="false">android.test.item_unavailable</string>
<string name="amlod_theme_purchase" translatable="false">android.test.purchased</string>
<string name="midnight_blue_theme_purchase" translatable="false">android.test.purchased</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public static List<FragmentPagerAdapterModel> buildForRepoCode(@NonNull Context
return Stream.of(new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeLight)),
new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeDark)),
new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeAmlod)))
// new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeMidNighBlue)))
.collect(Collectors.toList());
}
}
3 changes: 1 addition & 2 deletions app/src/main/java/com/fastaccess/data/dao/TimelineModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private TimelineModel(GroupedReviewModel groupedReview) {
.map(TimelineModel::new)
.collect(Collectors.toList()));
}
return models;
return Stream.of(models).sortBy(TimelineModel::getSortedDate).toList();
}

@Override public boolean equals(Object o) {
Expand All @@ -280,7 +280,6 @@ private TimelineModel(GroupedReviewModel groupedReview) {
return comment != null ? (int) comment.getId() : 0;
}


@Override public int describeContents() { return 0; }

@Override public void writeToParcel(Parcel dest, int flags) {
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/java/com/fastaccess/helper/PrefGetter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class PrefGetter {
public static final int LIGHT = 1;
public static final int DARK = 2;
public static final int AMLOD = 3;
public static final int MID_NIGHT_BLUE = 4;

public static final int RED = 1;
public static final int PINK = 2;
Expand All @@ -42,7 +43,8 @@ public class PrefGetter {
@IntDef({
LIGHT,
DARK,
AMLOD
AMLOD,
MID_NIGHT_BLUE
})
@Retention(RetentionPolicy.SOURCE) @interface ThemeType {}

Expand Down Expand Up @@ -86,6 +88,7 @@ public class PrefGetter {
private static final String SENT_VIA_BOX = "sent_via_enabled";
private static final String PROFILE_BACKGROUND_URL = "profile_background_url";
private static final String AMLOD_THEME_ENABLED = "amlod_theme_enabled";
private static final String MIDNIGHTBLUE_THEME_ENABLED = "midnightblue_theme_enabled";
private static final String PRO_ITEMS = "pro_items";

public static void setToken(@NonNull String token) {
Expand Down Expand Up @@ -249,6 +252,8 @@ public static boolean isSentViaBoxEnabled() {
return LIGHT;
} else if (appTheme.equalsIgnoreCase(resources.getString(R.string.amlod_theme_mode))) {
return AMLOD;
} else if (appTheme.equalsIgnoreCase(resources.getString(R.string.mid_night_blue_theme_mode))) {
return MID_NIGHT_BLUE;
}
}
return LIGHT;
Expand Down Expand Up @@ -334,6 +339,13 @@ public static void enableAmlodTheme() {
public static boolean isAmlodEnabled() {
return PrefHelper.getBoolean(AMLOD_THEME_ENABLED);
}
public static void enableMidNightBlueTheme() {
PrefHelper.set(MIDNIGHTBLUE_THEME_ENABLED, true);
}

public static boolean isMidNightBlueThemeEnabled() {
return PrefHelper.getBoolean(MIDNIGHTBLUE_THEME_ENABLED);
}

public static void setProItems() {
PrefHelper.set(PRO_ITEMS, true);
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,25 @@ object ThemeEngine {
PrefGetter.DEEP_ORANGE -> return R.style.ThemeAmlod_DeepOrange
else -> return R.style.ThemeAmlod
}
} else if (themeMode == PrefGetter.MID_NIGHT_BLUE) {
when (themeColor) {
PrefGetter.RED -> return R.style.ThemeMidNighBlue_Red
PrefGetter.PINK -> return R.style.ThemeMidNighBlue_Pink
PrefGetter.PURPLE -> return R.style.ThemeMidNighBlue_Purple
PrefGetter.DEEP_PURPLE -> return R.style.ThemeMidNighBlue_DeepPurple
PrefGetter.INDIGO -> return R.style.ThemeMidNighBlue_Indigo
PrefGetter.BLUE -> return R.style.ThemeMidNighBlue
PrefGetter.LIGHT_BLUE -> return R.style.ThemeMidNighBlue_LightBlue
PrefGetter.CYAN -> return R.style.ThemeMidNighBlue_Cyan
PrefGetter.TEAL, PrefGetter.GREEN -> return R.style.ThemeMidNighBlue_Green
PrefGetter.LIGHT_GREEN -> return R.style.ThemeMidNighBlue_LightGreen
PrefGetter.LIME -> return R.style.ThemeMidNighBlue_Lime
PrefGetter.YELLOW -> return R.style.ThemeMidNighBlue_Yellow
PrefGetter.AMBER -> return R.style.ThemeMidNighBlue_Amber
PrefGetter.ORANGE -> return R.style.ThemeMidNighBlue_Orange
PrefGetter.DEEP_ORANGE -> return R.style.ThemeMidNighBlue_DeepOrange
else -> return R.style.ThemeMidNighBlue
}
}
return R.style.ThemeLight
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private void appendPushEvent(SpannableBuilder spannableBuilder, Event eventsMode
int size = commits != null ? commits.size() : -1;
SpannableBuilder spanCommits = SpannableBuilder.builder();
if (size > 0) {
if (size != 1) spanCommits.append(String.valueOf(eventsModel.getPayload().getSize())).append(" more commits").append("\n");
if (size != 1) spanCommits.append(String.valueOf(eventsModel.getPayload().getSize())).append(" new commits").append("\n");
else spanCommits.append("1 new commit").append("\n");
int max = 5;
int appended = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@

import com.fastaccess.R;
import com.fastaccess.data.dao.model.Gist;
import com.fastaccess.helper.Logger;
import com.fastaccess.helper.ParseDateFormat;
import com.fastaccess.ui.widgets.AvatarLayout;
import com.fastaccess.ui.widgets.FontTextView;
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter;
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder;

import butterknife.BindView;

/**
* Created by Kosh on 11 Nov 2016, 2:08 PM
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.fastaccess.ui.adapter.viewholder

import android.view.View
import butterknife.bindView
import com.fastaccess.R
import com.fastaccess.data.dao.TrendingModel
import com.fastaccess.provider.colors.ColorsProvider
import com.fastaccess.provider.emoji.EmojiParser
import com.fastaccess.ui.widgets.FontTextView
import com.fastaccess.ui.widgets.bindView
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder

Expand Down
33 changes: 33 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,12 +26,14 @@
import com.evernote.android.state.State;
import com.evernote.android.state.StateSaver;
import com.fastaccess.App;
import com.fastaccess.BuildConfig;
import com.fastaccess.R;
import com.fastaccess.data.dao.model.Login;
import com.fastaccess.helper.AppHelper;
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.Bundler;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.Logger;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.PrefHelper;
import com.fastaccess.helper.ViewHelper;
Expand All @@ -56,6 +58,9 @@
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
import com.miguelbcr.io.rx_billing_service.RxBillingService;
import com.miguelbcr.io.rx_billing_service.entities.ProductType;
import com.miguelbcr.io.rx_billing_service.entities.Purchase;
import com.nostra13.universalimageloader.core.ImageLoader;

import net.grandcentrix.thirtyinch.TiActivity;
Expand All @@ -65,6 +70,7 @@
import butterknife.BindView;
import butterknife.ButterKnife;
import es.dmoral.toasty.Toasty;
import io.reactivex.functions.Action;


/**
Expand Down Expand Up @@ -433,6 +439,33 @@ protected void changeStatusBarColor(boolean isTransparent) {
}
}

protected void checkPurchases(@Nullable Action action) {
getPresenter().manageViewDisposable(RxBillingService.getInstance(this, BuildConfig.DEBUG)
.getPurchases(ProductType.IN_APP)
.doOnSubscribe(disposable -> showProgress(0))
.subscribe((purchases, throwable) -> {
hideProgress();
if (throwable == null) {
Logger.e(purchases);
if (purchases != null && !purchases.isEmpty()) {
for (Purchase purchase : purchases) {
String sku = purchase.sku();
if (sku != null) {
if (sku.equalsIgnoreCase(getString(R.string.donation_product_1))) {
PrefGetter.enableAmlodTheme();
} else {
PrefGetter.setProItems();
}
}
}
}
} else {
throwable.printStackTrace();
}
if (action != null) action.run();
}));
}

private void setupTheme() {
ThemeEngine.INSTANCE.apply(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class FastHubAboutActivity extends MaterialAboutActivity {
setTheme(R.style.AppTheme_AboutActivity_Dark);
} else if (themeMode == PrefGetter.AMLOD) {
setTheme(R.style.AppTheme_AboutActivity_Amlod);
} else if (themeMode == PrefGetter.MID_NIGHT_BLUE) {
setTheme(R.style.AppTheme_AboutActivity_MidNightBlue);
}
super.onCreate(savedInstanceState);
malRecyclerview = findViewById(R.id.mal_recyclerview);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,10 @@
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.Bundler;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.Logger;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.helper.PrefHelper;
import com.fastaccess.ui.base.BaseActivity;
import com.fastaccess.ui.modules.main.MainActivity;
import com.fastaccess.ui.modules.settings.LanguageBottomSheetDialog;
import com.miguelbcr.io.rx_billing_service.RxBillingService;
import com.miguelbcr.io.rx_billing_service.entities.ProductType;
import com.miguelbcr.io.rx_billing_service.entities.Purchase;

import java.util.Arrays;
import java.util.Locale;
Expand All @@ -43,7 +38,6 @@
import butterknife.OnEditorAction;
import butterknife.Optional;
import es.dmoral.toasty.Toasty;
import io.reactivex.functions.Action;

/**
* Created by Kosh on 08 Feb 2017, 9:10 PM
Expand Down Expand Up @@ -215,35 +209,6 @@ public static void start(@NonNull Activity activity, boolean isBasicAuth) {
progress.setVisibility(View.GONE);
login.show();
}

protected void checkPurchases(Action action) {
RxBillingService.getInstance(this, BuildConfig.DEBUG)
.getPurchases(ProductType.IN_APP)
.doOnSubscribe(disposable -> showProgress(0))
.subscribe((purchases, throwable) -> {
hideProgress();
if (throwable == null) {
Logger.e(purchases);
if (purchases != null && !purchases.isEmpty()) {
for (Purchase purchase : purchases) {
String sku = purchase.sku();
if (sku != null) {
Logger.e(sku);
if (sku.equalsIgnoreCase(getString(R.string.donation_product_1))) {
PrefGetter.enableAmlodTheme();
} else {
PrefGetter.setProItems();
}
}
}
}
} else {
throwable.printStackTrace();
}
action.run();
});
}

private void showLanguage() {
LanguageBottomSheetDialog languageBottomSheetDialog = new LanguageBottomSheetDialog();
languageBottomSheetDialog.onAttach((Context) this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.view.Menu;
import android.view.MenuItem;

import com.evernote.android.state.State;
import com.fastaccess.R;
import com.fastaccess.data.dao.model.Notification;
import com.fastaccess.helper.BundleConstant;
Expand All @@ -25,7 +26,6 @@

import butterknife.BindView;
import butterknife.OnClick;
import com.evernote.android.state.State;
import it.sephiroth.android.library.bottomnavigation.BottomNavigation;
import shortbread.Shortcut;

Expand Down Expand Up @@ -64,6 +64,7 @@ public class MainActivity extends BaseActivity<MainMvp.View, MainPresenter> impl
if (getIntent() != null && getIntent().getBooleanExtra(SlackBottomSheetDialog.TAG, false)) {
new SlackBottomSheetDialog().show(getSupportFragmentManager(), SlackBottomSheetDialog.TAG);
}
checkPurchases(null);
}
selectHome(false);
hideShowShadow(navType == MainMvp.FEEDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class DonateActivity : BaseActivity<BaseMvp.FAView, BasePresenter<BaseMvp.FAView
showMessage(R.string.success, R.string.success_purchase_message)
if (productKey == getString(R.string.donation_product_1) || productKey == getString(R.string.amlod_theme_purchase)) {
PrefGetter.enableAmlodTheme()
} else if (productKey == getString(R.string.midnight_blue_theme_purchase)) {
PrefGetter.enableMidNightBlueTheme()
} else {
PrefGetter.setProItems()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import java.util.*
open class ProfileEventsFragment : BaseFragment<ProfileEvents.View, ProfileEventsPresenter>(), ProfileEvents.View {


val recycler: DynamicRecyclerView by lazy { view!!.findViewById<DynamicRecyclerView>(R.id.recycler) }
val refresh: SwipeRefreshLayout by lazy { view!!.findViewById<SwipeRefreshLayout>(R.id.refresh) }
val stateLayout: StateLayout by lazy { view!!.findViewById<StateLayout>(R.id.stateLayout) }
val recycler: DynamicRecyclerView by lazy { view!!.findViewById(R.id.recycler) as DynamicRecyclerView }
val refresh: SwipeRefreshLayout by lazy { view!!.findViewById(R.id.refresh) as SwipeRefreshLayout }
val stateLayout: StateLayout by lazy { view!!.findViewById(R.id.stateLayout) as StateLayout }

val adapter by lazy { FeedsAdapter(presenter.getEvents(), true) }
private var onLoadMore: OnLoadMore<String>? = null
Expand Down
Loading

0 comments on commit 5953acb

Please sign in to comment.