Skip to content

Instantly share code, notes, and snippets.

View SpiritOfDarkDragon's full-sized avatar

SpiritOfDarkDragon

View GitHub Profile
public enum IconMapMarker {
PARK(R.mipmap.ic_map_park, R.mipmap.ic_map_park_p, 1),
WC(R.mipmap.ic_map_wc, R.mipmap.ic_map_wc_p, 2),
INFO(R.mipmap.ic_map_info, R.mipmap.ic_map_info_p, 3),
PARKING(R.mipmap.ic_map_parking, R.mipmap.ic_map_parking_p, 4),
FERRIS_WHEEL(R.mipmap.ic_map_ferris_wheel, R.mipmap.ic_map_ferris_wheel_p, 5),
RINK(R.mipmap.ic_map_rink, R.mipmap.ic_map_rink_p, 6),
FOOTBALL(R.mipmap.ic_map_football, R.mipmap.ic_map_football_p, 7),
FOOD(R.mipmap.ic_map_food, R.mipmap.ic_map_food_p, 8),
PLAYGROUND(R.mipmap.ic_map_playground, R.mipmap.ic_map_playground_p, 9),
@SpiritOfDarkDragon
SpiritOfDarkDragon / Disable auto-scroll after load
Created April 15, 2015 12:14
Disabling auto-scroll scrollview, after data in webview is loaded
Adding the "descendantFocusability" attribute to the ScrollView's containing LinearLayout, with the value "blockDescendants". In my case:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants" >
//activity.xml
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/sb_progress"
android:progressDrawable="@drawable/custom_seek_bar"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:minHeight="8dip"//important!
android:maxHeight="8dip"//important!
git fetch --all
git reset --hard origin/master (or your branch name)
git pull origin master
myWebView.loadData(myHtmlString, "text/html; charset=UTF-8", null);
view type — "Project", not "Android"
refactor - rename - package
refactor - rename - folder
change settings.gradle
restart AS
На Windows 7 и 8 клиент OpenVPN необходимо запускать от имени администратора. Иаче подклчюается удачно, всё хорошо, но страницы в этой сети не доступны.
@SpiritOfDarkDragon
SpiritOfDarkDragon / Android InApp (IAP) error
Created February 3, 2015 22:55
Authentication is required. You need to sign into your Google Account
В моём случае данная ошибка возникала из-за того, что приложение не было опубликовано в Google Play Console. Нужно не только зарегистри ровать там приложение и создать платежи, но и опубликовать приложение. Не важно, в паблик, бета или альфа тестирование. Эти типы релиза определяют только то, кто сможет скачать приложение. Платежи будут работать при любом типе публикации. Если .apk файл распространять вручную (например заливать на тестовое устройство), то нужно заливать именно релизный .apk, как и тот, который загружен в консоли.
@SpiritOfDarkDragon
SpiritOfDarkDragon / Facebook error with key hashes
Last active August 29, 2015 14:09
Facebook error : allow key: configure your app key hashes at dev.facebook android. Solved!
Goto: https://developers.facebook.com/apps, Settings, Add platform "Android", input Key Hashes of your app.
public static String printKeyHash(Activity context) {
PackageInfo packageInfo;
String key = null;
try {
//getting application package name, as defined in manifest
String packageName = context.getApplicationContext().getPackageName();
0. Авторизация происходит по трёхступенчатой схеме:
docs: https://dev.twitter.com/web/sign-in/implementing
1. Нам понадобятся 3 библиотеки.
compile('org.twitter4j:twitter4j-core:3.0.5')
compile('oauth.signpost:signpost-core:1.2.1.1')
compile('oauth.signpost:signpost-commonshttp4:1.2.1.1')
2. Заводим переменные
private Twitter twitter;