Skip to content

Instantly share code, notes, and snippets.

Avatar
📚
Studying android dev-skills.

Ji Sungbin jisungbin

📚
Studying android dev-skills.
View GitHub Profile
View final_module_gradle.gradle
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
View useless_dependency.gradle
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
View useless_testing_dependencies.gradle
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
@jisungbin
jisungbin / GridSpacingItemDecoration.md
Created Oct 16, 2020 — forked from liangzhitao/GridSpacingItemDecoration.md
Add column spacing in RecyclerView with GridLayoutManager
View GridSpacingItemDecoration.md

Android Recyclerview GridLayoutManager column spacing Here is the question, the first answer does not work well in my project,and it makes the spacing bigger between item and item. the second answer is quite perfect.But if RecyclerView has headers,it does not work well. Then I fixed it.

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
View Date.toCalendar()
fun Date.toCalendar(): Calendar {
val calendar = Calendar.getInstance()
calendar.time = this
return calendar
}
@jisungbin
jisungbin / Data+PrettyPrint.swift
Created Sep 22, 2020 — forked from cprovatas/Data+PrettyPrint.swift
Pretty print JSON string from Data in Swift 4.1 (especially useful printing to Xcode console)
View Data+PrettyPrint.swift
import Foundation
extension Data {
var prettyPrintedJSONString: NSString? { /// NSString gives us a nice sanitized debugDescription
guard let object = try? JSONSerialization.jsonObject(with: self, options: []),
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]),
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil }
return prettyPrintedString
}
View ImagePath.kt
fun getAllShownImagesPath(activity: Activity): MutableList<Uri> {
val uriExternal: Uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
val cursor: Cursor?
val columnIndexID: Int
val listOfAllImages: MutableList<Uri> = mutableListOf()
val projection = arrayOf(MediaStore.Images.Media._ID)
var imageId: Long
cursor = activity.contentResolver.query(uriExternal, projection, null, null, null)
if (cursor != null) {
columnIndexID = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID)
View 메봇호출벨.js
importPackage(android.content);
importPackage(android.app);
importClass(android.widget.Toast);
const CHANNEL_ID = "call_owner";
const ignoreActionName = "msgbot.call_owner.ignore";//그냥 시스템 전반적으로 유니크하게 하시면 됩니다.
const replyActionName="msgbot.call_owner.reply";
const replyKey="key_reply";
const bot = BotManager.getCurrentBot();
let repliers={};
View android_material_design_colours.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@jisungbin
jisungbin / MyEditText.java
Created May 7, 2020 — forked from lifeparticle/MyEditText.java
Custom Edittext with Line Number
View MyEditText.java
package rupantor.cusedittext;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.EditText;