Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Auto-update
Browse files Browse the repository at this point in the history
  • Loading branch information
google-automerger committed Feb 16, 2018
1 parent 2a20c26 commit f07019d
Show file tree
Hide file tree
Showing 29 changed files with 876 additions and 462 deletions.
14 changes: 6 additions & 8 deletions Application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
buildscript {
repositories {
jcenter()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

apply plugin: 'com.android.application'

repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
google()
}

dependencies {
Expand All @@ -31,14 +30,13 @@ List<String> dirs = [
'template'] // boilerplate code that is generated by the sample template process

android {

compileSdkVersion 26
compileSdkVersion 27

buildToolsVersion "26.0.1"
buildToolsVersion "27.0.2"

defaultConfig {
minSdkVersion 7
targetSdkVersion 26
targetSdkVersion 27
}

compileOptions {
Expand Down
444 changes: 0 additions & 444 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Android 5.0.
Pre-requisites
--------------

- Android SDK 26
- Android Build Tools v26.0.1
- Android SDK 27
- Android Build Tools v27.0.2
- Android Support Repository

Getting Started
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
11 changes: 4 additions & 7 deletions packaging.yaml → kotlinApp/.google/packaging.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# GOOGLE SAMPLE PACKAGING DATA
#
# This file is used by Google as part of our samples packaging process.
Expand All @@ -6,11 +7,7 @@
status: PUBLISHED
technologies: [Android]
categories: [UI]
languages: [Java]
languages: [Kotlin]
solutions: [Mobile]
github: googlesamples/android-CardView
level: INTERMEDIATE
icon: CardViewSample/src/main/res/drawable-xxhdpi/ic_launcher.png
doc_refs:
- android:preview/material/ui-widgets.html
license: apache2
github: android-CardView
license: apache2
36 changes: 36 additions & 0 deletions kotlinApp/Application/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.example.android.cardview"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

sourceSets {
main {
java.srcDirs "src/main/java"
res.srcDirs "src/main/res"
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}

dependencies {
implementation'com.android.support:cardview-v7:27.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$rootProject.ext.kotlinVersion"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.ext.espressoVersion"
}
36 changes: 36 additions & 0 deletions kotlinApp/Application/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2017 The Android Open Source Project
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
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.cardview">

<application
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".CardViewActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.android.cardview

import android.app.Activity
import android.os.Bundle

/**
* Launcher Activity for the CardView sample app.
*/
class CardViewActivity : Activity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_card_view)
if (savedInstanceState == null) {
fragmentManager.beginTransaction()
.add(R.id.container, CardViewFragment())
.commit()
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.android.cardview

import android.app.Fragment
import android.os.Bundle
import android.support.annotation.VisibleForTesting
import android.support.v7.widget.CardView
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.SeekBar

/**
* Fragment that demonstrates how to use [CardView].
*/
class CardViewFragment : Fragment() {

private val TAG = "CardViewFragment"

// The [CardView] widget.
@VisibleForTesting lateinit var cardView: CardView

// SeekBar that changes the cornerRadius attribute for the cardView widget.
@VisibleForTesting lateinit var radiusSeekBar: SeekBar

// SeekBar that changes the Elevation attribute for the cardView widget.
@VisibleForTesting lateinit var elevationSeekBar: SeekBar

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return inflater.inflate(R.layout.fragment_card_view, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
cardView = view.findViewById(R.id.cardview)

radiusSeekBar = view.findViewById(R.id.cardview_radius_seekbar)
radiusSeekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
Log.d(TAG, "SeekBar Radius progress: $progress")
cardView.radius = progress.toFloat()
}

override fun onStartTrackingTouch(seekBar: SeekBar) = Unit // Do nothing

override fun onStopTrackingTouch(seekBar: SeekBar) = Unit // Do nothing
})

elevationSeekBar = view.findViewById(R.id.cardview_elevation_seekbar)
elevationSeekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
Log.d(TAG, "SeekBar Elevation progress : $progress")
cardView.elevation = progress.toFloat()
}

override fun onStartTrackingTouch(seekBar: SeekBar) = Unit // Do nothing

override fun onStopTrackingTouch(seekBar: SeekBar) = Unit // Do nothing
})
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions kotlinApp/Application/src/main/res/layout/activity_card_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2017 The Android Open Source Project
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
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.android.cardview.CardViewActivity"
tools:ignore="MergeRootFrame" />
91 changes: 91 additions & 0 deletions kotlinApp/Application/src/main/res/layout/fragment_card_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2017 The Android Open Source Project
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
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">

<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">

<android.support.v7.widget.CardView
android:id="@+id/cardview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:elevation="@dimen/card_elevation"
card_view:cardBackgroundColor="@color/cardview_initial_background"
card_view:cardCornerRadius="@dimen/card_radius"
android:layout_marginLeft="@dimen/margin_large"
android:layout_marginRight="@dimen/margin_large">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_medium"
android:text="@string/cardview_contents"/>

</android.support.v7.widget.CardView>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_large"
android:orientation="horizontal">

<TextView
android:layout_width="@dimen/seekbar_label_length"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/cardview_radius_seekbar_text" />

<SeekBar
android:id="@+id/cardview_radius_seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_medium"/>

</LinearLayout>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:layout_width="@dimen/seekbar_label_length"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/cardview_elevation_seekbar_text"/>

<SeekBar
android:id="@+id/cardview_elevation_seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_medium"/>

</LinearLayout>

</LinearLayout>

</ScrollView>

Loading

0 comments on commit f07019d

Please sign in to comment.