1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-24 22:23:19 +00:00

init services in app onCreate

This commit is contained in:
Ritvik Saraf 2019-03-10 17:30:21 +05:30
parent d90b1ca5be
commit 2581fa4176
3 changed files with 4 additions and 8 deletions

View File

@ -6,7 +6,6 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.util.Log;
@ -23,12 +22,12 @@ import org.acra.config.ConfigurationBuilder;
import org.acra.sender.ReportSenderFactory;
import org.schabi.newpipe.extractor.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.utils.Localization;
import org.schabi.newpipe.report.AcraReportSenderFactory;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.settings.SettingsActivity;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ServiceHelper;
import org.schabi.newpipe.util.StateSaver;
import java.io.IOException;
@ -100,6 +99,8 @@ public class App extends Application {
StateSaver.init(this);
initNotificationChannel();
ServiceHelper.initServices(this);
// Initialize image loader
ImageLoader.getInstance().init(getImageLoaderConfigurations(10, 50));

View File

@ -95,8 +95,6 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
if (DEBUG) Log.d(TAG, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]");
ServiceHelper.initServices(this);
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
super.onCreate(savedInstanceState);
@ -302,7 +300,6 @@ public class MainActivity extends AppCompatActivity {
drawerItems.getMenu()
.add(R.id.menu_services_group, s.getServiceId(), ORDER, title)
.setIcon(ServiceHelper.getIcon(s.getServiceId()));
}
drawerItems.getMenu().getItem(ServiceHelper.getSelectedServiceId(this)).setChecked(true);
}

View File

@ -147,7 +147,6 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
if (!url.startsWith("https://")) {
Toast.makeText(getActivity(), "instance url should start with https://",
Toast.LENGTH_SHORT).show();
return false;
} else {
pEt.setSummary("fetching instance details..");
Disposable disposable = Single.fromCallable(() -> {
@ -174,8 +173,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
Toast.LENGTH_SHORT).show();
});
disposables.add(disposable);
return false;
}
return false;
});
}
@ -360,5 +359,4 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,
"none", "", R.string.app_ui_crash));
}
}