Removed unwanted code and files

This commit is contained in:
h4h13 2019-06-02 09:56:27 +05:30
parent 9ac24be7ac
commit cbfe8ec580
69 changed files with 72 additions and 2603 deletions

View file

@ -1,104 +0,0 @@
/*
* Copyright (c) 2019 Hemanth Savarala.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package code.name.monkey.retromusic.util;
import android.content.Context;
import android.graphics.Bitmap;
import java.io.File;
import java.io.IOException;
import io.reactivex.Flowable;
/**
* Created on : June 18, 2016
* Author : zetbaitsu
* Name : Zetra
* GitHub : https://github.com/zetbaitsu
*/
public class Compressor {
//max width and height values of the compressed image is taken as 612x816
private int maxWidth = 612;
private int maxHeight = 816;
private Bitmap.CompressFormat compressFormat = Bitmap.CompressFormat.JPEG;
private int quality = 80;
private String destinationDirectoryPath;
public Compressor(Context context) {
destinationDirectoryPath = context.getCacheDir().getPath() + File.separator + "images";
}
public Compressor setMaxWidth(int maxWidth) {
this.maxWidth = maxWidth;
return this;
}
public Compressor setMaxHeight(int maxHeight) {
this.maxHeight = maxHeight;
return this;
}
public Compressor setCompressFormat(Bitmap.CompressFormat compressFormat) {
this.compressFormat = compressFormat;
return this;
}
public Compressor setQuality(int quality) {
this.quality = quality;
return this;
}
public Compressor setDestinationDirectoryPath(String destinationDirectoryPath) {
this.destinationDirectoryPath = destinationDirectoryPath;
return this;
}
public File compressToFile(File imageFile) throws IOException {
return compressToFile(imageFile, imageFile.getName());
}
public File compressToFile(File imageFile, String compressedFileName) throws IOException {
return ImageUtil.compressImage(imageFile, maxWidth, maxHeight, compressFormat, quality,
destinationDirectoryPath + File.separator + compressedFileName);
}
public Bitmap compressToBitmap(File imageFile) throws IOException {
return ImageUtil.decodeSampledBitmapFromFile(imageFile, maxWidth, maxHeight);
}
public Flowable<File> compressToFileAsFlowable(final File imageFile) {
return compressToFileAsFlowable(imageFile, imageFile.getName());
}
public Flowable<File> compressToFileAsFlowable(final File imageFile, final String compressedFileName) {
return Flowable.defer(() -> {
try {
return Flowable.just(compressToFile(imageFile, compressedFileName));
} catch (IOException e) {
return Flowable.error(e);
}
});
}
public Flowable<Bitmap> compressToBitmapAsFlowable(final File imageFile) {
return Flowable.defer(() -> {
try {
return Flowable.just(compressToBitmap(imageFile));
} catch (IOException e) {
return Flowable.error(e);
}
});
}
}

View file

@ -26,10 +26,8 @@ import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.util.Pair;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.activities.AboutActivity;
import code.name.monkey.retromusic.activities.AlbumDetailsActivity;
import code.name.monkey.retromusic.activities.ArtistDetailActivity;
@ -43,8 +41,10 @@ import code.name.monkey.retromusic.activities.PurchaseActivity;
import code.name.monkey.retromusic.activities.SearchActivity;
import code.name.monkey.retromusic.activities.SettingsActivity;
import code.name.monkey.retromusic.activities.SupportDevelopmentActivity;
import code.name.monkey.retromusic.activities.UserInfoActivity;
import code.name.monkey.retromusic.activities.WhatsNewActivity;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Playlist;
import static code.name.monkey.retromusic.Constants.RATE_ON_GOOGLE_PLAY;
import static code.name.monkey.retromusic.util.RetroUtil.openUrl;
@ -138,10 +138,6 @@ public class NavigationUtil {
ActivityCompat.startActivity(activity, new Intent(activity, AboutActivity.class), null);
}
public static void goToUserInfo(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, UserInfoActivity.class), null);
}
public static void goToOpenSource(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, LicenseActivity.class), null);
}

View file

@ -1,113 +0,0 @@
/*
* Copyright (c) 2019 Hemanth Savarala.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package code.name.monkey.retromusic.util;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.view.ViewGroup;
import code.name.monkey.retromusic.App;
public class SystemUtils {
private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";
private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height";
private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape";
private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width";
private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";
private final float mSmallestWidthDp;
private final boolean mInPortrait;
private Activity activity;
public SystemUtils(Activity activity) {
this.activity = activity;
Resources resources = activity.getResources();
mSmallestWidthDp = getSmallestWidthDp(activity);
mInPortrait = (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
}
private static boolean hasNavBar(Resources resources) {
int id = resources.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android");
if (id > 0)
return resources.getBoolean(id);
else
return false;
}
public static int getNavigationBarHeight() {
int result = 0;
int resourceId = App.Companion.getContext().getResources().getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
result = App.Companion.getContext().getResources().getDimensionPixelSize(resourceId);
}
return result;
}
public int getComboHeight() {
if (isNavigationAtBottom()) {
return getNavigationBarWidth();
} else {
return getNavigationBarHeight();
}
}
public int getNavigationBarWidth() {
Resources res = activity.getResources();
int result = 0;
if (hasNavBar(activity.getResources())) {
if (!isNavigationAtBottom())
return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);
}
return result;
}
public void addPadding(ViewGroup viewGroup) {
Context context = viewGroup.getContext();
Resources resources = context.getResources();
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) viewGroup.getLayoutParams();
if (isNavigationAtBottom()) {
params.leftMargin = getNavigationBarWidth();
params.rightMargin = getNavigationBarWidth();
} else {
params.bottomMargin = getNavigationBarHeight();
}
}
private int getInternalDimensionSize(Resources res, String key) {
int result = 0;
int resourceId = res.getIdentifier(key, "dimen", "android");
if (resourceId > 0) {
result = res.getDimensionPixelSize(resourceId);
}
return result;
}
private float getSmallestWidthDp(Activity activity) {
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
float widthDp = metrics.widthPixels / metrics.density;
float heightDp = metrics.heightPixels / metrics.density;
return Math.min(widthDp, heightDp);
}
boolean isNavigationAtBottom() {
return (mSmallestWidthDp >= 600 || mInPortrait);
}
}

View file

@ -1,82 +0,0 @@
/*
* Copyright (c) 2019 Hemanth Savarala.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package code.name.monkey.retromusic.util;
/**
* @author Hemanth S (h4h13).
*/
public class TempUtils {
// Enums
public static final int TEMPO_STROLL = 0;
public static final int TEMPO_WALK = 1;
public static final int TEMPO_LIGHT_JOG = 2;
public static final int TEMPO_JOG = 3;
public static final int TEMPO_RUN = 4;
public static final int TEMPO_SPRINT = 5;
public static final int TEMPO_UNKNOWN = 6;
// take BPM as an int
public static int getTempoFromBPM(int bpm) {
// STROLL less than 60
if (bpm < 60) {
return TEMPO_STROLL;
}
// WALK between 60 and 70, or between 120 and 140
else if (bpm < 70 || bpm >= 120 && bpm < 140) {
return TEMPO_WALK;
}
// LIGHT_JOG between 70 and 80, or between 140 and 160
else if (bpm < 80 || bpm >= 140 && bpm < 160) {
return TEMPO_LIGHT_JOG;
}
// JOG between 80 and 90, or between 160 and 180
else if (bpm < 90 || bpm >= 160 && bpm < 180) {
return TEMPO_JOG;
}
// RUN between 90 and 100, or between 180 and 200
else if (bpm < 100 || bpm >= 180 && bpm < 200) {
return TEMPO_RUN;
}
// SPRINT between 100 and 120
else if (bpm < 120) {
return TEMPO_SPRINT;
}
// UNKNOWN
else {
return TEMPO_UNKNOWN;
}
}
// take BPM as a string
public static int getTempoFromBPM(String bpm) {
// cast to an int from string
try {
// convert the string to an int
return getTempoFromBPM(Integer.parseInt(bpm.trim()));
} catch (NumberFormatException nfe) {
//
return TEMPO_UNKNOWN;
}
}
}