From 5ef5f9b45fc362ce6cd000eb0e07d4df1f6f1dfb Mon Sep 17 00:00:00 2001 From: NoodleMage Date: Sat, 12 Mar 2016 14:22:40 +0100 Subject: [PATCH] Rewrote Theme --- app/src/main/AndroidManifest.xml | 4 +- .../main/java/eu/kanade/tachiyomi/App.java | 16 + .../data/preference/PreferencesHelper.kt | 6 + .../ui/base/activity/BaseActivity.kt | 12 +- .../ui/base/fragment/BaseRxFragment.java | 9 +- .../ui/catalogue/CatalogueFragment.kt | 5 +- .../ui/catalogue/CatalogueGridHolder.kt | 3 - .../ui/catalogue/CatalogueListHolder.kt | 7 +- .../tachiyomi/ui/category/CategoryActivity.kt | 1 + .../tachiyomi/ui/download/DownloadFragment.kt | 12 +- .../tachiyomi/ui/library/LibraryFragment.kt | 39 +- .../tachiyomi/ui/main/FragmentStack.java | 179 ----- .../kanade/tachiyomi/ui/main/MainActivity.kt | 121 +-- .../tachiyomi/ui/manga/MangaActivity.kt | 1 + .../ui/manga/chapter/ChaptersFragment.kt | 3 +- .../ui/manga/chapter/ChaptersHolder.kt | 5 +- .../tachiyomi/ui/reader/ReaderActivity.java | 10 +- .../viewer/base/PageDecodeErrorLayout.kt | 4 +- .../viewer/pager/PagerReaderFragment.kt | 4 +- .../ui/recent/RecentChaptersFragment.kt | 19 +- .../ui/recent/RecentChaptersHolder.kt | 8 +- .../tachiyomi/ui/setting/SettingsActivity.kt | 3 +- .../ui/setting/SettingsGeneralFragment.kt | 19 + .../tachiyomi/util/ContextExtensions.kt | 4 +- .../tachiyomi/util/ImageViewExtensions.kt | 5 +- .../kanade/tachiyomi/util/ThemeExtensions.kt | 19 + .../reader_background_checkbox_selected.png | Bin 227 -> 0 bytes .../reader_background_checkbox_unselected.png | Bin 249 -> 0 bytes .../reader_background_checkbox_selected.png | Bin 136 -> 0 bytes .../reader_background_checkbox_unselected.png | Bin 153 -> 0 bytes .../reader_background_checkbox_selected.png | Bin 142 -> 0 bytes .../reader_background_checkbox_unselected.png | Bin 148 -> 0 bytes .../drawable-v21/list_item_selector_dark.xml | 23 + .../drawable-v21/list_item_selector_light.xml | 23 + .../drawable-v21/selector_chapter_light.xml | 14 - .../touchable_background_white.xml | 5 - .../res/drawable-xhdpi/card_background.9.png | Bin .../reader_background_checkbox_selected.png | Bin 366 -> 0 bytes .../reader_background_checkbox_unselected.png | Bin 387 -> 0 bytes .../reader_background_checkbox_selected.png | Bin 434 -> 0 bytes .../reader_background_checkbox_unselected.png | Bin 499 -> 0 bytes app/src/main/res/drawable/header.png | Bin 5711 -> 0 bytes ...grey_128dp.xml => ic_book_black_128dp.xml} | 1 - ...k_grey_24dp.xml => ic_book_black_24dp.xml} | 1 - ...rey_24dp.xml => ic_explore_black_24dp.xml} | 1 - ...p.xml => ic_file_download_black_128dp.xml} | 1 - ...dp.xml => ic_file_download_black_24dp.xml} | 1 - ...y_128dp.xml => ic_history_black_128dp.xml} | 1 - ...rey_24dp.xml => ic_history_black_24dp.xml} | 1 - .../res/drawable/ic_history_blue_24dp.xml | 9 - ...reader_background_checkbox_black_24dp.xml} | 4 +- ...reader_background_checkbox_white_24dp.xml} | 4 +- ...ey_24dp.xml => ic_settings_black_24dp.xml} | 1 - .../main/res/drawable/{test.png => icon.png} | Bin ...line_divider.xml => line_divider_dark.xml} | 2 +- .../main/res/drawable/line_divider_light.xml | 11 + ..._light.xml => list_item_selector_dark.xml} | 10 +- .../res/drawable/list_item_selector_light.xml | 19 + .../drawable/reader_background_checkbox.xml | 4 +- .../drawable/touchable_background_white.xml | 6 - .../res/layout/activity_edit_categories.xml | 17 +- app/src/main/res/layout/activity_main.xml | 9 +- app/src/main/res/layout/activity_manga.xml | 14 +- .../main/res/layout/activity_preferences.xml | 5 +- app/src/main/res/layout/activity_reader.xml | 17 +- .../res/layout/card_myanimelist_personal.xml | 41 +- app/src/main/res/layout/chapter_image.xml | 4 +- .../layout/dialog_myanimelist_chapters.xml | 10 +- .../res/layout/dialog_myanimelist_score.xml | 10 +- .../res/layout/dialog_myanimelist_search.xml | 33 +- .../layout/dialog_myanimelist_search_item.xml | 6 +- .../main/res/layout/fragment_catalogue.xml | 32 +- .../res/layout/fragment_download_queue.xml | 9 +- app/src/main/res/layout/fragment_library.xml | 10 +- .../res/layout/fragment_library_category.xml | 12 +- .../res/layout/fragment_manga_chapters.xml | 29 +- .../main/res/layout/fragment_manga_info.xml | 88 ++- .../main/res/layout/fragment_myanimelist.xml | 8 +- .../res/layout/fragment_recent_chapters.xml | 1 - .../main/res/layout/item_catalogue_grid.xml | 32 +- .../main/res/layout/item_catalogue_list.xml | 7 +- app/src/main/res/layout/item_chapter.xml | 17 +- app/src/main/res/layout/item_download.xml | 4 +- .../main/res/layout/item_edit_categories.xml | 14 +- .../main/res/layout/item_recent_chapter.xml | 13 +- .../layout/item_recent_chapter_section.xml | 12 +- .../main/res/layout/item_webtoon_reader.xml | 10 +- .../main/res/layout/library_tab_layout.xml | 7 +- app/src/main/res/layout/listitem_dir.xml | 8 +- app/src/main/res/layout/navigation_header.xml | 26 +- .../main/res/layout/pref_account_login.xml | 45 +- .../main/res/layout/pref_library_columns.xml | 22 +- .../layout/preference_widget_imageview.xml | 4 +- app/src/main/res/layout/reader_menu.xml | 111 ++- app/src/main/res/layout/reader_popup.xml | 76 +- app/src/main/res/layout/tab_layout.xml | 7 +- app/src/main/res/layout/toolbar.xml | 7 +- app/src/main/res/menu/menu_navigation.xml | 12 +- app/src/main/res/values-land/dimens.xml | 5 + app/src/main/res/values-sw600dp/dimens.xml | 5 + app/src/main/res/values-v21/keys.xml | 7 + app/src/main/res/values-v21/styles.xml | 7 - app/src/main/res/values-v21/themes.xml | 22 + app/src/main/res/values/arrays.xml | 18 +- app/src/main/res/values/attrs.xml | 5 + app/src/main/res/values/colors.xml | 744 +----------------- app/src/main/res/values/dimens.xml | 19 +- app/src/main/res/values/keys.xml | 5 + app/src/main/res/values/strings.xml | 8 +- app/src/main/res/values/styles.xml | 219 ++++-- app/src/main/res/values/themes.xml | 93 +++ app/src/main/res/xml/pref_general.xml | 8 + 112 files changed, 1078 insertions(+), 1536 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/main/FragmentStack.java create mode 100644 app/src/main/java/eu/kanade/tachiyomi/util/ThemeExtensions.kt delete mode 100644 app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png delete mode 100644 app/src/main/res/drawable-hdpi/reader_background_checkbox_unselected.png delete mode 100644 app/src/main/res/drawable-ldpi/reader_background_checkbox_selected.png delete mode 100644 app/src/main/res/drawable-ldpi/reader_background_checkbox_unselected.png delete mode 100644 app/src/main/res/drawable-mdpi/reader_background_checkbox_selected.png delete mode 100644 app/src/main/res/drawable-mdpi/reader_background_checkbox_unselected.png create mode 100644 app/src/main/res/drawable-v21/list_item_selector_dark.xml create mode 100644 app/src/main/res/drawable-v21/list_item_selector_light.xml delete mode 100644 app/src/main/res/drawable-v21/selector_chapter_light.xml delete mode 100644 app/src/main/res/drawable-v21/touchable_background_white.xml mode change 100755 => 100644 app/src/main/res/drawable-xhdpi/card_background.9.png delete mode 100644 app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png delete mode 100644 app/src/main/res/drawable-xxhdpi/reader_background_checkbox_unselected.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_selected.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/reader_background_checkbox_unselected.png delete mode 100644 app/src/main/res/drawable/header.png rename app/src/main/res/drawable/{ic_book_grey_128dp.xml => ic_book_black_128dp.xml} (93%) rename app/src/main/res/drawable/{ic_book_grey_24dp.xml => ic_book_black_24dp.xml} (93%) rename app/src/main/res/drawable/{ic_explore_grey_24dp.xml => ic_explore_black_24dp.xml} (94%) rename app/src/main/res/drawable/{ic_file_download_grey_128dp.xml => ic_file_download_black_128dp.xml} (92%) rename app/src/main/res/drawable/{ic_file_download_grey_24dp.xml => ic_file_download_black_24dp.xml} (92%) rename app/src/main/res/drawable/{ic_history_grey_128dp.xml => ic_history_black_128dp.xml} (95%) rename app/src/main/res/drawable/{ic_history_grey_24dp.xml => ic_history_black_24dp.xml} (95%) delete mode 100644 app/src/main/res/drawable/ic_history_blue_24dp.xml rename app/src/main/res/drawable/{ic_file_download_blue_24dp.xml => ic_reader_background_checkbox_black_24dp.xml} (59%) rename app/src/main/res/drawable/{ic_book_blue_24dp.xml => ic_reader_background_checkbox_white_24dp.xml} (54%) rename app/src/main/res/drawable/{ic_settings_grey_24dp.xml => ic_settings_black_24dp.xml} (97%) rename app/src/main/res/drawable/{test.png => icon.png} (100%) rename app/src/main/res/drawable/{line_divider.xml => line_divider_dark.xml} (78%) create mode 100644 app/src/main/res/drawable/line_divider_light.xml rename app/src/main/res/drawable/{selector_chapter_light.xml => list_item_selector_dark.xml} (57%) create mode 100644 app/src/main/res/drawable/list_item_selector_light.xml delete mode 100644 app/src/main/res/drawable/touchable_background_white.xml create mode 100644 app/src/main/res/values-land/dimens.xml create mode 100644 app/src/main/res/values-sw600dp/dimens.xml create mode 100644 app/src/main/res/values-v21/keys.xml delete mode 100644 app/src/main/res/values-v21/styles.xml create mode 100644 app/src/main/res/values-v21/themes.xml create mode 100644 app/src/main/res/values/themes.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8bf4d710ec..47deba4508 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,10 +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: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 3992bffd49..a8b9bf4826 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 965a9f8984..3d5dc78474 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 879caa31f7..0de8b7f063 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 6e977a18b0..ad50e0b353 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 1a8a5e3d95..f1b6cc0aff 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,6 +19,7 @@ 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 @@ -155,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 659092e132..da7055c469 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 8eb52283f0..c1eb21dd50 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 3d24d793d0..34f8881abf 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 fd6436062f..a9ec45f0e6 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 @@ -8,8 +8,6 @@ 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 eu.kanade.tachiyomi.util.setInformationDrawable -import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_download_queue.* import nucleus.factory.RequiresPresenter import rx.Subscription @@ -63,8 +61,8 @@ class DownloadFragment : BaseRxFragment() { } } - override fun onCreate(bundle: Bundle?) { - super.onCreate(bundle) + override fun onCreate(savedState: Bundle?) { + super.onCreate(savedState) setHasOptionsMenu(true) } @@ -190,10 +188,8 @@ class DownloadFragment : BaseRxFragment() { * Set information view when queue is empty */ private fun setInformationView() { - if (presenter.downloadQueue.isEmpty()) { - ( activity as MainActivity).image_view.setInformationDrawable(R.drawable.ic_file_download_grey_128dp) - ( activity as MainActivity).text_label.text = getString(R.string.information_no_downloads) - } + (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 102923465a..d064cf55fc 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 @@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment 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.setInformationDrawable import eu.kanade.tachiyomi.util.toast import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_library.* @@ -51,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. @@ -112,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 @@ -126,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 @@ -150,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) { @@ -260,13 +252,8 @@ class LibraryFragment : BaseRxFragment(), ActionMode.Callback */ fun onNextLibraryUpdate(categories: List, mangaMap: Map>) { // Check if library is empty and update information accordingly. - if (mangaMap.isEmpty()) { - (activity as MainActivity).image_view.setInformationDrawable(R.drawable.ic_book_grey_128dp) - (activity as MainActivity).text_label.text = getString(R.string.information_empty_library) - } else { - ( activity as MainActivity).image_view.setInformationDrawable(null) - ( activity as MainActivity).text_label.text = "" - } + (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 31ea76f5e0..0000000000 --- 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.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 770ef5d32d..dfaeba8d0f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -1,10 +1,13 @@ 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 @@ -12,17 +15,15 @@ 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.setInformationDrawable +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.* -import nucleus.view.ViewWithPresenter class MainActivity : BaseActivity() { - lateinit var fragmentStack: FragmentStack - override fun onCreate(savedState: Bundle?) { - setTheme(R.style.AppTheme); + setAppTheme() super.onCreate(savedState) // Do not let the launcher create a new activity @@ -38,64 +39,78 @@ class MainActivity : BaseActivity() { setupToolbar(toolbar) supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp) - fragmentStack = FragmentStack(this, supportFragmentManager, R.id.frame_container - ) { fragment -> - if (fragment is ViewWithPresenter<*>) - fragment.presenter.destroy() - } + 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( - { menuItem -> - // Make information view invisible - image_view.setInformationDrawable(null) - text_label.text = "" + nav_view.setNavigationItemSelectedListener { item -> + // Make information view invisible + image_view.setDrawableCompat(null) + text_label.text = "" - when (menuItem.itemId) { - R.id.nav_drawer_library -> { - setFragment(LibraryFragment.newInstance()) - menuItem.isChecked = true - drawer.closeDrawer(GravityCompat.START) - } - R.id.nav_drawer_recent_updates -> { - setFragment(RecentChaptersFragment.newInstance()) - menuItem.isChecked = true - drawer.closeDrawer(GravityCompat.START) - } - R.id.nav_drawer_catalogues -> { - setFragment(CatalogueFragment.newInstance()) - menuItem.isChecked = true - drawer.closeDrawer(GravityCompat.START) - } - R.id.nav_drawer_downloads -> { - setFragment(DownloadFragment.newInstance()) - menuItem.isChecked = true - drawer.closeDrawer(GravityCompat.START) - } - R.id.nav_drawer_settings -> { - menuItem.isChecked = true - startActivity(Intent(this, SettingsActivity::class.java)) - drawer.closeDrawer(GravityCompat.START) - } - } - true - }) + 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 + } - setFragment(LibraryFragment.newInstance()) + if (savedState == null) { + setFragment(LibraryFragment.newInstance()) + } } override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { - android.R.id.home -> { - drawer.openDrawer(GravityCompat.START) - return true - } + android.R.id.home -> drawer.openDrawer(GravityCompat.START) + else -> return super.onOptionsItemSelected(item) } - return super.onOptionsItemSelected(item) + return true } - fun setFragment(fragment: Fragment) { - fragmentStack.replace(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 e65b7eb70e..47c092bd03 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 942f78c724..fdc634e6ed 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 5e8ec0b435..e971268a1f 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 cec18311ee..3f3e652f15 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 351f3beab8..7686fd0eec 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 f7c91069f1..dc8caf91ef 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 ac7d9e8a99..2b64234134 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 @@ -17,8 +16,7 @@ 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.setInformationDrawable -import kotlinx.android.synthetic.main.activity_main.* +import eu.kanade.tachiyomi.util.getResourceDrawable import kotlinx.android.synthetic.main.fragment_recent_chapters.* import nucleus.factory.RequiresPresenter import rx.Observable @@ -70,19 +68,13 @@ 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 // Update toolbar text setToolbarTitle(R.string.label_recent_updates) - - // Check if recent chapters is empty and update information accordingly. - (activity as MainActivity).image_view.setInformationDrawable(R.drawable.ic_history_grey_128dp) - (activity as MainActivity).text_label.text = getString(R.string.information_no_recent) - (activity as MainActivity).information_layout.bringToFront() } /** @@ -129,10 +121,9 @@ class RecentChaptersFragment : BaseRxFragment(), Flexib * @param chapters list of chapters */ fun onNextMangaChapters(chapters: List) { - if (!chapters.isEmpty()) { - ( activity as MainActivity).image_view.setInformationDrawable(null) - ( activity as MainActivity).text_label.text = "" - } + (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 0b811cd860..25eb0bd945 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 59486fbf6f..17d22ff801 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 7b6f58f172..ec5862484f 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 0dac66c7a8..4dc11e3a22 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 2456e4f856..518356f0e7 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 0000000000..81c1988fe5 --- /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/reader_background_checkbox_selected.png b/app/src/main/res/drawable-hdpi/reader_background_checkbox_selected.png deleted file mode 100644 index 9908433c073331a4d7356e7ea97e53e8377abaf3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpUtRh}-6Ar-gY&N#?>SV4g0r{cwi zyKylcg`SGJH~sGg^1Zyo*xh8T{8l`#fnS=5f#JY>L0!)&E9B}n+UV?7EkE}zd;O`0 z^QT=7a?Q*ZZ*}={Ia7Mi(ah?cz4L=VX|H2uS!KWSO0)vMh(((C2@Zt@1|}rp&P#90 zugmLF))r}IO?{9WEGQnG`(yg1xzT@1HtoM0xAjr^T3^dQx~F0p7#ik3V)mCgv;Fno SnjJt_GkCiCxvXIlZ*%=rLRGm0#*Uk?9y6*6CiT9^B z*%X}%UYim#`P@2Nw(}3?FP*aW+Ov@Cw;zqBU%33L?AC{S9!Vy#>Tj3N+i`c2`Rp(+ z+qJBh`j|dnWEEoKP-tL4BGP{a$^8o6pT6dkVSi}U22+iaBED@Ve{LJkoqXiRq60S# q!v4%%y7_LKz3UEc28Iv$HH>^Wj;nEXT4n?N!rn 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 d06d87c9571bac625d670ea2a8fbcfa0578831bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`{+=$5Ar-fh6C`>Xx*3jft2FH3 z>X2^OA;)X(@Koi)O`f0+Tpjx#99X{~Ye#|P1%}Wc{OtdjLYpr)R4MVSkblM&Ak!h@ js(h5QQ_FMaKL&7S66E(|eFe0O!PC{xWt~$(696tE BGmZcN 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 f0faf295f8548ba7617af2bcec6c1faff28fdf8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJP)`@fkcwMxr)}f~O0eYKIdE5I z9?0l#FY%d0$9mpmY!BUo-X$Lr_exj+jTJYD@<);T3K0RYA_E|vfQ 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 69e1ee734a399d3880c6b4aa55b467f257eba37a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 148 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJXipc%kcwMxuNm?lFyL{ysFRqG zm- + + + + + + + + + + + + + + + + + + + \ 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 0000000000..57bb65957a --- /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 f92e970b2a..0000000000 --- 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 322353b5ff..0000000000 --- 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/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/reader_background_checkbox_selected.png b/app/src/main/res/drawable-xxhdpi/reader_background_checkbox_selected.png deleted file mode 100644 index 287892b71b130a0fa24a9bd738323c915b22d0f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 366 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>U^Mk~aSW-r_4dxfzC#WI4G%?C z(zQR-PT0Mj@t%NAfAB???#xSfOeA@PE}!}I_vDYf{b{e4nR-rAfg!v1>S-O8VzU+J z@6BnSVfaj>xPNBSGbQ7v#`8b(w0G(MH-9Gexg#>^TGHkxo9}=I8k){eQLd zIt{{hefIzPb>Zq-_y-COO#rv2TzsQU4-J$VD$2IaSW-r_4bZp-eCs;hl>qf zOW964*S3E%E6t0zEO*$QBSOsxx| 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 90c1bd6f56549cce91c1055099eaf7bb5df43060..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 434 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7xzrV660XaSW-r_4ckKSF?eLYvA#` z<-2)P%-}pHH}BowyyL0-eon9dOnyIH@BG?4ZHciwQou1V a{OD)T{q(Kt;-+0{AaPGuKbLh*2~7Yab%iD;uunK>+Ri(oXrLz4j1co z_uXdO)EjNll^~_4%es1sljp~|?BxuTowvrn5A)iona9V-&<-?5fPu+@frEijfq?}d z=f|Rr)3SFR^ha! zZ>!C(3MZZZZFc|uwnWPBpL+LuUQz$<7pw^@eBb@C47Q$Zz#zv_^x^u!Tjvs9l=9m$ z?x_=A@{LvIq5h*w^Gv^1JpZrEz(^o0k%QdsJ>QhCj;Ed%cDjQC#M9N!Wt~$(699+? BfB^si diff --git a/app/src/main/res/drawable/header.png b/app/src/main/res/drawable/header.png deleted file mode 100644 index 9379dcb71e7b753df676b624e347015349b00f43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5711 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 diff --git a/app/src/main/res/drawable/ic_book_grey_128dp.xml b/app/src/main/res/drawable/ic_book_black_128dp.xml similarity index 93% rename from app/src/main/res/drawable/ic_book_grey_128dp.xml rename to app/src/main/res/drawable/ic_book_black_128dp.xml index 24c101cff9..5226a4ad51 100644 --- a/app/src/main/res/drawable/ic_book_grey_128dp.xml +++ b/app/src/main/res/drawable/ic_book_black_128dp.xml @@ -1,7 +1,6 @@ - - diff --git a/app/src/main/res/drawable/ic_file_download_blue_24dp.xml b/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml similarity index 59% rename from app/src/main/res/drawable/ic_file_download_blue_24dp.xml rename to app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml index 0f912b6f34..f041ff22a8 100644 --- a/app/src/main/res/drawable/ic_file_download_blue_24dp.xml +++ b/app/src/main/res/drawable/ic_reader_background_checkbox_black_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> + android:fillColor="#FF000000" + android:pathData="M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z"/> diff --git a/app/src/main/res/drawable/ic_book_blue_24dp.xml b/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml similarity index 54% rename from app/src/main/res/drawable/ic_book_blue_24dp.xml rename to app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml index debaf260ab..6ec88b7172 100644 --- a/app/src/main/res/drawable/ic_book_blue_24dp.xml +++ b/app/src/main/res/drawable/ic_reader_background_checkbox_white_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> + android:fillColor="#FFFFFFFF" + android:pathData="M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z"/> 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 51fc037eff..ace746c40e 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 0000000000..eca76daba5 --- /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 57% rename from app/src/main/res/drawable/selector_chapter_light.xml rename to app/src/main/res/drawable/list_item_selector_dark.xml index 58df6ebf87..2607d316f3 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 0000000000..4cb278d904 --- /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 2ace26fced..07dff0006b 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 26044d48fb..0000000000 --- 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 55ae9acc0b..af66227aaa 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 feb03e35d6..a06c3ddee0 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -34,7 +34,7 @@ android:layout_height="wrap_content" android:layout_gravity="center"> - + android:layout_centerHorizontal="true"/> - diff --git a/app/src/main/res/layout/activity_manga.xml b/app/src/main/res/layout/activity_manga.xml index f73e0924af..7815e9107c 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 b44b7a9bab..c80a17301e 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 4535f1cf40..53f22748fb 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 428984ced7..74202c1787 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 29f084acbb..b7930636a4 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 fe25e41771..75c95a7c8a 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 7d5015e9cd..f671792d18 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 fe5e2f2282..00b2abf23e 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 18f7308a39..53d52fef6c 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 38956c3f0f..346a3e94bb 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 5bec7ea126..60d252d9fc 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 6dd275e58d..f603e3d3ed 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 06ab5a9151..d3d94f1d2c 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 267404551b..d5f5770ba4 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 dc273685f3..46a8d85a78 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 9e7c31895a..76d5fcfb41 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 52b8f93573..5dc4a8842a 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 409714fe62..f9d1b20f85 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 0c3635b7ce..ec7a7e54b9 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 5136181bb8..2ec2c80209 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 aa80ba9f36..00fa12e329 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 cbf5798910..60553b72c9 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 0bf14dd38c..3bd4e82007 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 84274e9e57..b2e4b953f3 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">