Skip to content

Instantly share code, notes, and snippets.

View Swisyn's full-sized avatar

Dzhunet Hasan Swisyn

  • kleinanzeigen GmbH
  • Berlin, Germany
  • 14:39 (UTC +02:00)
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / LICENCE SUBLIME TEXT
Created February 9, 2017 21:41
Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
93F6323C FD7F7544 3F39C318 D95E6480
FCCC7561 8A4A1741 68FA4223 ADCEDE07
@Swisyn
Swisyn / README.md
Created December 6, 2016 11:56 — forked from gabrielemariotti/README.md
How to manage the firebase libraries in a multi-module projects

Centralize the firebase libraries dependencies in gradle

ext {
      firebaseVersion = '9.0.0';

      firebaseDependencies = [
              core :         "com.google.firebase:firebase-core:${firebaseVersion}",
              database :     "com.google.firebase:firebase-database:${firebaseVersion}",
              storage :      "com.google.firebase:firebase-storage:${firebaseVersion}",
@Swisyn
Swisyn / new_gist_file.java
Created November 30, 2016 20:49
Database Operations
package com.cuneytayyildiz.aktuelurunler.utils;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;