This file contains hidden or 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 android.content.Context | |
| import android.graphics.Bitmap | |
| import android.os.Build | |
| import android.renderscript.Allocation | |
| import android.renderscript.Element | |
| import android.renderscript.RenderScript | |
| import android.renderscript.ScriptIntrinsicBlur | |
| fun blur(context: Context, sourceBitmap: Bitmap, radius: Float): Bitmap { |
This file contains hidden or 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
| Context context = getContext(); | |
| context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()).getComponent().getClassName(); |
This file contains hidden or 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 long mLastClickTime = 0L; | |
| findViewById(R.id.button) | |
| .setOnClickListener(new OnClickListener() { | |
| @Override public void onClick(View v) { | |
| // mis-clicking prevention :: 1000 ms | |
| if (SystemClock.elapsedRealtime() - mLastClickTime < 1000) return; | |
| mLastClickTime = SystemClock.elapsedRealtime(); | |
| } | |
| }); |
This file contains hidden or 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
| .divider { | |
| text-transform: uppercase; | |
| color: $dark-grey; | |
| font-weight: 600; | |
| margin: 20px 0; | |
| position: relative; | |
| &:before, | |
| &:after { | |
| content: ""; |
This file contains hidden or 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
| $tablet-width: 768px; | |
| $desktop-width: 875px; | |
| $xl-desktop-width: 1351px; | |
| $phone-width: 320px; | |
| $iphone6-width: 375px; | |
| $iphone6plus-width: 450px; | |
| @mixin breakpoint($breakpoint) { | |
| @if $breakpoint == "tablet" { | |
| @media (min-width: #{$iphone6plus-width}) and (max-width: #{$desktop-width}) { |
This file contains hidden or 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
| @mixin breakpoint($point) { | |
| @if $point == desktop { | |
| @media (min-width: 70em) { | |
| @content; | |
| } | |
| } | |
| @else if $point == laptop { | |
| @media (min-width: 64em) { | |
| @content; | |
| } |
This file contains hidden or 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
| def get_if_int_or_float(value, under_num=1): | |
| return int(value) if value.is_integer() else round(value, under_num) |
This file contains hidden or 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 val backButtonSubject: Subject<Long> = BehaviorSubject.createDefault(0L).toSerialized() | |
| private val backButtonSubjectDisposable = | |
| compositeDisposable.add(backButtonSubject.toFlowable(BackpressureStrategy.BUFFER) | |
| .subscribeOn(Schedulers.io()) | |
| .observeOn(AndroidSchedulers.mainThread()) // need compose | |
| .buffer(2, 1) | |
| .map { it[0] to it[1] } | |
| .subscribe({ value -> | |
| if (value.second - value.first < 2000) getView()?.finishView() |
This file contains hidden or 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
| <a href="#modalBox" data-toggle="modal">OpenButton</a> | |
| <div class="modal fade" id="modalBox" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true"> | |
| <div class="modal-dialog"> | |
| <div class="modal-content"> | |
| <div class="modal-header"> | |
| <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> | |
| <h4 class="modal-title" id="modal-label"> | |
| Title Area | |
| </h4> |