Skip to content

Instantly share code, notes, and snippets.

View anry200's full-sized avatar

Denys Honcharenko anry200

View GitHub Profile
@anry200
anry200 / ScalableVideoView.java
Created January 16, 2014 13:40
Android : How to stretch video to use whole area of VideoView (code snippets)
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;
@anry200
anry200 / Android adb help
Created October 17, 2014 10:21
Android adb help
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"
@anry200
anry200 / gist:a650f1e4601c6cca0125
Created November 17, 2014 15:37
device rotation adb
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:
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.
*
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.
*/
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
@anry200
anry200 / LoginActivity.java
Created February 27, 2017 11:27
Disable animation when starting LoginActivity from another activity.
@Override
protected void onCreate(Bundle savedInstanceState) {
//Disable start animation
overridePendingTransition(0, 0);
getWindow().setWindowAnimations(0);
super.onCreate();
}
@anry200
anry200 / dns_fix.sh
Created March 30, 2021 12:44
DNS on Mac override workaround to fix dns issues with InfoBlox
#!/bin/bash
while true; do
networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4
sleep 1;
done
@anry200
anry200 / dns_fix.sh
Created March 30, 2021 12:45
DNS on Mac override workaround to fix dns issues with InfoBlox
#!/bin/bash
while true; do
networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4
sleep 1;
done