Java Code Examples for android.content.Intent#getSourceBounds()

The following examples show how to use android.content.Intent#getSourceBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OneKeyWifi.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	setContentView(R.layout.wifi_onekey);
	final Intent intent = getIntent();
	SharedPreferences localSharedPreferences = OneKeyWifi.this
			.getSharedPreferences("User_Data", 0);
	String str1 = localSharedPreferences.getString("wifi_Account", "");
	String str2 = localSharedPreferences.getString("wifi_Password", "");
	try {
		Account = BosCrypto.decrypt(BosCrypto.Excalibur, str1);
		Password = BosCrypto.decrypt(BosCrypto.Excalibur, str2);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	wifiManager = (WifiManager) OneKeyWifi.this
			.getSystemService(Context.WIFI_SERVICE);
	bg = (FrameLayout) findViewById(R.id.anim_layout);
	Rect rect = intent.getSourceBounds();
	if (rect != null) {
		// int i = getResources().getDimensionPixelSize(0x7f0b001d);
		int i = 5;
		int j = rect.left + rect.width() / 2;
		int k = i + rect.top;
		android.widget.RelativeLayout.LayoutParams layoutparams = (android.widget.RelativeLayout.LayoutParams) bg
				.getLayoutParams();
		layoutparams.leftMargin = j - layoutparams.width / 2;
		layoutparams.topMargin = k - layoutparams.height / 2;
		bg.setLayoutParams(layoutparams);
	}
	final ImageView iv = (ImageView) findViewById(R.id.anim_image);
	iv.setScaleType(ScaleType.CENTER);

	final InputStream is = getResources().openRawResource(
			R.drawable.wifi_onekey_cat);
	final GifFrame[] frames = CommonUtil.getGif(is);
	// System.out.println("delay:" + frames[1].delay + ",size:"
	// + frames.length);
	if (GetWifiStatus())
		new Thread(new OnlineThread()).start();
	else
		CheckNetwork();
	// new Thread(new OnlineThread()).start();
	mGifTask = new PlayGifTask(iv, frames);
	mGifTask.start();
}