diff --git a/app/build.gradle b/app/build.gradle index 43601ee7e..c6ff87d0b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,7 +49,7 @@ android { buildTypes { release { minifyEnabled true - shrinkResources true + shrinkResources false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } @@ -105,8 +105,6 @@ repositories { mavenCentral() } - - dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile "com.android.support:appcompat-v7:${supportVersion}" diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index eda99f739..ece94ad67 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -72,7 +72,8 @@ -keepclasseswithmembernames class * { @icepick.* ; } --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 *; } @@ -101,11 +102,13 @@ ; } --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.** { *; } diff --git a/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java b/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java index 27392c789..fd0d1e5c0 100644 --- a/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java +++ b/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java @@ -74,7 +74,7 @@ private FragmentPagerAdapterModel(String title, Fragment fragment) { @NonNull public static List 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)), diff --git a/app/src/main/java/com/fastaccess/ui/modules/about/FastHubAboutActivity.java b/app/src/main/java/com/fastaccess/ui/modules/about/FastHubAboutActivity.java index 6b797d1aa..cb7efcffe 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/about/FastHubAboutActivity.java +++ b/app/src/main/java/com/fastaccess/ui/modules/about/FastHubAboutActivity.java @@ -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; @@ -15,11 +14,14 @@ 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; @@ -27,13 +29,16 @@ 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()); @@ -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() { @@ -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()); + } } diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsActivity.java b/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsActivity.java index abf0ac877..63d58b1b7 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsActivity.java +++ b/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsActivity.java @@ -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; @@ -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: @@ -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"); } } diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsMvp.java deleted file mode 100644 index 13d026d2d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsMvp.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.ui.modules.settings; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by JediB on 5/12/2017. - */ - -public interface SettingsMvp { - interface Presenter extends BaseMvp.FAPresenter { - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsPresenter.java deleted file mode 100644 index ef93cb280..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.settings; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by JediB on 5/12/2017. - */ - -class SettingsPresenter extends BasePresenter implements SettingsMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryActivity.java b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryActivity.java index 55e14ad59..62974160e 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryActivity.java +++ b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryActivity.java @@ -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; @@ -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) diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryFragment.java b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryFragment.java index 8f5e4bfb9..c66bf6d9b 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryFragment.java +++ b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryFragment.java @@ -14,17 +14,14 @@ import android.widget.FrameLayout; import android.widget.Toast; -import com.fastaccess.BuildConfig; import com.fastaccess.R; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.helper.ActivityHelper; +import com.fastaccess.helper.BundleConstant; +import com.fastaccess.helper.Bundler; import com.fastaccess.helper.InputHelper; import com.fastaccess.helper.PrefGetter; import com.fastaccess.helper.PrefHelper; import com.fastaccess.provider.tasks.notification.NotificationSchedulerJobTask; import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.changelog.ChangelogBottomSheetDialog; -import com.fastaccess.ui.widgets.SpannableBuilder; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -44,7 +41,6 @@ import butterknife.BindView; import es.dmoral.toasty.Toasty; -import io.reactivex.disposables.Disposable; import static android.app.Activity.RESULT_OK; @@ -64,7 +60,14 @@ public class SettingsCategoryFragment extends PreferenceFragmentCompat implement private Preference notificationTime; private Preference notificationRead; private Preference notificationSound; - private Disposable disposable; + + @NonNull public static SettingsCategoryFragment newInstance(int settings) { + SettingsCategoryFragment fragment = new SettingsCategoryFragment(); + fragment.setArguments(Bundler.start() + .put(BundleConstant.EXTRA, settings) + .end()); + return fragment; + } @Override public void onAttach(Context context) { super.onAttach(context); @@ -75,7 +78,7 @@ public class SettingsCategoryFragment extends PreferenceFragmentCompat implement } @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - int settings = getActivity().getIntent().getExtras().getInt("settings", 0); + int settings = getArguments().getInt("settings", 0); switch (settings) { case 0: addPreferencesFromResource(R.xml.notification_settings); @@ -106,37 +109,8 @@ public class SettingsCategoryFragment extends PreferenceFragmentCompat implement findPreference("appColor").setOnPreferenceChangeListener(this); break; case 3: - addPreferencesFromResource(R.xml.about_settings); - findPreference("showChangelog").setOnPreferenceClickListener(preference -> { - new ChangelogBottomSheetDialog().show(getChildFragmentManager(), "ChangelogBottomSheetDialog"); - return true; - }); - findPreference("joinSlack").setOnPreferenceClickListener(preference -> { - ActivityHelper.startCustomTab(getActivity(), "http://rebrand.ly/fasthub"); - return true; - }); - findPreference("currentVersion").setSummary(SpannableBuilder.builder() - .append(getString(R.string.current_version)) - .append("(") - .bold(BuildConfig.VERSION_NAME) - .append(")")); - findPreference("currentVersion").setOnPreferenceClickListener(preference -> { - disposable = Release.get("FastHub", "k0shk0sh").subscribe(releases -> { - if (releases != null) { - if (releases.get(0).getTagName().equals(BuildConfig.VERSION_NAME)) - Toasty.success(getContext(), getString(R.string.up_to_date)).show(); - else - Toasty.warning(getContext(), getString(R.string.new_version)).show(); - } - }); - return true; - }); - break; - case 4: addPreferencesFromResource(R.xml.backup_settings); findPreference("backup").setOnPreferenceClickListener((Preference preference) -> { - - if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { Map settings_ = PrefHelper.getAll(); @@ -162,7 +136,7 @@ public class SettingsCategoryFragment extends PreferenceFragmentCompat implement Log.e(getTag(), "Couldn't backup: " + e.toString()); } - PrefHelper.set("backed_up", new SimpleDateFormat("MM/dd").format(new Date())); + PrefHelper.set("backed_up", new SimpleDateFormat("MM/dd", Locale.ENGLISH).format(new Date())); } else { requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE); } @@ -244,7 +218,6 @@ public class SettingsCategoryFragment extends PreferenceFragmentCompat implement @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); - if (requestCode == PERMISSION_REQUEST_CODE) { if (permissions[0].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { @@ -323,13 +296,6 @@ else if (entry.getValue().getAsJsonPrimitive().isString()) } } - @Override public void onDestroyView() { - super.onDestroyView(); - if (disposable != null && !disposable.isDisposed()) { - disposable.dispose(); - } - } - private void showFileChooser() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("application/json"); diff --git a/app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java b/app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java index 6f2fc75c4..9b4ac98ed 100644 --- a/app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java +++ b/app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java @@ -302,52 +302,54 @@ public void onResponse(List contributionsDay) { } } - private Bitmap drawOnCanvas(Canvas canvas) { - canvas.getClipBounds(rect); - int width = rect.width(); - int verticalBlockNumber = 7; - int horizontalBlockNumber = getHorizontalBlockNumber(contributionsFilter.size(), verticalBlockNumber); - float marginBlock = (1.0F - 0.1F); - float blockWidth = width / (float) horizontalBlockNumber * marginBlock; - float spaceWidth = width / (float) horizontalBlockNumber - blockWidth; - float topMargin = (displayMonth) ? 7f : 0; - float monthTextHeight = (displayMonth) ? blockWidth * 1.5F : 0; - int height = (int) ((blockWidth + spaceWidth) * 7 + topMargin + monthTextHeight); - Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - Canvas canvas1 = new Canvas(bitmap); - // Background - blockPaint.setColor(backgroundBaseColor); - canvas1.drawRect(0, (topMargin + monthTextHeight), width, height + monthTextHeight, blockPaint); - monthTextPaint.setColor(textColor); - monthTextPaint.setTextSize(monthTextHeight); - // draw the blocks - int currentWeekDay = DatesUtils.getWeekDayFromDate( - contributions.get(0).year, - contributions.get(0).month, - contributions.get(0).day); - float x = 0; - float y = (currentWeekDay - 7) % 7 * (blockWidth + spaceWidth) + (topMargin + monthTextHeight); - for (ContributionsDay day : contributionsFilter) { - blockPaint.setColor(ColorsUtils.calculateLevelColor(baseColor, baseEmptyColor, day.level)); - canvas1.drawRect(x, y, x + blockWidth, y + blockWidth, blockPaint); - - if (DatesUtils.isFirstDayOfWeek(day.year, day.month, day.day + 1)) { - // another column - x += blockWidth + spaceWidth; - y = topMargin + monthTextHeight; + Bitmap bitmap = null; - if (DatesUtils.isFirstWeekOfMount(day.year, day.month, day.day + 1)) { - canvas1.drawText( - DatesUtils.getShortMonthName(day.year, day.month, day.day + 1), - x, monthTextHeight, monthTextPaint); + private Bitmap drawOnCanvas(Canvas canvas) { + if (bitmap == null) { + canvas.getClipBounds(rect); + int width = rect.width(); + int verticalBlockNumber = 7; + int horizontalBlockNumber = getHorizontalBlockNumber(contributionsFilter.size(), verticalBlockNumber); + float marginBlock = (1.0F - 0.1F); + float blockWidth = width / (float) horizontalBlockNumber * marginBlock; + float spaceWidth = width / (float) horizontalBlockNumber - blockWidth; + float topMargin = (displayMonth) ? 7f : 0; + float monthTextHeight = (displayMonth) ? blockWidth * 1.5F : 0; + int height = (int) ((blockWidth + spaceWidth) * 7 + topMargin + monthTextHeight); + bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas1 = new Canvas(bitmap); + // Background + blockPaint.setColor(backgroundBaseColor); + canvas1.drawRect(0, (topMargin + monthTextHeight), width, height + monthTextHeight, blockPaint); + monthTextPaint.setColor(textColor); + monthTextPaint.setTextSize(monthTextHeight); + // draw the blocks + int currentWeekDay = DatesUtils.getWeekDayFromDate( + contributions.get(0).year, + contributions.get(0).month, + contributions.get(0).day); + float x = 0; + float y = (currentWeekDay - 7) % 7 * (blockWidth + spaceWidth) + (topMargin + monthTextHeight); + for (ContributionsDay day : contributionsFilter) { + blockPaint.setColor(ColorsUtils.calculateLevelColor(baseColor, baseEmptyColor, day.level)); + canvas1.drawRect(x, y, x + blockWidth, y + blockWidth, blockPaint); + if (DatesUtils.isFirstDayOfWeek(day.year, day.month, day.day + 1)) { + // another column + x += blockWidth + spaceWidth; + y = topMargin + monthTextHeight; + + if (DatesUtils.isFirstWeekOfMount(day.year, day.month, day.day + 1)) { + canvas1.drawText( + DatesUtils.getShortMonthName(day.year, day.month, day.day + 1), + x, monthTextHeight, monthTextPaint); + } + + } else { + y += blockWidth + spaceWidth; } - - } else { - y += blockWidth + spaceWidth; } + adjustHeight(height); } - - adjustHeight(height); return bitmap; } diff --git a/app/src/main/res/header-.svg b/app/src/main/res/header-.svg deleted file mode 100644 index 6c36b5332..000000000 --- a/app/src/main/res/header-.svg +++ /dev/null @@ -1 +0,0 @@ -header- \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-v26/login_form_layout.xml b/app/src/main/res/layouts/main_layouts/layout-v26/login_form_layout.xml deleted file mode 100644 index bb724de07..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-v26/login_form_layout.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 631892e68..ecc0cadab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -478,4 +478,5 @@ Assignee added successfully Reviewer added successfully Milestone added successfully + Feed diff --git a/app/src/main/res/xml/fasthub_settings.xml b/app/src/main/res/xml/fasthub_settings.xml index f88d3b88c..6a86d3fe2 100644 --- a/app/src/main/res/xml/fasthub_settings.xml +++ b/app/src/main/res/xml/fasthub_settings.xml @@ -1,7 +1,7 @@ + > @@ -10,22 +10,22 @@ android:dialogTitle="@string/every" android:entries="@array/notification_duration" android:entryValues="@array/notification_duration" - android:key="notificationTime" android:icon="@drawable/ic_time" + android:key="notificationTime" android:summary="@string/background_job_summary" android:title="@string/background_job_title"/> @@ -43,8 +43,8 @@ android:dialogTitle="@string/theme_title" android:entries="@array/theme_modes" android:entryValues="@array/theme_modes" - android:key="appTheme" android:icon="@drawable/ic_brush" + android:key="appTheme" android:summary="@string/theme_summary" android:title="@string/theme_title"/> @@ -53,8 +53,8 @@ android:dialogTitle="@string/theme_color_title" android:entries="@array/theme_colors" android:entryValues="@array/theme_colors" - android:key="appColor" android:icon="@drawable/ic_blank" + android:key="appColor" android:summary="@string/theme_color_summary" android:title="@string/theme_color_title"/> @@ -107,29 +107,4 @@ - - - - - - - - - - - - - - \ No newline at end of file