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 | |
while true; do | |
networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4 | |
sleep 1; | |
done |
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 | |
while true; do | |
networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4 | |
sleep 1; | |
done |
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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
//Disable start animation | |
overridePendingTransition(0, 0); | |
getWindow().setWindowAnimations(0); | |
super.onCreate(); | |
} |
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 rx.Observable; | |
import rx.Subscription; | |
import rx.android.schedulers.AndroidSchedulers; | |
import rx.schedulers.Schedulers; | |
import rx.subscriptions.CompositeSubscription; | |
public class RxUtils { | |
/** | |
* {@link rx.Observable.Transformer} that transforms the source observable to subscribe in the |
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.database.Cursor; | |
import android.os.Bundle; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentStatePagerAdapter; | |
/** | |
* A simple pager adapter. | |
*/ |
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.content.Context; | |
import android.database.Cursor; | |
import android.support.v4.content.AsyncTaskLoader; | |
/** | |
* Used to write apps that run on platforms prior to Android 3.0. When running | |
* on Android 3.0 or above, this implementation is still used; it does not try | |
* to switch to the framework's implementation. See the framework SDK | |
* documentation for a class overview. | |
* |
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
disable accelerometer controlling rotation - just do this once | |
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0 | |
rotate landscape: | |
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1 | |
rotate portrait: | |
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0 | |
rotate upside down landscape: |
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
Device boot | |
~~~sh | |
am broadcast -a android.intent.action.BOOT_COMPLETED | |
~~~ | |
Removale mount | |
~~~sh | |
am broadcast -a "android.intent.action.MEDIA_MOUNTED" -d "file:///mnt/sdcard/usb1" | |
am broadcast -a "android.intent.action.MEDIA_MOUNTED" -d "file:///mnt/sdcard/usb/subfolder" |
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.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.VideoView; | |
public class ScalableVideoView extends VideoView { | |
private int mVideoWidth; | |
private int mVideoHeight; | |
private DisplayMode displayMode = DisplayMode.ORIGINAL; |