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 android.databinding.DataBindingUtil; | |
import android.databinding.ViewDataBinding; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
/** | |
* Created by Davud. MyApplication project. | |
*/ |
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 MainActivity : AppCompatActivity() { | |
private val messageView : TextView by lazy { | |
// runs on first access of messageView | |
findViewById(R.id.message_view) as TextView | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) |
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 Optional<T> { | |
private var value: T? = null | |
private constructor() { | |
this.value = null | |
} | |
private constructor(value: T) { | |
this.value = value |
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.izigzag.messenger.model.db | |
import com.izigzag.messenger.model.db.ConversationDao.Properties.Mid | |
import com.izigzag.messenger.model.db.UserDao.Properties.Username | |
fun UserDao.getByUsername(username: String): User = | |
queryBuilder().where(Username.eq(username)).unique() | |
fun MessageDao.getMessage(mid: Long): Message = | |
queryBuilder().where(Mid.eq(mid)).unique() |
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 com.example.db.ConversationDao.Properties.Mid | |
import com.example.db.UserDao.Properties.Username | |
fun UserDao.getByUsername(username: String): User = | |
queryBuilder().where(Username.eq(username)).unique() | |
fun MessageDao.getMessage(mid: Long): Message = | |
queryBuilder().where(Mid.eq(mid)).unique() |
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 PreferenceRepositoryTest { | |
@get:Rule | |
var instantExecutorRule = InstantTaskExecutorRule() | |
@Mock | |
private lateinit var connectionApiServices: ConnectionApiServices | |
private lateinit var preferenceRepository: PrefrenceRepository |
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 FileUtils { | |
/** | |
* @return The MIME type for the given file. | |
*/ | |
public static String getMimeType(File file) { | |
String extension = getExtension(file.getName()).toLowerCase(); | |
if (!TextUtils.isEmpty(extension) && extension.length() > 1) |
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 android.content.SharedPreferences | |
import kotlin.properties.ReadWriteProperty | |
import kotlin.reflect.KProperty | |
abstract class BasePreferencesDataSource { | |
protected abstract val preferences : SharedPreferences | |
protected class StringPrefProperty(private val key: String) : ReadWriteProperty<BasePreferencesDataSource, String> { |
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 Theme : BaseObservable() { | |
@Bindable val colorPrimary: String = "colorPrimary" | |
@Bindable val colorPrimaryDark: String = "colorPrimaryDark" | |
... | |
} |
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
%kotlinc% -script DeleteBuildFolders.kts -- -dir . | |
:: "." is default path you can change it to any folder you want to work on that folder ^ | |
:: (script workes on current folder without "-dir" argument)" | |
:: "^" can be used for multiline commands |
OlderNewer