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
v.setOutlineProvider(ViewOutlineProvider.BOUNDS); | |
v.setElevation(10.0); | |
v.setTranslationZ(10.0); |
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
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
class SplashActivity: AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
// Make sure this is before calling super.onCreate | |
setTheme(R.style.AppTheme) | |
super.onCreate(savedInstanceState) |
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
class OrderCancellationComponent(private val context: Context, | |
private val api: Api, | |
private val orderNumber: String) { | |
interface Callbacks { | |
fun onOrderCancelledSuccessfully() | |
fun onOrderCancellationFailed() | |
} | |
var callbacks: Callbacks? = null // Callbacks for communication with the parent component |
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
// This layout will display its children with rounded corners | |
// It works with Glide image library placeholders and animations | |
// It assumes your background is a solid color. If you need the corners to be truly transparent, | |
// this solution will not work for you. | |
package com.myapp.ui; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.Canvas; |
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
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.text.TextUtils; | |
import android.util.AttributeSet; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewTreeObserver; | |
import android.view.ViewTreeObserver.OnGlobalLayoutListener; | |
import android.widget.FrameLayout; | |
import android.widget.TextView; |
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 (C) 2014 Antonio Leiva Gordillo. | |
* | |
* 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 |
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 2013 Evelio Tarazona Cáceres <evelio@evelio.info> | |
* | |
* 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 |
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
// app module build.gradle | |
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion rootProject.compileSdkVersion | |
buildToolsVersion rootProject.buildToolsVersion | |
defaultConfig { | |
applicationId "com.segunfamisa.gradleextraproperties" | |
minSdkVersion rootProject.minSdkVersion | |
targetSdkVersion rootProject.targetSdkVersion |
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 class BaseActivity extends AppCompatActivity | |
{ | |
public DrawerLayout drawerLayout; | |
public ListView drawerList; | |
private ActionBarDrawerToggle drawerToggle; | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
// R.id.drawer_layout should be in every activity with exactly the same id. | |
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); |
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
object MyReachability { | |
private fun hasNetworkAvailable(context: Context): Boolean { | |
val service = Context.CONNECTIVITY_SERVICE | |
val manager = context.getSystemService(service) as ConnectivityManager? | |
val network = manager?.activeNetworkInfo | |
Log.d(classTag, "hasNetworkAvailable: ${(network != null)}") | |
return (network?.isConnected) ?: false | |
} |