适用于想为 Spotify 应用程序等视图创建"向下推动动画点击"的 Android 开发者的库。
clone repo and build it :)or
version: 1.1.1
ViewTreeObserver.OnGlobalLayoutListener use getMeasuredWidth()/getMeasuredHeight() insteadversion: 1.1.0
setOnLongClickListener(...)MODE_SCALEMODE_STATIC_DPversion: 1.0.8
setOnTouchPushDownAnim(...) to setPushDownAnimTo(...) setPushDownAnimTo(...)Maven
com.github.thekhaeng
pushdown-anim-click
1.1.1
pom
Gradle
compile( 'com.github.thekhaeng:pushdown-anim-click:1.1.1' ){
exclude group: 'com.android.support'
}Button button = findViewById( R.id.button );
PushDownAnim.setPushDownAnimTo( button, ... )
.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick( View view ){
Toast.makeText( MainActivity.this, "PUSH DOWN !!", Toast.LENGTH_SHORT ).show();
}
} );
…MODE_SCALE0.97f50 millisecond125 millisecondAccelerateDecelerateInterpolator()1. MODE_SCALE: use range scale 0.00 - 1.00 to push down view.
EXAMPLE: This case 8dp ≈ 0.89 scale
PushDownAnim.setPushDownAnimTo( button )
.setScale( MODE_SCALE, 0.89f )
...;2. MODE_STATIC_DP: use static dp unit to push down view.
EXAMPLE: 8dp static scale
PushDownAnim.setPushDownAnimTo( button )
.setScale( MODE_STATIC_DP, 8 )
...;setOnClickListener(...)
@Override
public boolean onLongClick( View view ){
...
return true; // true: not effect to single click
}NOTE: If you do not want to trigger a normal click
return true
If your project has logic that want to disable click programmatically. You must use setEnabled(...) (do not use setClickable(...) it is not effective.)
button.setEnabled( false );Copyright 2017 TheKhaeng
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Follow facebook.com/thekhaeng.io on Facebook page. or @nonthawit at my Medium blog. :)
For contact, shoot me an email at [email protected]
暂无开放 Issues,或尚未同步最近议题。