Remove unused util classes

This commit is contained in:
inorichi 2015-10-21 20:54:11 +02:00
parent 985d71a869
commit 57290a5395
10 changed files with 6 additions and 122 deletions

View File

@ -1,4 +1,4 @@
package eu.kanade.mangafeed.util.events; package eu.kanade.mangafeed.events;
public class ChapterCountEvent { public class ChapterCountEvent {
private int count; private int count;

View File

@ -1,4 +1,4 @@
package eu.kanade.mangafeed.util.events; package eu.kanade.mangafeed.events;
import eu.kanade.mangafeed.data.models.Chapter; import eu.kanade.mangafeed.data.models.Chapter;
import eu.kanade.mangafeed.sources.Source; import eu.kanade.mangafeed.sources.Source;

View File

@ -16,8 +16,8 @@ import eu.kanade.mangafeed.data.models.Manga;
import eu.kanade.mangafeed.sources.Source; import eu.kanade.mangafeed.sources.Source;
import eu.kanade.mangafeed.ui.fragment.MangaChaptersFragment; import eu.kanade.mangafeed.ui.fragment.MangaChaptersFragment;
import eu.kanade.mangafeed.util.EventBusHook; import eu.kanade.mangafeed.util.EventBusHook;
import eu.kanade.mangafeed.util.events.ChapterCountEvent; import eu.kanade.mangafeed.events.ChapterCountEvent;
import eu.kanade.mangafeed.util.events.SourceChapterEvent; import eu.kanade.mangafeed.events.SourceChapterEvent;
import rx.Observable; import rx.Observable;
import rx.android.schedulers.AndroidSchedulers; import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers; import rx.schedulers.Schedulers;

View File

@ -8,7 +8,7 @@ import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
import eu.kanade.mangafeed.data.models.Manga; import eu.kanade.mangafeed.data.models.Manga;
import eu.kanade.mangafeed.ui.fragment.MangaInfoFragment; import eu.kanade.mangafeed.ui.fragment.MangaInfoFragment;
import eu.kanade.mangafeed.util.EventBusHook; import eu.kanade.mangafeed.util.EventBusHook;
import eu.kanade.mangafeed.util.events.ChapterCountEvent; import eu.kanade.mangafeed.events.ChapterCountEvent;
import rx.Observable; import rx.Observable;
public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> { public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {

View File

@ -13,7 +13,7 @@ import eu.kanade.mangafeed.data.models.Page;
import eu.kanade.mangafeed.sources.Source; import eu.kanade.mangafeed.sources.Source;
import eu.kanade.mangafeed.ui.activity.ReaderActivity; import eu.kanade.mangafeed.ui.activity.ReaderActivity;
import eu.kanade.mangafeed.util.EventBusHook; import eu.kanade.mangafeed.util.EventBusHook;
import eu.kanade.mangafeed.util.events.SourceChapterEvent; import eu.kanade.mangafeed.events.SourceChapterEvent;
import icepick.State; import icepick.State;
import rx.Observable; import rx.Observable;
import rx.android.schedulers.AndroidSchedulers; import rx.android.schedulers.AndroidSchedulers;

View File

@ -1,33 +0,0 @@
package eu.kanade.mangafeed.util;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import timber.log.Timber;
public class AndroidComponentUtil {
public static void toggleComponent(Context context, Class componentClass, boolean enable) {
Timber.i((enable ? "Enabling " : "Disabling ") + componentClass.getSimpleName());
ComponentName componentName = new ComponentName(context, componentClass);
PackageManager pm = context.getPackageManager();
pm.setComponentEnabledSetting(componentName,
enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
}
public static boolean isServiceRunning(Context context, Class serviceClass) {
ActivityManager manager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
}

View File

@ -1,13 +0,0 @@
package eu.kanade.mangafeed.util;
import android.content.Context;
import android.net.ConnectivityManager;
public class DataUtils {
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return connectivityManager.getActiveNetworkInfo() != null;
}
}

View File

@ -1,39 +0,0 @@
package eu.kanade.mangafeed.util;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import eu.kanade.mangafeed.R;
public class DialogFactory {
public static Dialog createSimpleOkErrorDialog(Context context, String title, String message) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
.setTitle(title)
.setMessage(message)
.setNeutralButton(R.string.dialog_action_ok, null);
return alertDialog.create();
}
public static Dialog createSimpleErrorDialog(Context context) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
.setTitle(context.getString(R.string.dialog_error_title))
.setMessage(context.getString(R.string.dialog_general_error_Message))
.setNeutralButton(R.string.dialog_action_ok, null);
return alertDialog.create();
}
public static ProgressDialog createProgressDialog(Context context, String message) {
ProgressDialog progressDialog = new ProgressDialog(context);
progressDialog.setMessage(message);
return progressDialog;
}
public static ProgressDialog createProgressDialog(Context context, @StringRes int messageResoruce) {
return createProgressDialog(context, context.getString(messageResoruce));
}
}

View File

@ -1,18 +0,0 @@
package eu.kanade.mangafeed.util;
import android.content.Context;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.view.ViewGroup;
import eu.kanade.mangafeed.R;
public class SnackbarFactory {
public static Snackbar createSnackbar(Context context, View view, String message) {
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_SHORT);
ViewGroup group = (ViewGroup) snackbar.getView();
group.setBackgroundColor(context.getResources().getColor(R.color.primary));
return snackbar;
}
}

View File

@ -1,13 +0,0 @@
package eu.kanade.mangafeed.util;
import android.content.Context;
import android.util.DisplayMetrics;
public class ViewUtils {
public static float convertPixelsToDp(float px, Context context){
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
return px / (metrics.densityDpi / 160f);
}
}