-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement searching in server list from Urlbar
Re: #196
- Loading branch information
Showing
7 changed files
with
107 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/src/main/java/com/gaurav/avnc/viewmodel/UrlBarViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2023 Gaurav Ujjwal. | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
* | ||
* See COPYING.txt for more details. | ||
*/ | ||
|
||
package com.gaurav.avnc.viewmodel | ||
|
||
import android.app.Application | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.switchMap | ||
|
||
class UrlBarViewModel(app: Application) : BaseViewModel(app) { | ||
|
||
val query = MutableLiveData("") | ||
val filteredServers = query.switchMap { | ||
if (it.isNotBlank()) serverProfileDao.search("%$it%") | ||
else MutableLiveData(listOf()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ Copyright (c) 2020 Gaurav Ujjwal. | ||
~ | ||
~ SPDX-License-Identifier: GPL-3.0-or-later | ||
~ | ||
~ See COPYING.txt for more details. | ||
--> | ||
|
||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:id="@+id/edit" | ||
android:title="@string/title_edit" /> | ||
<item | ||
android:id="@+id/duplicate" | ||
android:title="@string/title_duplicate" /> | ||
<item | ||
android:id="@+id/copy_host" | ||
android:title="@string/title_copy_host" /> | ||
<item | ||
android:id="@+id/delete" | ||
android:title="@string/title_delete" /> | ||
</menu> |