Skip to content

Instantly share code, notes, and snippets.

View pokk's full-sized avatar
🌀

Jieyi pokk

🌀
View GitHub Profile
<!-- 允許應用訪問精確(如GPS)性的定位 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- 允許應訪問額外的提供定位的指令 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<!-- 允許應用創建用於測試的模擬定位提供者 -->
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<!-- 允許應用訪問網絡上的信息 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 允許應用使用低版本視圖的特徵 -->
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
@pokk
pokk / README.md
Last active April 5, 2017 02:37
How to implement callback method

[TOC]

Introduction

How to implement a callback method.

Callback's callbacker

public class SubClass {

[TOC]

Introduction

Optimize the Android's memory usage by using SparseArray and ArrayMap to instead of HashMap.

HashMap

HashMap's default capacity is 16 for keeping the data. Inside of the data struct we will explain as below.

@pokk
pokk / Mackito.md
Last active April 5, 2017 02:41
Android unit test

[TOC]

Mockito

Generating a kind of virtual object for verifying the method reacting output which fits our expecting.

Concept

  1. Verifying the using status of a assignment object's method and how many times was executed, and what's the parameters, etc.
@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.
@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'

Introduction

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

attrs.xml

We can have kind of attrbutes.

  • reference
  • string

Introduction

Make the WkWebView zoom-in and zoom-out.

Introduction

How to define a drawable shape.

Describe

File path: res/drawable/filename.xml

Resource type: GradientDrawable

@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!!