- basic build.gradle directory using flatDir
repositories {
mavenCentral()
flatDir {
dirs 'libs'| #!/bin/bash | |
| # Script adb+ | |
| # Usage | |
| # You can run any command adb provides on all your currently connected devices | |
| # ./adb+ <command> is the equivalent of ./adb -s <serial number> <command> | |
| # | |
| # Examples | |
| # ./adb+ version | |
| # ./adb+ install apidemo.apk | |
| # ./adb+ uninstall com.example.android.apis |
| package org.lucasr.layoutsamples.canvas; | |
| import android.os.Build; | |
| import android.text.Layout.Alignment; | |
| import android.text.StaticLayout; | |
| import android.text.TextDirectionHeuristic; | |
| import android.text.TextDirectionHeuristics; | |
| import android.text.TextPaint; | |
| import android.text.TextUtils.TruncateAt; | |
| import android.util.Log; |
| /* | |
| * Copyright (C) 2014 skyfish.jy@gmail.com | |
| * | |
| * 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 |
| struct DictionaryTwoWay<S:Hashable,T:Hashable> : DictionaryLiteralConvertible | |
| { | |
| // Literal convertible | |
| typealias Key = S | |
| typealias Value = T | |
| // Real storage | |
| private var st : [S : T] = [:] | |
| private var ts : [T : S] = [:] | |
| import java.util.Arrays; | |
| class NonCapturing { | |
| public static void main(String... args) { | |
| run(new Runnable() { | |
| @Override public void run() { | |
| System.out.println("Hey!"); | |
| } | |
| }); | |
| } |
| import RxSwift // Version 3.2.0 | |
| import RxCocoa // Version 3.2.0 | |
| func keyboardHeight() -> Observable<CGFloat> { | |
| return Observable | |
| .from([ | |
| NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillShow) | |
| .map { notification -> CGFloat in | |
| (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0 | |
| }, |
| // Fonts can be created with UIFont.preferredFont(forTextStyle:), but there's | |
| // no direct way to find out what textStyle a font was created with. | |
| // | |
| // Requires: Swift 4.2, iOS 11 | |
| extension UIFont { | |
| // Can be nil if the font was created using another method other than UIFont.preferredFont(forTextStyle:) | |
| var textStyle: TextStyle? { | |
| guard let styleName = fontDescriptor.fontAttributes[.textStyle] as? String else { | |
| return nil | |
| } |