aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-04 10:49:22 -0700
committerAllan Wang <me@allanwang.ca>2017-06-04 10:49:22 -0700
commit5aac1cda7b1ad561131de109d1f29e8e7b730e82 (patch)
treecb0e0387782c24a667a51bb3583af704c9266f4c /app/src
parent4b78e433e1f55b278623c84d1223e42cab875be6 (diff)
downloadfrost-5aac1cda7b1ad561131de109d1f29e8e7b730e82.tar.gz
frost-5aac1cda7b1ad561131de109d1f29e8e7b730e82.tar.bz2
frost-5aac1cda7b1ad561131de109d1f29e8e7b730e82.zip
Remove positions in WebFragment
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/BaseFragment.kt31
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt1
5 files changed, 5 insertions, 42 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index 24497d1c..fa666aa4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -167,7 +167,7 @@ class MainActivity : BaseLeakActivity() {
inner class SectionsPagerAdapter(fm: FragmentManager, val pages: List<FbTab>) : FragmentPagerAdapter(fm) {
- override fun getItem(position: Int) = WebFragment.newInstance(position, pages[position].url)
+ override fun getItem(position: Int) = WebFragment.newInstance(pages[position].url)
override fun getCount() = pages.size
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/BaseFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/BaseFragment.kt
deleted file mode 100644
index 4ca45d86..00000000
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/BaseFragment.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.pitchedapps.frost.fragments
-
-import android.support.annotation.CallSuper
-import android.support.v4.app.Fragment
-import com.pitchedapps.frost.utils.putInt
-import com.pitchedapps.frost.utils.refWatch
-
-/**
- * Created by Allan Wang on 2017-05-29.
- */
-interface BaseFragmentContract {
- fun onBackPressed(): Boolean
-}
-
-abstract class BaseFragment : Fragment(), BaseFragmentContract {
- val position: Int by lazy { arguments.getInt(ARG_POSITION) }
-
- companion object {
- val ARG_POSITION = "arg_position"
-
- fun <T : BaseFragment> newInstance(fragment: T, position: Int): T {
- fragment.putInt(ARG_POSITION, position)
- return fragment
- }
- }
-
-// override fun onDestroyView() {
-// super.onDestroyView()
-// refWatch()
-// }
-} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
index 3c8094aa..3882260e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
@@ -2,6 +2,7 @@ package com.pitchedapps.frost.fragments
import android.content.Context
import android.os.Bundle
+import android.support.v4.app.Fragment
import android.support.v4.widget.SwipeRefreshLayout
import android.view.LayoutInflater
import android.view.View
@@ -18,11 +19,11 @@ import io.reactivex.disposables.Disposable
*/
-class WebFragment : BaseFragment() {
+class WebFragment:Fragment() {
companion object {
private const val ARG_URL = "arg_url"
- fun newInstance(position: Int, url: String) = BaseFragment.newInstance(WebFragment(), position).putString(ARG_URL, url)
+ fun newInstance(url: String) = WebFragment().putString(ARG_URL, url)
}
// val refresh: SwipeRefreshLayout by lazy { frostWebView.refresh }
@@ -40,7 +41,6 @@ class WebFragment : BaseFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
super.onCreateView(inflater, container, savedInstanceState)
frostWebView = FrostWebView(context)
- frostWebView.position = position
frostWebView.baseUrl = url
return frostWebView
}
@@ -78,5 +78,5 @@ class WebFragment : BaseFragment() {
super.onDetach()
}
- override fun onBackPressed() = frostWebView.onBackPressed()
+ fun onBackPressed() = frostWebView.onBackPressed()
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
index c5ac03ae..f9deb3b8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
@@ -27,11 +27,6 @@ class FrostWebView @JvmOverloads constructor(context: Context, attrs: AttributeS
val refresh: SwipeRefreshLayout by bindView(R.id.swipe_refresh)
val web: FrostWebViewCore by bindView(R.id.frost_webview_core)
val progress: ProgressBar by bindView(R.id.progressBar)
- var position: Int
- get() = web.position
- set(value) {
- web.position = value
- }
init {
inflate(getContext(), R.layout.swipe_webview, this)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
index ab9a6209..e0fcb9b5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
@@ -43,7 +43,6 @@ class FrostWebViewCore @JvmOverloads constructor(
val titleObservable: BehaviorSubject<String> // Only emits on different non http titles
var baseUrl: String? = null
- var position: Int = -1
init {
isNestedScrollingEnabled = true