mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
Auto-launch app if only one result is found
As this behaviour seems more efficient. TODO: Add option to disable this
This commit is contained in:
parent
2b96b3140d
commit
02ae80be68
1 changed files with 11 additions and 0 deletions
|
@ -8,6 +8,7 @@ import android.net.Uri
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
@ -172,6 +173,16 @@ class AppsRecyclerAdapter(val activity: Activity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Launch apps automatically if only one result is found
|
||||||
|
// TODO: Add option to disable this
|
||||||
|
if (appsListDisplayed.size == 1) {
|
||||||
|
launch(appsListDisplayed[0].packageName.toString(), activity)
|
||||||
|
|
||||||
|
val inputMethodManager = activity.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
|
inputMethodManager.hideSoftInputFromWindow(View(activity).windowToken, 0)
|
||||||
|
}
|
||||||
|
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue