From 895245abcc3a5c66c435f8e2c1f6657e3363dca0 Mon Sep 17 00:00:00 2001 From: chrqls Date: Tue, 31 Dec 2013 00:03:46 -0800 Subject: [PATCH] [#4] Adding comments and removing useless ids --- res/layout-large-land/preview_iqset_item.xml | 1 - .../use_prepared_questions_item.xml | 1 - .../smile/ui/adapter/IQSetListAdapter.java | 35 ++++--------------- 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/res/layout-large-land/preview_iqset_item.xml b/res/layout-large-land/preview_iqset_item.xml index 1ecdb83..2699558 100644 --- a/res/layout-large-land/preview_iqset_item.xml +++ b/res/layout-large-land/preview_iqset_item.xml @@ -31,7 +31,6 @@ android:layout_width="fill_parent" > diff --git a/res/layout-large-land/use_prepared_questions_item.xml b/res/layout-large-land/use_prepared_questions_item.xml index 5351a37..924967d 100644 --- a/res/layout-large-land/use_prepared_questions_item.xml +++ b/res/layout-large-land/use_prepared_questions_item.xml @@ -87,7 +87,6 @@ android:layout_gravity="center_vertical" android:layout_marginLeft="1dip" android:layout_marginRight="3dip" - android:background="@color/gray" android:textColor="@color/black" /> questionsOfIQSet = null; @@ -87,10 +88,12 @@ public View getView(int position, View convertView, ViewGroup parent) { } catch (NetworkErrorException e) { e.printStackTrace(); } + // ...to count the number of questions TextView tvSize = (TextView) convertView.findViewById(R.id.tv_size); if(size < 10) tvSize.setText("0"+String.valueOf(questionsOfIQSet.size())); else tvSize.setText(String.valueOf(questionsOfIQSet.size())); + // ...and get values for the preview if listener is called ImageView ivDetails = (ImageView) convertView.findViewById(R.id.iv_details); iqset.setQuestions(questionsOfIQSet); ivDetails.setOnClickListener(new OpenIQSetDetailsListener(iqset)); @@ -100,7 +103,7 @@ public View getView(int position, View convertView, ViewGroup parent) { } /** - * Class called to display the preview of an IQSet + * Listener called to display the preview of an IQSet */ private class OpenIQSetDetailsListener implements OnClickListener { @@ -125,6 +128,9 @@ public void onClick(View v) { } } +/** + * Preparing the Dialog to show a preview of IQSet + */ private void loadDetailOfIQSet(final Dialog detailsDialog, IQSet iqsetToPreview) { ImageButton btClose = (ImageButton) detailsDialog.findViewById(R.id.bt_close); @@ -136,32 +142,5 @@ private void loadDetailOfIQSet(final Dialog detailsDialog, IQSet iqsetToPreview) ListView lvQuestionsPreviewed = (ListView) detailsDialog.findViewById(R.id.lv_questions_preview); ArrayAdapter data = new IQSetPreviewAdapter(context, (List) iqsetToPreview.getQuestions()); lvQuestionsPreviewed.setAdapter(data); - -// ImageView tvImage = (ImageView) detailsDialog.findViewById(R.id.iv_image); - -// Display displaySize = ActivityUtil.getDisplaySize(context); -// float percentWidth = (float) (displaySize.getWidth() * 0.6); -// float percentHeight = (float) (displaySize.getHeight() * 0.6); -// int width = (int) (displaySize.getWidth() - percentWidth); -// int height = (int) (displaySize.getHeight() - percentHeight); -// LayoutParams lp = new LayoutParams(width, height); -// lp.setMargins(35, 20, 50, 0); -// tvImage.setLayoutParams(lp); - -// if (question.hasImage()) { -// byte[] data = ImageLoader.loadBitmap(Constants.HTTP + ip + question.getImageUrl()); -// -// if (data != null) { -// BitmapFactory.Options options = new BitmapFactory.Options(); -// Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options); -// if (bitmap != null) { -// tvImage.setImageBitmap(bitmap); -// } -// } - -// } else { -// tvImage.setVisibility(View.GONE); -// } - } }