This repository has been archived by the owner on Sep 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2b80a99
Showing
36 changed files
with
1,388 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:0.12.+' | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
|
||
|
||
dependencies { | ||
|
||
|
||
compile "com.android.support:cardview-v7:21.+" | ||
} | ||
|
||
// The sample build uses multiple directories to | ||
// keep boilerplate and common code separate from | ||
// the main sample code. | ||
List<String> dirs = [ | ||
'main', // main sample code; look here for the interesting stuff. | ||
'common', // components that are reused by multiple samples | ||
'template'] // boilerplate code that is generated by the sample template process | ||
|
||
android { | ||
compileSdkVersion "android-L" | ||
|
||
buildToolsVersion "20.0.0" | ||
|
||
sourceSets { | ||
main { | ||
dirs.each { dir -> | ||
java.srcDirs "src/${dir}/java" | ||
res.srcDirs "src/${dir}/res" | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2014 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" | ||
android:versionCode="1" | ||
android:versionName="1.0" > | ||
|
||
<application | ||
android:allowBackup="true" | ||
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> |
37 changes: 37 additions & 0 deletions
37
Application/src/main/java/com/example/android/cardview/CardViewActivity.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2014 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. | ||
*/ | ||
public class CardViewActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_card_view); | ||
if (savedInstanceState == null) { | ||
getFragmentManager().beginTransaction() | ||
.add(R.id.container, CardViewFragment.newInstance()) | ||
.commit(); | ||
} | ||
} | ||
} |
120 changes: 120 additions & 0 deletions
120
Application/src/main/java/com/example/android/cardview/CardViewFragment.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* Copyright 2014 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.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. | ||
*/ | ||
public class CardViewFragment extends Fragment { | ||
|
||
private static final String TAG = CardViewFragment.class.getSimpleName(); | ||
|
||
/** The CardView widget. */ | ||
//@VisibleForTesting | ||
CardView mCardView; | ||
|
||
/** | ||
* SeekBar that changes the cornerRadius attribute for the {@link #mCardView} widget. | ||
*/ | ||
//@VisibleForTesting | ||
SeekBar mRadiusSeekBar; | ||
|
||
/** | ||
* SeekBar that changes the Elevation attribute for the {@link #mCardView} widget. | ||
*/ | ||
//@VisibleForTesting | ||
SeekBar mElevationSeekBar; | ||
|
||
/** | ||
* Use this factory method to create a new instance of | ||
* this fragment using the provided parameters. | ||
* | ||
* @return A new instance of fragment NotificationFragment. | ||
*/ | ||
public static CardViewFragment newInstance() { | ||
CardViewFragment fragment = new CardViewFragment(); | ||
fragment.setRetainInstance(true); | ||
return fragment; | ||
} | ||
|
||
public CardViewFragment() { | ||
// Required empty public constructor | ||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_card_view, container, false); | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
mCardView = (CardView) view.findViewById(R.id.cardview); | ||
mRadiusSeekBar = (SeekBar) view.findViewById(R.id.cardview_radius_seekbar); | ||
mRadiusSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { | ||
@Override | ||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | ||
Log.d(TAG, String.format("SeekBar Radius progress : %d", progress)); | ||
mCardView.setRadius(progress); | ||
} | ||
@Override | ||
public void onStartTrackingTouch(SeekBar seekBar) { | ||
//Do nothing | ||
} | ||
|
||
@Override | ||
public void onStopTrackingTouch(SeekBar seekBar) { | ||
//Do nothing | ||
} | ||
}); | ||
|
||
mElevationSeekBar = (SeekBar) view.findViewById(R.id.cardview_elevation_seekbar); | ||
mElevationSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { | ||
@Override | ||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | ||
Log.d(TAG, String.format("SeekBar Elevation progress : %d", progress)); | ||
mCardView.setElevation(progress); | ||
} | ||
@Override | ||
public void onStartTrackingTouch(SeekBar seekBar) { | ||
//Do nothing | ||
} | ||
|
||
@Override | ||
public void onStopTrackingTouch(SeekBar seekBar) { | ||
//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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2014 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" /> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- | ||
Copyright 2013 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. | ||
--> | ||
|
||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<LinearLayout style="@style/Widget.SampleMessageTile" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<TextView style="@style/Widget.SampleMessage" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="@dimen/horizontal_page_margin" | ||
android:layout_marginRight="@dimen/horizontal_page_margin" | ||
android:layout_marginTop="@dimen/vertical_page_margin" | ||
android:layout_marginBottom="@dimen/vertical_page_margin" | ||
android:text="@string/intro_message" /> | ||
</LinearLayout> | ||
</LinearLayout> |
Oops, something went wrong.