Swipe

Usability means understanding how users prefer to interact with apps.

Now, let’s resort to Java for this time. I want to show how to programmatically open and close a swiping pane!

 
			final WrappingSlidingPaneLayout swipeL = new WrappingSlidingPaneLayout(this);
			LinearLayout .LayoutParams SlayoutParams= new 
					LinearLayout .LayoutParams ( LinearLayout.LayoutParams.MATCH_PARENT, 
							LinearLayout.LayoutParams.WRAP_CONTENT);
			swipeL.setLayoutParams(SlayoutParams);
			
			LinearLayout detailL = new LinearLayout(this);
			detailL.setOrientation(LinearLayout.VERTICAL);
			swipeL.addView(detailL);
			swipeL.addView(newtweet);
			if (checkIcon.isChecked()) {
				ImageView newprofile = new ImageView(this);
				newprofile.setId(id);
				loadBitmap(newprofile,item.profile);
				tw_res.addView(newprofile);
			}
			tw_res.addView(opSw); 
			tw_res.addView(swipeL);
			opSw.setOnClickListener(new OnClickListener() {
				public void onClick(View v) {
					if (opSw.getText().toString().equals("open swipe")) {
						swipeL.openPane();
						opSw.setText("close swipe");
						return;
					}
					if (opSw.getText().toString().equals("close swipe")) {
						swipeL.closePane();
						opSw.setText("open swipe");
					}
				}
			}); 

Don’t forget to download my free open source (github project) twitting app from GooglePlay

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s