Skip to content

Instantly share code, notes, and snippets.

@beta
beta / weibo-better-layout.css
Last active March 22, 2016 05:59
Custom CSS for Sina Weibo
body {
font-family: "Helvetica Neue", Helvetica, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Source Han Sans CN", "Source Han Sans SC", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp", sans-serif;
}
.WB_feed_detail {
padding: 0px;
}
.WB_feed_detail .WB_screen {
margin-right: 20px;
@beta
beta / areas.xml
Created May 27, 2016 06:40
XML for provinces & cities of China
<?xml version="1.0" encoding="utf-8"?>
<provinces>
<province name="北京市">
<city>东城区</city>
<city>西城区</city>
<city>朝阳区</city>
<city>丰台区</city>
<city>石景山区</city>
<city>海淀区</city>
<city>门头沟区</city>
@beta
beta / design_bottom_sheet_dialog.xml
Last active August 18, 2016 08:02
res/layout/design_bottom_sheet_dialog.xml of Android Support Design Library 23.4.0
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/touch_outside"
android:layout_width="match_parent"
android:layout_height="match_parent"
@beta
beta / BottomSheetDialog.java
Last active August 18, 2016 08:01
android/support/design/widget/BottomSheetDialog.java of Android Design Support Library 23.4.0
private View wrapInBottomSheet(int layoutResId, View view, ViewGroup.LayoutParams params) {
final CoordinatorLayout coordinator = (CoordinatorLayout) View.inflate(getContext(),
R.layout.design_bottom_sheet_dialog, null);
if (layoutResId != 0 && view == null) {
view = getLayoutInflater().inflate(layoutResId, coordinator, false);
}
FrameLayout bottomSheet = (FrameLayout) coordinator.findViewById(R.id.design_bottom_sheet);
BottomSheetBehavior.from(bottomSheet).setBottomSheetCallback(mBottomSheetCallback);
if (params == null) {
bottomSheet.addView(view);
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/accelerate_decelerate">
<scale
android:duration="100"
android:pivotX="50%"
android:pivotY="50%"
android:fromXScale="1.0"
android:fromYScale="1.0"
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:ordering="sequentially"
android:repeatCount="infinite">
<scale
android:startOffset="1200"
android:duration="100"
android:pivotX="50%"
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="sequentially"
android:interpolator="@android:interpolator/accelerate_decelerate">
<set>
<objectAnimator
android:propertyName="scaleX"
android:valueFrom="1.0"
android:valueTo="0.8"
android:duration="100" />
PropertyValuesHolder pvhIncreaseScaleX =
PropertyValuesHolder.ofFloat("scaleX", 1.0f, 0.8f);
PropertyValuesHolder pvhIncreaseScaleY =
PropertyValuesHolder.ofFloat("scaleY", 1.0f, 0.8f);
PropertyValuesHolder pvhDecreaseScaleX =
PropertyValuesHolder.ofFloat("scaleX", 0.8f, 1.0f);
PropertyValuesHolder pvhDecreaseScaleY =
PropertyValuesHolder.ofFloat("scaleY", 0.8f, 1.0f);
ObjectAnimator heartBeatIncreaseAnimator = ObjectAnimator.ofPropertyValuesHolder(
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
/**
* An utility class for playing "heart beat" animation on a certain view object.
*/
HeartBeatAnimationUtil.with(mImageLogo).start();
HeartBeatAnimationUtil.with(mImageLogo)
.scaleFrom(1.0f)
.scaleTo(0.8f)
.in(100)
.after(1200)
.start();