Use FragmentTransaction#setPrimaryNavigationFragment(fragment)
to set a ChildFragmentManager
as deleage for the Activity
s FragmentManager
.
This makes sure the back-button gets delegated to the ChildFragmentManager
and allows you to keep a back-stack per tab without having
to override OnBackPressed()
everywhere.
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
package com.themobilecompany.Onderweg.generic.view.draggable; | |
import android.animation.Animator; | |
import android.animation.AnimatorListenerAdapter; | |
import android.animation.LayoutTransition; | |
import android.animation.ObjectAnimator; | |
import android.animation.PropertyValuesHolder; | |
import android.animation.ValueAnimator; | |
import android.content.Context; | |
import android.content.res.Resources; |
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
adb devices | |
sudo adb -s emulator-xxx shell | |
run-as {package-name} | |
cd databases/ | |
ls | |
sqlite3 {database name} | |
.databses -> view databases | |
.tables -> view tables | |
.schema -> view schema of table |
return Observable.create { emitter ->
foo.fetchBar(object : FooCallback<Bar> {
override fun onSuccess(bar: Bar) {
emitter.onNext(bar)
}
override fun onError(error: Throwable) {
emitter.onError(error)
}
fun EditText.showSoftKeyboard() {
requestFocus()
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.showSoftInput(this, 0)
}
fun EditText.hideSoftKeyboard() {
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.hideSoftInputFromWindow(windowToken, 0)
}
private fun show() {
val input = AppCompatEditText(context).apply {
setHint(R.string.parking_product_add_promo_code_hint)
ViewCompat.setBackgroundTintList(this, ColorStateList.valueOf(ContextCompat.getColor(context, R.color.orange)))
}
AlertDialog.Builder(ContextThemeWrapper(context, R.style.DFWTheme_Parking))
.setTitle("Title")
.setEditText(input)
.setPositiveButton("Button", null)
class FooFragment : DialogFragment() {
private val viewPagerAdapter by lazy { BarViewPager() }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_foo, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
private fun changeTouchableAreaOfView(view: View, extraSpace: Int) {
val parent = view.parent as View
parent.post {
val touchableArea = Rect()
button.getHitRect(touchableArea)
touchableArea.top -= extraSpace
touchableArea.bottom += extraSpace
touchableArea.left -= extraSpace
touchableArea.right += extraSpace
/**
* Invoke some action when the observable does not emit an item for longer than a given time out
* @param timeout time out
* @param timeUnit the unit for the time out
* @param scheduler the scheduler on which the action must be ran
* @param action the action to invoke
*/
fun <T> Observable<T>.startAfterDelay(timeout: Long, timeUnit: TimeUnit, scheduler: Scheduler, action: () -> Unit): Observable<T> {
return this.publish { o ->
class SomeViewHolder(override val containerView: View) : RecyclerView.ViewHolder(containerView), LayoutContainer {
fun bind(data: Data) {
myFirstTextView.text = data.foo
}
}
OlderNewer