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