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

Commit b8e5e3a

Browse files
Auto-update
0 parents commit b8e5e3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3343
-0
lines changed

.google/packaging.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
# GOOGLE SAMPLE PACKAGING DATA
3+
#
4+
# This file is used by Google as part of our samples packaging process.
5+
# End users may safely ignore this file. It has no relevance to other systems.
6+
---
7+
status: DRAFT
8+
technologies: [Android]
9+
categories: [System]
10+
languages: [Java]
11+
solutions: [Mobile]
12+
github: android-RuntimePermissions
13+
level: BEGINNER
14+
icon: screenshots/big_icon.png
15+
apiRefs:
16+
- android:android.app.Activity
17+
- android:android.Manifest.permission
18+
license: apache2

Application/build.gradle

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
buildscript {
3+
repositories {
4+
jcenter()
5+
}
6+
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:1.1.0'
9+
}
10+
}
11+
12+
apply plugin: 'com.android.application'
13+
14+
repositories {
15+
jcenter()
16+
}
17+
18+
dependencies {
19+
compile "com.android.support:support-v4:21.0.2"
20+
compile "com.android.support:support-v13:21.0.2"
21+
compile "com.android.support:cardview-v7:21.0.2"
22+
compile 'com.android.support:appcompat-v7:21.+'
23+
}
24+
25+
// The sample build uses multiple directories to
26+
// keep boilerplate and common code separate from
27+
// the main sample code.
28+
List<String> dirs = [
29+
'main', // main sample code; look here for the interesting stuff.
30+
'common', // components that are reused by multiple samples
31+
'template'] // boilerplate code that is generated by the sample template process
32+
33+
android {
34+
compileSdkVersion "android-MNC"
35+
buildToolsVersion "22.0.1"
36+
37+
defaultConfig {
38+
minSdkVersion "MNC"
39+
targetSdkVersion "MNC"
40+
}
41+
42+
compileOptions {
43+
sourceCompatibility JavaVersion.VERSION_1_7
44+
targetCompatibility JavaVersion.VERSION_1_7
45+
}
46+
47+
sourceSets {
48+
main {
49+
dirs.each { dir ->
50+
java.srcDirs "src/${dir}/java"
51+
res.srcDirs "src/${dir}/res"
52+
}
53+
}
54+
androidTest.setRoot('tests')
55+
androidTest.java.srcDirs = ['tests/src']
56+
57+
}
58+
59+
}
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2015 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18+
package="com.example.android.system.runtimepermissions" >
19+
20+
<!-- BEGIN_INCLUDE(manifest) -->
21+
22+
<!-- Note that all required permissions are declared here in the Android manifest.
23+
On Android M and above, use of these permissions is only requested at run time. -->
24+
<uses-permission android:name="android.permission.CAMERA"/>
25+
26+
<!-- The following permissions are only requested if the device is on M or above.
27+
On older platforms these permissions are not requested and will not be available. -->
28+
<uses-permission-sdk-m android:name="android.permission.READ_CONTACTS" />
29+
<uses-permission-sdk-m android:name="android.permission.WRITE_CONTACTS" />
30+
31+
<!-- END_INCLUDE(manifest) -->
32+
33+
<application
34+
android:allowBackup="true"
35+
android:icon="@mipmap/ic_launcher"
36+
android:label="@string/app_name"
37+
android:theme="@style/AppTheme" >
38+
<activity
39+
android:name=".MainActivity"
40+
android:label="@string/app_name" >
41+
<intent-filter>
42+
<action android:name="android.intent.action.MAIN" />
43+
44+
<category android:name="android.intent.category.LAUNCHER" />
45+
</intent-filter>
46+
</activity>
47+
48+
</application>
49+
50+
</manifest>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2013 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.android.common.activities;
18+
19+
import android.os.Bundle;
20+
import android.support.v4.app.FragmentActivity;
21+
22+
import com.example.android.common.logger.Log;
23+
import com.example.android.common.logger.LogWrapper;
24+
25+
/**
26+
* Base launcher activity, to handle most of the common plumbing for samples.
27+
*/
28+
public class SampleActivityBase extends FragmentActivity {
29+
30+
public static final String TAG = "SampleActivityBase";
31+
32+
@Override
33+
protected void onCreate(Bundle savedInstanceState) {
34+
super.onCreate(savedInstanceState);
35+
}
36+
37+
@Override
38+
protected void onStart() {
39+
super.onStart();
40+
initializeLogging();
41+
}
42+
43+
/** Set up targets to receive log data */
44+
public void initializeLogging() {
45+
// Using Log, front-end to the logging chain, emulates android.util.log method signatures.
46+
// Wraps Android's native log framework
47+
LogWrapper logWrapper = new LogWrapper();
48+
Log.setLogNode(logWrapper);
49+
50+
Log.i(TAG, "Ready");
51+
}
52+
}

0 commit comments

Comments
 (0)