This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import com.squareup.picasso.Transformation; | |
public class ShadeTransform implements Transformation { | |
/* The shade alpha of black to apply */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//auto versioning logic | |
def versionPropertiesFile = file('version.properties') | |
if (versionPropertiesFile.canRead()) { | |
def Properties properties = new Properties() | |
properties.load(new FileInputStream(versionPropertiesFile)) | |
def build = properties['BUILD'].toInteger() + 1 | |
properties['BUILD'] = build.toString() | |
properties.store(versionPropertiesFile.newWriter(), null) | |
defaultConfig { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Colors specific to Material themes. --> | |
<resources> | |
<!-- RED --> | |
<color name="red_50">#fde0dc</color> | |
<color name="red_100">#f9bdbb</color> | |
<color name="red_200">#f69988</color> | |
<color name="red_300">#f36c60</color> | |
<color name="red_400">#e84e40</color> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Dev tools and the play store (and others?) launch with a different intent, and so | |
* lead to a redundant instance of this activity being spawned. <a | |
* href="http://stackoverflow.com/questions/17702202/find-out-whether-the-current-activity-will-be-task-root-eventually-after-pendin" | |
* >Details</a>. | |
*/ | |
private boolean isWrongInstance() { | |
if (!isTaskRoot()) { | |
Intent intent = getIntent(); | |
boolean isMainAction = intent.getAction() != null && intent.getAction().equals(ACTION_MAIN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" > | |
<android.support.v7.widget.Toolbar | |
android:id="@+id/appbar" | |
android:layout_height="wrap_content" | |
android:layout_width="match_parent" | |
android:minHeight="?attr/actionBarSize" | |
android:elevation="6dp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*************************************************************************************************** | |
* | |
* Step 1: Save the sent file locally on the server | |
* | |
*/ | |
$file_name = basename($_FILES["file"]["name"]); | |
$target_file = "images/".basename($_FILES["file"]["name"]); | |
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Post-Commit hook text | |
post_commit_hook_base='#!/bin/sh | |
### lolcommits hook (begin) ### | |
export LANG=en_US.UTF-8 | |
export LANGUAGE=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
export PATH="/usr/bin:/usr/local/bin:$PATH"\n' | |
post_commit_hook_suffix='\n### lolcommits hook (end) ###' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply kerning to a string | |
* | |
* @param src the source string | |
* @param kerning the amount of kerning | |
* @return the spannable output | |
*/ | |
public static Spannable applyKerning(CharSequence src, float kerning) { | |
if (src == null) return null; | |
final int srcLength = src.length(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String nickName; | |
try { | |
Cursor c = getActivity().getContentResolver().query(ContactsContract.Profile.CONTENT_URI, null, null, null, null); | |
c.moveToFirst(); | |
nickName = c.getString(c.getColumnIndex("display_name")).concat("'s Android"); | |
c.close(); | |
}catch (Exception e){ | |
Timber.e("Unable to load user's contact information, reverting to default device name"); | |
nickName = Build.MANUFACTURER + " - " + Build.PRODUCT; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static float mCurrentBatteryPct; | |
private static long mCurrentBatteryPctDateMs; | |
/** | |
* A flavor of {@link #getCurrentBatteryLevel(Context)} that only polls the battery level from the OS | |
* every once in a while in an attempt to limit battery drain vs battery data freshness. | |
* | |
* @param readingPeriodMs the reading period (ms) | |
* @return the current battery level(%) |
OlderNewer