Skip to content

Instantly share code, notes, and snippets.

View maxlord's full-sized avatar
🏠
Working from home

Maksim Kuleshov maxlord

🏠
Working from home
View GitHub Profile
class IntroDelegate(
) : BaseAdapterDelegate<TrackItemUiModel.Intro, IntroDelegate.IntroViewHolder>() {
private val actionRelay = PublishRelay.create<TrackItemUiModel>()
val actionObservable: Observable<TrackItemUiModel> = actionRelay
override fun isForViewType(item: Item): Boolean = item is TrackItemUiModel.Intro
override val layoutId: Int = R.layout.view_track_intro
@maxlord
maxlord / gist:30634441bef7a356ad4f562ab71388be
Created November 22, 2017 12:20
ListAdapter with paging support
class CarNewsAdapter(
private val context: Context,
private val dateTimeFormatter: DateTimeFormatter,
private val recycler: RecyclerView,
private val callback: Callback,
private val onLoadMoreListener: OnLoadMoreListener) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private val imageRoundedTransformation = RoundedCornersTransformation(context, 8, 0)
private var isLoading = false
private var visibleThreshold = THRESHOLD_LIMIT
private var lastVisibleItem = 0
@maxlord
maxlord / gist:c51f95dc18c2ce8fa9225ab2c9b3cd35
Created October 27, 2017 11:47
Reversion of Linked Lists
private static Node reverseLinkedListByRecursion(Node node) {
if (node == null || node.next == null) {
return node;
}
Node rest = node.next;
rest = reverseLinkedListByRecursion(rest);
node.next.next = node;
node.next = null;
return rest;
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp">
<CheckBox
android:id="@+id/checkbox"
style="@style/Widget.Avito.CheckBox"
@maxlord
maxlord / RestClient.java
Created December 9, 2016 11:23
methodPut
@SuppressWarnings("unchecked")
public static <T> T methodPut(Map<String, Object> params, String url, MapperParams mapperParams) {
HttpClient httpClient = getHttpClient();
List<NameValuePair> httpParams = new ArrayList<NameValuePair>();
for (String key : params.keySet()) {
httpParams.add(new BasicNameValuePair(key, params.get(key).toString()));
}
HttpPut put = new HttpPut(url);
try {
@maxlord
maxlord / widget_toolbar.xml
Created October 17, 2016 15:58
Standalone-toolbar
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
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"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
app:popupTheme="@style/AppTheme.PopupOverlay">
var codes = new List<string>();
codes.Add(db.Quote(config.Keyword.ToUpper()));
// Добавляем кроссы - если выбран соотв параметр
if (config.DisplayAnalogs)
{
if (crossInfosIfCodeSearchMaked != null && crossInfosIfCodeSearchMaked.Any())
{
foreach (var ci in crossInfosIfCodeSearchMaked)
{
codes.Add(db.Quote(ci.PartCode));
@maxlord
maxlord / Import.cs
Created May 31, 2016 10:15
MyPrice Import PriceList
// Создаем запись о новом прайс-листе в БД
var pricelistDate = DateTime.Now;
var pricelistColumns = new Dictionary<string, object>()
{
{"Date", pricelistDate},
{"LoadType", (int) PriceListLoadType},
{"LoadTypeData", PriceListLoadTypeData},
{"Name", PriceListFileName},
{"FileSize", PriceListFileSize},
{"NameMd5Hash", PriceListFileMd5Hash}
public class EventNotification$$Table implements RxSQLiteTable<EventNotification> {
private final CustomTypes mTypes;
public EventNotification$$Table(CustomTypes types) {
mTypes = types;
}
@Override
public void create(SQLiteDb db) {
db.exec("CREATE TABLE IF NOT EXISTS event_notification("
<html>
<head>
<title>Apache Tomcat/7.0.23 - Error report</title>
<style>
<!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-->
</style>
</head>
<body>
<h1>HTTP Status 406 - </h1>
<HR size="1" noshade="noshade">