Skip to content

Instantly share code, notes, and snippets.

View billmote's full-sized avatar

Bill Mote billmote

  • Boca Raton, FL
  • 18:22 (UTC -04:00)
View GitHub Profile
@billmote
billmote / AndroidManifest.xml
Last active October 15, 2023 10:48 — forked from JakeWharton/gist:f50f3b4d87e57d8e96e9
When pushing code from your IDE, wake the device and show the activity.
<?xml version="1.0" encoding="utf-8"?>
<!-- Add this as a debug manifest so the permissions won't be required by your production app -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
</manifest>
<receiver
android:name=".DownloadBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:enabled="true" android:name="android.intent.action.DOWNLOAD_COMPLETE" />
</intent-filter>
</receiver>
@billmote
billmote / build.gradle
Created December 4, 2015 16:22 — forked from PhoenixIllusion/build.gradle
Using the local.properties file of an Android Studio project to select the latest BuildTools version
apply plugin: 'com.android.library'
android {
compileSdkVersion 'Google Inc.:Google APIs:22'
Properties localProps = new Properties()
localProps.load(new FileInputStream(file('../local.properties')))
def buildToolVer = file("${localProps['sdk.dir']}/build-tools/").listFiles().sort().reverse().first().name;
buildToolsVersion buildToolVer;
class SoccerTeam {
private static int numWins;
private static int numLosses;
private static int numTies;
//these 2 variables are for the modified version
private static int numGames=0;
private static int numGoals=0;
@billmote
billmote / autobuy.txt
Last active August 3, 2017 11:38
CS:GO key mappings and custom config
// This list of "buy aliases" is used by the AutoBuy system.
// The system begins with the first alias in the list, and attempts to purchase it.
// If a primary weapon is successfully purchased, all later primary weapon aliases are skipped.
// Similarly, secondary weapon buy alias are skipped once a seconary weapon has been purchased.
// You can customize this file to reflect your weapon and equipment preferences and priorities.
//
// Attempting to purchase a weapon that shares a slot with another weapon on that team
// (like the m4a1 and m4a1_silencer), will purchase the weapon currently equipped in that slot if possible.
//
// The console command for autobuy is "autobuy"
import android.os.Parcel;
import android.os.Parcelable;
public class ParcelableHelper {
/**
* There is not always a guarantee that Parcelable values will be immediately written out and
* read back in. For data data that mutable (its own issue), this can be a problem. This is
* for the times when it would be great to have confidence that you will be working with a copy
* of that data.
@billmote
billmote / OnTouchSpinnerActivity.java
Last active August 27, 2016 08:55
A spinner that only updates when the user touches the screen
// A member variable
private boolean userIsInteracting;
/*
Beginning with API level 3 you can use onUserInteraction() on an Activity with a boolean to determine if the user is interacting with the device.
http://developer.android.com/reference/android/app/Activity.html#onUserInteraction()
*/
@Override
public void onUserInteraction() {
tag:^((?!CoreMetrics|InputEventConsistency|memalloc|Adreno200-EGLSUB|Resources|global|TaggingRequest|Facade[B|U]|dalvik|skia|KeyCharacterMap|BackStackEntry|FragmentManager|ServiceRunnable|ServiceLocator|BaseHttpRequest|szipinf|APACHE).)*$
// In Android Studio you do not include the leading "tag:" but you must "edit a filter configuration" in order to use this. It does not appear that the in-line search field supports RegEx.
// This line would remove any log line that included the words: StringMode, System.err or GAV4
^((?!StrictMode|System.err|GAV4).)*$
@billmote
billmote / SomeClass.java
Last active May 2, 2016 20:10
Which do you prefer?
public class SomeClass {
someMethod(String className) {
// I see this more often
if (!TextUtils.isEmpty(className)) { // We have to ensure that className isn't null before calling equals()
if (className.equals(SomeClass.class.getName()) {
// do something
}
}
}
package com.example.helloworld.ui.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.exacttarget.etpushsdk.adapter.CloudPageListAdapter;