List of usage examples for android.widget LinearLayout addView
public void addView(View child, int index)
From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragmentKoopman.java
/** * Populate the koopman fragment item details item when the loader has finished * @param loader the cursor loader/*from w ww .j av a 2s . c o m*/ * @param data data object containing one or more koopman rows with joined sollicitatie data */ @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data != null && data.moveToFirst()) { boolean validSollicitatie = false; // get the markt id from the sharedprefs SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext()); int marktId = settings.getInt(getContext().getString(R.string.sharedpreferences_key_markt_id), 0); // make the koopman details visible mKoopmanDetail.setVisibility(View.VISIBLE); // check koopman status String koopmanStatus = data.getString(data.getColumnIndex("koopman_status")); mMeldingVerwijderd = koopmanStatus.equals(getString(R.string.koopman_status_verwijderd)); // koopman photo Glide.with(getContext()) .load(data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_FOTO_URL))) .error(R.drawable.no_koopman_image).into(mKoopmanFotoImage); // koopman naam String naam = data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_VOORLETTERS)) + " " + data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_ACHTERNAAM)); mKoopmanVoorlettersAchternaamText.setText(naam); // koopman erkenningsnummer mErkenningsnummer = data .getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_ERKENNINGSNUMMER)); mErkenningsnummerText.setText(mErkenningsnummer); // koopman sollicitaties View view = getView(); if (view != null) { LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout placeholderLayout = (LinearLayout) view.findViewById(R.id.sollicitaties_placeholder); placeholderLayout.removeAllViews(); // get vaste producten for selected markt, and add multiple markt sollicitatie views to the koopman items while (!data.isAfterLast()) { // get vaste producten for selected markt if (marktId > 0 && marktId == data .getInt(data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_MARKT_ID))) { String[] productParams = getResources().getStringArray(R.array.array_product_param); for (String product : productParams) { mProducten.put(product, data.getInt(data.getColumnIndex(product))); } } // inflate sollicitatie layout and populate its view items View childLayout = layoutInflater.inflate(R.layout.dagvergunning_koopman_item_sollicitatie, null); // highlight the sollicitatie for the current markt if (data.getCount() > 1 && marktId > 0 && marktId == data .getInt(data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_MARKT_ID))) { childLayout.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary)); } // markt afkorting String marktAfkorting = data .getString(data.getColumnIndex(MakkelijkeMarktProvider.Markt.COL_AFKORTING)); TextView marktAfkortingText = (TextView) childLayout .findViewById(R.id.sollicitatie_markt_afkorting); marktAfkortingText.setText(marktAfkorting); // koopman sollicitatienummer String sollicitatienummer = data.getString( data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_SOLLICITATIE_NUMMER)); TextView sollicitatienummerText = (TextView) childLayout .findViewById(R.id.sollicitatie_sollicitatie_nummer); sollicitatienummerText.setText(sollicitatienummer); // koopman sollicitatie status String sollicitatieStatus = data.getString(data.getColumnIndex("sollicitatie_status")); TextView sollicitatieStatusText = (TextView) childLayout.findViewById(R.id.sollicitatie_status); sollicitatieStatusText.setText(sollicitatieStatus); if (sollicitatieStatus != null && !sollicitatieStatus.equals("?") && !sollicitatieStatus.equals("")) { sollicitatieStatusText .setTextColor(ContextCompat.getColor(getContext(), android.R.color.white)); sollicitatieStatusText.setBackgroundColor(ContextCompat.getColor(getContext(), Utility.getSollicitatieStatusColor(getContext(), sollicitatieStatus))); // check if koopman has at least one valid sollicitatie on selected markt if (marktId == data .getInt(data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_MARKT_ID))) { validSollicitatie = true; } } // add view and move cursor to next placeholderLayout.addView(childLayout, data.getPosition()); data.moveToNext(); } } // check valid sollicitatie mMeldingNoValidSollicitatie = !validSollicitatie; // get the date of today for the dag param SimpleDateFormat sdf = new SimpleDateFormat(getString(R.string.date_format_dag)); String dag = sdf.format(new Date()); // check multiple dagvergunningen Cursor dagvergunningen = getContext().getContentResolver().query( MakkelijkeMarktProvider.mUriDagvergunningJoined, null, "dagvergunning_doorgehaald != '1' AND " + MakkelijkeMarktProvider.mTableDagvergunning + "." + MakkelijkeMarktProvider.Dagvergunning.COL_MARKT_ID + " = ? AND " + MakkelijkeMarktProvider.Dagvergunning.COL_DAG + " = ? AND " + MakkelijkeMarktProvider.Dagvergunning.COL_ERKENNINGSNUMMER_INVOER_WAARDE + " = ? ", new String[] { String.valueOf(marktId), dag, mErkenningsnummer, }, null); mMeldingMultipleDagvergunningen = (dagvergunningen != null && dagvergunningen.moveToFirst()) && (dagvergunningen.getCount() > 1 || mDagvergunningId == -1); if (dagvergunningen != null) { dagvergunningen.close(); } // callback to dagvergunning activity to updaten the meldingen view ((Callback) getActivity()).onMeldingenUpdated(); } }
From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragmentProduct.java
/** * * @param inflater//ww w . java 2s . co m * @param container * @param savedInstanceState * @return */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dagvergunning_fragment_product, container, false); // bind the elements to the view ButterKnife.bind(this, view); // get the producten from the sharedprefs and create the product selectors SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext()); String producten = settings .getString(getContext().getString(R.string.sharedpreferences_key_markt_producten), null); if (producten != null) { // split comma-separated string into list with product strings List<String> productList = Arrays.asList(producten.split(",")); if (productList.size() > 0) { String[] productKeys = getResources().getStringArray(R.array.array_product_key); String[] productTypes = getResources().getStringArray(R.array.array_product_type); String[] productTitles = getResources().getStringArray(R.array.array_product_title); // inflate the producten placeholder view LinearLayout placeholderLayout = (LinearLayout) view.findViewById(R.id.producten_placeholder); if (placeholderLayout != null) { placeholderLayout.removeAllViews(); LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // add multiple product item views to the placeholder view for (int i = 0; i < productList.size(); i++) { // get a resource id for the product int id = Utility.getResId("product_" + productList.get(i), R.id.class); if (id != -1) { // get the corresponding product type based on the productlist item value String productType = ""; for (int j = 0; j < productKeys.length; j++) { if (productKeys[j].equals(productList.get(i))) { productType = productTypes[j]; } } // get the product item layout depending on the product type View childLayout = null; if (productType.equals("integer")) { childLayout = layoutInflater.inflate(R.layout.dagvergunning_product_item_count, null); } else if (productType.equals("boolean")) { childLayout = layoutInflater.inflate(R.layout.dagvergunning_product_item_toggle, null); } if (childLayout != null) { childLayout.setId(id); // get the corresponding product title based on the productlist item value String productTitle = ""; for (int j = 0; j < productKeys.length; j++) { if (productKeys[j].equals(productList.get(i))) { productTitle = productTitles[j]; } } // set product name TextView productNameText = (TextView) childLayout.findViewById(R.id.product_name); productNameText.setText(productTitle); // if product type is integer add click handlers to +- buttons if (productType.equals("integer")) { // set onclickhandler on the - buttons to decrease the value of the product_count textview Button countDownButton = (Button) childLayout .findViewById(R.id.product_count_down); countDownButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeProductCountText(v, false); } }); // set onclickhandler on the + buttons to increase the value of the product_count textview Button countUpButton = (Button) childLayout.findViewById(R.id.product_count_up); countUpButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { changeProductCountText(v, true); } }); } // add view and move cursor to next product placeholderLayout.addView(childLayout, i); } } } } } } return view; }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createexamLayout/*from w w w. j a va2 s. c o m*/ * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // exam public void createexamLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutExam); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (examresGooruOid.size() > 4) { intial = examresGooruOid.size() - 5; } else { examRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.exam_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + examresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Exam"; resourceGooruId = examresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", examresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createslideLayout/*from w w w . ja v a 2 s . c om*/ * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // slide public void createslideLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutSlide); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (slideresGooruOid.size() > 4) { intial = slideresGooruOid.size() - 5; } else { slideRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.slides_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + slideresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Slide"; resourceGooruId = slideresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", slideresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name : createlessonLayout// www .ja va 2 s. co m * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // lesson public void createlessonLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutLesson); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (lessonresGooruOid.size() > 4) { intial = lessonresGooruOid.size() - 5; } else { lessonRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.lesson_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + lessonresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Lesson"; resourceGooruId = lessonresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", lessonresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createwebsiteLayout/*from ww w .j a va2 s . c om*/ * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // website public void createwebsiteLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutWebsite); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (websiteresGooruOid.size() > 4) { intial = websiteresGooruOid.size() - 5; } else { websiteRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.website_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + websiteresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Website"; resourceGooruId = websiteresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", websiteresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createhandoutLayout//www . ja v a 2 s .c o m * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // handout public void createhandoutLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutHandout); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (handoutresGooruOid.size() > 4) { intial = handoutresGooruOid.size() - 5; } else { handoutRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.handouts_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + handoutresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Handout"; resourceGooruId = handoutresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", handoutresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createtextbookLayout// w w w . j a v a 2 s.co m * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // textbook public void createtextbookLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutTextbook); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (textbookresGooruOid.size() > 4) { intial = textbookresGooruOid.size() - 5; } else { textbookRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.textbook_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + textbookresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Textbook"; resourceGooruId = textbookresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", textbookresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createinteractiveLayout * //from w w w .j a v a 2s . c o m * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // interactive public void createinteractiveLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutInteractive); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (interactiveresGooruOid.size() > 4) { intial = interactiveresGooruOid.size() - 5; } else { interactiveRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.interactive_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + interactiveresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Interactive"; resourceGooruId = interactiveresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", interactiveresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }