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

Commit

Permalink
this commit fixes #542
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosh committed Jun 4, 2017
1 parent 500efcf commit 6e520e5
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 399 deletions.
4 changes: 1 addition & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {
buildTypes {
release {
minifyEnabled true
shrinkResources true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down Expand Up @@ -105,8 +105,6 @@ repositories {
mavenCentral()
}



dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:${supportVersion}"
Expand Down
9 changes: 6 additions & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
-keepclasseswithmembernames class * {
@icepick.* <fields>;
}
-keep class com.fastaccess.data.dao.** { *; }
-keep class com.fastaccess.data.** { *; }
-keep class com.fastaccess.provider.rest.** { *; }
-keepclassmembers class com.prettifier.pretty.callback.MarkDownInterceptorInterface {
public *;
}
Expand Down Expand Up @@ -101,11 +102,13 @@
<fields>;
}

-keep class net.nightwhistler.** {*;}
-keep class org.htmlcleaner.** {*;}
-keep class net.nightwhistler.** { *; }
-keep class org.htmlcleaner.** { *; }
-dontwarn org.jaxen.**
-dontwarn org.jdom.**
-dontwarn com.google.android.gms.**
-dontwarn android.animation.**
-dontwarn java.io.**
-dontwarn android.content.**
-keeppackagenames org.jsoup.nodes
-keep class com.github.florent37.** { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private FragmentPagerAdapterModel(String title, Fragment fragment) {

@NonNull public static List<FragmentPagerAdapterModel> buildForProfile(@NonNull Context context, @NonNull String login) {
return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.overview), ProfileOverviewFragment.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.feeds), ProfileEventsFragment.Companion.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.feed), ProfileEventsFragment.Companion.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.repos), ProfileReposFragment.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.starred), ProfileStarredFragment.newInstance(login)),
new FragmentPagerAdapterModel(context.getString(R.string.gists), ProfileGistsFragment.newInstance(login)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
Expand All @@ -15,25 +14,31 @@
import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem;
import com.danielstone.materialaboutlibrary.model.MaterialAboutCard;
import com.danielstone.materialaboutlibrary.model.MaterialAboutList;
import com.fastaccess.BuildConfig;
import com.fastaccess.R;
import com.fastaccess.data.dao.model.Release;
import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.helper.AppHelper;
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.PrefGetter;
import com.fastaccess.ui.modules.changelog.ChangelogBottomSheetDialog;
import com.fastaccess.ui.modules.repos.RepoPagerActivity;
import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity;
import com.fastaccess.ui.modules.user.UserPagerActivity;
import com.mikepenz.aboutlibraries.Libs;
import com.mikepenz.aboutlibraries.LibsBuilder;

import es.dmoral.toasty.Toasty;
import io.reactivex.disposables.Disposable;

/**
* Created by danielstone on 12 Mar 2017, 1:57 AM
*/
public class FastHubAboutActivity extends MaterialAboutActivity {

View malRecyclerview;
private View malRecyclerview;
private Disposable disposable;


@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
int themeMode = PrefGetter.getThemeType(getApplicationContext());
Expand All @@ -48,70 +53,14 @@ public class FastHubAboutActivity extends MaterialAboutActivity {

@Override protected MaterialAboutList getMaterialAboutList(Context context) {
MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();
try {
appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(context, ContextCompat.getDrawable(context, R.drawable.ic_issues),
getString(R.string.version), false));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}

appCardBuilder.addItem(ConvenienceBuilder.createRateActionItem(context, ContextCompat.getDrawable(context, R.drawable.ic_star_filled),
getString(R.string.rate_app), null));

appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.report_issue)
.subText(R.string.report_issue_here)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_bug))
.setOnClickListener(b -> CreateIssueActivity.startForResult(this, CreateIssueActivity.startForResult(this), malRecyclerview))
.build());
appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.open_source_libs)
.icon(R.drawable.ic_github)
.setOnClickListener(b -> new LibsBuilder()
.withActivityStyle(AppHelper.isNightMode(getResources()) ? Libs.ActivityStyle.DARK : Libs.ActivityStyle.LIGHT)
.withAutoDetect(true)
.withAboutIconShown(true)
.withAboutVersionShown(true)
.start(this))
.build());

buildApp(context, appCardBuilder);
MaterialAboutCard.Builder miscCardBuilder = new MaterialAboutCard.Builder();
buildMisc(context, miscCardBuilder);
MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
authorCardBuilder.title(R.string.author);
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Kosh")
.subText("k0shk0sh")
.icon(ContextCompat.getDrawable(context, R.drawable.ic_profile))
.setOnClickListener(b -> UserPagerActivity.startActivity(context, "k0shk0sh"))
.build());
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.fork_github)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_github))
.setOnClickListener(b -> startActivity(RepoPagerActivity.createIntent(this, "FastHub", "k0shk0sh")))
.build());

authorCardBuilder.addItem(ConvenienceBuilder.createEmailItem(context, ContextCompat.getDrawable(context, R.drawable.ic_email),
getString(R.string.send_email), true, getString(R.string.email_address), getString(R.string.question_concerning_fasthub)));

buildAuthor(context, authorCardBuilder);
MaterialAboutCard.Builder logoAuthor = new MaterialAboutCard.Builder();
logoAuthor.title(getString(R.string.logo_designer, "Kevin Aguilar"));
logoAuthor.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.google_plus)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_profile))
.setOnClickListener(b -> ActivityHelper.startCustomTab(this, "https://plus.google.com/+KevinAguilarC"))
.build());
logoAuthor.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.twitter)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_profile))
.setOnClickListener(b -> ActivityHelper.startCustomTab(this, "https://twitter.com/kevttob"))
.build());
logoAuthor.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.website)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_brower))
.setOnClickListener(b -> ActivityHelper.startCustomTab(this, "https://www.221pixels.com/"))
.build());


return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build(), logoAuthor.build());
buildLogo(context, logoAuthor);
return new MaterialAboutList(appCardBuilder.build(), miscCardBuilder.build(), authorCardBuilder.build(), logoAuthor.build());
}

@Override protected CharSequence getActivityTitle() {
Expand All @@ -131,4 +80,96 @@ public class FastHubAboutActivity extends MaterialAboutActivity {
}
return false;//override
}

@Override protected void onDestroy() {
if (disposable != null && !disposable.isDisposed()) {
disposable.dispose();
}
super.onDestroy();
}

private void buildLogo(Context context, MaterialAboutCard.Builder logoAuthor) {
logoAuthor.title(getString(R.string.logo_designer, "Kevin Aguilar"));
logoAuthor.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.google_plus)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_profile))
.setOnClickListener(b -> ActivityHelper.startCustomTab(this, "https://plus.google.com/+KevinAguilarC"))
.build())
.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.twitter)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_profile))
.setOnClickListener(b -> ActivityHelper.startCustomTab(this, "https://twitter.com/kevttob"))
.build())
.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.website)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_brower))
.setOnClickListener(b -> ActivityHelper.startCustomTab(this, "https://www.221pixels.com/"))
.build());
}

private void buildAuthor(Context context, MaterialAboutCard.Builder authorCardBuilder) {
authorCardBuilder.title(R.string.author);
authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text("Kosh Sergani")
.subText("k0shk0sh")
.icon(ContextCompat.getDrawable(context, R.drawable.ic_profile))
.setOnClickListener(b -> UserPagerActivity.startActivity(context, "k0shk0sh"))
.build())
.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.fork_github)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_github))
.setOnClickListener(b -> startActivity(RepoPagerActivity.createIntent(this, "FastHub", "k0shk0sh")))
.build())
.addItem(ConvenienceBuilder.createEmailItem(context, ContextCompat.getDrawable(context, R.drawable.ic_email),
getString(R.string.send_email), true, getString(R.string.email_address), getString(R.string.question_concerning_fasthub)));
}

private void buildMisc(Context context, MaterialAboutCard.Builder miscCardBuilder) {
miscCardBuilder.title(R.string.about)
.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.changelog)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_track_changes))
.setOnClickListener(b -> new ChangelogBottomSheetDialog().show(getSupportFragmentManager(), "ChangelogBottomSheetDialog"))
.build())
.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.join_slack)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_slack))
.setOnClickListener(b -> ActivityHelper.startCustomTab(this, "http://rebrand.ly/fasthub"))
.build())
.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.open_source_libs)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_github))
.setOnClickListener(b -> new LibsBuilder()
.withActivityStyle(AppHelper.isNightMode(getResources()) ? Libs.ActivityStyle.DARK : Libs.ActivityStyle.LIGHT)
.withAutoDetect(true)
.withAboutIconShown(true)
.withAboutVersionShown(true)
.start(this))
.build());
}

private void buildApp(Context context, MaterialAboutCard.Builder appCardBuilder) {
appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(getString(R.string.version))
.icon(ContextCompat.getDrawable(context, R.drawable.ic_update))
.subText(BuildConfig.VERSION_NAME)
.setOnClickListener(b -> disposable = Release.get("FastHub", "k0shk0sh")
.subscribe(releases -> {
if (releases != null && !releases.isEmpty()) {
if (releases.get(0).getTagName().contains(BuildConfig.VERSION_NAME))
Toasty.success(context, getString(R.string.up_to_date)).show();
else
Toasty.warning(context, getString(R.string.new_version)).show();
}
}))
.build())
.addItem(ConvenienceBuilder.createRateActionItem(context, ContextCompat.getDrawable(context, R.drawable.ic_star_filled),
getString(R.string.rate_app), null))
.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.report_issue)
.subText(R.string.report_issue_here)
.icon(ContextCompat.getDrawable(context, R.drawable.ic_bug))
.setOnClickListener(b -> CreateIssueActivity.startForResult(this, CreateIssueActivity.startForResult(this), malRecyclerview))
.build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.ui.adapter.SettingsAdapter;
import com.fastaccess.ui.base.BaseActivity;
import com.fastaccess.ui.base.mvp.presenter.BasePresenter;
import com.fastaccess.ui.modules.settings.category.SettingsCategoryActivity;

import net.grandcentrix.thirtyinch.TiPresenter;
Expand All @@ -33,7 +34,7 @@ public class SettingsActivity extends BaseActivity {
case 1:
ActivityHelper.startReveal(this, intent, settingsList, THEME_CHANGE);
break;
case 5:
case 4:
showLanguageList();
break;
default:
Expand Down Expand Up @@ -67,29 +68,24 @@ public class SettingsActivity extends BaseActivity {
SettingsModel.newInstance(R.drawable.ic_ring, getString(R.string.notifications), ""),
SettingsModel.newInstance(R.drawable.ic_settings, getString(R.string.behavior), ""),
SettingsModel.newInstance(R.drawable.ic_brush, getString(R.string.customization), ""),
SettingsModel.newInstance(R.drawable.ic_info, getString(R.string.about), ""),
SettingsModel.newInstance(R.drawable.ic_backup, getString(R.string.backup), ""),
SettingsModel.newInstance(R.drawable.ic_language, getString(R.string.app_language), "")
};

settingsList.setAdapter(new SettingsAdapter(this, settings));
}

private void showLanguageList() {
LanguageBottomSheetDialog languageBottomSheetDialog = new LanguageBottomSheetDialog();
languageBottomSheetDialog.onAttach((Context) this);
languageBottomSheetDialog.show(getSupportFragmentManager(), "LanguageBottomSheetDialog");
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == THEME_CHANGE)
setResult(resultCode);
}

@NonNull
@Override
public TiPresenter providePresenter() {
return new SettingsPresenter();
@NonNull @Override public TiPresenter providePresenter() {
return new BasePresenter();
}

private void showLanguageList() {
LanguageBottomSheetDialog languageBottomSheetDialog = new LanguageBottomSheetDialog();
languageBottomSheetDialog.onAttach((Context) this);
languageBottomSheetDialog.show(getSupportFragmentManager(), "LanguageBottomSheetDialog");
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.evernote.android.state.State;
import com.fastaccess.R;
import com.fastaccess.ui.base.BaseActivity;

import net.grandcentrix.thirtyinch.TiPresenter;

import com.evernote.android.state.State;

public class SettingsCategoryActivity extends BaseActivity {

@State String title;
Expand All @@ -35,7 +34,9 @@ public class SettingsCategoryActivity extends BaseActivity {
setResult(RESULT_CANCELED);
if (savedInstanceState == null) {
title = getIntent() != null ? getIntent().getStringExtra("title") : getString(R.string.settings);
SettingsCategoryFragment settingsCategoryFragment = new SettingsCategoryFragment();

SettingsCategoryFragment settingsCategoryFragment = SettingsCategoryFragment.
newInstance(getIntent().getIntExtra("settings", 0));
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.settingsContainer, settingsCategoryFragment)
Expand Down
Loading

0 comments on commit 6e520e5

Please sign in to comment.