This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="ConstraintLayout"> | |
<template name="cbb" value="app:layout_constraintBottom_toBottomOf="$cursor$"" description="constraint bottom to bottom of id" toReformat="true" toShortenFQNames="true"> | |
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="XML" value="true" /> | |
<option name="XML_TEXT" value="false" /> | |
</context> | |
</template> | |
<template name="cbp" value="app:layout_constraintBottom_toBottomOf="parent"" description="constraint bottom to bottom of parent" toReformat="true" toShortenFQNames="true"> | |
<context> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.myapplication | |
import android.content.Intent | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import kotlinx.android.synthetic.main.activity_main.* | |
import java.io.Serializable | |
class MainActivity : AppCompatActivity() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Assert | |
import org.junit.Test | |
import kotlin.reflect.KProperty | |
class DataClassTest { | |
@Test | |
fun copyObj() { | |
val data= Data1(1, "b", Value(3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Spannable getLinkifiedSpannable(String text) { | |
Spannable spannable = new SpannableStringBuilder(text); //create spannable for linkify | |
Linkify.addLinks(spannable, Linkify.ALL); // make URLspan | |
URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); //get url spans | |
for (URLSpan span : spans) { //iterate on url spans | |
int spanStart = spannable.getSpanStart(span); //save postion of current url span | |
int spanEnd = spannable.getSpanEnd(span); | |
if (spanStart < 0 || spanEnd < 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface A { | |
val myVal: Boolean | |
var myVar: Boolean | |
} | |
//no problem | |
class B : A { | |
override val myVal = false | |
override var myVar = false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.reactivex.Single | |
import io.reactivex.exceptions.UndeliverableException | |
import io.reactivex.schedulers.Schedulers | |
import org.junit.Assert | |
import org.junit.Assert.assertTrue | |
import org.junit.Assert.fail | |
import org.junit.Test | |
import java.util.concurrent.CancellationException | |
import java.util.concurrent.CountDownLatch | |
import java.util.concurrent.Executors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
fun getMap(arg1: Array<Int>, arg2: Array<Int>) = | |
arg1.mapIndexed { index, v -> (v or arg2[index]).toString(2) } | |
.map { | |
it.map { if (it == '1') '#' else ' ' } | |
.toCharArray().joinToString(prefix = "\"", postfix = "\"", separator = "") | |
} | |
println(getMap(arrayOf(9, 20, 28, 18, 11), arrayOf(30, 1, 21, 17, 28))) | |
println(getMap(arrayOf(46, 33, 33, 22, 31, 50), arrayOf(27, 56, 19, 14, 14, 10))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WebViewActivity extends Activity { | |
WebView wv; | |
LinkedList<JsResult> jsResults = new LinkedList<>(); | |
@TargetApi(Build.VERSION_CODES.KITKAT) | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_wv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void pushFragments(String tag, Fragment fragment, | |
boolean shouldAnimate, boolean shouldAdd) { | |
if (shouldAdd) | |
mStacks.get(tag).push(fragment); | |
FragmentManager manager = getSupportFragmentManager(); | |
FragmentTransaction ft = manager.beginTransaction(); | |
ft.replace(R.id.realtabcontent, fragment).addToBackStack(null); | |
ft.commit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final static String PATTERN_COLOR_REGEXP = "(<color=(.+?)>)(.+?)(</color>)"; | |
private final static Pattern PATTERN_COLOR = Pattern.compile(PATTERN_COLOR_REGEXP); | |
private final static String PATTERN_BOLD_REGEXP = "(<b>)(.+?)(</b>)"; | |
private final static Pattern PATTERN_BOLD = Pattern.compile(PATTERN_BOLD_REGEXP); | |
private final static String PATTERN_UNDERLINE_REGEXP = "(<u>)(.+?)(</u>)"; | |
private final static Pattern PATTERN_UNDERLINE = Pattern.compile(PATTERN_UNDERLINE_REGEXP); | |
/** |
NewerOlder