0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-19 01:35:10 +00:00

fixed app crash

This commit is contained in:
X1nto 2020-05-23 21:36:50 +04:00
parent 084dc40afc
commit a788ee1ab5

View file

@ -87,19 +87,20 @@ class HomeFragment : Home() {
val microginstallbtn = view?.findViewById<Button>(R.id.microg_installbtn) val microginstallbtn = view?.findViewById<Button>(R.id.microg_installbtn)
val vancedinstallbtn = view?.findViewById<Button>(R.id.vanced_installbtn) val vancedinstallbtn = view?.findViewById<Button>(R.id.vanced_installbtn)
microginstallbtn?.visibility = View.VISIBLE
vancedinstallbtn?.visibility = View.VISIBLE
val microgLatestTxt = view?.findViewById<TextView>(R.id.microg_latest_version) val microgLatestTxt = view?.findViewById<TextView>(R.id.microg_latest_version)
val vancedLatestTxt = view?.findViewById<TextView>(R.id.vanced_latest_version) val vancedLatestTxt = view?.findViewById<TextView>(R.id.vanced_latest_version)
val vancedVer: JsonObject = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/vanced.json") val vancedVer: JsonObject = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/vanced.json")
val microgVer: JsonObject = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/microg.json") val microgVer: JsonObject = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/microg.json")
vancedLatestTxt?.text = vancedVer.get("version").asString
microgLatestTxt?.text = microgVer.get("version").asString
activity?.runOnUiThread { activity?.runOnUiThread {
microginstallbtn?.visibility = View.VISIBLE
vancedinstallbtn?.visibility = View.VISIBLE
vancedLatestTxt?.text = vancedVer.get("version").asString
microgLatestTxt?.text = microgVer.get("version").asString
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper) val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f) val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f)
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f) val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f)
@ -124,22 +125,22 @@ class HomeFragment : Home() {
val microginstallbtn = view?.findViewById<Button>(R.id.microg_installbtn) val microginstallbtn = view?.findViewById<Button>(R.id.microg_installbtn)
val vancedinstallbtn = view?.findViewById<Button>(R.id.vanced_installbtn) val vancedinstallbtn = view?.findViewById<Button>(R.id.vanced_installbtn)
microginstallbtn?.visibility = View.GONE
vancedinstallbtn?.visibility = View.GONE
val vancedLatestTxt = view?.findViewById<TextView>(R.id.vanced_latest_version) val vancedLatestTxt = view?.findViewById<TextView>(R.id.vanced_latest_version)
val microgLatestTxt = view?.findViewById<TextView>(R.id.microg_latest_version) val microgLatestTxt = view?.findViewById<TextView>(R.id.microg_latest_version)
if (GetJson().isConnected(requireContext())) { if (GetJson().isConnected(requireContext())) {
vancedLatestTxt?.text = getString(R.string.unavailable)
microgLatestTxt?.text = getString(R.string.unavailable)
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper) val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
if (networkErrorLayout?.visibility != View.VISIBLE) { if (networkErrorLayout?.visibility != View.VISIBLE) {
activity?.runOnUiThread { activity?.runOnUiThread {
microginstallbtn?.visibility = View.GONE
vancedinstallbtn?.visibility = View.GONE
vancedLatestTxt?.text = getString(R.string.unavailable)
microgLatestTxt?.text = getString(R.string.unavailable)
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", -1f, 0.3f) val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", -1f, 0.3f)
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, 0f) val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, 0f)