Skip to content

Instantly share code, notes, and snippets.

View erickogi's full-sized avatar
👨‍💻

Eric kogi erickogi

👨‍💻
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
android:background="@drawable/backgroundimage">
<resources>
<!-- Declare custom theme attributes that allow changing which styles are
used for button bars depending on the API level.
?android:attr/buttonBarStyle is new as of API 11 so this is
necessary to support previous API levels. -->
<declare-styleable name="CircleImageView">
<attr name="civ_border_width" format="dimension" />
<attr name="civ_border_color" format="color" />
@erickogi
erickogi / CircleImageView.kt
Last active March 26, 2019 07:08
To create custom circular/rounded imageview
import android.content.Context
import android.graphics.*
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.net.Uri
import android.util.AttributeSet
import android.widget.ImageView
@erickogi
erickogi / mpesa.php
Last active January 13, 2019 06:59
Implementing mpesa stk push (php part)
<?php
/**
* Created by PhpStorm.
* User: kogi
* Date: 13/01/19
* Time: 9:30 AM
*/
/**
String a="{\"userDetails\":[{\"ID\":\"4\",\"productName\":\"shoes\",\"brandName\":\"\",\"category\":\"\",\"" +
"description\":\"awesome \",\"" +
"sellingPrice\":\"2000\",\"productStatus\":\"Antoney\",\"imagePath\":\"download.jpeg\"}]}";
//METHOD 1 USE OWN PARSER METHOD
public List<UserDetails> parse(String data){
//Create a webview client class
public class MyAppWebViewClient extends WebViewClient {
boolean refreshed;
String url;
public MyAppWebViewClient(String url) {
this.url = url;
}
@erickogi
erickogi / Upload Image
Created July 1, 2018 10:27
File to Bitmap To String then Upload
//Steps
//1 Convert the image to a bitmap ofrom file
//Convert file to bitmap
public Bitmap getThumbnail(String filename) {
Bitmap thumnail = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ic_person_black_24dp);