moved manager changelog to home page
This commit is contained in:
parent
af2db59800
commit
5db787d642
|
@ -2,6 +2,7 @@ package com.vanced.manager.adapter
|
|||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.vanced.manager.ui.fragments.ManagerChangelogFragment
|
||||
import com.vanced.manager.ui.fragments.MicrogChangelogFragment
|
||||
import com.vanced.manager.ui.fragments.VancedChangelogFragment
|
||||
|
||||
|
@ -17,6 +18,7 @@ class SectionPageAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
|
|||
when (position) {
|
||||
0 -> fragment = VancedChangelogFragment()
|
||||
1 -> fragment = MicrogChangelogFragment()
|
||||
2 -> fragment = ManagerChangelogFragment()
|
||||
}
|
||||
return fragment!!
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ class HomeFragment : Home() {
|
|||
when (position) {
|
||||
0 -> tab.text = "Vanced"
|
||||
1 -> tab.text = "MicroG"
|
||||
2 -> tab.text = "Manager"
|
||||
}
|
||||
}.attach()
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.vanced.manager.ui.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import com.dezlum.codelabs.getjson.GetJson
|
||||
import com.vanced.manager.R
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass.
|
||||
*/
|
||||
class ManagerChangelogFragment : Fragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.fragment_manager_changelog, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val changelogTxt = view.findViewById<TextView>(R.id.manager_changelog)
|
||||
|
||||
val checkUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json")
|
||||
val changelog = checkUrl.get("versionCode").asString
|
||||
|
||||
if (GetJson().isConnected(requireContext()))
|
||||
changelogTxt.text = changelog
|
||||
}
|
||||
}
|
|
@ -54,17 +54,12 @@ class UpdateCheckFragment : DialogFragment() {
|
|||
val recheckbtn = view.findViewById<Button>(R.id.update_center_recheck)
|
||||
val checkingTxt = view.findViewById<TextView>(R.id.update_center_checking)
|
||||
val loadBar = view.findViewById<ProgressBar>(R.id.update_center_progressbar)
|
||||
val changelogTitle = view.findViewById<TextView>(R.id.update_center_changelog_title)
|
||||
val changelogTxt = view.findViewById<TextView>(R.id.update_center_changelog)
|
||||
|
||||
closebtn.setOnClickListener { dismiss() }
|
||||
|
||||
if (GetJson().isConnected(requireContext())) {
|
||||
val checkUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json")
|
||||
val remoteVersion = checkUrl.get("versionCode").asInt
|
||||
val changelog = checkUrl.get("changelog").asString
|
||||
|
||||
changelogTxt.text = changelog
|
||||
|
||||
if (remoteVersion > BuildConfig.VERSION_CODE) {
|
||||
|
||||
|
@ -96,8 +91,6 @@ class UpdateCheckFragment : DialogFragment() {
|
|||
|
||||
} else {
|
||||
checkingTxt.text = "No connection"
|
||||
changelogTxt.visibility = View.GONE
|
||||
changelogTitle.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragments.MicrogChangelogFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/manager_changelog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/loading" />
|
||||
|
||||
</FrameLayout>
|
|
@ -43,23 +43,6 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/update_center_changelog_title"
|
||||
style="@style/AppVer.Bold"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="Changelog"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/update_center_changelog"
|
||||
style="@style/AppVer"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="Loading..."
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/update_button_container"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue