Skip to content

Instantly share code, notes, and snippets.

@hoang06kx1
hoang06kx1 / NestedScrollableHost.kt
Created October 4, 2023 15:20 — forked from ichenhe/NestedScrollableHost.kt
Fix parallel scroll with a NestedScrollView inside a ViewPager2
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hoang06kx1
hoang06kx1 / FadingTextView.java
Created July 3, 2023 09:38 — forked from vkay94/FadingTextView.java
Custom TextView class which shows a fading end on the last line if maxLines is set
package de.vkay.customviews.widget;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
@hoang06kx1
hoang06kx1 / edittext.java
Created October 17, 2019 02:10 — forked from Reacoder/edittext.java
EditText onClick event is not triggering
When a user interacts with a UI element the various listeners are called in a top down order. (For example: OnTouch -> OnFocusChange -> OnClick.) If a listener has been defined (with setOn...Listener) and it consumes this event: the lower priority listeners will not be called. By its nature the first time you touch an EditText it receives focus with OnFocusChangeListener so that the user can type. The action is consumed here therefor OnClick is not called. Each successive touch doesn't change the focus so the event trickles down to the OnClickListener.
Basically, you have three choices:
Set the focusable attribute to false in your XML:
android:focusable="false"
Now the OnClickListener will fire every time it is clicked. But this makes the EditText useless since the user can no longer enter any text...
Implement an OnFocusChangeListener along with the OnClickListener:
@hoang06kx1
hoang06kx1 / sampleREADME.md
Created August 7, 2019 13:00 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here