Rewrote Theme
This commit is contained in:
@@ -10,7 +10,6 @@ import android.view.View
|
||||
import android.widget.TextView
|
||||
import eu.kanade.tachiyomi.App
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.injection.component.AppComponent
|
||||
import icepick.Icepick
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
@@ -31,6 +30,13 @@ open class BaseActivity : AppCompatActivity() {
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
|
||||
fun setAppTheme() {
|
||||
when (app.appTheme) {
|
||||
2 -> setTheme(R.style.Theme_Tachiyomi_Dark)
|
||||
else -> setTheme(R.style.Theme_Tachiyomi)
|
||||
}
|
||||
}
|
||||
|
||||
fun setToolbarTitle(title: String) {
|
||||
supportActionBar?.title = title
|
||||
}
|
||||
@@ -83,7 +89,7 @@ open class BaseActivity : AppCompatActivity() {
|
||||
snack.show()
|
||||
}
|
||||
|
||||
protected val applicationComponent: AppComponent
|
||||
get() = App.get(this).component
|
||||
protected val app: App
|
||||
get() = App.get(this)
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.base.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import eu.kanade.tachiyomi.App;
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
||||
@@ -83,6 +84,12 @@ public abstract class BaseRxFragment<P extends Presenter> extends BaseFragment i
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
presenterDelegate.onPause(getActivity().isFinishing());
|
||||
presenterDelegate.onPause(getActivity().isFinishing() || shouldDestroyPresenter(this));
|
||||
}
|
||||
|
||||
private boolean shouldDestroyPresenter(Fragment fragment) {
|
||||
if (fragment == null) return false;
|
||||
else return fragment.isRemoving() || shouldDestroyPresenter(fragment.getParentFragment());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user