This file contains hidden or 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 | |
| echo Making Directories | |
| mkdir -p ~/backup/docs | |
| mkdir -p ~/backup/pictures | |
| mkdir -p ~/backup/music | |
| mkdir -p ~/backup/movies | |
| echo Copying images ... |
This file contains hidden or 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 | |
| # chmod +x ./forkproject.sh # make this file executable | |
| # Search and replace {NewRepoName}, {newappname} and {NewAppName} | |
| # NOTE: this will mess up 1 URL in res/values/build_properties.xml, but you'll want your own API endpoint anyway ;) | |
| cd ~/git/{NewRepoName}/app | |
| mv ~/git/{NewRepoName}/app/src/main/java/com/androidfu/foundation ~/git/{NewRepoName}/app/src/main/java/com/androidfu/{newappname} |
This file contains hidden or 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
| // ... | |
| final String contactName = this.contact.getFullname(); | |
| final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(contactName); | |
| final StyleSpan boldSpan = new StyleSpan(android.graphics.Typeface.BOLD); | |
| if (!TextUtils.isEmpty(searchTerm) && contactName.toLowerCase().contains(searchTerm.toLowerCase())) { | |
| int startIndex = contactName.toLowerCase().indexOf(searchTerm.toLowerCase()); | |
| int endIndex = startIndex + searchTerm.length(); | |
| spannableStringBuilder.setSpan(boldSpan, startIndex, endIndex, Spannable.SPAN_INCLUSIVE_INCLUSIVE); | |
| this.fullname.setText(spannableStringBuilder); |
This file contains hidden or 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
| def toCamelCase(String string) { | |
| String result = "" | |
| string.findAll("[^\\W]+") { String word -> | |
| result += word.capitalize() | |
| } | |
| return result | |
| } | |
| afterEvaluate { project -> | |
| Configuration runtimeConfiguration = project.configurations.getByName('compile') |
This file contains hidden or 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
| <!-- GCM permissions --> | |
| <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> | |
| <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | |
| <uses-permission android:name="android.permission.WAKE_LOCK" /> | |
| <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> | |
| <uses-permission android:name="android.permission.VIBRATE" /> | |
| <permission | |
| android:name="com.example.android.app.gcm.permission.C2D_MESSAGE" | |
| android:protectionLevel="signature" /> |
This file contains hidden or 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
| public class EventBus { | |
| private static final Handler mainThread = new Handler(Looper.getMainLooper()); | |
| private static EventBus mInstance; | |
| private final Bus mBus; | |
| @DebugLog | |
| private EventBus() { | |
| // Don't let this class get instantiated directly. | |
| mBus = new Bus(); |
This file contains hidden or 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
| <!-- download this file and include it in res/drawable --> | |
| <a href="https://dl.dropboxusercontent.com/u/2026413/battery_saver_tile.png">battery_saver_tile.png</a> | |
| <!-- for you GIMPers out there: here's the .xcf file I created --> | |
| <a href="https://dl.dropboxusercontent.com/u/2026413/battery_saver_tile.xcf">battery_saver_tile.xcf</a> | |
| <!-- before --> | |
| <a href="https://www.dropbox.com/s/b0qirkuraf29r10/Screenshot%202014-11-13%2021.00.49.png?dl=0">before</a> | |
| <!-- after --> |
This file contains hidden or 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.Rect; | |
| import android.view.TouchDelegate; | |
| import android.view.View; | |
| import android.view.ViewTreeObserver.OnGlobalLayoutListener; | |
| import android.widget.CheckBox; | |
| /** | |
| * Enlarges the effective hit target of a checkbox to more closely match the dimensions of the | |
| * provided root view. If the provided root isn't actually an ancestor view of the checkbox, bad | |
| * things will happen. |
This file contains hidden or 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
| public class MySingletonManager { | |
| public static final String TAG = MySingletonManager.class.getSimpleName(); | |
| private static MySingletonManager mInstance; | |
| private Application mContext; | |
| private ArrayList<PickleData> mSavedPickles = new ArrayList<PickleData>(); | |
| @DebugLog | |
| private MySingletonManager() { | |
| // Don't let this class get instantiated directly. |
This file contains hidden or 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/sh | |
| while true; do | |
| sleep 3300 # 55 min * 60 sec | |
| echo "Bouncing the wifi at `date`" | |
| # You might need to change en1 to something else. | |
| # ifconfig can tell you what network adapter to use | |
| networksetup -setairportpower en1 off | |
| sleep 2 |