Sharetap settings screen animation and text.

Change-Id: Ia19426be5a38a191a2786c1e75c4c5833a7c155f
This commit is contained in:
Martijn Coenen
2011-08-18 09:48:34 +02:00
parent ba36152bad
commit 82f92e500f
11 changed files with 79 additions and 12 deletions

BIN
res/drawable-hdpi/tap1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
res/drawable-hdpi/tap2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
res/drawable-hdpi/tap3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
res/drawable-hdpi/tap4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
res/drawable-hdpi/tap5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
res/drawable-hdpi/tap6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2011, 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.
*/
-->
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/tap1" android:duration="200" />
<item android:drawable="@drawable/tap2" android:duration="200" />
<item android:drawable="@drawable/tap3" android:duration="200" />
<item android:drawable="@drawable/tap4" android:duration="200" />
<item android:drawable="@drawable/tap5" android:duration="200" />
<item android:drawable="@drawable/tap6" android:duration="600" />
</animation-list>

View File

@@ -30,15 +30,31 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/zeroclick_explained"
<TextView android:id="@+id/sharetap_explained"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:gravity="top"
android:text="@string/zeroclick_explained"
/>
<ImageView android:id="@+id/sharetap_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView android:id="@+id/sharetap_safety"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:gravity="top"
android:text="@string/zeroclick_top"
/>
<TextView android:id="@+id/sharetap_safety"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:gravity="top"
android:text="@string/zeroclick_safety"
/>
</LinearLayout>
</ScrollView>

View File

@@ -1098,15 +1098,16 @@
<!-- NFC settings -->
<!-- Used in the 1st-level settings screen to turn on NFC -->
<string name="nfc_quick_toggle_title">NFC</string>
<!-- Used to enter the Zero-click sharing preferences screen -->
<string name="zeroclick_settings_title">Tap to share</string>
<!-- Used to enter the ShareTap sharing preferences screen -->
<string name="zeroclick_settings_title">ShareTap</string>
<string name="zeroclick_settings_summary"></string>
<string name="zeroclick_on_summary">On</string>
<string name="zeroclick_off_summary">Off</string>
<!-- Used in the zero-click sharing preferences screen -->
<string name="zeroclick_label">Zero-click sharing</string>
<string name="zeroclick_explained">Tap to share allows you to share content from applications, just by tapping your NFC-enabled device to another.</string>
<string name="zeroclick_label">ShareTap</string>
<string name="zeroclick_explained">Share content by touching two NFC-enabled devices back to back.</string>
<string name="zeroclick_top">The app on the top device\'s screen sends content to the bottom device.</string>
<string name="zeroclick_safety">Your data is safe: nothing is shared unless both devices are on and unlocked.</string>
<!-- Wi-Fi Settings --> <skip />
<!-- Used in the 1st-level settings screen to turn on Wi-Fi -->
<string name="wifi_quick_toggle_title">Wi-Fi</string>

View File

@@ -39,7 +39,7 @@
android:persistent="false" />
<PreferenceScreen
android:fragment="com.android.settings.nfc.ZeroClick"
android:fragment="com.android.settings.nfc.ShareTap"
android:key="zeroclick_settings"
android:title="@string/zeroclick_settings_title"
android:summary="@string/zeroclick_settings_summary" >

View File

@@ -19,20 +19,25 @@ package com.android.settings.nfc;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.graphics.drawable.AnimationDrawable;
import android.nfc.NfcAdapter;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceActivity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.Switch;
import com.android.settings.R;
public class ZeroClick extends Fragment
public class ShareTap extends Fragment
implements CompoundButton.OnCheckedChangeListener {
private View mView;
private AnimationDrawable mAnimation;
private ImageView mImageView;
private NfcAdapter mNfcAdapter;
private Switch mActionBarSwitch;
@@ -69,25 +74,42 @@ public class ZeroClick extends Fragment
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.zeroclick, container, false);
mView = inflater.inflate(R.layout.sharetap, container, false);
initView(mView);
return mView;
}
private void initView(View view) {
mNfcAdapter = NfcAdapter.getDefaultAdapter(getActivity());
mActionBarSwitch.setOnCheckedChangeListener(this);
mActionBarSwitch.setChecked(mNfcAdapter.isZeroClickEnabled());
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mImageView = (ImageView) getActivity().findViewById(R.id.sharetap_image);
mImageView.setBackgroundResource(R.drawable.sharetap_anim);
mAnimation = (AnimationDrawable) mImageView.getBackground();
}
@Override
public void onPause() {
super.onPause();
mAnimation.stop();
}
@Override
public void onResume() {
super.onResume();
// This is nasty: the animation can only be started once the fragment
// is attached to the window, and there are no callbacks for that.
mImageView.post(new Runnable() {
public void run() {
mAnimation.start();
}
});
}
@Override