Skip to content

Instantly share code, notes, and snippets.

View ekosp's full-sized avatar

Eko Setyo Purnomo ekosp

View GitHub Profile
@ekosp
ekosp / README.md
Created July 4, 2019 13:35 — 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:

@ekosp
ekosp / uploadFileToAPIService
Created May 18, 2019 08:52
php script upload file (path file) by running post rest api
<?php
require_once
$target_url = 'http://192.168.43.111/latihan/UploadToServer.php';
$q=$db1->();
$fname = urlencode($_GET['file_path']);
$cfile = new CURLFile(realpath($fname));
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/ivSertifikat"
android:src="@drawable/background1"
android:layout_width="match_parent"
package com.bpmpk.jhon.projek;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
@ekosp
ekosp / ImageCompression
Created February 15, 2019 07:14 — forked from vipulasri/ImageCompression
Whatsapp Like Image Compression
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.media.ExifInterface;
import android.os.AsyncTask;
import android.os.Environment;
@ekosp
ekosp / Connectivity.java
Created February 4, 2019 03:53 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
/*
* 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:
@ekosp
ekosp / expand-collapse.java
Created January 17, 2019 13:47 — forked from ZkHaider/expand-collapse.java
Simple Expand / Collapse RecyclerView Item
public static class ExampleViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
private int originalHeight = 0;
private boolean isViewExpanded = false;
private YourCustomView yourCustomView
public ExampleViewHolder(View v) {
super(v);
v.setOnClickListener(this);
@ekosp
ekosp / shadow.xml
Created January 17, 2019 06:40 — forked from lecho/shadow.xml
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
@ekosp
ekosp / gist:f1727f4de55978aa720d8168c7b5a416
Created November 1, 2018 23:56 — forked from yeradis/gist:890783
ANDROID - Store and read an image on SQlite
To store an image file inside your SQLite db you should use a Blog field, and due Android SQlite limitations you should store info in this way:
ContentValues cv = new ContentValues();
//your table fields goes here
...
// adding the bitmap in byte array way to the blob field
ByteArrayOutputStream out = new ByteArrayOutputStream();
friendInfo.getImage_bmp().compress(Bitmap.CompressFormat.PNG, 100,out);
cv.put("avatar_img", out.toByteArray());
db.insert(TABLE_NAME, null, cv);
@ekosp
ekosp / MainActivity.java
Created October 29, 2018 11:21 — forked from ishitcno1/MainActivity.java
multiple row radio button in android.
package com.edinstudio.app.samples.multiplerowradiobuttons;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends ActionBarActivity {