diff options
Diffstat (limited to 'samples/browseable/BasicAndroidKeyStore')
9 files changed, 135 insertions, 95 deletions
diff --git a/samples/browseable/BasicAndroidKeyStore/_index.jd b/samples/browseable/BasicAndroidKeyStore/_index.jd index a3d5960b1..5eedee8fa 100644 --- a/samples/browseable/BasicAndroidKeyStore/_index.jd +++ b/samples/browseable/BasicAndroidKeyStore/_index.jd @@ -3,12 +3,13 @@ sample.group=Security @jd:body <p> - - Welcome to the <b>Basic Android Key Store</b> sample!\n\n - This sample demonstrates how to use the Android Key Store to safely create and store - encryption keys that only your application can access. You can also sign data - using those keys.\n\n - To create a new KeyPair, click \"Create\".\n\n - To sign some data using a KeyPair, click \"Sign\".\n\n - To verify the data using the signature provided, click \"Verify\".\n\n + +Welcome to the <b>Basic Android Key Store</b> sample!\n\n +This sample demonstrates how to use the Android Key Store to safely create and store +encryption keys that only your application can access. You can also sign data +using those keys.\n\n +To create a new KeyPair, click \"Create\".\n\n +To sign some data using a KeyPair, click \"Sign\".\n\n +To verify the data using the signature provided, click \"Verify\".\n\n + </p> diff --git a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml index 653454bb2..8fed5f746 100644 --- a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml +++ b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml @@ -13,25 +13,30 @@ See the License for the specific language governing permissions and limitations under the License. --> -<LinearLayout +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="horizontal" - android:layout_width="fill_parent" - android:layout_height="fill_parent" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true" android:id="@+id/sample_main_layout"> - <TextView android:id="@+id/sample_output" - style="@style/Widget.SampleMessage" - android:background="@android:color/white" - android:layout_weight="1" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:text="@string/intro_message" - android:layout_margin="16dp" /> - <fragment - android:name="com.example.android.common.logger.LogFragment" - android:id="@+id/log_fragment" - android:layout_weight="1" + <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_margin="16dp" /> -</LinearLayout> + android:orientation="vertical"> + <TextView android:id="@+id/sample_output" + style="@style/Widget.SampleMessage" + android:background="@android:color/white" + android:layout_weight="1" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="@string/intro_message" + android:layout_margin="16dp" /> + <fragment + android:name="com.example.android.common.logger.LogFragment" + android:id="@+id/log_fragment" + android:layout_weight="1" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_margin="16dp" /> + </LinearLayout> +</ScrollView> diff --git a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml index 11cd71b8e..f811ef7dc 100644 --- a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml +++ b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml @@ -13,24 +13,28 @@ See the License for the specific language governing permissions and limitations under the License. --> -<LinearLayout +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true" android:id="@+id/sample_main_layout"> - <TextView android:id="@+id/sample_output" - style="@style/Widget.SampleMessage" - android:background="@android:color/white" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/intro_message" - android:padding="16dp" - android:layout_margin="16dp"/> - <fragment - android:name="com.example.android.common.logger.LogFragment" - android:id="@+id/log_fragment" + <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_margin="16dp" /> -</LinearLayout> + android:orientation="vertical"> + <TextView android:id="@+id/sample_output" + style="@style/Widget.SampleMessage" + android:background="@android:color/white" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="16dp" + android:layout_margin="16dp"/> + <fragment + android:name="com.example.android.common.logger.LogFragment" + android:id="@+id/log_fragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_margin="16dp" /> + </LinearLayout> +</ScrollView> diff --git a/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml b/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml index 6f41369cf..d17095875 100644 --- a/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml +++ b/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml @@ -13,27 +13,31 @@ See the License for the specific language governing permissions and limitations under the License. --> -<LinearLayout +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true" android:id="@+id/sample_main_layout"> - <TextView android:id="@+id/sample_output" - style="@style/Widget.SampleMessage" - android:layout_weight="1" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:text="@string/intro_message" - android:padding="16dp" /> - <View - android:layout_width="fill_parent" - android:layout_height="1dp" - android:background="@android:color/darker_gray"/> - <fragment - android:name="com.example.android.common.logger.LogFragment" - android:id="@+id/log_fragment" - android:layout_weight="1" + <LinearLayout android:layout_width="match_parent" - android:layout_height="match_parent" /> -</LinearLayout> + android:layout_height="match_parent" + android:orientation="vertical"> + <TextView android:id="@+id/sample_output" + style="@style/Widget.SampleMessage" + android:layout_weight="1" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="16dp" /> + <View + android:layout_width="fill_parent" + android:layout_height="1dp" + android:background="@android:color/darker_gray"/> + <fragment + android:name="com.example.android.common.logger.LogFragment" + android:id="@+id/log_fragment" + android:layout_weight="1" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + </LinearLayout> +</ScrollView> diff --git a/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-colors.xml b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-colors.xml new file mode 100644 index 000000000..34c9cd138 --- /dev/null +++ b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-colors.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<resources> + + +</resources> diff --git a/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-template-styles.xml b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-template-styles.xml new file mode 100644 index 000000000..0b2948f7e --- /dev/null +++ b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-template-styles.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<resources> + + <!-- Activity themes --> + <style name="Theme.Base" parent="android:Theme.Material.Light"> + </style> + +</resources> diff --git a/samples/browseable/BasicAndroidKeyStore/res/values-v21/template-styles.xml b/samples/browseable/BasicAndroidKeyStore/res/values-v21/template-styles.xml deleted file mode 100644 index 134fcd9d3..000000000 --- a/samples/browseable/BasicAndroidKeyStore/res/values-v21/template-styles.xml +++ /dev/null @@ -1,22 +0,0 @@ -<!-- - 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. - --> - -<resources> - - <!-- Activity themes --> - <style name="Theme.Base" parent="android:Theme.Material.Light" /> - -</resources> diff --git a/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml b/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml index 484618c0f..7a83818c1 100644 --- a/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml +++ b/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml @@ -19,14 +19,15 @@ <string name="intro_message"> <![CDATA[ - - Welcome to the <b>Basic Android Key Store</b> sample!\n\n - This sample demonstrates how to use the Android Key Store to safely create and store - encryption keys that only your application can access. You can also sign data - using those keys.\n\n - To create a new KeyPair, click \"Create\".\n\n - To sign some data using a KeyPair, click \"Sign\".\n\n - To verify the data using the signature provided, click \"Verify\".\n\n + +Welcome to the <b>Basic Android Key Store</b> sample!\n\n +This sample demonstrates how to use the Android Key Store to safely create and store +encryption keys that only your application can access. You can also sign data +using those keys.\n\n +To create a new KeyPair, click \"Create\".\n\n +To sign some data using a KeyPair, click \"Sign\".\n\n +To verify the data using the signature provided, click \"Verify\".\n\n + ]]> </string> diff --git a/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java b/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java index 7fd9466e2..f322af57f 100644 --- a/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java +++ b/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java @@ -19,6 +19,8 @@ package com.example.android.basicandroidkeystore; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; +import android.text.Html; +import android.widget.TextView; import android.view.Menu; import com.example.android.common.activities.SampleActivityBase; @@ -41,6 +43,8 @@ public class MainActivity extends SampleActivityBase { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + TextView sampleOutput = (TextView) findViewById(R.id.sample_output); + sampleOutput.setText(Html.fromHtml(getString(R.string.intro_message))); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); BasicAndroidKeyStoreFragment fragment = new BasicAndroidKeyStoreFragment(); @@ -75,4 +79,4 @@ public class MainActivity extends SampleActivityBase { Log.i(TAG, "Ready"); } -}
\ No newline at end of file +} |