diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt | 31 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_debug.xml | 8 |
2 files changed, 21 insertions, 18 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt index c8177604..b0a148d1 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt @@ -27,13 +27,13 @@ import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.visible import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R +import com.pitchedapps.frost.databinding.ActivityDebugBinding import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.injectors.JsActions import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.createFreshDir import com.pitchedapps.frost.utils.setFrostColors -import kotlinx.android.synthetic.main.activity_debug.* import kotlinx.coroutines.CoroutineExceptionHandler import java.io.File import kotlin.coroutines.resume @@ -51,9 +51,16 @@ class DebugActivity : KauBaseActivity() { fun baseDir(context: Context) = File(context.externalCacheDir, "offline_debug") } + lateinit var binding: ActivityDebugBinding + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_debug) + binding = ActivityDebugBinding.inflate(layoutInflater) + setContentView(binding.root) + binding.init() + } + + fun ActivityDebugBinding.init() { setSupportActionBar(toolbar) supportActionBar?.apply { setDisplayHomeAsUpEnabled(true) @@ -64,10 +71,10 @@ class DebugActivity : KauBaseActivity() { setFrostColors { toolbar(toolbar) } - debug_webview.loadUrl(FbItem.FEED.url) - debug_webview.onPageFinished = { swipe_refresh.isRefreshing = false } + debugWebview.loadUrl(FbItem.FEED.url) + debugWebview.onPageFinished = { swipeRefresh.isRefreshing = false } - swipe_refresh.setOnRefreshListener(debug_webview::reload) + swipeRefresh.setOnRefreshListener(debugWebview::reload) fab.visible().setIcon(GoogleMaterial.Icon.gmd_bug_report, Prefs.iconColor) fab.backgroundTintList = ColorStateList.valueOf(Prefs.accentColor) @@ -85,16 +92,16 @@ class DebugActivity : KauBaseActivity() { parent.createFreshDir() val body: String? = suspendCoroutine { cont -> - debug_webview.evaluateJavascript(JsActions.RETURN_BODY.function) { + debugWebview.evaluateJavascript(JsActions.RETURN_BODY.function) { cont.resume(it) } } val hasScreenshot: Boolean = - debug_webview.getScreenshot(File(parent, "screenshot.png")) + debugWebview.getScreenshot(File(parent, "screenshot.png")) val intent = Intent() - intent.putExtra(RESULT_URL, debug_webview.url) + intent.putExtra(RESULT_URL, debugWebview.url) intent.putExtra(RESULT_SCREENSHOT, hasScreenshot) if (body != null) intent.putExtra(RESULT_BODY, body) @@ -111,17 +118,17 @@ class DebugActivity : KauBaseActivity() { override fun onResume() { super.onResume() - debug_webview.resumeTimers() + binding.debugWebview.resumeTimers() } override fun onPause() { - debug_webview.pauseTimers() + binding.debugWebview.pauseTimers() super.onPause() } override fun onBackPressed() { - if (debug_webview.canGoBack()) - debug_webview.goBack() + if (binding.debugWebview.canGoBack()) + binding.debugWebview.goBack() else super.onBackPressed() } diff --git a/app/src/main/res/layout/activity_debug.xml b/app/src/main/res/layout/activity_debug.xml index d2f9a397..8480053b 100644 --- a/app/src/main/res/layout/activity_debug.xml +++ b/app/src/main/res/layout/activity_debug.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" @@ -9,12 +8,9 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + style="@style/Main.Toolbar" android:background="?attr/colorPrimary" - android:theme="@style/AppTheme.AppBarOverlay" - app:layout_scrollFlags="scroll|enterAlways" - app:popupTheme="@style/AppTheme.PopupOverlay" /> + android:theme="@style/AppTheme.AppBarOverlay" /> <com.pitchedapps.frost.views.SwipeRefreshLayout android:id="@+id/swipe_refresh" |