mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 20:21:48 +01:00
Show changelog when new version is installed
This commit is contained in:
parent
5d9c817461
commit
a08cea9df8
@ -143,6 +143,9 @@ dependencies {
|
||||
// Parse HTML
|
||||
compile 'org.jsoup:jsoup:1.9.1'
|
||||
|
||||
// Changelog
|
||||
compile 'com.github.gabrielemariotti.changeloglib:changelog:2.1.0'
|
||||
|
||||
// Database
|
||||
compile "com.pushtorefresh.storio:sqlite:$STORIO_VERSION"
|
||||
compile "com.pushtorefresh.storio:sqlite-annotations:$STORIO_VERSION"
|
||||
|
@ -99,6 +99,8 @@ class PreferencesHelper(private val context: Context) {
|
||||
|
||||
fun lastUsedCategory() = rxPrefs.getInteger(keys.lastUsedCategory, 0)
|
||||
|
||||
fun lastVersionCode() = rxPrefs.getInteger("last_version_code", 0)
|
||||
|
||||
fun seamlessMode() = prefs.getBoolean(keys.seamlessMode, true)
|
||||
|
||||
fun catalogueAsList() = rxPrefs.getBoolean(keys.catalogueAsList, false)
|
||||
|
@ -8,8 +8,8 @@ import eu.kanade.tachiyomi.data.glide.MangaModelLoader
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||
import eu.kanade.tachiyomi.data.mangasync.UpdateMangaSyncService
|
||||
import eu.kanade.tachiyomi.data.mangasync.base.MangaSyncService
|
||||
import eu.kanade.tachiyomi.data.source.base.Source
|
||||
import eu.kanade.tachiyomi.data.source.base.OnlineSource
|
||||
import eu.kanade.tachiyomi.data.source.base.Source
|
||||
import eu.kanade.tachiyomi.data.updater.UpdateDownloader
|
||||
import eu.kanade.tachiyomi.injection.module.AppModule
|
||||
import eu.kanade.tachiyomi.injection.module.DataModule
|
||||
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.ui.catalogue.CataloguePresenter
|
||||
import eu.kanade.tachiyomi.ui.category.CategoryPresenter
|
||||
import eu.kanade.tachiyomi.ui.download.DownloadPresenter
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryPresenter
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaActivity
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaPresenter
|
||||
import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersPresenter
|
||||
import eu.kanade.tachiyomi.ui.manga.info.MangaInfoPresenter
|
||||
@ -44,7 +44,7 @@ interface AppComponent {
|
||||
fun inject(recentChaptersPresenter: RecentChaptersPresenter)
|
||||
fun inject(backupPresenter: BackupPresenter)
|
||||
|
||||
fun inject(mangaActivity: MangaActivity)
|
||||
fun inject(mainActivity: MainActivity)
|
||||
fun inject(settingsActivity: SettingsActivity)
|
||||
|
||||
fun inject(source: Source)
|
||||
|
@ -0,0 +1,43 @@
|
||||
package eu.kanade.tachiyomi.ui.main
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.DialogFragment
|
||||
import android.support.v4.app.FragmentManager
|
||||
import android.util.AttributeSet
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import it.gmariotti.changelibs.library.view.ChangeLogRecyclerView
|
||||
|
||||
class ChangelogDialogFragment : DialogFragment() {
|
||||
|
||||
companion object {
|
||||
fun show(preferences: PreferencesHelper, fragmentManager: FragmentManager) {
|
||||
if (preferences.lastVersionCode().getOrDefault() < BuildConfig.VERSION_CODE) {
|
||||
preferences.lastVersionCode().set(BuildConfig.VERSION_CODE)
|
||||
ChangelogDialogFragment().show(fragmentManager, "changelog")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedState: Bundle?): Dialog {
|
||||
val view = WhatsNewRecyclerView(context)
|
||||
return MaterialDialog.Builder(activity)
|
||||
.title("Changelog")
|
||||
.customView(view, false)
|
||||
.positiveText(android.R.string.yes)
|
||||
.build()
|
||||
}
|
||||
|
||||
class WhatsNewRecyclerView(context: Context) : ChangeLogRecyclerView(context) {
|
||||
override fun initAttrs(attrs: AttributeSet?, defStyle: Int) {
|
||||
mRowLayoutId = R.layout.changelog_row_layout
|
||||
mRowHeaderLayoutId = R.layout.changelog_header_layout
|
||||
mChangeLogFileResourceId = if (BuildConfig.DEBUG) R.raw.changelog_debug else R.raw.changelog_release
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,9 @@ import android.os.Bundle
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v4.view.GravityCompat
|
||||
import android.view.MenuItem
|
||||
import eu.kanade.tachiyomi.App
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.backup.BackupFragment
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
||||
import eu.kanade.tachiyomi.ui.catalogue.CatalogueFragment
|
||||
@ -15,9 +17,12 @@ import eu.kanade.tachiyomi.ui.recent.RecentChaptersFragment
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsActivity
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class MainActivity : BaseActivity() {
|
||||
|
||||
@Inject lateinit var preferences: PreferencesHelper
|
||||
|
||||
override fun onCreate(savedState: Bundle?) {
|
||||
setAppTheme()
|
||||
super.onCreate(savedState)
|
||||
@ -28,6 +33,8 @@ class MainActivity : BaseActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
App.get(this).component.inject(this)
|
||||
|
||||
// Inflate activity_main.xml.
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
@ -54,6 +61,7 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
if (savedState == null) {
|
||||
setFragment(LibraryFragment.newInstance())
|
||||
ChangelogDialogFragment.show(preferences, supportFragmentManager)
|
||||
}
|
||||
}
|
||||
|
||||
|
26
app/src/main/res/layout/changelog_header_layout.xml
Normal file
26
app/src/main/res/layout/changelog_header_layout.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/chg_rowheader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/chglib_material_minHeight"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/chglib_material_keyline1"
|
||||
android:paddingRight="@dimen/chglib_material_keyline1">
|
||||
|
||||
|
||||
<!-- ChangeLog Header [Version] You have to use the id="chg_headerVersion" -->
|
||||
<TextView
|
||||
android:id="@+id/chg_headerVersion"
|
||||
style="?android:attr/listSeparatorTextViewStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingBottom="@dimen/chglib_material_keyline1"
|
||||
android:paddingTop="@dimen/chglib_material_keyline1"
|
||||
android:textAppearance="@style/TextAppearance.Medium.Body2"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="?attr/colorAccent"
|
||||
/>
|
||||
</LinearLayout>
|
37
app/src/main/res/layout/changelog_row_layout.xml
Normal file
37
app/src/main/res/layout/changelog_row_layout.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/chg_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/listPreferredItemHeightSmall"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<!-- ChangeLog Row [Bullet Point] You have to use the id="chg_textbullet" -->
|
||||
<TextView
|
||||
android:id="@+id/chg_textbullet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingLeft="@dimen/chglib_material_keyline1"
|
||||
android:paddingRight="0dp"
|
||||
android:paddingStart="@dimen/chglib_material_keyline1"
|
||||
android:text="@string/changelog_row_bulletpoint"
|
||||
android:textAppearance="@style/TextAppearance.Medium.Title"
|
||||
/>
|
||||
|
||||
|
||||
<!-- ChangeLog Row [Text] You have to use the id="chg_text" -->
|
||||
<TextView
|
||||
android:id="@+id/chg_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/listPreferredItemHeightSmall"
|
||||
android:padding="@dimen/chglib_material_keyline1"
|
||||
android:textAppearance="@style/TextAppearance.Regular.Body1"
|
||||
tools:text="Use DashClock with Android 4.2's Daydream feature; great for use with desktop docks!"
|
||||
/>
|
||||
</LinearLayout>
|
16
app/src/main/res/raw/changelog_debug.xml
Normal file
16
app/src/main/res/raw/changelog_debug.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog bulletedList="false">
|
||||
|
||||
<changelogversion versionName="r736" changeDate="">
|
||||
<changelogtext>[b]Important![/b] Now chapters follow the order of the sources. [b]It's required that you update your entire library
|
||||
before reading in order for them to be synced.[/b] Old behavior can be restored for a manga in the overflow menu of the chapters tab.
|
||||
</changelogtext>
|
||||
</changelogversion>
|
||||
|
||||
<changelogversion versionName="r724" changeDate="">
|
||||
<changelogtext>Kissmanga covers may not load anymore. The only workaround is to update the details of the manga
|
||||
from the info tab, or clearing the database (the latter won't fix covers from library manga).
|
||||
</changelogtext>
|
||||
</changelogversion>
|
||||
|
||||
</changelog>
|
4
app/src/main/res/raw/changelog_release.xml
Normal file
4
app/src/main/res/raw/changelog_release.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog bulletedList="true">
|
||||
|
||||
</changelog>
|
@ -21,7 +21,7 @@
|
||||
<color name="selectorColorLight">@color/md_blue_A400_38</color>
|
||||
|
||||
<!-- Dark Theme -->
|
||||
<color name="colorAccentDark">@color/md_blue_A200</color>
|
||||
<color name="colorAccentDark">#3399ff</color>
|
||||
<color name="textColorPrimaryDark">@color/md_white_1000</color>
|
||||
<color name="textColorSecondaryDark">@color/md_white_1000_70</color>
|
||||
<color name="textColorHintDark">@color/md_white_1000_50</color>
|
||||
|
Loading…
Reference in New Issue
Block a user