diff --git a/app/build.gradle b/app/build.gradle index 3a33fc0f9..63fcd4d96 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -154,10 +154,6 @@ dependencies { apt "com.pushtorefresh.storio:sqlite-annotations-processor:$STORIO_VERSION" provided 'org.glassfish:javax.annotation:10.0-b28' - compile('com.mikepenz:materialdrawer:4.6.4@aar') { - transitive = true - } - compile('com.github.afollestad.material-dialogs:core:0.8.5.6@aar') { transitive = true } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a6bdb7cdf..47deba450 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,9 +15,10 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:hardwareAccelerated="true" - android:theme="@style/AppTheme" > + android:theme="@style/Theme.Tachiyomi" > + android:name=".ui.main.MainActivity" + android:theme="@style/Theme.BrandedLaunch"> diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.java b/app/src/main/java/eu/kanade/tachiyomi/App.java index 3992bffd4..a8b9bf482 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.java +++ b/app/src/main/java/eu/kanade/tachiyomi/App.java @@ -7,6 +7,7 @@ import org.acra.ACRA; import org.acra.annotation.ReportsCrashes; import org.greenrobot.eventbus.EventBus; +import eu.kanade.tachiyomi.data.preference.PreferencesHelper; import eu.kanade.tachiyomi.injection.ComponentReflectionInjector; import eu.kanade.tachiyomi.injection.component.AppComponent; import eu.kanade.tachiyomi.injection.component.DaggerAppComponent; @@ -24,6 +25,8 @@ public class App extends Application { AppComponent applicationComponent; ComponentReflectionInjector componentInjector; + private int theme = 0; + public static App get(Context context) { return (App) context.getApplicationContext(); } @@ -38,10 +41,15 @@ public class App extends Application { componentInjector = new ComponentReflectionInjector<>(AppComponent.class, applicationComponent); + setupTheme(); setupEventBus(); setupAcra(); } + private void setupTheme() { + theme = PreferencesHelper.getTheme(this); + } + protected DaggerAppComponent.Builder prepareAppComponent() { return DaggerAppComponent.builder() .appModule(new AppModule(this)); @@ -65,4 +73,12 @@ public class App extends Application { public ComponentReflectionInjector getComponentReflection() { return componentInjector; } + + public int getAppTheme() { + return theme; + } + + public void setAppTheme(int theme) { + this.theme = theme; + } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 965a9f898..3d5dc7847 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -49,6 +49,12 @@ class PreferencesHelper(private val context: Context) { return PreferenceManager.getDefaultSharedPreferences(context).getInt( context.getString(R.string.pref_library_update_interval_key), 0) } + + @JvmStatic + fun getTheme(context: Context): Int { + return PreferenceManager.getDefaultSharedPreferences(context).getInt( + context.getString(R.string.pref_theme_key), 1) + } } private fun getKey(keyResource: Int): String { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt index 879caa31f..0de8b7f06 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt @@ -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) } \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/fragment/BaseRxFragment.java b/app/src/main/java/eu/kanade/tachiyomi/ui/base/fragment/BaseRxFragment.java index 6e977a18b..ad50e0b35 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/fragment/BaseRxFragment.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/fragment/BaseRxFragment.java @@ -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

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()); + } + } \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt index 3193ed983..f1b6cc0af 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueFragment.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.ui.catalogue import android.os.Bundle -import android.support.v4.content.ContextCompat import android.support.v7.widget.GridLayoutManager import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.SearchView @@ -20,10 +19,12 @@ import eu.kanade.tachiyomi.ui.base.decoration.DividerItemDecoration import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaActivity +import eu.kanade.tachiyomi.util.getResourceDrawable import eu.kanade.tachiyomi.util.toast import eu.kanade.tachiyomi.widget.EndlessGridScrollListener import eu.kanade.tachiyomi.widget.EndlessListScrollListener import kotlinx.android.synthetic.main.fragment_catalogue.* +import kotlinx.android.synthetic.main.toolbar.* import nucleus.factory.RequiresPresenter import rx.Subscription import rx.android.schedulers.AndroidSchedulers @@ -154,8 +155,7 @@ class CatalogueFragment : BaseRxFragment(), FlexibleViewHold catalogue_list.adapter = adapter catalogue_list.layoutManager = llm catalogue_list.addOnScrollListener(listScrollListener) - catalogue_list.addItemDecoration(DividerItemDecoration( - ContextCompat.getDrawable(context, R.drawable.line_divider))) + catalogue_list.addItemDecoration(DividerItemDecoration(context.theme.getResourceDrawable(R.attr.divider_drawable))) if (presenter.isListMode) { switcher.showNext() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueGridHolder.kt index 8503603db..da7055c46 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueGridHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueGridHolder.kt @@ -27,9 +27,6 @@ class CatalogueGridHolder(private val view: View, adapter: CatalogueAdapter, lis // Set manga title view.title.text = manga.title - // Set visibility of in library icon. - view.favorite_sticker.visibility = if (manga.favorite) View.VISIBLE else View.GONE - // Set alpha of thumbnail. view.thumbnail.alpha = if (manga.favorite) 0.3f else 1.0f diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueListHolder.kt index 8eb52283f..c1eb21dd5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueListHolder.kt @@ -1,9 +1,8 @@ package eu.kanade.tachiyomi.ui.catalogue -import android.support.v4.content.ContextCompat import android.view.View -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga +import eu.kanade.tachiyomi.util.getResourceColor import kotlinx.android.synthetic.main.item_catalogue_list.view.* /** @@ -18,8 +17,8 @@ import kotlinx.android.synthetic.main.item_catalogue_list.view.* class CatalogueListHolder(private val view: View, adapter: CatalogueAdapter, listener: OnListItemClickListener) : CatalogueHolder(view, adapter, listener) { - private val favoriteColor = ContextCompat.getColor(view.context, R.color.hint_text) - private val unfavoriteColor = ContextCompat.getColor(view.context, R.color.primary_text) + private val favoriteColor = view.context.theme.getResourceColor(android.R.attr.textColorHint) + private val unfavoriteColor = view.context.theme.getResourceColor(android.R.attr.textColorPrimary) /** * Method called from [CatalogueAdapter.onBindViewHolder]. It updates the data for this diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt index 3d24d793d..34f8881ab 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryActivity.kt @@ -57,6 +57,7 @@ class CategoryActivity : BaseRxActivity(), ActionMode.Callbac } override fun onCreate(savedInstanceState: Bundle?) { + setAppTheme() super.onCreate(savedInstanceState) // Inflate activity_edit_categories.xml. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt index 05094dd84..a9ec45f0e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadFragment.kt @@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.DownloadService import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment +import eu.kanade.tachiyomi.ui.main.MainActivity import kotlinx.android.synthetic.main.fragment_download_queue.* import nucleus.factory.RequiresPresenter import rx.Subscription @@ -60,8 +61,8 @@ class DownloadFragment : BaseRxFragment() { } } - override fun onCreate(bundle: Bundle?) { - super.onCreate(bundle) + override fun onCreate(savedState: Bundle?) { + super.onCreate(savedState) setHasOptionsMenu(true) } @@ -73,6 +74,9 @@ class DownloadFragment : BaseRxFragment() { override fun onViewCreated(view: View, savedState: Bundle?) { setToolbarTitle(R.string.label_download_queue) + // Check if download queue is empty and update information accordingly. + setInformationView() + // Initialize adapter. adapter = DownloadAdapter(activity) recycler.adapter = adapter @@ -138,6 +142,9 @@ class DownloadFragment : BaseRxFragment() { startButton?.isVisible = !running && !presenter.downloadQueue.isEmpty() pauseButton?.isVisible = running clearButton?.isVisible = running + + // Check if download queue is empty and update information accordingly. + setInformationView() } /** @@ -177,4 +184,12 @@ class DownloadFragment : BaseRxFragment() { return recycler.findViewHolderForItemId(download.chapter.id) as? DownloadHolder } + /** + * Set information view when queue is empty + */ + private fun setInformationView() { + (activity as MainActivity).updateEmptyView(presenter.downloadQueue.isEmpty(), + R.string.information_no_downloads, R.drawable.ic_file_download_black_128dp) + } + } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt index ff2c0d75d..d064cf55f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt @@ -21,6 +21,7 @@ import eu.kanade.tachiyomi.ui.category.CategoryActivity import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.util.inflate import eu.kanade.tachiyomi.util.toast +import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_library.* import nucleus.factory.RequiresPresenter import org.greenrobot.eventbus.EventBus @@ -49,7 +50,8 @@ class LibraryFragment : BaseRxFragment(), ActionMode.Callback /** * AppBarLayout from [MainActivity]. */ - private lateinit var appBar: AppBarLayout + private val appbar: AppBarLayout + get() = (activity as MainActivity).appbar /** * Position of the active category. @@ -110,8 +112,8 @@ class LibraryFragment : BaseRxFragment(), ActionMode.Callback } } - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) + override fun onCreate(savedState: Bundle?) { + super.onCreate(savedState) setHasOptionsMenu(true) isFilterDownloaded = presenter.preferences.filterDownloaded().get() as Boolean isFilterUnread = presenter.preferences.filterUnread().get() as Boolean @@ -124,17 +126,9 @@ class LibraryFragment : BaseRxFragment(), ActionMode.Callback override fun onViewCreated(view: View, savedState: Bundle?) { setToolbarTitle(getString(R.string.label_library)) - appBar = (activity as MainActivity).appBar - tabs = appBar.inflate(R.layout.library_tab_layout) as TabLayout + tabs = appbar.inflate(R.layout.library_tab_layout) as TabLayout - // Workaround to prevent: Tab belongs to a different TabLayout. - // Internal bug in Support library v23.2.0. - // See https://code.google.com/p/android/issues/detail?id=201827 - for (j in 0..16) { - tabs.newTab() - } - - appBar.addView(tabs) + appbar.addView(tabs) adapter = LibraryAdapter(childFragmentManager) view_pager.adapter = adapter @@ -148,14 +142,14 @@ class LibraryFragment : BaseRxFragment(), ActionMode.Callback } override fun onDestroyView() { - appBar.removeView(tabs) + appbar.removeView(tabs) super.onDestroyView() } - override fun onSaveInstanceState(bundle: Bundle) { - bundle.putInt(CATEGORY_KEY, view_pager.currentItem) - bundle.putString(QUERY_KEY, query) - super.onSaveInstanceState(bundle) + override fun onSaveInstanceState(outState: Bundle) { + outState.putInt(CATEGORY_KEY, view_pager.currentItem) + outState.putString(QUERY_KEY, query) + super.onSaveInstanceState(outState) } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { @@ -257,6 +251,10 @@ class LibraryFragment : BaseRxFragment(), ActionMode.Callback * @param mangaMap a map containing the manga for each category. */ fun onNextLibraryUpdate(categories: List, mangaMap: Map>) { + // Check if library is empty and update information accordingly. + (activity as MainActivity).updateEmptyView(mangaMap.isEmpty(), + R.string.information_empty_library, R.drawable.ic_book_black_128dp) + // Get the current active category. val activeCat = if (adapter.categories != null) view_pager.currentItem else activeCategory diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/FragmentStack.java b/app/src/main/java/eu/kanade/tachiyomi/ui/main/FragmentStack.java deleted file mode 100644 index 31ea76f5e..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/FragmentStack.java +++ /dev/null @@ -1,179 +0,0 @@ -package eu.kanade.tachiyomi.ui.main; - -import android.app.Activity; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; - -import java.util.ArrayList; -import java.util.List; - -import eu.kanade.tachiyomi.R; - -/** - * Why this class is needed. - * - * FragmentManager does not supply a developer with a fragment stack. - * It gives us a fragment *transaction* stack. - * - * To be sane, we need *fragment* stack. - * - * This implementation also handles NucleusSupportFragment presenter`s lifecycle correctly. - */ -public class FragmentStack { - - public interface OnBackPressedHandlingFragment { - boolean onBackPressed(); - } - - public interface OnFragmentRemovedListener { - void onFragmentRemoved(Fragment fragment); - } - - private Activity activity; - private FragmentManager manager; - private int containerId; - @Nullable private OnFragmentRemovedListener onFragmentRemovedListener; - - public FragmentStack(Activity activity, FragmentManager manager, int containerId, @Nullable OnFragmentRemovedListener onFragmentRemovedListener) { - this.activity = activity; - this.manager = manager; - this.containerId = containerId; - this.onFragmentRemovedListener = onFragmentRemovedListener; - } - - /** - * Returns the number of fragments in the stack. - * - * @return the number of fragments in the stack. - */ - public int size() { - return getFragments().size(); - } - - /** - * Pushes a fragment to the top of the stack. - */ - public void push(Fragment fragment) { - - Fragment top = peek(); - if (top != null) { - manager.beginTransaction() - .setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right) - .remove(top) - .add(containerId, fragment, indexToTag(manager.getBackStackEntryCount() + 1)) - .addToBackStack(null) - .commit(); - } - else { - manager.beginTransaction() - .add(containerId, fragment, indexToTag(0)) - .commit(); - } - - manager.executePendingTransactions(); - } - - /** - * Pops the top item if the stack. - * If the fragment implements {@link OnBackPressedHandlingFragment}, calls {@link OnBackPressedHandlingFragment#onBackPressed()} instead. - * If {@link OnBackPressedHandlingFragment#onBackPressed()} returns false the fragment gets popped. - * - * @return true if a fragment has been popped or if {@link OnBackPressedHandlingFragment#onBackPressed()} returned true; - */ - public boolean back() { - Fragment top = peek(); - if (top instanceof OnBackPressedHandlingFragment) { - if (((OnBackPressedHandlingFragment)top).onBackPressed()) - return true; - } - return pop(); - } - - /** - * Pops the topmost fragment from the stack. - * The lowest fragment can't be popped, it can only be replaced. - * - * @return false if the stack can't pop or true if a top fragment has been popped. - */ - public boolean pop() { - if (manager.getBackStackEntryCount() == 0) - return false; - Fragment top = peek(); - manager.popBackStackImmediate(); - if (onFragmentRemovedListener != null) - onFragmentRemovedListener.onFragmentRemoved(top); - return true; - } - - /** - * Replaces stack contents with just one fragment. - */ - public void replace(Fragment fragment) { - List fragments = getFragments(); - - manager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); - manager.beginTransaction() - .replace(containerId, fragment, indexToTag(0)) - .commit(); - manager.executePendingTransactions(); - - if (onFragmentRemovedListener != null) { - for (Fragment fragment1 : fragments) - onFragmentRemovedListener.onFragmentRemoved(fragment1); - } - } - - /** - * Returns the topmost fragment in the stack. - */ - public Fragment peek() { - return manager.findFragmentById(containerId); - } - - /** - * Returns a back fragment if the fragment is of given class. - * If such fragment does not exist and activity implements the given class then the activity will be returned. - * - * @param fragment a fragment to search from. - * @param callbackType a class of type for callback to search. - * @param a type of callback. - * @return a back fragment or activity. - */ - @SuppressWarnings("unchecked") - public T findCallback(Fragment fragment, Class callbackType) { - - Fragment back = getBackFragment(fragment); - - if (back != null && callbackType.isAssignableFrom(back.getClass())) - return (T)back; - - if (callbackType.isAssignableFrom(activity.getClass())) - return (T)activity; - - return null; - } - - private Fragment getBackFragment(Fragment fragment) { - List fragments = getFragments(); - for (int f = fragments.size() - 1; f >= 0; f--) { - if (fragments.get(f) == fragment && f > 0) - return fragments.get(f - 1); - } - return null; - } - - private List getFragments() { - List fragments = new ArrayList<>(manager.getBackStackEntryCount() + 1); - for (int i = 0; i < manager.getBackStackEntryCount() + 1; i++) { - Fragment fragment = manager.findFragmentByTag(indexToTag(i)); - if (fragment != null) - fragments.add(fragment); - } - return fragments; - } - - private String indexToTag(int index) { - return Integer.toString(index); - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.java b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.java deleted file mode 100644 index b54223eb7..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.java +++ /dev/null @@ -1,220 +0,0 @@ -package eu.kanade.tachiyomi.ui.main; - -import android.content.Intent; -import android.os.Bundle; -import android.support.design.widget.AppBarLayout; -import android.support.v4.app.Fragment; -import android.support.v4.content.ContextCompat; -import android.support.v4.widget.DrawerLayout; -import android.support.v7.widget.Toolbar; -import android.widget.FrameLayout; - -import com.mikepenz.materialdrawer.Drawer; -import com.mikepenz.materialdrawer.DrawerBuilder; -import com.mikepenz.materialdrawer.holder.ImageHolder; -import com.mikepenz.materialdrawer.model.DividerDrawerItem; -import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; - -import butterknife.Bind; -import butterknife.ButterKnife; -import eu.kanade.tachiyomi.R; -import eu.kanade.tachiyomi.ui.base.activity.BaseActivity; -import eu.kanade.tachiyomi.ui.catalogue.CatalogueFragment; -import eu.kanade.tachiyomi.ui.download.DownloadFragment; -import eu.kanade.tachiyomi.ui.library.LibraryFragment; -import eu.kanade.tachiyomi.ui.recent.RecentChaptersFragment; -import eu.kanade.tachiyomi.ui.setting.SettingsActivity; -import icepick.State; -import nucleus.view.ViewWithPresenter; - -public class MainActivity extends BaseActivity { - - @Bind(R.id.appbar) AppBarLayout appBar; - @Bind(R.id.toolbar) Toolbar toolbar; - @Bind(R.id.drawer_container) FrameLayout container; - @State - int selectedItem; - private Drawer drawer; - private FragmentStack fragmentStack; - private int prevIdentifier = -1; - - @Override - protected void onCreate(Bundle savedState) { - super.onCreate(savedState); - - // Do not let the launcher create a new activity - if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { - finish(); - return; - } - - setContentView(R.layout.activity_main); - ButterKnife.bind(this); - - setupToolbar(toolbar); - - fragmentStack = new FragmentStack(this, getSupportFragmentManager(), R.id.content_layout, - fragment -> { - if (fragment instanceof ViewWithPresenter) - ((ViewWithPresenter) fragment).getPresenter().destroy(); - }); - - drawer = new DrawerBuilder() - .withActivity(this) - .withRootView(container) - .withToolbar(toolbar) - .withActionBarDrawerToggleAnimated(true) - .withOnDrawerNavigationListener(view -> { - if (fragmentStack.size() > 1) { - onBackPressed(); - return true; - } - return false; - }) - .addDrawerItems( - new PrimaryDrawerItem() - .withName(R.string.label_library) - .withIdentifier(R.id.nav_drawer_library) - .withIcon(ContextCompat.getDrawable(this, R.drawable.ic_book_grey_24dp)), - new PrimaryDrawerItem() - .withName(R.string.label_recent_updates) - .withIdentifier(R.id.nav_drawer_recent_updates) - .withIcon(ContextCompat.getDrawable(this, R.drawable.ic_history_grey_24dp)), - new PrimaryDrawerItem() - .withName(R.string.label_catalogues) - .withIdentifier(R.id.nav_drawer_catalogues) - .withIcon(ContextCompat.getDrawable(this, R.drawable.ic_explore_grey_24dp)), - new PrimaryDrawerItem() - .withName(R.string.label_download_queue) - .withIdentifier(R.id.nav_drawer_downloads) - .withIcon(ContextCompat.getDrawable(this, R.drawable.ic_file_download_grey_24dp)), - new DividerDrawerItem(), - new PrimaryDrawerItem() - .withName(R.string.label_settings) - .withIdentifier(R.id.nav_drawer_settings) - .withSelectable(false) - .withIcon(ContextCompat.getDrawable(this, R.drawable.ic_settings_grey_24dp)) - ) - .withSavedInstance(savedState) - .withOnDrawerItemClickListener( - (view, position, drawerItem) -> { - if (drawerItem != null) { - int identifier = drawerItem.getIdentifier(); - if (prevIdentifier != -1) - setIconBackToGrey(prevIdentifier, identifier); - prevIdentifier = identifier; - - switch (identifier) { - case R.id.nav_drawer_library: - drawer.updateIcon(identifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_book_blue_24dp))); - setFragment(LibraryFragment.newInstance()); - break; - case R.id.nav_drawer_recent_updates: - drawer.updateIcon(identifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_history_blue_24dp))); - setFragment(RecentChaptersFragment.newInstance()); - break; - case R.id.nav_drawer_catalogues: - drawer.updateIcon(identifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_explore_blue_24dp))); - setFragment(CatalogueFragment.newInstance()); - break; - case R.id.nav_drawer_downloads: - drawer.updateIcon(identifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_file_download_blue_24dp))); - setFragment(DownloadFragment.newInstance()); - break; - case R.id.nav_drawer_settings: - startActivity(new Intent(this, SettingsActivity.class)); - break; - } - } - return false; - } - ) - .build(); - - if (savedState != null) { - // Recover icon state after rotation - if (fragmentStack.size() > 1) { - showBackArrow(); - } - - // Set saved selection - drawer.setSelection(selectedItem, false); - } else { - // Set default selection - drawer.setSelection(R.id.nav_drawer_library); - } - } - - private void setIconBackToGrey(int prevIdentifier, int identifier) { - // Don't set to grey when settings - if (identifier == R.id.nav_drawer_settings) - return; - - switch (prevIdentifier) { - case R.id.nav_drawer_library: - drawer.updateIcon(prevIdentifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_book_grey_24dp))); - break; - case R.id.nav_drawer_recent_updates: - drawer.updateIcon(prevIdentifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_history_grey_24dp))); - break; - case R.id.nav_drawer_catalogues: - drawer.updateIcon(prevIdentifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_explore_grey_24dp))); - break; - case R.id.nav_drawer_downloads: - drawer.updateIcon(prevIdentifier, new ImageHolder(ContextCompat.getDrawable(this, R.drawable.ic_file_download_grey_24dp))); - break; - } - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - selectedItem = drawer.getCurrentSelection(); - super.onSaveInstanceState(outState); - } - - public void setFragment(Fragment fragment) { - fragmentStack.replace(fragment); - } - - public void pushFragment(Fragment fragment) { - fragmentStack.push(fragment); - if (fragmentStack.size() > 1) { - showBackArrow(); - } - } - - @Override - public void onBackPressed() { - if (!fragmentStack.pop()) { - super.onBackPressed(); - } else if (fragmentStack.size() == 1) { - showHamburgerIcon(); - drawer.getActionBarDrawerToggle().syncState(); - } - } - - private void showHamburgerIcon() { - if (getSupportActionBar() != null) { - getSupportActionBar().setDisplayHomeAsUpEnabled(false); - drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true); - drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); - } - } - - private void showBackArrow() { - if (getSupportActionBar() != null) { - drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); - } - } - - public Toolbar getToolbar() { - return toolbar; - } - - public AppBarLayout getAppBar() { - return appBar; - } - -} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt new file mode 100644 index 000000000..dfaeba8d0 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -0,0 +1,116 @@ +package eu.kanade.tachiyomi.ui.main + +import android.content.Intent +import android.os.Build +import android.os.Bundle +import android.support.v4.app.Fragment +import android.support.v4.view.GravityCompat +import android.support.v4.widget.DrawerLayout +import android.view.MenuItem +import android.view.View +import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.ui.base.activity.BaseActivity +import eu.kanade.tachiyomi.ui.catalogue.CatalogueFragment +import eu.kanade.tachiyomi.ui.download.DownloadFragment +import eu.kanade.tachiyomi.ui.library.LibraryFragment +import eu.kanade.tachiyomi.ui.recent.RecentChaptersFragment +import eu.kanade.tachiyomi.ui.setting.SettingsActivity +import eu.kanade.tachiyomi.util.getResourceColor +import eu.kanade.tachiyomi.util.setDrawableCompat +import kotlinx.android.synthetic.main.activity_main.* +import kotlinx.android.synthetic.main.toolbar.* + +class MainActivity : BaseActivity() { + + override fun onCreate(savedState: Bundle?) { + setAppTheme() + super.onCreate(savedState) + + // Do not let the launcher create a new activity + if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT != 0) { + finish() + return + } + + // Inflate activity_edit_categories.xml. + setContentView(R.layout.activity_main) + + // Handle Toolbar + setupToolbar(toolbar) + supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp) + + drawer.addDrawerListener(object : DrawerLayout.SimpleDrawerListener() { + override fun onDrawerSlide(drawerView: View, slideOffset: Float) { + if (Build.VERSION.SDK_INT >= 21) { + window.statusBarColor = theme.getResourceColor(R.attr.status_bar_trans) + } + } + + override fun onDrawerClosed(drawerView: View) { + if (Build.VERSION.SDK_INT >= 21) { + window.statusBarColor = theme.getResourceColor(R.attr.colorPrimaryDark) + } + } + }) + + // Set behavior of Navigation drawer + nav_view.setNavigationItemSelectedListener { item -> + // Make information view invisible + image_view.setDrawableCompat(null) + text_label.text = "" + + when (item.itemId) { + R.id.nav_drawer_library -> { + setFragment(LibraryFragment.newInstance()) + item.isChecked = true + } + R.id.nav_drawer_recent_updates -> { + setFragment(RecentChaptersFragment.newInstance()) + item.isChecked = true + } + R.id.nav_drawer_catalogues -> { + setFragment(CatalogueFragment.newInstance()) + item.isChecked = true + } + R.id.nav_drawer_downloads -> { + setFragment(DownloadFragment.newInstance()) + item.isChecked = true + } + R.id.nav_drawer_settings -> { + item.isChecked = false + startActivity(Intent(this, SettingsActivity::class.java)) + } + } + drawer.closeDrawer(GravityCompat.START) + true + } + + if (savedState == null) { + setFragment(LibraryFragment.newInstance()) + } + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + android.R.id.home -> drawer.openDrawer(GravityCompat.START) + else -> return super.onOptionsItemSelected(item) + } + return true + } + + fun setFragment(fragment: Fragment) { + supportFragmentManager.beginTransaction() + .replace(R.id.frame_container, fragment) + .commit() + } + + fun updateEmptyView(show: Boolean, textResource: Int, drawable: Int) { + if (show) { + image_view.setDrawableCompat(drawable) + text_label.text = getString(textResource) + } else { + image_view.setDrawableCompat(null) + text_label.text = "" + } + } +} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaActivity.kt index e65b7eb70..47c092bd0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaActivity.kt @@ -48,6 +48,7 @@ class MangaActivity : BaseRxActivity() { private set override fun onCreate(savedState: Bundle?) { + setAppTheme() super.onCreate(savedState) setContentView(R.layout.activity_manga) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt index 942f78c72..fdc634e6e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.kt @@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.ui.base.decoration.DividerItemDecoration import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment import eu.kanade.tachiyomi.ui.manga.MangaActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity +import eu.kanade.tachiyomi.util.getResourceDrawable import eu.kanade.tachiyomi.util.toast import kotlinx.android.synthetic.main.fragment_manga_chapters.* import nucleus.factory.RequiresPresenter @@ -65,7 +66,7 @@ class ChaptersFragment : BaseRxFragment(), ActionMode.Callbac recycler.adapter = adapter recycler.layoutManager = LinearLayoutManager(activity) recycler.addItemDecoration(DividerItemDecoration( - ContextCompat.getDrawable(context, R.drawable.line_divider))) + context.theme.getResourceDrawable(R.attr.divider_drawable))) recycler.setHasFixedSize(true) swipe_refresh.setOnRefreshListener { fetchChapters() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.kt index 5e8ec0b43..e971268a1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.kt @@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder +import eu.kanade.tachiyomi.util.getResourceColor import kotlinx.android.synthetic.main.item_chapter.view.* import rx.Observable import java.text.DateFormat @@ -19,8 +20,8 @@ import java.util.* class ChaptersHolder(private val view: View, private val adapter: ChaptersAdapter, listener: FlexibleViewHolder.OnListItemClickListener) : FlexibleViewHolder(view, adapter, listener) { - private val readColor = ContextCompat.getColor(view.context, R.color.hint_text) - private val unreadColor = ContextCompat.getColor(view.context, R.color.primary_text) + private val readColor = view.context.theme.getResourceColor(android.R.attr.textColorHint) + private val unreadColor = view.context.theme.getResourceColor(android.R.attr.textColorPrimary) private val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols().apply { decimalSeparator = '.' }) private val df = DateFormat.getDateInstance(DateFormat.SHORT) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java index cec18311e..3f3e652f1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.java @@ -71,6 +71,7 @@ public class ReaderActivity extends BaseRxActivity { @Override public void onCreate(Bundle savedState) { + setTheme(R.style.Theme_Reader); super.onCreate(savedState); setContentView(R.layout.activity_reader); ButterKnife.bind(this); @@ -85,6 +86,7 @@ public class ReaderActivity extends BaseRxActivity { initializeSettings(); + maxBitmapSize = GLUtil.getMaxTextureSize(); } @@ -393,12 +395,12 @@ public class ReaderActivity extends BaseRxActivity { View rootView = getWindow().getDecorView().getRootView(); if (theme == BLACK_THEME) { rootView.setBackgroundColor(Color.BLACK); - pageNumber.setTextColor(ContextCompat.getColor(this, R.color.light_grey)); - pageNumber.setBackgroundColor(ContextCompat.getColor(this, R.color.page_number_background_black)); + pageNumber.setTextColor(ContextCompat.getColor(this, R.color.textColorPrimaryDark)); + pageNumber.setBackgroundColor(ContextCompat.getColor(this, R.color.backgroundDark)); } else { rootView.setBackgroundColor(Color.WHITE); - pageNumber.setTextColor(ContextCompat.getColor(this, R.color.primary_text)); - pageNumber.setBackgroundColor(ContextCompat.getColor(this, R.color.page_number_background)); + pageNumber.setTextColor(ContextCompat.getColor(this, R.color.textColorPrimaryLight)); + pageNumber.setBackgroundColor(ContextCompat.getColor(this, R.color.backgroundLight)); } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/PageDecodeErrorLayout.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/PageDecodeErrorLayout.kt index 351f3beab..7686fd0ee 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/PageDecodeErrorLayout.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/PageDecodeErrorLayout.kt @@ -17,8 +17,8 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity class PageDecodeErrorLayout(context: Context) : LinearLayout(context) { - private val lightGreyColor = ContextCompat.getColor(context, R.color.light_grey) - private val blackColor = ContextCompat.getColor(context, R.color.primary_text) + private val lightGreyColor = ContextCompat.getColor(context, android.R.attr.textColorHint) + private val blackColor = ContextCompat.getColor(context, android.R.attr.textColorPrimary) init { orientation = LinearLayout.VERTICAL diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.kt index f7c91069f..dc8caf91e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerReaderFragment.kt @@ -74,12 +74,12 @@ class PagerReaderFragment : BaseFragment() { /** * Text color for black theme. */ - private val lightGreyColor by lazy { ContextCompat.getColor(context, R.color.light_grey) } + private val lightGreyColor by lazy { ContextCompat.getColor(context, R.color.textColorHintDark) } /** * Text color for white theme. */ - private val blackColor by lazy { ContextCompat.getColor(context, R.color.primary_text) } + private val blackColor by lazy { ContextCompat.getColor(context, R.color.textColorHintLight) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedState: Bundle?): View? { return inflater.inflate(R.layout.item_pager_reader, container, false) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersFragment.kt index c83eff48b..2b6423413 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersFragment.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.ui.recent import android.os.Bundle -import android.support.v4.content.ContextCompat import android.support.v7.widget.LinearLayoutManager import android.view.LayoutInflater import android.view.View @@ -15,7 +14,9 @@ import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder import eu.kanade.tachiyomi.ui.base.decoration.DividerItemDecoration import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment +import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity +import eu.kanade.tachiyomi.util.getResourceDrawable import kotlinx.android.synthetic.main.fragment_recent_chapters.* import nucleus.factory.RequiresPresenter import rx.Observable @@ -67,8 +68,7 @@ class RecentChaptersFragment : BaseRxFragment(), Flexib override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { // Init RecyclerView and adapter recycler.layoutManager = LinearLayoutManager(activity) - recycler.addItemDecoration(DividerItemDecoration(ContextCompat.getDrawable( - context, R.drawable.line_divider))) + recycler.addItemDecoration(DividerItemDecoration(context.theme.getResourceDrawable(R.attr.divider_drawable))) recycler.setHasFixedSize(true) adapter = RecentChaptersAdapter(this) recycler.adapter = adapter @@ -121,6 +121,9 @@ class RecentChaptersFragment : BaseRxFragment(), Flexib * @param chapters list of chapters */ fun onNextMangaChapters(chapters: List) { + (activity as MainActivity).updateEmptyView(chapters.isEmpty(), + R.string.information_no_recent, R.drawable.ic_history_black_128dp) + adapter.setItems(chapters) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersHolder.kt index 0b811cd86..25eb0bd94 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersHolder.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.ui.recent -import android.support.v4.content.ContextCompat +import android.content.Context import android.view.View import android.widget.PopupMenu import eu.kanade.tachiyomi.R @@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.data.database.models.MangaChapter import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder +import eu.kanade.tachiyomi.util.getResourceColor import kotlinx.android.synthetic.main.item_recent_chapter.view.* import rx.Observable @@ -26,12 +27,12 @@ class RecentChaptersHolder(view: View, private val adapter: RecentChaptersAdapte /** * Color of read chapter */ - private val readColor = ContextCompat.getColor(view.context, R.color.hint_text) + private var readColor = view.context.theme.getResourceColor(android.R.attr.textColorHint) /** * Color of unread chapter */ - private val unreadColor = ContextCompat.getColor(view.context, R.color.primary_text) + private var unreadColor = view.context.theme.getResourceColor(android.R.attr.textColorPrimary) /** * Object containing chapter information @@ -41,6 +42,7 @@ class RecentChaptersHolder(view: View, private val adapter: RecentChaptersAdapte init { //Set OnClickListener for download menu itemView.chapterMenu.setOnClickListener { v -> v.post({ showPopupMenu(v) }) } + } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt index 59486fbf6..17d22ff80 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsActivity.kt @@ -21,9 +21,10 @@ class SettingsActivity : BaseActivity() { @Inject lateinit var syncManager: MangaSyncManager override fun onCreate(savedState: Bundle?) { + setAppTheme() super.onCreate(savedState) setContentView(R.layout.activity_preferences) - applicationComponent.inject(this) + app.component.inject(this) setupToolbar(toolbar) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt index 7b6f58f17..ec5862484 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt @@ -1,10 +1,14 @@ package eu.kanade.tachiyomi.ui.setting +import android.content.Intent import android.os.Bundle +import android.support.v4.app.TaskStackBuilder import android.support.v7.preference.Preference import android.view.View +import eu.kanade.tachiyomi.App import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.library.LibraryUpdateAlarm +import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.widget.preference.IntListPreference import eu.kanade.tachiyomi.widget.preference.LibraryColumnsDialog import eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference @@ -29,6 +33,10 @@ class SettingsGeneralFragment : SettingsNestedFragment() { findPreference(getString(R.string.pref_library_update_interval_key)) as IntListPreference } + val themePreference by lazy { + findPreference(getString(R.string.pref_theme_key)) as IntListPreference + } + var columnsSubscription: Subscription? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -36,6 +44,17 @@ class SettingsGeneralFragment : SettingsNestedFragment() { LibraryUpdateAlarm.startAlarm(activity, (newValue as String).toInt()) true } + + themePreference.setOnPreferenceChangeListener { preference, newValue -> + App.get(activity).appTheme = (newValue as String).toInt() + + // Rebuild activity's to apply themes. + TaskStackBuilder.create(activity) + .addNextIntent(Intent(activity, MainActivity::class.java)) + .addNextIntent(activity.intent) + .startActivities() + true + } } override fun onResume() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt index 0dac66c7a..4dc11e3a2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ContextExtensions.kt @@ -40,7 +40,7 @@ inline fun Context.notification(func: NotificationCompat.Builder.() -> Unit): No /** * Property to get the notification manager from the context. */ -val Context.notificationManager : NotificationManager +val Context.notificationManager: NotificationManager get() = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager /** @@ -48,4 +48,4 @@ val Context.notificationManager : NotificationManager * @return the alarm manager. */ val Context.alarmManager: AlarmManager - get() = getSystemService(Context.ALARM_SERVICE) as AlarmManager \ No newline at end of file + get() = getSystemService(Context.ALARM_SERVICE) as AlarmManager diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt index 2456e4f85..518356f0e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ImageViewExtensions.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.util import android.support.annotation.DrawableRes import android.support.v4.content.ContextCompat +import android.support.v4.graphics.drawable.DrawableCompat import android.widget.ImageView /** @@ -11,7 +12,9 @@ import android.widget.ImageView */ fun ImageView.setDrawableCompat(@DrawableRes drawable: Int?) { if (drawable != null) { - setImageDrawable(ContextCompat.getDrawable(context, drawable)) + var drawable = ContextCompat.getDrawable(context, drawable) + DrawableCompat.setTint(drawable,this.context.theme.getResourceColor(android.R.attr.textColorHint)) + setImageDrawable(drawable) } else { setImageResource(android.R.color.transparent) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt new file mode 100644 index 000000000..81c1988fe --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt @@ -0,0 +1,19 @@ +package eu.kanade.tachiyomi.util + +import android.content.res.Resources +import android.graphics.drawable.Drawable +import android.support.annotation.StringRes + +fun Resources.Theme.getResourceColor(@StringRes resource: Int) : Int { + val typedArray = this.obtainStyledAttributes(intArrayOf(resource)) + val attrValue = typedArray.getColor(0, 0) + typedArray.recycle() + return attrValue +} + +fun Resources.Theme.getResourceDrawable(@StringRes resource: Int) : Drawable { + val typedArray = this.obtainStyledAttributes(intArrayOf(resource)) + val attrValue = typedArray.getDrawable(0) + typedArray.recycle() + return attrValue +} \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/application_logo_144dp.png b/app/src/main/res/drawable-hdpi/application_logo_144dp.png new file mode 100644 index 000000000..87f8ef081 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/application_logo_144dp.png differ diff --git a/app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png deleted file mode 100644 index 9908433c0..000000000 Binary files a/app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-hdpi/reader_background_checkbox_unselected.png deleted file mode 100644 index 195e875fb..000000000 Binary files a/app/src/main/res/drawable-hdpi/reader_background_checkbox_unselected.png and /dev/null differ diff --git a/app/src/main/res/drawable-ldpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-ldpi/reader_background_checkbox_selected.png deleted file mode 100644 index d06d87c95..000000000 Binary files a/app/src/main/res/drawable-ldpi/reader_background_checkbox_selected.png and /dev/null differ diff --git a/app/src/main/res/drawable-ldpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-ldpi/reader_background_checkbox_unselected.png deleted file mode 100644 index 4899a16ff..000000000 Binary files a/app/src/main/res/drawable-ldpi/reader_background_checkbox_unselected.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/application_logo_144dp.png b/app/src/main/res/drawable-mdpi/application_logo_144dp.png new file mode 100644 index 000000000..d40042f0b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/application_logo_144dp.png differ diff --git a/app/src/main/res/drawable-mdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-mdpi/reader_background_checkbox_selected.png deleted file mode 100644 index f0faf295f..000000000 Binary files a/app/src/main/res/drawable-mdpi/reader_background_checkbox_selected.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-mdpi/reader_background_checkbox_unselected.png deleted file mode 100644 index 69e1ee734..000000000 Binary files a/app/src/main/res/drawable-mdpi/reader_background_checkbox_unselected.png and /dev/null differ diff --git a/app/src/main/res/drawable-v21/list_item_selector_dark.xml b/app/src/main/res/drawable-v21/list_item_selector_dark.xml new file mode 100644 index 000000000..3391e4ea2 --- /dev/null +++ b/app/src/main/res/drawable-v21/list_item_selector_dark.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/list_item_selector_light.xml b/app/src/main/res/drawable-v21/list_item_selector_light.xml new file mode 100644 index 000000000..57bb65957 --- /dev/null +++ b/app/src/main/res/drawable-v21/list_item_selector_light.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/selector_chapter_light.xml b/app/src/main/res/drawable-v21/selector_chapter_light.xml deleted file mode 100644 index f92e970b2..000000000 --- a/app/src/main/res/drawable-v21/selector_chapter_light.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/touchable_background_white.xml b/app/src/main/res/drawable-v21/touchable_background_white.xml deleted file mode 100644 index 322353b5f..000000000 --- a/app/src/main/res/drawable-v21/touchable_background_white.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-xhdpi/application_logo_144dp.png b/app/src/main/res/drawable-xhdpi/application_logo_144dp.png new file mode 100644 index 000000000..4e32de55e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/application_logo_144dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/card_background.9.png b/app/src/main/res/drawable-xhdpi/card_background.9.png old mode 100755 new mode 100644 diff --git a/app/src/main/res/drawable-xxhdpi/application_logo_144dp.png b/app/src/main/res/drawable-xxhdpi/application_logo_144dp.png new file mode 100644 index 000000000..b3aa86fb4 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/application_logo_144dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png deleted file mode 100644 index 287892b71..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_unselected.png deleted file mode 100644 index b279adbbd..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_unselected.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/application_logo_144dp.png b/app/src/main/res/drawable-xxxhdpi/application_logo_144dp.png new file mode 100644 index 000000000..212a2fbe9 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/application_logo_144dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_selected.png b/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_selected.png deleted file mode 100644 index 90c1bd6f5..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_selected.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_unselected.png b/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_unselected.png deleted file mode 100644 index 5a3af58d6..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_unselected.png and /dev/null differ diff --git a/app/src/main/res/drawable/branded_logo.xml b/app/src/main/res/drawable/branded_logo.xml new file mode 100644 index 000000000..1fc2ba120 --- /dev/null +++ b/app/src/main/res/drawable/branded_logo.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_book_blue_24dp.xml b/app/src/main/res/drawable/ic_book_black_128dp.xml similarity index 75% rename from app/src/main/res/drawable/ic_book_blue_24dp.xml rename to app/src/main/res/drawable/ic_book_black_128dp.xml index debaf260a..5226a4ad5 100644 --- a/app/src/main/res/drawable/ic_book_blue_24dp.xml +++ b/app/src/main/res/drawable/ic_book_black_128dp.xml @@ -1,9 +1,9 @@ diff --git a/app/src/main/res/drawable/ic_book_grey_24dp.xml b/app/src/main/res/drawable/ic_book_black_24dp.xml similarity index 93% rename from app/src/main/res/drawable/ic_book_grey_24dp.xml rename to app/src/main/res/drawable/ic_book_black_24dp.xml index 959ce93b5..811d5ac4b 100644 --- a/app/src/main/res/drawable/ic_book_grey_24dp.xml +++ b/app/src/main/res/drawable/ic_book_black_24dp.xml @@ -1,7 +1,6 @@ diff --git a/app/src/main/res/drawable/ic_file_download_grey_24dp.xml b/app/src/main/res/drawable/ic_file_download_black_24dp.xml similarity index 92% rename from app/src/main/res/drawable/ic_file_download_grey_24dp.xml rename to app/src/main/res/drawable/ic_file_download_black_24dp.xml index a3bd2706c..492b41d34 100644 --- a/app/src/main/res/drawable/ic_file_download_grey_24dp.xml +++ b/app/src/main/res/drawable/ic_file_download_black_24dp.xml @@ -1,7 +1,6 @@ diff --git a/app/src/main/res/drawable/ic_history_grey_24dp.xml b/app/src/main/res/drawable/ic_history_black_24dp.xml similarity index 95% rename from app/src/main/res/drawable/ic_history_grey_24dp.xml rename to app/src/main/res/drawable/ic_history_black_24dp.xml index 3e12265b9..a61de1bc9 100644 --- a/app/src/main/res/drawable/ic_history_grey_24dp.xml +++ b/app/src/main/res/drawable/ic_history_black_24dp.xml @@ -1,7 +1,6 @@ + + diff --git a/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml b/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml new file mode 100644 index 000000000..f041ff22a --- /dev/null +++ b/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml b/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml new file mode 100644 index 000000000..6ec88b717 --- /dev/null +++ b/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_settings_grey_24dp.xml b/app/src/main/res/drawable/ic_settings_black_24dp.xml similarity index 97% rename from app/src/main/res/drawable/ic_settings_grey_24dp.xml rename to app/src/main/res/drawable/ic_settings_black_24dp.xml index 51fc037ef..ace746c40 100644 --- a/app/src/main/res/drawable/ic_settings_grey_24dp.xml +++ b/app/src/main/res/drawable/ic_settings_black_24dp.xml @@ -1,7 +1,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/line_divider_light.xml b/app/src/main/res/drawable/line_divider_light.xml new file mode 100644 index 000000000..eca76daba --- /dev/null +++ b/app/src/main/res/drawable/line_divider_light.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_chapter_light.xml b/app/src/main/res/drawable/list_item_selector_dark.xml similarity index 59% rename from app/src/main/res/drawable/selector_chapter_light.xml rename to app/src/main/res/drawable/list_item_selector_dark.xml index 58df6ebf8..2607d316f 100644 --- a/app/src/main/res/drawable/selector_chapter_light.xml +++ b/app/src/main/res/drawable/list_item_selector_dark.xml @@ -1,10 +1,10 @@ + xmlns:android="http://schemas.android.com/apk/res/android"> - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/list_item_selector_light.xml b/app/src/main/res/drawable/list_item_selector_light.xml new file mode 100644 index 000000000..4cb278d90 --- /dev/null +++ b/app/src/main/res/drawable/list_item_selector_light.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/reader_background_checkbox.xml b/app/src/main/res/drawable/reader_background_checkbox.xml index 2ace26fce..07dff0006 100644 --- a/app/src/main/res/drawable/reader_background_checkbox.xml +++ b/app/src/main/res/drawable/reader_background_checkbox.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/touchable_background_white.xml b/app/src/main/res/drawable/touchable_background_white.xml deleted file mode 100644 index 26044d48f..000000000 --- a/app/src/main/res/drawable/touchable_background_white.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_edit_categories.xml b/app/src/main/res/layout/activity_edit_categories.xml index 55ae9acc0..af66227aa 100644 --- a/app/src/main/res/layout/activity_edit_categories.xml +++ b/app/src/main/res/layout/activity_edit_categories.xml @@ -2,9 +2,9 @@ @@ -15,20 +15,13 @@ android:layout_marginTop="?attr/actionBarSize" android:id="@+id/recycler" android:choiceMode="multipleChoice" - android:listSelector="@color/list_choice_pressed_bg_light" - tools:listitem="@layout/item_edit_categories"/> + tools:listitem="@layout/item_edit_categories" + /> + app:srcCompat="@drawable/ic_add_white_24dp" + style="@style/Theme.Widget.FAB"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c4ffbf1ce..a06c3ddee 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,32 +1,65 @@ - + + android:fitsSystemWindows="true"> - + android:layout_height="match_parent"> - + - + + + - - - + android:layout_height="match_parent" + android:layout_below="@id/appbar"> + + + + + + + + - - \ No newline at end of file + + + + diff --git a/app/src/main/res/layout/activity_manga.xml b/app/src/main/res/layout/activity_manga.xml index f73e0924a..7815e9107 100644 --- a/app/src/main/res/layout/activity_manga.xml +++ b/app/src/main/res/layout/activity_manga.xml @@ -1,18 +1,18 @@ + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + tools:context="eu.kanade.tachiyomi.ui.manga.MangaActivity"> - + - + diff --git a/app/src/main/res/layout/activity_preferences.xml b/app/src/main/res/layout/activity_preferences.xml index b44b7a9ba..c80a17301 100644 --- a/app/src/main/res/layout/activity_preferences.xml +++ b/app/src/main/res/layout/activity_preferences.xml @@ -1,7 +1,8 @@ + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> diff --git a/app/src/main/res/layout/activity_reader.xml b/app/src/main/res/layout/activity_reader.xml index 4535f1cf4..53f22748f 100644 --- a/app/src/main/res/layout/activity_reader.xml +++ b/app/src/main/res/layout/activity_reader.xml @@ -1,7 +1,7 @@ + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center"> + android:layout_gravity="bottom|start" + android:background="?android:attr/colorBackground" + android:padding="4dp"/> diff --git a/app/src/main/res/layout/card_myanimelist_personal.xml b/app/src/main/res/layout/card_myanimelist_personal.xml index 428984ced..74202c178 100644 --- a/app/src/main/res/layout/card_myanimelist_personal.xml +++ b/app/src/main/res/layout/card_myanimelist_personal.xml @@ -9,7 +9,7 @@ android:id="@+id/myanimelist_title_layout" android:layout_width="match_parent" android:layout_height="?android:listPreferredItemHeightSmall" - android:background="?attr/selectableItemBackground" + android:background="?attr/selectable_list_drawable" android:clickable="true" android:paddingLeft="?android:listPreferredItemPaddingLeft" android:paddingRight="?android:listPreferredItemPaddingRight"> @@ -18,7 +18,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:text="Title"/> + android:text="Title" + style="@style/TextAppearance.Regular.Body1"/> + android:text="Edit" + style="@style/TextAppearance.Medium.Button"/> @@ -35,23 +37,25 @@ android:layout_width="fill_parent" android:layout_height="1dp" android:layout_below="@id/myanimelist_title_layout" - android:background="@color/list_choice_pressed_bg_light" /> + android:background="?android:attr/divider" /> + android:paddingRight="?android:listPreferredItemPaddingRight" + > + android:text="Status" + style="@style/TextAppearance.Regular.Body1"/> + tools:text="Reading" + style="@style/TextAppearance.Regular.Body1.Secondary"/> @@ -68,14 +73,14 @@ android:layout_width="fill_parent" android:layout_height="1dp" android:layout_below="@id/myanimelist_status_layout" - android:background="@color/list_choice_pressed_bg_light" /> + android:background="?android:attr/divider" /> @@ -84,7 +89,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:text="Chapters"/> + android:text="Chapters" + style="@style/TextAppearance.Regular.Body1"/> + tools:text="12/24" + style="@style/TextAppearance.Regular.Body1.Secondary"/> @@ -101,14 +108,14 @@ android:layout_width="fill_parent" android:layout_height="1dp" android:layout_below="@id/myanimelist_chapters_layout" - android:background="@color/list_choice_pressed_bg_light" /> + android:background="?android:attr/divider" /> @@ -117,7 +124,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:text="@string/score"/> + android:text="@string/score" + style="@style/TextAppearance.Regular.Body1"/> + tools:text="10" + style="@style/TextAppearance.Regular.Body1.Secondary"/> diff --git a/app/src/main/res/layout/chapter_image.xml b/app/src/main/res/layout/chapter_image.xml index 29f084acb..b7930636a 100644 --- a/app/src/main/res/layout/chapter_image.xml +++ b/app/src/main/res/layout/chapter_image.xml @@ -1,6 +1,6 @@ + android:layout_height="match_parent"/> diff --git a/app/src/main/res/layout/dialog_myanimelist_chapters.xml b/app/src/main/res/layout/dialog_myanimelist_chapters.xml index fe25e4177..75c95a7c8 100644 --- a/app/src/main/res/layout/dialog_myanimelist_chapters.xml +++ b/app/src/main/res/layout/dialog_myanimelist_chapters.xml @@ -1,16 +1,16 @@ + android:layout_height="match_parent" + android:orientation="vertical"> + app:max="9999" + app:min="0"/> \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_myanimelist_score.xml b/app/src/main/res/layout/dialog_myanimelist_score.xml index 7d5015e9c..f671792d1 100644 --- a/app/src/main/res/layout/dialog_myanimelist_score.xml +++ b/app/src/main/res/layout/dialog_myanimelist_score.xml @@ -1,16 +1,16 @@ + android:layout_height="match_parent" + android:orientation="vertical"> + app:max="10" + app:min="0"/> \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_myanimelist_search.xml b/app/src/main/res/layout/dialog_myanimelist_search.xml index fe5e2f228..00b2abf23 100644 --- a/app/src/main/res/layout/dialog_myanimelist_search.xml +++ b/app/src/main/res/layout/dialog_myanimelist_search.xml @@ -1,31 +1,24 @@ + android:layout_height="wrap_content" + android:orientation="vertical"> + android:paddingRight="@dimen/margin_right"> - - + android:hint="@string/title_hint"/> @@ -34,21 +27,21 @@ style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="fill_parent" - android:paddingTop="32dp" - android:paddingBottom="32dp" android:layout_gravity="center_vertical|center_horizontal" + android:paddingBottom="32dp" + android:paddingTop="32dp" android:visibility="gone"/> \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_myanimelist_search_item.xml b/app/src/main/res/layout/dialog_myanimelist_search_item.xml index 18f7308a3..53d52fef6 100644 --- a/app/src/main/res/layout/dialog_myanimelist_search_item.xml +++ b/app/src/main/res/layout/dialog_myanimelist_search_item.xml @@ -1,13 +1,13 @@ + android:layout_height="match_parent" + android:orientation="vertical"> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_catalogue.xml b/app/src/main/res/layout/fragment_catalogue.xml index 38956c3f0..346a3e94b 100644 --- a/app/src/main/res/layout/fragment_catalogue.xml +++ b/app/src/main/res/layout/fragment_catalogue.xml @@ -1,11 +1,11 @@ + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fitsSystemWindows="true" + android:orientation="vertical" + tools:context="eu.kanade.tachiyomi.ui.catalogue.CatalogueFragment"> + - + android:layout_weight="1"> - - + android:columnWidth="140dp" + tools:listitem="@layout/item_catalogue_grid"/> + + diff --git a/app/src/main/res/layout/fragment_download_queue.xml b/app/src/main/res/layout/fragment_download_queue.xml index 5bec7ea12..60d252d9f 100644 --- a/app/src/main/res/layout/fragment_download_queue.xml +++ b/app/src/main/res/layout/fragment_download_queue.xml @@ -1,12 +1,15 @@ + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:id="@+id/recycler" + tools:listitem="@layout/item_download"> diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 6dd275e58..f603e3d3e 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -1,12 +1,12 @@ + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + android:layout_height="match_parent"> diff --git a/app/src/main/res/layout/fragment_library_category.xml b/app/src/main/res/layout/fragment_library_category.xml index 06ab5a915..d3d94f1d2 100644 --- a/app/src/main/res/layout/fragment_library_category.xml +++ b/app/src/main/res/layout/fragment_library_category.xml @@ -1,13 +1,15 @@ + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> + tools:listitem="@layout/item_catalogue_grid"/> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_manga_chapters.xml b/app/src/main/res/layout/fragment_manga_chapters.xml index 267404551..d5f5770ba 100644 --- a/app/src/main/res/layout/fragment_manga_chapters.xml +++ b/app/src/main/res/layout/fragment_manga_chapters.xml @@ -1,9 +1,9 @@ @@ -33,12 +32,11 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:layout_alignParentBottom="true" - android:background="@color/colorPrimary" + android:background="?attr/colorPrimary" android:elevation="4dp" - android:paddingLeft="12dp" - android:paddingRight="12dp" android:gravity="top|start" - android:theme="@style/AppTheme.Popup"> + android:paddingLeft="12dp" + android:paddingRight="12dp"> + android:background="@color/md_white_1000"/> - - + android:background="@color/md_white_1000"/> - + android:layout_alignParentRight="true" + android:title="@string/action_next_unread" + app:srcCompat="@drawable/ic_play_arrow_white_36dp"/> diff --git a/app/src/main/res/layout/fragment_manga_info.xml b/app/src/main/res/layout/fragment_manga_info.xml index dc273685f..46a8d85a7 100644 --- a/app/src/main/res/layout/fragment_manga_info.xml +++ b/app/src/main/res/layout/fragment_manga_info.xml @@ -67,17 +67,24 @@ @@ -90,17 +97,24 @@ @@ -113,17 +127,24 @@ @@ -136,17 +157,24 @@ @@ -159,17 +187,24 @@ @@ -182,18 +217,24 @@ @@ -218,17 +259,23 @@ + android:ellipsize="end" + android:paddingRight="10dp" + android:singleLine="true" + android:text="@string/description" + android:textIsSelectable="false"/> @@ -241,12 +288,11 @@ + app:layout_anchorGravity="bottom|right|end" + app:layout_behavior="" + app:srcCompat="@drawable/ic_bookmark_border_white_24dp"/> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_myanimelist.xml b/app/src/main/res/layout/fragment_myanimelist.xml index 9e7c31895..76d5fcfb4 100644 --- a/app/src/main/res/layout/fragment_myanimelist.xml +++ b/app/src/main/res/layout/fragment_myanimelist.xml @@ -1,14 +1,14 @@ + android:paddingTop="@dimen/margin_top"> diff --git a/app/src/main/res/layout/item_catalogue_grid.xml b/app/src/main/res/layout/item_catalogue_grid.xml index cadc73342..5dc4a8842 100644 --- a/app/src/main/res/layout/item_catalogue_grid.xml +++ b/app/src/main/res/layout/item_catalogue_grid.xml @@ -5,7 +5,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/selector_chapter_light"> + android:background="?attr/selectable_list_drawable"> + - - - diff --git a/app/src/main/res/layout/item_catalogue_list.xml b/app/src/main/res/layout/item_catalogue_list.xml index 409714fe6..f9d1b20f8 100644 --- a/app/src/main/res/layout/item_catalogue_list.xml +++ b/app/src/main/res/layout/item_catalogue_list.xml @@ -3,14 +3,15 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="?android:listPreferredItemHeightSmall" - android:background="@drawable/selector_chapter_light"> + android:background="?attr/selectable_list_drawable"> + android:paddingRight="?android:listPreferredItemPaddingLeft"/> \ No newline at end of file diff --git a/app/src/main/res/layout/item_chapter.xml b/app/src/main/res/layout/item_chapter.xml index 0c3635b7c..ec7a7e54b 100644 --- a/app/src/main/res/layout/item_chapter.xml +++ b/app/src/main/res/layout/item_chapter.xml @@ -4,7 +4,7 @@ android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" xmlns:app="http://schemas.android.com/apk/res-auto" - android:background="@drawable/selector_chapter_light"> + android:background="?attr/selectable_list_drawable"> + style="@style/TextAppearance.Regular.Caption.Hint"/> @@ -88,14 +87,14 @@ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingRight="?android:attr/listPreferredItemPaddingRight"> - + app:srcCompat="@drawable/ic_more_horiz_black_24dp" + android:tint="?android:attr/textColorPrimary"/> diff --git a/app/src/main/res/layout/item_download.xml b/app/src/main/res/layout/item_download.xml index 5136181bb..2ec2c8020 100644 --- a/app/src/main/res/layout/item_download.xml +++ b/app/src/main/res/layout/item_download.xml @@ -1,7 +1,7 @@ @@ -25,7 +25,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/download_progress_text" - android:layout_gravity="left" /> + android:layout_gravity="start" /> diff --git a/app/src/main/res/layout/item_edit_categories.xml b/app/src/main/res/layout/item_edit_categories.xml index aa80ba9f3..00fa12e32 100644 --- a/app/src/main/res/layout/item_edit_categories.xml +++ b/app/src/main/res/layout/item_edit_categories.xml @@ -1,13 +1,13 @@ - + android:background="?attr/selectable_list_drawable" + > - + app:srcCompat="@drawable/ic_reorder_grey_24dp" + android:tint="?android:attr/textColorPrimary"/> \ No newline at end of file diff --git a/app/src/main/res/layout/item_recent_chapter.xml b/app/src/main/res/layout/item_recent_chapter.xml index cbf579891..60553b72c 100644 --- a/app/src/main/res/layout/item_recent_chapter.xml +++ b/app/src/main/res/layout/item_recent_chapter.xml @@ -3,8 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:background="@drawable/selector_chapter_light"> + xmlns:app="http://schemas.android.com/apk/res-auto"> @@ -51,7 +49,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:singleLine="true" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textAppearance="@style/TextAppearance.Regular.Body1" tools:text="My manga"/> @@ -82,7 +80,7 @@ android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"> - + app:srcCompat="@drawable/ic_more_horiz_black_24dp" + android:tint="?android:attr/textColorPrimary"/> diff --git a/app/src/main/res/layout/item_recent_chapter_section.xml b/app/src/main/res/layout/item_recent_chapter_section.xml index 0bf14dd38..3bd4e8200 100644 --- a/app/src/main/res/layout/item_recent_chapter_section.xml +++ b/app/src/main/res/layout/item_recent_chapter_section.xml @@ -4,22 +4,20 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="32dp" + android:background="?attr/colorPrimary" android:gravity="center_vertical" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" android:paddingRight="?android:attr/listPreferredItemPaddingRight" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:background="@color/colorPrimary"> + android:paddingStart="?android:attr/listPreferredItemPaddingStart"> + android:singleLine="true"/> diff --git a/app/src/main/res/layout/item_webtoon_reader.xml b/app/src/main/res/layout/item_webtoon_reader.xml index 84274e9e5..b2e4b953f 100644 --- a/app/src/main/res/layout/item_webtoon_reader.xml +++ b/app/src/main/res/layout/item_webtoon_reader.xml @@ -5,9 +5,9 @@ android:layout_height="wrap_content"> + android:layout_height="match_parent">