(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| def toCamelCase(String string) { | |
| String result = "" | |
| string.findAll("[^\\W]+") { String word -> | |
| result += word.capitalize() | |
| } | |
| return result | |
| } | |
| afterEvaluate { project -> | |
| Configuration runtimeConfiguration = project.configurations.getByName('compile') |
| package com.pascalwelsch.utils; | |
| import android.support.annotation.Nullable; | |
| import android.support.v7.util.DiffUtil; | |
| import android.support.v7.widget.RecyclerView; | |
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.Comparator; | |
| import java.util.List; |
| /** | |
| * Retrieves all the rows in the active spreadsheet that contain data and logs the | |
| * values for each row. | |
| * For more information on using the Spreadsheet API, see | |
| * https://developers.google.com/apps-script/service_spreadsheet | |
| */ | |
| function readRows() { | |
| var sheet = SpreadsheetApp.getActiveSheet(); | |
| var rows = sheet.getDataRange(); | |
| var numRows = rows.getNumRows(); |
| /* | |
| * Copyright 2013 Chris Banes | |
| * | |
| * 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 |
| import javafx.application.*; | |
| import javafx.geometry.Pos; | |
| import javafx.scene.*; | |
| import javafx.scene.control.Label; | |
| import javafx.scene.layout.*; | |
| import javafx.scene.paint.Color; | |
| import javafx.stage.*; | |
| import javax.imageio.ImageIO; | |
| import java.io.IOException; |
| ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image); | |
| Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
| //Default | |
| imageView.setBackgroundResource(R.drawable.rose); | |
| } else { | |
| //RoundCorners | |
| RoundCornersDrawable round = new RoundCornersDrawable(mBitmap, | |
| getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius |
| import android.content.Context; | |
| import android.os.Build; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.AttributeSet; | |
| import android.view.Gravity; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.view.animation.TranslateAnimation; | |
| import android.widget.FrameLayout; |
| AppCompat-v7:21 provides a very useful way of dealing with pressed/focused/activated states maintaining backwards compatibility downto API-7, but there's a small issue (big for some) with the default selectableItemBackground: It uses some PNGs and/or default values for API<21. | |
| The main reason is that android drawable resource definitions (prior API 21) CANNOT use theme attributes at all, so there's no way of making something like: | |
| <shape android:shape="rectangle"> | |
| <solid android:color="?attr/colorControlHighlight" /> | |
| </shape> | |
| For this, I've put this simple mockup on how to give your app better drawables that the appcompat defaults. |