Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Antarix's full-sized avatar

Antarix Antarix

View GitHub Profile
@Antarix
Antarix / TimePreference.java
Created June 23, 2014 09:59
custom TimePreference dialog for preference activity
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TimePicker;
public class TimePreference extends DialogPreference {
private int lastHour=0;
private int lastMinute=0;
@Antarix
Antarix / PhonegapPermission.xml
Created June 24, 2014 09:30
Permissons for Phongap. You should remove unwanted permissions before before publishing application to play store
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
public class ContactsActivity extends Activity {
List<Contact> contacts;
ContactsAdapter contactsAdapter;
ListView contactsList;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// just add these few lines of code to your app delegate .m file right before the @implementation part
@implementation NSURLRequest (DSInvalidSSL)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host {
return YES;
}
@end
/**
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
*/
public static void riseAndShine(Activity activity) {
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED);
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
@Antarix
Antarix / AES.c
Last active August 29, 2015 14:17 — forked from bricef/AES.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
@Antarix
Antarix / Polymertext.html
Created June 23, 2015 05:18
Ploymer designer demo
//demo
@Antarix
Antarix / OpacityHex.txt
Last active August 29, 2015 14:27
Opacity hex color code.
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C
@Antarix
Antarix / PreapareListFromXML.java
Last active December 12, 2015 03:18
fetches data from local Android xml folder having xml file and returns in Arraylist
public ArrayList<string> prepareListFromXml() {
ArrayList<string> todoItems = new ArrayList<string>();
XmlResourceParser todolistXml = getResources().getXml(R.xml.todolist);
int eventType = -1;
@Antarix
Antarix / round_background.xml
Created February 7, 2013 03:39
Round background image drawable for android
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<stroke android:width="1dp" android:color="#FFFFFF" />
<gradient
android:startColor="#679031"
android:centerColor="#679031"