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
class Solution { | |
fun merge(intervals: Array<IntArray>): Array<IntArray> { | |
if (intervals.size < 2) return intervals | |
intervals.sortBy { it[0] } | |
var index = 1 | |
val result = ArrayList<IntArray>() | |
var merge: IntArray = intervals[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
package eventpal.com.play | |
import org.junit.Assert | |
import org.junit.Test | |
import kotlin.math.abs | |
class ElevatorTest { | |
interface Elevator { |
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 SpannableStringBuilder.appendText(string: String, self: SpannableStringBuilder.() -> SpannableStringBuilder): SpannableStringBuilder { | |
val newSpan = SpannableStringBuilder(string) | |
self(newSpan) | |
return append(newSpan) | |
} | |
fun SpannableStringBuilder.color(color: Int): SpannableStringBuilder { | |
val span = ForegroundColorSpan(color) | |
setSpan(span, 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) | |
return this |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<androidx.appcompat.widget.AppCompatTextView | |
android:id="@+id/textMyTime" | |
android:layout_width="wrap_content" |
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
@SuppressLint("InflateParams") | |
fun View.showPopupInfo(text: String) { | |
val view = LayoutInflater.from(context).inflate(R.layout.popup_info, null, false) | |
val popupWindow = PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true) | |
popupWindow.isTouchable = true | |
popupWindow.setTouchInterceptor { _, _ -> false } | |
val windowWidth = Resources.getSystem().displayMetrics.widthPixels | |
popupWindow.showAsDropDown(this, windowWidth, -height * 2) |
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
/** | |
* Provides resources without context. | |
* should be initial when [Application.onCreate] | |
*/ | |
@SuppressLint("StaticFieldLeak") | |
class ResourceProvider( | |
private var resources: Resources |
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.dpick.screen.post.detail | |
import android.content.Context | |
import android.content.res.Resources | |
import android.support.v7.widget.RecyclerView | |
import android.view.LayoutInflater | |
import android.view.ViewGroup | |
import com.dpick.R | |
import com.dpick.model.Comment | |
import com.dpick.model.Post |
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<ImageView | |
android:id="@+id/avatar" | |
android:layout_width="100dp" | |
android:layout_height="100dp" |
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
class ViewModelFactory( | |
private val application: Application, | |
private val schedulerProvider: SchedulerProvider, | |
private val authRepository: AuthRepository, | |
private val loginRepository: LoginRepository, | |
private val forumRepository: ForumSource, | |
private val postRepository: PostSource, | |
private val commentRepository: CommentRepository |
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
class PostDetailViewModel( | |
application: Application, | |
private var schedulerProvider: AppScheduler, | |
private var postRepository: PostSource, | |
private var commentRepository: CommentRepository | |
) : AndroidViewModel(application) { | |
companion object { |
NewerOlder