Skip to content

Instantly share code, notes, and snippets.

View Swisyn's full-sized avatar

Dzhunet Hasan Swisyn

  • kleinanzeigen GmbH
  • Berlin, Germany
  • 08:24 (UTC +01:00)
View GitHub Profile
@Swisyn
Swisyn / file
Created February 18, 2017 22:43
freedom_public
{"0.3731753471884953":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEIUqFbmrAOe09vcGzVXq5ScqREYgdX6yV\r\nYpYATq/sst5lOLwT4DQK4U+r/wpau0uQx1YZgj3Y/bOt+R8G2Cw7Uc3/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCWKjOEP8AAAACiwn/AAAACZCXidFimoTY\r\nLP8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAA3K4A/0tsj/6C8QZf\r\n5ahfGaTNvnDaqPIcYiVX7e+iPSHgxyGYAQDcHRGkMmavdz/pWswdtJhVxALesGVJ\r\nvhR5TE/Fw0mRf87/AAAAVgQAAAAAEggqhkjOPQMBBwIDBL7AJJJe6sRLJNfkr6gt\r\n9WviMw/UZYTvZGPJj91jVdrgSX5idaoEH0hlin6gl5ql8ScWjcLT77aaBk0Lo0jO\r\n7DsDAQgHwv8AAABtBBgTCAAf/wAAAAWCWKjOEP8AAAAJkJeJ0WKahNgs/wAAAAKb\r\nDAAAbIgBAITu9WEzFHWA4YZHUiFz3TBtDrQIduOxhr6vXbNAmkGCAP0c7W7CP4vj\r\nezaQPkzcU+oD5LMJCJgOSlCCdd58V3Bl5g==\r\n=Nsze\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"}
@Swisyn
Swisyn / CommonIntents.java
Created August 8, 2017 16:54 — forked from Jawnnypoo/CommonIntents.java
Common Android Intents, as builders
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.app.SearchManager;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.CalendarContract;
import android.provider.CalendarContract.Events;
import android.provider.AlarmClock;
@Swisyn
Swisyn / android_instructions.md
Last active December 21, 2017 13:15 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@Swisyn
Swisyn / download.java
Created December 23, 2017 10:10
koush ion download with notification
private static NotificationCompat.Builder notificationBuilder;
private static NotificationManager notificationManager;
private static long _downloaded;
private static int randomId = 0;
public static void DownloadFile(final Context context, String fileUrl, String company, final boolean indeterminate, final boolean withDialog) {
DownloadFile(context, fileUrl, company, indeterminate, withDialog, null);
}
public static void DownloadFile(final Context context, final String fileUrl, final String company, final boolean indeterminate, final boolean withDialog, final IFileDownloadListener listener) {
Dexter.withActivity((Activity) context)
@Swisyn
Swisyn / functions.java
Created December 23, 2017 15:56
get time as milliseconds from string date
public static long getTimeMilliSec(String timeStamp) {
SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.getDefault());
try {
Date date = format.parse(timeStamp);
return date.getTime();
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
@Swisyn
Swisyn / functions.java
Created December 23, 2017 15:57
check whether application is working in background
public static boolean isAppIsInBackground(Context context) {
boolean isInBackground = true;
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT_WATCH) {
List<ActivityManager.RunningAppProcessInfo> runningProcesses = am.getRunningAppProcesses();
for (ActivityManager.RunningAppProcessInfo processInfo : runningProcesses) {
if (processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
for (String activeProcess : processInfo.pkgList) {
if (activeProcess.equals(context.getPackageName())) {
isInBackground = false;
@Swisyn
Swisyn / InstagramLikeColorTransition.txt
Created January 16, 2018 19:10 — forked from deepak786/InstagramLikeColorTransition.txt
Instagram Like Gradient Color Transition in Android
/******This Gist explains how to create instagram like Gradient color transition in android.******/
1. Create some gradient color drawables inside drawable Folder.
a) color1.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#c44e4e"
android:endColor="#dcb9b9"
android:angle="0"/>
@Swisyn
Swisyn / build.gradle
Created February 8, 2018 05:43 — forked from dzungpv/build.gradle
Gradle obfuscate string
apply from: "$rootDir/utils.gradle"
android {
defaultConfig {
buildConfigField 'String', 'SECRET_KEY', toJavaCodeString(SECRET_KEY)
}
}
@Swisyn
Swisyn / README.md
Created February 26, 2018 07:29 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@Swisyn
Swisyn / Locator.java
Created April 28, 2018 19:42 — forked from emil2k/Locator.java
Android utility class for getting device location using various methods. Depends on `Connectivity` class found here: https://gist.github.com/emil2k/5130324
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions: