mirror of https://git.sr.ht/~oppen/ariane
pull to refresh
This commit is contained in:
parent
52969a834f
commit
f671d1b52d
|
@ -52,6 +52,7 @@ dependencies {
|
||||||
|
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
|
||||||
|
|
||||||
//ROOM DB
|
//ROOM DB
|
||||||
def room_version = "2.2.5"
|
def room_version = "2.2.5"
|
||||||
|
|
|
@ -93,6 +93,9 @@ class GemActivity : AppCompatActivity() {
|
||||||
history = HistoryInterface.default(this)
|
history = HistoryInterface.default(this)
|
||||||
|
|
||||||
model.initialise(Datasource.factory(this), BookmarksDatasource.getDefault(applicationContext)){ state ->
|
model.initialise(Datasource.factory(this), BookmarksDatasource.getDefault(applicationContext)){ state ->
|
||||||
|
|
||||||
|
binding.pullToRefresh.isRefreshing = false
|
||||||
|
|
||||||
when(state){
|
when(state){
|
||||||
is GemState.AppQuery -> runOnUiThread{ showAlert("App backdoor/query not implemented yet") }
|
is GemState.AppQuery -> runOnUiThread{ showAlert("App backdoor/query not implemented yet") }
|
||||||
is GemState.ResponseInput -> runOnUiThread {
|
is GemState.ResponseInput -> runOnUiThread {
|
||||||
|
@ -173,11 +176,6 @@ class GemActivity : AppCompatActivity() {
|
||||||
startActivity(Intent.createChooser(this, null))
|
startActivity(Intent.createChooser(this, null))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
R.id.overflow_menu_reload -> {
|
|
||||||
val address = binding.addressEdit.text.toString()
|
|
||||||
RuntimeCache.remove(address)
|
|
||||||
model.request(address)
|
|
||||||
}
|
|
||||||
R.id.overflow_menu_history -> HistoryDialog.show(this){ historyAddress ->
|
R.id.overflow_menu_history -> HistoryDialog.show(this){ historyAddress ->
|
||||||
model.request(historyAddress)
|
model.request(historyAddress)
|
||||||
}
|
}
|
||||||
|
@ -190,11 +188,18 @@ class GemActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.home.setOnClickListener {
|
binding.home.setOnClickListener {
|
||||||
val prefs = getSharedPreferences("oppen.tva.ui.dialogs.set_home", Context.MODE_PRIVATE)
|
val prefs = getSharedPreferences("oppen.tva.ui.dialogs.set_home", Context.MODE_PRIVATE)
|
||||||
val home = prefs.getString("home", Ariane.DEFAULT_HOME_CAPSULE)
|
val home = prefs.getString("home", Ariane.DEFAULT_HOME_CAPSULE)
|
||||||
model.request(home!!)
|
model.request(home!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.pullToRefresh.setOnRefreshListener {
|
||||||
|
val address = binding.addressEdit.text.toString()
|
||||||
|
RuntimeCache.remove(address)
|
||||||
|
model.request(address)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
|
|
|
@ -137,14 +137,22 @@
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/pull_to_refresh"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/gemtext_recycler"
|
android:id="@+id/gemtext_recycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingTop="@dimen/default_margin"
|
android:paddingTop="@dimen/screen_margin"
|
||||||
android:paddingBottom="@dimen/default_margin"
|
android:paddingBottom="@dimen/default_margin"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
/>
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -27,10 +27,6 @@
|
||||||
android:id="@+id/overflow_menu_backlinks"
|
android:id="@+id/overflow_menu_backlinks"
|
||||||
android:title="@string/page_backlinks"
|
android:title="@string/page_backlinks"
|
||||||
android:icon="@drawable/vector_link"/>
|
android:icon="@drawable/vector_link"/>
|
||||||
<item
|
|
||||||
android:id="@+id/overflow_menu_reload"
|
|
||||||
android:title="@string/reload"
|
|
||||||
android:icon="@drawable/vector_refresh"/>
|
|
||||||
</group>
|
</group>
|
||||||
<group android:id="@+id/other" >
|
<group android:id="@+id/other" >
|
||||||
<item
|
<item
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="default_margin">8dp</dimen>
|
<dimen name="default_margin">8dp</dimen>
|
||||||
<dimen name="default_margin_big">16dp</dimen>
|
<dimen name="default_margin_big">16dp</dimen>
|
||||||
<dimen name="screen_margin">16dp</dimen>
|
<dimen name="screen_margin">20dp</dimen>
|
||||||
<dimen name="button_margin">12dp</dimen>
|
<dimen name="button_margin">12dp</dimen>
|
||||||
<dimen name="default_text_size">16sp</dimen>
|
<dimen name="default_text_size">16sp</dimen>
|
||||||
<dimen name="code_text_size">14sp</dimen>
|
<dimen name="code_text_size">14sp</dimen>
|
||||||
|
|
Loading…
Reference in New Issue