Skip to content

Commit

Permalink
Fixes and Code Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sarsamurmu committed Sep 17, 2019
1 parent fc19a51 commit 38db71e
Show file tree
Hide file tree
Showing 37 changed files with 77 additions and 358 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Unreleased Version
- Enabled Multidex
# v3.5.0-beta.6.4
- Enabled MultiDex
- Support for Custom Drawable name, like this:
```xml
<item drawable="my_icon" name="Custom Name"/>
```
- Fixed Icon Search
- Support for Android 10
- Lots of Fixes

# v3.5.0-beta.6.3
- Now you can exclude launchers.
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.3'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.5'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
Expand Down Expand Up @@ -40,7 +40,7 @@ android {
minSdkVersion rootProject.ext.MinSdk
targetSdkVersion rootProject.ext.TargetSdk
versionCode 355
versionName "3.5.0-beta.6.2"
versionName "3.5.0-beta.6.4"
multiDexEnabled true

// Remove '/*' and '*/' below to enable OneSignal
Expand Down Expand Up @@ -70,5 +70,5 @@ dependencies {
implementation project (':library')

// Remove '//' below to Enable OneSignal
//implementation 'com.onesignal:OneSignal:3.9.1'
}
//implementation 'com.onesignal:OneSignal:3.11.3'
}
Binary file modified app/src/main/res/drawable-nodpi/home_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-nodpi/ic_splash_screen.png
Binary file not shown.
Binary file modified app/src/main/res/drawable-nodpi/nav_head.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-xxxhdpi/ic_muzei_logo.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_splash_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/res/values-v27/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="navigationBar">#FFF</color>
<color name="navigationBar">#FFFFFF</color>
</resources>
7 changes: 4 additions & 3 deletions app/src/main/res/values/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* <u> for Underline
* <a href="linkUrl">Link Text</a> for links -->
<string-array name="changelog">
<item>Minor Fixes</item>
<item>Added New Launchers</item>
<item>Fixed Bugs</item>
<item>Now using MultiDex</item>
<item>Support for Android 10</item>
<item>Custom Drawable Names</item>
<item>Lot of Fixes</item>
</string-array>

</resources>
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Expand All @@ -30,8 +28,8 @@ allprojects {
rootProject.ext {
BuildTools = "29.0.0"
MinSdk = 15
TargetSdk = 28
CompileSdk = 28
TargetSdk = 29
CompileSdk = 29
SupportLibrary = "27.1.1"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ private static boolean shouldStopLoading(CopyListener listener, int current, int
if (listener != null) {
boolean shouldContinue = listener.onBytesCopied(current, total);
if (!shouldContinue) {
if (100 * current / total < CONTINUE_LOADING_PERCENTAGE) {
return true; // if loaded more than 75% then continue loading anyway
}
return 100 * current / total < CONTINUE_LOADING_PERCENTAGE; // if loaded more than 75% then continue loading anyway
}
}
return false;
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xms512m -Xmx1024m
kapt.incremental.apt=false
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
7 changes: 4 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ android {
minSdkVersion rootProject.ext.MinSdk
targetSdkVersion rootProject.ext.TargetSdk
versionCode 355
versionName "3.5.0-beta.6.3"
vectorDrawables.useSupportLibrary = true
versionName "3.5.0-beta.6.4"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
}

Expand Down Expand Up @@ -88,6 +88,7 @@ dependencies {
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
implementation 'com.github.pluscubed:recycler-fast-scroll:0.3.2@aar'
implementation 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
Expand All @@ -97,7 +98,7 @@ dependencies {
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'com.github.KeepSafe:TapTargetView:1.9.1'
implementation 'com.github.javiersantos:AppUpdater:2.7'
implementation 'com.github.sarsamurmu:AdaptiveIconBitmap:d1031e96a6'
implementation 'com.github.sarsamurmu:AdaptiveIconBitmap:ef93e01193'

implementation 'com.github.danimahardhika:cafebar:1.3.2'
implementation('com.github.danimahardhika.android-helpers:core:-SNAPSHOT') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import com.danimahardhika.android.helpers.core.ColorHelper;
import com.danimahardhika.android.helpers.core.utils.LogUtil;
import com.nostra13.universalimageloader.core.ImageLoader;

Expand Down Expand Up @@ -62,9 +58,7 @@ public abstract class CandyBarSplashActivity extends AppCompatActivity implement
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
mConfig = onInit();
initBottomText();

mSplashScreenLoader = new SplashScreenLoader(this)
.mainActivity(mConfig.getMainActivity())
Expand Down Expand Up @@ -95,23 +89,6 @@ protected void onDestroy() {
super.onDestroy();
}

private void initBottomText() {
TextView splashTitle = findViewById(R.id.splash_title);
if (splashTitle != null) {
splashTitle.setText(mConfig.getBottomText());

if (mConfig.getBottomTextColor() != -1) {
splashTitle.setTextColor(mConfig.getBottomTextColor());
} else {
int color = ContextCompat.getColor(this, R.color.splashColor);
splashTitle.setTextColor(ColorHelper.getBodyTextColor(color));
}

splashTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, mConfig.getBottomTextSize());
splashTitle.setTypeface(mConfig.getBottomTextFont(this));
}
}

private static class SplashScreenLoader extends AsyncTask<Void, Void, Boolean> {

private WeakReference<Context> context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
package candybar.lib.activities.configurations;

import android.content.Context;
import android.graphics.Typeface;

import androidx.annotation.ColorInt;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import candybar.lib.helpers.TypefaceHelper;

/*
* CandyBar - Material Dashboard
*
Expand All @@ -34,90 +24,16 @@ public class SplashScreenConfiguration {

@NonNull
private Class<?> mMainActivity;
@ColorInt
private int mBottomTextColor;
private String mBottomText;
@FontSize
private int mBottomTextSize;
@FontStyle
private int mBottomTextFont;

public SplashScreenConfiguration(@NonNull Class<?> mainActivity) {
mMainActivity = mainActivity;
mBottomTextColor = -1;
mBottomTextFont = FontStyle.REGULAR;
mBottomTextSize = FontSize.REGULAR;
}

public SplashScreenConfiguration setBottomText(String text) {
mBottomText = text;
return this;
}

public SplashScreenConfiguration setBottomTextColor(@ColorInt int color) {
mBottomTextColor = color;
return this;
}

public SplashScreenConfiguration setBottomTextSize(@FontSize int fontSize) {
mBottomTextSize = fontSize;
return this;
}

public SplashScreenConfiguration setBottomTextFont(@FontStyle int fontStyle) {
mBottomTextFont = fontStyle;
return this;
}

public Class<?> getMainActivity() {
return mMainActivity;
}

public String getBottomText() {
return mBottomText;
}

public int getBottomTextColor() {
return mBottomTextColor;
}

public float getBottomTextSize() {
switch (mBottomTextSize) {
case FontSize.SMALL:
return 14f;
case FontSize.LARGE:
return 16f;
case FontSize.REGULAR:
default:
return 15f;
}
}

public Typeface getBottomTextFont(@NonNull Context context) {
switch (mBottomTextFont) {
case FontStyle.MEDIUM:
return TypefaceHelper.getMedium(context);
case FontStyle.BOLD:
return TypefaceHelper.getBold(context);
case FontStyle.REGULAR:
default:
return TypefaceHelper.getRegular(context);
}
}

@IntDef({FontSize.SMALL, FontSize.REGULAR, FontSize.LARGE})
@Retention(RetentionPolicy.SOURCE)
public @interface FontSize {
int SMALL = 0;
int REGULAR = 1;
int LARGE = 2;
}

@IntDef({FontStyle.REGULAR, FontStyle.MEDIUM, FontStyle.BOLD})
@Retention(RetentionPolicy.SOURCE)
public @interface FontStyle {
int REGULAR = 0;
int MEDIUM = 1;
int BOLD = 2;
}
}
19 changes: 5 additions & 14 deletions library/src/main/java/candybar/lib/adapters/AboutAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,11 @@ public AboutAdapter(@NonNull Context context, int spanCount) {

mShowContributors = mContext.getResources().getBoolean(R.bool.show_contributors_dialog);

if (mContext.getResources().getString(R.string.privacy_policy_link).length() > 0)
mShowPrivacyPolicy = true;
else
mShowPrivacyPolicy = false;

if (mContext.getResources().getString(R.string.terms_and_conditions_link).length() > 0)
mShowTerms = true;
else
mShowTerms = false;

if (mShowContributors || mShowPrivacyPolicy || mShowTerms)
mShowExtraInfo = true;
else
mShowExtraInfo = false;
mShowPrivacyPolicy = mContext.getResources().getString(R.string.privacy_policy_link).length() > 0;

mShowTerms = mContext.getResources().getString(R.string.terms_and_conditions_link).length() > 0;

mShowExtraInfo = mShowContributors || mShowPrivacyPolicy || mShowTerms;

if (mShowExtraInfo) {
mItemCount += 1;
Expand Down
6 changes: 2 additions & 4 deletions library/src/main/java/candybar/lib/adapters/HomeAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,8 @@ private boolean isFullSpan(int viewType) {
if (viewType == TYPE_HEADER) {
if (mOrientation == Configuration.ORIENTATION_PORTRAIT) {
return true;
} else if (mImageStyle.getType() == Home.Style.Type.SQUARE ||
mImageStyle.getType() == Home.Style.Type.LANDSCAPE) {
return true;
}
} else return mImageStyle.getType() == Home.Style.Type.SQUARE ||
mImageStyle.getType() == Home.Style.Type.LANDSCAPE;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ public void onClick(View view) {
Preferences.get(mContext).setDarkTheme(!checkBox.isChecked());
((AppCompatActivity) mContext).recreate();
break;
case WALLPAPER:
break;
case LANGUAGE:
LanguagesFragment.showLanguageChooser(((AppCompatActivity) mContext).getSupportFragmentManager());
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ private boolean isLauncherInstalled(String pkg1, String pkg2, String pkg3) {
private boolean isLauncherShouldBeAdded(String packageName) {
if (("com.dlto.atom.launcher").equals(packageName)) {
int id = getResources().getIdentifier("appmap", "xml", getActivity().getPackageName());
if (id <= 0) return false;
return id > 0;
} else if (("com.lge.launcher2").equals(packageName) ||
("com.lge.launcher3").equals(packageName)) {
int id = getResources().getIdentifier("theme_resources", "xml", getActivity().getPackageName());
if (id <= 0) return false;
return id > 0;
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,6 @@ protected Boolean doInBackground(Void... voids) {
while (!isCancelled()) {
try {
Thread.sleep(2);
/*
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", getResources().getString(R.string.dev_email), null));
*/

boolean nonMailingAppSend = getResources().getBoolean(R.bool.enable_non_mail_app_request);
Intent intent;
Expand Down Expand Up @@ -581,7 +578,7 @@ protected void onPostExecute(Boolean resBoolean) {

// Checks If Request can be Done or Not
if (appVersionCode < disabledReqBelow) canRequest = false;
String disabledReqOns[] = disabledReqOn.split("[\\s,]");
String[] disabledReqOns = disabledReqOn.split("[\\s,]");
for (String version : disabledReqOns) {
//Log.d("Disabled Versions", version);
//Log.d("Disabled Version Length", version.length() + "");
Expand Down
Loading

0 comments on commit 38db71e

Please sign in to comment.