Commit b9f5dd61 authored by Romain Hunault's avatar Romain Hunault
Browse files

Merge branch 'feature_purposal' into 'master'

Implemented support for microG easy installation

See merge request e/apps/apps!51
parents 3e5c1342 35128780
Pipeline #102785 passed with stage
in 2 minutes and 32 seconds
......@@ -36,6 +36,11 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".application.ApplicationActivity" />
<activity android:name=".categories.category.CategoryActivity" />
......
......@@ -118,8 +118,19 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
getAccentColor();
bottom_navigation_view_color()
openSearchFragment()
}
private fun openSearchFragment() {
if (intent.getBooleanExtra(Constants.OPEN_SEARCH,false)) {
currentFragmentId = R.id.menu_search
val bundle = Bundle()
bundle.putString(Constants.MICROG_QUERY,"microg")
searchFragment.arguments= bundle
}
}
private fun bottom_navigation_view_color() {
val iconsColorStates =
ColorStateList(arrayOf(intArrayOf(-android.R.attr.state_checked),
......
......@@ -102,7 +102,7 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On
progressBar.visibility = View.VISIBLE
onQueryTextSubmit(searchView.query.toString())
}
automaticSearchMicroG()
// Initialise search view
val from = arrayOf(SUGGESTION_KEY)
val to = intArrayOf(android.R.id.text1)
......@@ -186,6 +186,20 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On
return view
}
private fun automaticSearchMicroG() {
if (arguments?.getString(Constants.MICROG_QUERY) != null) {
val query = arguments?.getString(Constants.MICROG_QUERY).toString()
searchView.setQuery(query,true)
hideKeyboard(activity as Activity)
focusView!!.requestFocus()
recyclerView.visibility = View.GONE
progressBar.visibility = View.VISIBLE
splashContainer.visibility = View.GONE
searchViewModel.onSearchQuerySubmitted(context!!,query)
}
}
override fun onQueryTextSubmit(query: String?): Boolean {
query?.let {
hideKeyboard(activity as Activity)
......
......@@ -43,6 +43,8 @@ object Constants {
const val RESULTS_PER_PAGE = 20
const val SUGGESTION_KEY = "suggestion"
const val SUGGESTIONS_RESULTS = 5
const val MICROG_QUERY = "query"
const val OPEN_SEARCH = "open_search"
// Application
const val WEB_STORE_URL = "https://cleanapk.org/#/app/"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment