Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
Rustacean

Folyd Folyd

🦀
Rustacean
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am Folyd on github.
  • I am wichna (https://keybase.io/wichna) on keybase.
  • I have a public key whose fingerprint is DF25 E39D 5B47 5708 901F 15DA 0A8F BCAD D5DD 3A9A

To claim this, I am signing this object:

View LevelFilterView.java
public class LevelFilterView extends TextView implements View.OnClickListener {
private LevelFilterPopup mFilterPopup;
private OnLevelFilteredListener mOnLevelFilteredListener;
private int mItemBackgroundId;
private String[] mEntries;
public LevelFilterView(Context context) {
super(context);
View TextBadgeDrawable.java
public class TextBadgeDrawable extends Drawable {
private Paint mPaint;
private Rect mBounds;
private Rect mTextBounds;
private RectF mRectF;
private int mColor;
private String mText;
public TextBadgeDrawable() {
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@Folyd
Folyd / VideoSurfaceView.java
Created Nov 12, 2015
A enhance SurfaceView which support scale content size according to aspect ratio.
View VideoSurfaceView.java
public class VideoSurfaceView extends SurfaceView implements MediaPlayer.OnVideoSizeChangedListener {
private int mVideoWidth;
private int mVideoHeight;
public VideoSurfaceView(Context context) {
super(context);
}
public VideoSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
View WeakAsyncTask.java
import android.os.AsyncTask;
import java.lang.ref.WeakReference;
public abstract class WeakAsyncTask<Params, Progress, Result, WeakTarget> extends
AsyncTask<Params, Progress, Result> {
protected WeakReference<WeakTarget> mTarget;
public WeakAsyncTask(WeakTarget target) {
mTarget = new WeakReference<WeakTarget>(target);
}
/** {@inheritDoc} */
@Override
View KeySensitiveSeekBar.java
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.SeekBar;
/**
* This is workaround version for SeekBar which didn't detect the progress changed
* by arrow key pressed.
*
*/
@Folyd
Folyd / IncrementTimer.java
Created Nov 2, 2015
IncrementTimer similar to CountdownTimer in android framework
View IncrementTimer.java
public abstract class IncrementTimer {
/**
* Millis since epoch when alarm should stop.
*/
private final long mMillisInFuture;
/**
* The interval in millis that the user receives callbacks
*/
private final long mIncrementInterval;
View MultiSwipeRefreshLayout.java
/*
* Copyright 2014 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
@Folyd
Folyd / VideoPickerActivity.java
Last active Oct 8, 2015
A video picker activity
View VideoPickerActivity.java
public class VideoPickerActivity extends Activity{
private final int REQUEST_PICK_VIDEO = 1;
public void onVideoPickClick(View view) {
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, REQUEST_PICK_VIDEO);
}
@Override
@Folyd
Folyd / debug_via_wifi.sh
Created Sep 17, 2015
A shell script let you debug android device via WI-FI.
View debug_via_wifi.sh
#!/usr/bin/env bash
#Notice: if unable to connect to [ip]:5555,
#try adb kill-server then try again.
adb shell ip route > addrs.txt
#Case 1:Nexus 7
#192.168.88.0/23 dev wlan0 proto kernel scope link src 192.168.89.48
#Case 2: Smartsian T1,Huawei C8813
#default via 192.168.88.1 dev eth0 metric 30
You can’t perform that action at this time.