mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Add shortcut to see commit history for official extensions
This commit is contained in:
		@@ -14,6 +14,7 @@ import android.view.MenuItem
 | 
			
		||||
import android.view.View
 | 
			
		||||
import android.view.ViewGroup
 | 
			
		||||
import androidx.appcompat.view.ContextThemeWrapper
 | 
			
		||||
import androidx.core.net.toUri
 | 
			
		||||
import androidx.core.os.bundleOf
 | 
			
		||||
import androidx.preference.Preference
 | 
			
		||||
import androidx.preference.PreferenceGroupAdapter
 | 
			
		||||
@@ -175,10 +176,13 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
 | 
			
		||||
 | 
			
		||||
    override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
 | 
			
		||||
        inflater.inflate(R.menu.extension_details, menu)
 | 
			
		||||
 | 
			
		||||
        menu.findItem(R.id.action_history).isVisible = presenter.extension?.isUnofficial == false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun onOptionsItemSelected(item: MenuItem): Boolean {
 | 
			
		||||
        when (item.itemId) {
 | 
			
		||||
            R.id.action_history -> openCommitHistory()
 | 
			
		||||
            R.id.action_enable_all -> toggleAllSources(true)
 | 
			
		||||
            R.id.action_disable_all -> toggleAllSources(false)
 | 
			
		||||
            R.id.action_open_in_settings -> openInSettings()
 | 
			
		||||
@@ -202,6 +206,13 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun openCommitHistory() {
 | 
			
		||||
        val pkgName = presenter.extension!!.pkgName.substringAfter("eu.kanade.tachiyomi.extension.")
 | 
			
		||||
        val url = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master/src/${pkgName.replace(".", "/")}"
 | 
			
		||||
        val intent = Intent(Intent.ACTION_VIEW, url.toUri())
 | 
			
		||||
        startActivity(intent)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun openInSettings() {
 | 
			
		||||
        val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
 | 
			
		||||
            data = Uri.fromParts("package", presenter.pkgName, null)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user