Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
plus ultra

Kang Cahya dyazincahya

😎
plus ultra
View GitHub Profile
@dyazincahya
dyazincahya / get_permission_android.kt
Created Jul 29, 2020
Sample code for get permission on android kotlin
View get_permission_android.kt
private fun xPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ActivityCompat.checkSelfPermission(
this,
Manifest.permission.READ_SMS
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
this,
Manifest.permission.SEND_SMS
) != PackageManager.PERMISSION_GRANTED
) {
@dyazincahya
dyazincahya / EmailValidator.kt
Created Jul 28, 2020 — forked from ironic-name/EmailValidator.kt
Kotlin regex email validator function
View EmailValidator.kt
fun isEmailValid(email: String): Boolean {
return Pattern.compile(
"^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]|[\\w-]{2,}))@"
+ "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
+ "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9]))|"
+ "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$"
).matcher(email).matches()
}
@dyazincahya
dyazincahya / README.md
Created Apr 3, 2020 — forked from lopspower/README.md
Hexadecimal color code for transparency
View README.md

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@dyazincahya
dyazincahya / spinner_with_icons
Created Apr 2, 2020 — forked from ControlAdad/spinner_with_icons
Android Spinner with icons
View spinner_with_icons
final Item[] items = {
new Item("Email", android.R.drawable.ic_menu_add),
new Item("Facebook", android.R.drawable.ic_menu_delete),
new Item("...", 0),//no icon for this one
};
ListAdapter adapter = new ArrayAdapter<Item>(
this,
android.R.layout.select_dialog_item,
android.R.id.text1,
@dyazincahya
dyazincahya / order-page.css
Last active Jan 24, 2020
module order VibriPay
View order-page.css
.popup-container{
position: fixed;
z-index:99999;
background-color:#bb000000;
min-height:100;
width:100%;
height:100%;
padding: 30px;
overflow: show;
margin: auto;
@dyazincahya
dyazincahya / popup-model.js
Last active Jan 21, 2020
POPUP NATIVESCRIPT 6.3.1
View popup-model.js
const ObservableArray = require("data/observable-array").ObservableArray;
function xViewModel(items) {
var viewModel = new ObservableArray(items);
return viewModel;
}
module.exports = xViewModel;
@dyazincahya
dyazincahya / TAKE-A-PHOTO-WITH-CAMERA-IN-KOTLIN.md
Last active Jan 20, 2020
ANDROID - TAKE A PHOTO WITH CAMERA IN KOTLIN (https://kang-cahya.com)
View TAKE-A-PHOTO-WITH-CAMERA-IN-KOTLIN.md

TAKE A PHOTO WITH CAMERA IN KOTLIN

SETTING

Step-1

Create provider_paths.xml in res/xml folder and write below code in it.

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
@dyazincahya
dyazincahya / lang-locales-support.md
Last active Jan 14, 2020
List of languages or locales supported on Android
View lang-locales-support.md

Updated list as of Android 5.1

  • af_ [Afrikaans]
  • af_NA [Afrikaans (Namibia)]
  • af_ZA [Afrikaans (South Africa)]
  • agq_ [Aghem]
  • agq_CM [Aghem (Cameroon)]
  • ak_ [Akan]
  • ak_GH [Akan (Ghana)]
  • am_ [Amharic]
View SolarSystem.java
package ComputerGraphics;
import java.awt.*;
import java.applet.*;
import java.util.Random;
public class SolarSystem extends Applet {
Dimension screen;
Random random;
@dyazincahya
dyazincahya / SolarSystem.java
Last active Dec 1, 2019
Draw solar system with Java Applet [kang-cahya.com]
View SolarSystem.java
package ComputerGraphics;
import java.awt.*;
import java.applet.*;
import java.util.Random;
public class SolarSystem extends Applet {
Dimension screen;
Random random;
You can’t perform that action at this time.