Created
April 10, 2019 05:40
-
-
Save Harshhb101/e10feb2cccda9d698ff06487bbb879ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onBindViewHolder(final com.volga.alumnialliances.views.adapter.DashboardPostsAdapter.FeedViewHolder holder, final int position) { | |
//Setting the loader for the last item | |
if (position == getItemCount() - 1 && isLoading()){ | |
holder.loadingProgressBar.setVisibility(View.VISIBLE); | |
holder.bottom_view.setVisibility(View.GONE); | |
}else { | |
holder.loadingProgressBar.setVisibility(View.GONE); | |
holder.bottom_view.setVisibility(View.VISIBLE); | |
} | |
// Getting the items from the news feed object that consists of all the posts/feed | |
Item item = items.get(position); | |
//Adjusting the post layout and filling the info | |
String postType = item.getType(); | |
switch (postType) { | |
//Post for Business Requirements | |
case "business" : | |
holder.postImage.setVisibility(View.GONE); | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutCompany.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
holder.layoutEmail.setVisibility(View.VISIBLE); | |
holder.layoutWebsite.setVisibility(View.VISIBLE); | |
holder.layoutContact.setVisibility(View.VISIBLE); | |
//test code for youtube start | |
// holder.youTubePlayerSupportFragment.initialize("AIzaSyDJz96JR9_Hipmqnt9sYYPZzu7GeQKSKhs", new YouTubePlayer.OnInitializedListener() { | |
// @Override | |
// public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) { | |
// if (!b) { | |
// holder.myYouTubePlayer = youTubePlayer; | |
// | |
// //set the player style default | |
// youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT); | |
// | |
// //cue the 1st video by default | |
// youTubePlayer.cueVideo("https://www.youtube.com/watch?v=ubb8Cmc-Of0&list=RDyIdKbSeAueY&index=13"); | |
// } | |
// } | |
// | |
// @Override | |
// public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) { | |
// | |
// } | |
// }); | |
//test code for youtube end | |
//Setting the post action text | |
holder.postActionText.setText(mContext.getString(R.string.show_interest)); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_businessrequirements_icon); | |
holder.companyText.setText(item.getCompany().getName()); | |
//Handling multiple industries | |
if (item.getIndustries().size() > 0) | |
{ | |
String industries = ""; | |
for (Industry industry: item.getIndustries()){ | |
if (industries.length() == 0) | |
{ | |
industries = industry.getName(); | |
}else { | |
industries = industries + ", " + industry.getName(); | |
} | |
} | |
holder.industryText.setText(industries); | |
} | |
holder.locationText.setText(item.getLocations().get(0).getLocation()); | |
holder.emailText.setText(item.getContact().getEmail()); | |
holder.websiteText.setText(item.getContact().getWebsite().replaceFirst("^(http[s]?://www\\.|http[s]?://|www\\.)","www.")); | |
holder.contactText.setText(item.getContact().getPhone()); | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for Business Promotion | |
case "advertisment" : | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutCompany.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
holder.layoutEmail.setVisibility(View.VISIBLE); | |
holder.layoutWebsite.setVisibility(View.VISIBLE); | |
holder.layoutContact.setVisibility(View.VISIBLE); | |
//Setting the post action text | |
holder.postActionText.setText("I am Interested"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_businesspromotions_icon); | |
//Checking if the company has a tagline | |
if (item.getCompany().getTagLine().length() >0) | |
{ | |
holder.companyText.setText(item.getCompany().getName() + ", " + item.getCompany().getTagLine()); | |
}else { | |
holder.companyText.setText(item.getCompany().getName()); | |
} | |
//Handling multiple industries | |
if (item.getIndustries().size() > 0) | |
{ | |
String industries = ""; | |
for (Industry industry: item.getIndustries()){ | |
if (industries.length() == 0) | |
{ | |
industries = industry.getName(); | |
}else { | |
industries = industries + ", " + industry.getName(); | |
} | |
} | |
holder.industryText.setText(industries); | |
} | |
//Checking if the post has location or no | |
if (item.getLocations().size() == 0) | |
{ | |
holder.layoutLocation.setVisibility(View.GONE); | |
}else { | |
//Handling multiple locations | |
String locations = ""; | |
for (Location location: item.getLocations()){ | |
if (locations.length() == 0) | |
{ | |
locations = location.getLocation(); | |
}else { | |
locations = locations + "; " + location.getLocation(); | |
} | |
} | |
holder.locationText.setText(locations); | |
} | |
//Checking if the post has email or no | |
if (item.getContact().getEmail().length() == 0) | |
{ | |
holder.layoutEmail.setVisibility(View.GONE); | |
}else { | |
holder.emailText.setText(item.getContact().getEmail()); | |
} | |
//Checking if the post has website or no | |
if (item.getContact().getWebsite().length() == 0) | |
{ | |
holder.layoutWebsite.setVisibility(View.GONE); | |
}else { | |
holder.websiteText.setText(item.getContact().getWebsite().replaceFirst("^(http[s]?://www\\.|http[s]?://|www\\.)","www.")); | |
} | |
//Checking if the post has email or no | |
if (item.getContact().getPhone().length() == 0) | |
{ | |
holder.layoutContact.setVisibility(View.GONE); | |
}else { | |
holder.contactText.setText(item.getContact().getPhone()); | |
} | |
//Checking if post has attributes | |
if(item.getFeedAttributes() != null) | |
{ | |
holder.layoutAttributes.setVisibility(View.VISIBLE); | |
//Checking if post has only one attrib | |
if (item.getFeedAttributes().size() == 1) | |
{ | |
holder.layoutAttrib1.setVisibility(View.VISIBLE); | |
holder.attrib1Name.setText(item.getFeedAttributes().get(0).getName()); | |
holder.attrib1Value.setText(item.getFeedAttributes().get(0).getValue()); | |
holder.layoutAttrib2.setVisibility(View.GONE); | |
}else if(item.getFeedAttributes().size() > 1){ | |
//Showing max 2 attribs | |
holder.layoutAttrib1.setVisibility(View.VISIBLE); | |
holder.attrib1Name.setText(item.getFeedAttributes().get(0).getName()); | |
holder.attrib1Value.setText(item.getFeedAttributes().get(0).getValue()); | |
holder.layoutAttrib2.setVisibility(View.VISIBLE); | |
holder.attrib2Name.setText(item.getFeedAttributes().get(1).getName()); | |
holder.attrib2Value.setText(item.getFeedAttributes().get(1).getValue()); | |
} | |
}else{ | |
holder.layoutAttributes.setVisibility(View.GONE); | |
} | |
//Setting the Images, Videos and the Logo | |
if(item.getCompany().getLogo() != null){ | |
holder.postImage.setVisibility(View.VISIBLE); | |
Glide.with(mContext).load(item.getCompany().getLogo().getUrl()).into(holder.postImage); | |
}else { | |
holder.postImage.setVisibility(View.GONE); | |
} | |
//Populating media if any | |
implodeMedia(item, holder, position); | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for Investor Requirements | |
case "investment" : | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutEmail.setVisibility(View.GONE); | |
holder.layoutWebsite.setVisibility(View.GONE); | |
holder.layoutContact.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutCompany.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
holder.layoutInvestorType.setVisibility(View.VISIBLE); | |
//Setting the post action text | |
holder.postActionText.setText("Message"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_invest_icon); | |
// holder.companyText.setText(item.getCompany().getName()); | |
//Handling multiple industries | |
if (item.getIndustries().size() > 0) | |
{ | |
String industries = ""; | |
for (Industry industry: item.getIndustries()){ | |
if (industries.length() == 0) | |
{ | |
industries = industry.getName(); | |
}else { | |
industries = industries + ", " + industry.getName(); | |
} | |
} | |
holder.industryText.setText(industries); | |
} | |
//Checking if the post has location or no | |
if (item.getLocations().size() == 0) | |
{ | |
holder.layoutLocation.setVisibility(View.GONE); | |
}else { | |
//Handling multiple locations | |
String locations = ""; | |
for (Location location: item.getLocations()){ | |
if (locations.length() == 0) | |
{ | |
locations = location.getLocation(); | |
}else { | |
locations = locations + "; " + location.getLocation(); | |
} | |
} | |
holder.locationText.setText(locations); | |
} | |
//Checking if the owner is an "Individual Investor" or "Institutional Investor" by checking if company exists | |
if (item.getCompany() != null) | |
{ | |
holder.investorText.setText("Institutional Investor"); | |
holder.layoutInvestorCompany.setVisibility(View.VISIBLE); | |
holder.investorCompanyText.setText(item.getCompany().getName() + ", " + item.getCompany().getType() + ", " + item.getCompany().getCountry()); | |
}else { | |
holder.investorText.setText("Individual Investor"); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
} | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for Fund Raising | |
case "crowdfund" : | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.VISIBLE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutCompany.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
holder.layoutEmail.setVisibility(View.VISIBLE); | |
holder.layoutWebsite.setVisibility(View.VISIBLE); | |
holder.layoutContact.setVisibility(View.VISIBLE); | |
holder.layoutGoals.setVisibility(View.VISIBLE); | |
//Setting the post action text | |
holder.postActionText.setText("Show Interest"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_fundraising_icon); | |
//Populating the data into the views | |
Glide.with(mContext).load(item.getPostImage()).into(holder.postImage); | |
//Checking if the company has a tagline | |
if (item.getCompany().getTagLine().length() >0) | |
{ | |
holder.companyText.setText(item.getCompany().getName() + ", " + item.getCompany().getTagLine()); | |
}else { | |
holder.companyText.setText(item.getCompany().getName()); | |
} | |
//Handling multiple industries | |
if (item.getIndustries().size() > 0) | |
{ | |
String industries = ""; | |
for (Industry industry: item.getIndustries()){ | |
if (industries.length() == 0) | |
{ | |
industries = industry.getName(); | |
}else { | |
industries = industries + ", " + industry.getName(); | |
} | |
} | |
holder.industryText.setText(industries); | |
} | |
//Checking if the post has location or no | |
if (item.getLocations().size() == 0) | |
{ | |
holder.layoutLocation.setVisibility(View.GONE); | |
}else { | |
holder.locationText.setText(item.getLocations().get(0).getLocation()); | |
} | |
//Checking if the post has a video | |
for(Media media : item.getMedia()) | |
{ | |
if (media.getMediaType().equalsIgnoreCase("External")) | |
{ | |
if (media.getUrl().length() > 0) | |
{ | |
holder.layoutVideoLink.setVisibility(View.VISIBLE); | |
}else { | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
} | |
} | |
} | |
//Checking if the post has downloadable content | |
for(Media media : item.getMedia()) | |
{ | |
if (media.getMediaType().equalsIgnoreCase("InvestorDeck")) | |
{ | |
if (media.getUrl().length() > 0) | |
{ | |
holder.downloadPostContent.setVisibility(View.VISIBLE); | |
holder.downloadText.setText("Download Documents"); | |
holder.downloadIcon.setBackgroundResource(R.drawable.document_icon); | |
}else { | |
holder.downloadPostContent.setVisibility(View.GONE); | |
} | |
} | |
} | |
//Checking if post has contact info | |
if (item.getContact().getEmail().length() > 0) | |
{ | |
holder.emailText.setText(item.getContact().getEmail()); | |
}else { | |
holder.layoutEmail.setVisibility(View.GONE); | |
} | |
//Website | |
if (item.getContact().getWebsite().length() > 0) | |
{ | |
holder.websiteText.setText(item.getContact().getWebsite().replaceFirst("^(http[s]?://www\\.|http[s]?://|www\\.)","www.")); | |
}else { | |
holder.layoutWebsite.setVisibility(View.GONE); | |
} | |
//Contact | |
if (item.getContact().getPhone().length() > 0) | |
{ | |
holder.contactText.setText(item.getContact().getPhone()); | |
}else { | |
holder.layoutContact.setVisibility(View.GONE); | |
} | |
//Populating Goal Info | |
//Converting the amount into money format | |
double moneyRaised = item.getCrowdfundAmountDetails().getAmountRaised(); | |
double goal = item.getCrowdfundAmountDetails().getGoal(); | |
double minAmount = item.getCrowdfundAmountDetails().getMinOffering(); | |
double maxAmount = item.getCrowdfundAmountDetails().getMaxOffering(); | |
DecimalFormatSymbols symbols = new DecimalFormatSymbols(); | |
symbols.setGroupingSeparator(','); | |
DecimalFormat decimalFormat = new DecimalFormat("$#,###", symbols); | |
String moneyRaisedFinal = decimalFormat.format(moneyRaised); | |
String minAmountFinal = decimalFormat.format(minAmount); | |
String maxAmountFinal = decimalFormat.format(maxAmount); | |
String goalFinal = decimalFormat.format(goal); | |
// holder.amountRaised.setText("$" + item.getCrowdfundAmountDetails().getAmountRaised() + " of $" + item.getCrowdfundAmountDetails().getGoal() + " Raised"); | |
// holder.minAmount.setText("$" + item.getCrowdfundAmountDetails().getMinOffering() + " (Min)"); | |
// holder.maxAmount.setText("$" + item.getCrowdfundAmountDetails().getMaxOffering() + " (Max)"); | |
holder.amountRaised.setText(moneyRaisedFinal + " of " + goalFinal + " Raised"); | |
holder.minAmount.setText(minAmountFinal + " (Min)"); | |
holder.maxAmount.setText(maxAmountFinal + " (Max)"); | |
//Calculating the percentage raised and populating it | |
float raised = (float) item.getCrowdfundAmountDetails().getAmountRaised(); | |
float total = (float) item.getCrowdfundAmountDetails().getGoal(); | |
float percentRaised = (raised / total) *100; | |
DecimalFormat numberFormat1 = new DecimalFormat("#0.00"); | |
String percentString = numberFormat1.format(percentRaised); | |
String[] parts = percentString.split(Pattern.quote(".")); | |
if (parts.length > 1 && parts[1].equalsIgnoreCase("00")) { | |
holder.achievedPercent.setText(parts[0] + "% of Goal"); | |
}else { | |
holder.achievedPercent.setText(percentString + "% of Goal"); | |
} | |
//Populating the progress bar | |
holder.goalProgressBar.setProgress(((int) percentRaised)); | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for Searching jobs | |
case "job" : | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutCompany.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutEmail.setVisibility(View.GONE); | |
holder.layoutWebsite.setVisibility(View.GONE); | |
holder.layoutContact.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutTypeOfJob.setVisibility(View.VISIBLE); | |
holder.layoutExperience.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
holder.downloadPostContent.setVisibility(View.VISIBLE); | |
//Setting the post action text | |
holder.postActionText.setText("Apply"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_jobseekers_icon); | |
holder.jobTypeText.setText(item.getJobDetails().getJobTypeName()); | |
holder.locationText.setText(item.getLocations().get(0).getLocation()); | |
//Checking if the post has downloadable content | |
if (item.getMedia() != null){ | |
holder.downloadText.setText("Download Resume"); | |
holder.downloadIcon.setBackgroundResource(R.drawable.download_icon); | |
}else { | |
holder.downloadPostContent.setVisibility(View.GONE); | |
} | |
//Checking if more that one year of experience and hence change the text from "year" to "years" | |
if (item.getJobDetails().getExperience() == 0) { | |
holder.experienceText.setText("Fresher"); | |
}else if (item.getJobDetails().getExperience() == 1){ | |
holder.experienceText.setText(item.getJobDetails().getExperience() + "+ year"); | |
}else { | |
holder.experienceText.setText(item.getJobDetails().getExperience() + "+ years"); | |
} | |
//Handling multiple industries | |
if (item.getIndustries().size() > 0) | |
{ | |
String industries = ""; | |
for (Industry industry: item.getIndustries()){ | |
if (industries.length() == 0) | |
{ | |
industries = industry.getName(); | |
}else { | |
industries = industries + ", " + industry.getName(); | |
} | |
} | |
holder.industryText.setText(industries); | |
} | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for Recruitment | |
case "recruitment" : | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutCompany.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutEmail.setVisibility(View.GONE); | |
holder.layoutWebsite.setVisibility(View.GONE); | |
holder.layoutContact.setVisibility(View.GONE); | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutTypeOfJob.setVisibility(View.VISIBLE); | |
holder.layoutExperience.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
//Setting the post action text | |
holder.postActionText.setText("Message"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_recruittalent_icon); | |
holder.jobTypeText.setText(item.getJobDetails().getJobTypeName()); | |
holder.locationText.setText(item.getLocations().get(0).getLocation()); | |
//Checking if more that one year of experience and hence change the text from "year" to "years" | |
if (item.getJobDetails().getExperience() == 0) { | |
holder.experienceText.setText("Fresher"); | |
}else if (item.getJobDetails().getExperience() == 1){ | |
holder.experienceText.setText(item.getJobDetails().getExperience() + "+ year"); | |
}else { | |
holder.experienceText.setText(item.getJobDetails().getExperience() + "+ years"); | |
} | |
//Handling multiple industries | |
if (item.getIndustries().size() > 0) | |
{ | |
String industries = ""; | |
for (Industry industry: item.getIndustries()){ | |
if (industries.length() == 0) | |
{ | |
industries = industry.getName(); | |
}else { | |
industries = industries + ", " + industry.getName(); | |
} | |
} | |
holder.industryText.setText(industries); | |
} | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for mentees seeking mentorship | |
case "mentorship" : | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutEmail.setVisibility(View.GONE); | |
holder.layoutWebsite.setVisibility(View.GONE); | |
holder.layoutContact.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutCompany.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
//Setting the post action text | |
holder.postActionText.setText("Message"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_seekmentorship_icon); | |
holder.industryText.setText(item.getIndustries().get(0).getName()); | |
//Checking if the post has location or no | |
if (item.getLocations().size() == 0) | |
{ | |
holder.layoutLocation.setVisibility(View.GONE); | |
}else { | |
//Handling multiple locations | |
String locations = ""; | |
for (Location location: item.getLocations()){ | |
if (locations.length() == 0) | |
{ | |
locations = location.getLocation(); | |
}else { | |
locations = locations + "; " + location.getLocation(); | |
} | |
} | |
holder.locationText.setText(locations); | |
} | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for mentors seeking mentees | |
case "mentor" : | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutEmail.setVisibility(View.GONE); | |
holder.layoutWebsite.setVisibility(View.GONE); | |
holder.layoutContact.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutCompany.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
holder.layoutIndustry.setVisibility(View.VISIBLE); | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
//Setting the post action text | |
holder.postActionText.setText("Message"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.VISIBLE); | |
holder.typeOfPostIcon.setImageResource(R.drawable.post_mentorothers_icon); | |
//Handling multiple industries | |
if (item.getIndustries().size() > 0) | |
{ | |
String industries = ""; | |
for (Industry industry: item.getIndustries()){ | |
if (industries.length() == 0) | |
{ | |
industries = industry.getName(); | |
}else { | |
industries = industries + ", " + industry.getName(); | |
} | |
} | |
holder.industryText.setText(industries); | |
} | |
//Checking if the post has location or no | |
if (item.getLocations().size() == 0) | |
{ | |
holder.layoutLocation.setVisibility(View.GONE); | |
}else { | |
//Handling multiple locations | |
String locations = ""; | |
for (Location location: item.getLocations()){ | |
if (locations.length() == 0) | |
{ | |
locations = location.getLocation(); | |
}else { | |
locations = locations + "; " + location.getLocation(); | |
} | |
} | |
holder.locationText.setText(locations); | |
} | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post for networking | |
case "networking" : | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutEmail.setVisibility(View.GONE); | |
holder.layoutWebsite.setVisibility(View.GONE); | |
holder.layoutContact.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutCompany.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.GONE); | |
holder.layoutIndustry.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
//Setting the post action text | |
holder.postActionText.setText("Message"); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.GONE); | |
//Checking if the post has location or no | |
if (item.getLocations().size() == 0) | |
{ | |
holder.layoutLocation.setVisibility(View.GONE); | |
holder.layoutLocation.setVisibility(View.GONE); | |
}else { | |
//Handling multiple locations | |
String locations = ""; | |
for (Location location: item.getLocations()){ | |
if (locations.length() == 0) | |
{ | |
locations = location.getLocation(); | |
}else { | |
locations = locations + "; " + location.getLocation(); | |
} | |
} | |
holder.layoutLocation.setVisibility(View.VISIBLE); | |
holder.locationText.setText(locations); | |
} | |
//Populating media if any | |
implodeMedia(item, holder, position); | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
//Post from Newswire | |
case "newsWire" : | |
holder.downloadPostContent.setVisibility(View.GONE); | |
holder.layoutExperience.setVisibility(View.GONE); | |
holder.layoutTypeOfJob.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.postImage.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutEmail.setVisibility(View.GONE); | |
holder.layoutWebsite.setVisibility(View.GONE); | |
holder.layoutContact.setVisibility(View.GONE); | |
holder.layoutGoals.setVisibility(View.GONE); | |
holder.layoutVideoLink.setVisibility(View.GONE); | |
holder.layoutCompany.setVisibility(View.GONE); | |
holder.layoutInvestorType.setVisibility(View.GONE); | |
holder.layoutAttributes.setVisibility(View.GONE); | |
holder.layoutInvestorCompany.setVisibility(View.GONE); | |
holder.layoutIndustry.setVisibility(View.GONE); | |
holder.layoutLocation.setVisibility(View.GONE); | |
holder.layoutImageGallery.removeAllViews(); | |
holder.layoutImageGallery.setVisibility(View.GONE); | |
holder.layoutPostAction.setVisibility(View.GONE); | |
holder.postDesc.setVisibility(View.VISIBLE); | |
//Setting the post type image | |
holder.typeOfPostIcon.setVisibility(View.GONE); | |
//Populating media if any | |
implodeMedia(item, holder, position); | |
//Populating the basic information such Title, Time etc | |
try { | |
populateBasicData(holder, item); | |
} catch (ParseException e) { | |
e.printStackTrace(); | |
} | |
break; | |
default: | |
Log.e("Unknown Post Type", postType); | |
break; | |
} | |
//End of Switch | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment