Skip to content

Instantly share code, notes, and snippets.

View pokk's full-sized avatar
🌀

Jieyi pokk

🌀
View GitHub Profile
@pokk
pokk / README.md
Created January 13, 2017 07:51
using kotlin language in new instance.

Introduction

New a fragment instance in Kotlin style.

Introduction

Customize View by yourself, you must inherit View class. For the View class, it must run this three methods in flow. Brief describe as below

  1. onMeasure(): Set the layout size.
  2. onLayout(): Set the layout position.
  3. onDraw(): Draw the layout content.

Before the flow, I will explain a little the constructor of View or ViewGroup. Normally, there are three constructor we need to override.

@pokk
pokk / README.md
Last active April 5, 2017 02:31
delay search for searchTextView

Introduction

Search data from inputing text.

Talk is cheap. Show me the code.

I have two ways to archive it, as below.

  • RxKotlin
@pokk
pokk / README.md
Created January 26, 2017 09:47
from InputStream to File.

Introduction

We're able to get a Uri from Camera, Gallery, Video Camera Intent. We will obtain a Uri from the intent then you can use it to get a temp File.

@pokk
pokk / README.md
Created January 29, 2017 14:33
bash_profile

Introduction

When I use zsh, I have to type source ~/.bash_profile every time. It's kind of trobulesome.

But I found some way to fix it!!!

If your default shell is bash then just put . ~/.bash_profile in the end of ~/.bashrc. If your default shell is zsh, then put it at the same way!!

Introduction

How to define a drawable shape.

Describe

File path: res/drawable/filename.xml

Resource type: GradientDrawable

Introduction

Make the WkWebView zoom-in and zoom-out.

Introduction

Make a lace edge layout as like a coupon ticket layout.

attrs.xml

We can have kind of attrbutes.

  • reference
  • string
@pokk
pokk / README.md
Last active February 9, 2017 17:02
How to use the Palette.

Introduction

We can extract the colors from the bitmap.

Start

Add the library in your app gradle.

compile 'com.android.support:palette-v7:25.1.0'
@pokk
pokk / DataController.swift
Created February 10, 2017 05:50
How to use CoreData and comparing with SQLite.
class DataController: NSObject {
var managedObjectContext: NSManagedObjectContext
override init() {
// This resource is the same name as your xcdatamodeld contained in your project.
guard let modelURL = Bundle.main.url(forResource: "YOUR_CORDDATA_NAME", withExtension: "momd") else {
fatalError("Error loading model from bundle")
}
// The managed object model for the application. It is a fatal error for the application not to be able to find and load its model.