Skip to content

Instantly share code, notes, and snippets.

View gshockv's full-sized avatar

Vitaly Gashock gshockv

  • Odessa, Ukraine
View GitHub Profile
07-22 16:12:52.732 4678-11525/com.videomedicine D/Retrofit: {"appointments":[],"items":[{"id":208,"doctor_id":353,"start":"2016-05-01 07:00:00","end":"2016-05-01 16:00:00","rule":"FREQ=DAILY;","timezone":"Europe\/Kiev","events":[]},{"id":216,"doctor_id":353,"start":"2016-07-21 14:00:00","end":"2016-07-21 17:00:00","rule":"FREQ=DAILY;UNTIL=2016-08-11 20:59:59;","timezone":"Europe\/Kiev","events":[]}]}
07-22 16:12:52.732 4678-11525/com.videomedicine D/Retrofit: <--- END HTTP (343-byte body)
07-22 16:12:52.744 4678-4678/com.videomedicine D/VideoMedicine: [ReadOnlyAvailableTimePresenter:whenAvailableTimeArrived:97]: RRule string: RRULE:FREQ=DAILY;
07-22 16:12:52.763 4678-4678/com.videomedicine D/VideoMedicine: [ReadOnlyAvailableTimePresenter:whenAvailableTimeArrived:142]: Start cal [2016-06-01 07:00:00], End cal [2016-06-01 16:00:00]
07-22 16:12:52.764 4678-4678/com.videomedicine D/VideoMedicine: [ReadOnlyAvailableTimePresenter:whenAvailableTimeArrived:142]: Start cal [2016-06-02 07:00:00], End cal [2016-06-02 16
@gshockv
gshockv / build.gradle
Created December 28, 2015 14:41 — forked from jaydp17/build.gradle
Kotlin and dataBinding
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.mvptestkotlin"
@gshockv
gshockv / DividerItemDecoration.java
Created November 19, 2015 14:07 — forked from lapastillaroja/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@gshockv
gshockv / README.md
Created October 13, 2015 07:10 — forked from shekibobo/README.md
Android: Base Styles for Button (not provided by AppCompat)

How to create custom button styles using Android's AppCompat-v7:21

Introduction

AppCompat is an Android support library to provide backwards-compatible functionality for Material design patterns. It currently comes bundled with a set of styles in the Theme.AppCompat and Widget.AppCompat namespaces. However, there is a critical component missing which I would have thought essential to provide the a default from which we could inherit our styles: Widget.AppCompat.Button. Sure, there's Widget.AppCompat.Light.ActionButton, but that doesn't actually inherit from Widget.ActionButton, which does not inherit from Widget.Button, so we might get some unexpected behavior using that as our base button style, mainly because Widget.ActionButton strictly belongs in the ActionBar.

So, if we want to have a decently normal default button style related to AppCompat, we need to make it ourselves. Let's start by digging into the Android SDK to see how it's doing default styles.

Digging In

if (result != null && result instanceof TreeMap<?, ?>) {
TreeMap<String, Vector<AvailableDates>> ret = (TreeMap<String, Vector<AvailableDates>>) result;
for (Entry<String, Vector<AvailableDates>> days : ret.entrySet()) {
for (AvailableDates day : days.getValue()) {
for (Period pr : day.getPeriods())
if (
((p.getEndTime().getTime() - appointment.getDuration() * 60000 >= pr.getStartTime().getTime())
&& (p.getEndTime().getTime() <= day.getEndDate().getTime()))

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

package the.app.util;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import com.feelflea.android.io.LocationService;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class RxSignupActivity extends ActionBarActivity {
private static final Pattern emailPattern = Pattern.compile(
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
private EditText editTextUsername;
private EditText editTextEmail;
private Button buttonRegister;
@Override