Skip to content

Instantly share code, notes, and snippets.

View stemark's full-sized avatar

dangVarmit stemark

View GitHub Profile
public void enterLoadingState(){
// Animation roller = AnimationUtils.loadAnimation(context, R.anim.roller);
// roller.setRepeatMode(ValueAnimator.INFINITE);
// mProfileImageView.setImageDrawable(progress);
// mProfileImageView.setAnimation(roller);
Drawable progress = getResources().getDrawable(R.drawable.indeterminate_progress);
mProfileExtra.setCompoundDrawablesWithIntrinsicBounds(null, null, progress, null);
mProfileExtra.setText(R.string.loading);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
//mStationTextViewGroup.setBackground(progress);
@stemark
stemark / activity.java
Created November 5, 2015 20:55
guarding against fastclicks
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if ((ev.getEventTime() - mGuardingClicksMarker) < CLICK_GUARD_TIMEOUT)
return true;
return super.dispatchTouchEvent(ev);
}
static long mGuardingClicksMarker = 0;
public class GuardedOnClickListener implements View.OnClickListener {
public void onClick (View view) {
@stemark
stemark / Monitor Stand
Last active August 29, 2015 14:27
Monitor stand
3D printed monitor stand for the Acer monitors that I have at work.
Monitor has a 7.75" round base.
Stand should be able to hold one or more 7" tablets at a comfortable angle for debugging.
Tablets should be held firmly enough that they can be tapped and swiped
Tablets should be able to be plugged in and the plugs should go to a hub.
Swivel base would be nice
@stemark
stemark / addi_drive_gear.scad
Last active August 29, 2015 14:27
Addi Platform
//use <MCAD/involute_gears.scad>
include <parametric_involute_gear_v5.0.scad>
// number_of_teeth=11,
// cone_distance=100,
// face_width=20,
// outside_circular_pitch=1000,
// pressure_angle=30,
// clearance = 0.2,
@stemark
stemark / autoknitter_dimen.scad
Created August 9, 2015 02:30
AutoKnitter Parts
/**
AUTO-KNITTER PRINCIPLE PARTS - Historical definitions
BED PLATE:: The foundation which all the other parts rest-the stationary needle cylinder, the cam shell (with ribbing attachment when in use), and the yarn stand. It is secured to the bench or table by thumb screws.
GEAR RING::
CRANK WHEEL::
CAM SHELL:: The outside shell of the machine containing the needle paths and cams which operate the long needles. It rests on the gear ring which moves it around the needle cylinder
NEEDLE CYLINDER:: A hollow cylinder, slotted outside to hold the long needles. This cylinder does not move but is stationary.
YARN CARRIER:: An upright attached to the gear ring which supplies yarn to the needles as it travels around the cylinder with the cam shell.
RIBBER NEEDLE DIAL:: a flat disc, sloted on its upper side to hold the short needles which make the ribbing or "purling"
TAPPET PLATE:: A plate which rests on the ribber dial and contains cams governing the action of the ribber needles
/**
* This is a way to manage A-B testing within an app.
* log properties can be set/got through 'adb shell setprop|getprop' commands
* Properties that start with log. can be set. other properties can just be read.
* Since the properties can be adjusted while the program is running
* This is designed to allow logging changes in real-time to be made
* But it is also an easy way to communicate runtime options to a program
*
* Properties that are set are device specific and they will persist until the device is rebooted
* Upon reboot, all log properties will be lost
@stemark
stemark / gist:a3f1caf8bd3aa514892f
Created November 4, 2014 18:35
Rounded top for a sliding up panel peek
// Gradient that creates a shader with a very large circular radius
// to create slightly rounded launchpad background image
// once the Launchpad changes, this can likely be removed
/* Usage ..
Display display = getActivity().getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
View panel = view.findViewById(R.id.panel);
panel.setBackground(new LaunchPadDrawable(size.x * 4f));
*/
@stemark
stemark / PaginateBar
Last active March 27, 2020 11:16
Use a progress bar to create a horizontal sliding tab line or a simple pagination index widget
package com.dangvarmit.helper
import android.view.ViewGroup;
import android.widget.ProgressBar;
/**
* Configures a standard ProgressBar to act like a horizontal page indexer
* can be configured to show dots or rectangles depending on the drawable used
* <p/>
* usage: