diff options
author | Martijn Coenen <maco@google.com> | 2011-08-18 09:48:34 +0200 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2011-08-18 16:36:35 +0200 |
commit | 82f92e500f5b6848c9162584a7e70b6607d49f60 (patch) | |
tree | 99d706695fba1f5bcb50230988867e5d78c46959 /src | |
parent | ba36152badae29fae23d0c98ed176361032c95f7 (diff) | |
download | packages_apps_settings-82f92e500f5b6848c9162584a7e70b6607d49f60.zip packages_apps_settings-82f92e500f5b6848c9162584a7e70b6607d49f60.tar.gz packages_apps_settings-82f92e500f5b6848c9162584a7e70b6607d49f60.tar.bz2 |
Sharetap settings screen animation and text.
Change-Id: Ia19426be5a38a191a2786c1e75c4c5833a7c155f
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/nfc/ShareTap.java (renamed from src/com/android/settings/nfc/ZeroClick.java) | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/com/android/settings/nfc/ZeroClick.java b/src/com/android/settings/nfc/ShareTap.java index 1b59b52..e434781 100644 --- a/src/com/android/settings/nfc/ZeroClick.java +++ b/src/com/android/settings/nfc/ShareTap.java @@ -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 |