View gist:08f6cb8546f80a9e5e78
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
/* | |
* 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
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.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
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"?> | |
<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
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"?> | |
<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
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
{ | |
"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
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
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" |
View MainActivity.kt
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 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
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
private void onCaptureClick() { | |
if (mMapBoxMap!=null){ | |
mMapBoxMap.snapshot((Bitmap snapshot) -> | |
SendScreenshotDialogFragment | |
.show(snapshot,mainActivity.getSupportFragmentManager())); | |
} | |
} |
View SendScreenshotDialogFragment.java
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 static DialogFragment show(Bitmap bitmap, FragmentManager fragmentManager){ | |
DialogFragment dialog = SendScreenshotDialogFragment.newInstance(bitmap); | |
dialog.show(fragmentManager, "SendScreenshotDialogFragment"); | |
return dialog; | |
} |
View gist:c99c3fca6c4d292e763948018d1c3c98
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 Date.toUTC(): Date { | |
var milliseconds = time | |
val offset = TimeZone.getDefault().getOffset(milliseconds).toLong() | |
milliseconds -= offset | |
return Date(milliseconds) | |
} |
OlderNewer