Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert RobertApikyan

  • V-Mobile
  • Armenia, Yerevan
View GitHub Profile
View gist:08f6cb8546f80a9e5e78
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View MainActivity
package com.example.robert.materialtabs;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
View custom_tab_view.xml
<?xml version="1.0" encoding="utf-8"?>
<TabWidget xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="?android:actionBarSize"
android:layout_margin="10dp"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:visibility="gone"
View custom_tab_view.xml
<?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="match_parent"
tools:context="com.example.robert.materialtabs.MainActivity">
<com.example.robert.materialtabs.SlidingTabLayout
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
View gist:7adc75ea0f9b64f2c0edb1c475fad200
{
"Item": {
"BackgroundLink": "https://files.parsetfss.com/ff52c3df-2896-47df-b8ae-f54a832fa777/tfss-4c09e2b0-cf1d-47a2-a5db-565679ba74dc-iowaspeedwaylogo.jpg",
"ChatEnabled": true,
"ConvoID": 15155,
"CreateDate": "/Date(1453765097003)/",
"Description": "Iowa Speedway is a 7/8-mile paved oval motor racing track in Newton, Iowa aka The Fastest short track on the planet.",
"Email": "",
"Facebook": "IowaSpeedway",
"Hash": "IowaSpeedway",
View gist:c718105a7c736f83b90b4b0879373d94
infix fun <T> Boolean.then(param:T):T? = if(this) param else null
infix fun <T> T.ifNot(param: T):T? = if (this.isNull()) param else this
{
val isFirst = false
Log.d("loog","${isFirst then "First" ifNot "Second"}")
}
// output "Second"
@RobertApikyan
RobertApikyan / MainActivity.kt
Created Mar 23, 2018
MainActivity code for segmented controll
View MainActivity.kt
package example.com.segmentedcontrollsupport
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import segmented_control.widget.custom.android.com.segmentedcontrol.SegmentedControl
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
View MapFragment.java
private void onCaptureClick() {
if (mMapBoxMap!=null){
mMapBoxMap.snapshot((Bitmap snapshot) ->
SendScreenshotDialogFragment
.show(snapshot,mainActivity.getSupportFragmentManager()));
}
}
View SendScreenshotDialogFragment.java
public static DialogFragment show(Bitmap bitmap, FragmentManager fragmentManager){
DialogFragment dialog = SendScreenshotDialogFragment.newInstance(bitmap);
dialog.show(fragmentManager, "SendScreenshotDialogFragment");
return dialog;
}
View gist:c99c3fca6c4d292e763948018d1c3c98
fun Date.toUTC(): Date {
var milliseconds = time
val offset = TimeZone.getDefault().getOffset(milliseconds).toLong()
milliseconds -= offset
return Date(milliseconds)
}