Skip to content

Instantly share code, notes, and snippets.

View isfaaghyth's full-sized avatar
Work from home

Muh Isfhani Ghiath isfaaghyth

Work from home
View GitHub Profile
@isfaaghyth
isfaaghyth / RuntimePermission.java
Created November 20, 2016 12:46
Runtime Permission
package daeng.app.test.Permission;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.widget.Toast;
/**
@isfaaghyth
isfaaghyth / test.php
Last active February 3, 2020 17:09
Split Name, Birth, and Born with PHP
<?php
/*
apply for : Isfahani Ghiyath 24 Makassar or,
Isfahani Ghiyath 24 Th Makassar or,
Isfahani Ghiyath 24 Tahun Makassar or,
Isfahani Ghiyath 24 Tahun Sulawesi Selatan.
*/
$test = "Isfahani Ghiyath 24 Tahun Makassar";
private void generateImage() {
Bitmap src = BitmapFactory.decodeResource(getResources(), R.drawable.img_canvas); //base of image
Bitmap dest = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Bitmap.Config.ARGB_8888);
String yourText = "Happy Code!"; //content for insert to src.
Canvas cs = new Canvas(dest);
Paint tPaint = new Paint();
tPaint.setTextSize(40);
tPaint.setColor(Color.WHITE);
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "net.mnafian.buildflavorsample"
minSdkVersion 16
targetSdkVersion 23
@isfaaghyth
isfaaghyth / MainActivity.java
Created January 21, 2017 18:37
Show-Hide content on Cardview
public class MainActivity extends AppCompatActivity {
@BindView(R.id.btn_load_more)
Button btnLoadMore;
@BindView(R.id.txt_more)
TextView txtMore;
boolean showContent = true;
@Override

Dokumentasi API dan contoh

0. Push Product (Add force as optional parameter )

HTTP Request

PATCH https://api.bukalapak.com/v2/products/:id/push.json

Parameters

import android.os.AsyncTask;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
@isfaaghyth
isfaaghyth / ListAdapter.java
Last active June 7, 2017 04:13
Generic Class for Recyclerview Adapter
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
public abstract class ListAdapter<T, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
public class DrawingView extends View {
public int width;
public int height;
private Bitmap mBitmap;
private Canvas mCanvas;
private Path mPath;
private Paint mBitmapPaint;
Context context;
private Paint circlePaint;
public class KeyHash {
public static void generateKeyHash(Context context) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
Log.e("Hash key", something);