Panagiotis Triantafyllou

mfy fixes

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc75'
PUBLISH_VERSION = '4.5.4.6rc76'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -23,6 +23,7 @@ import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
......@@ -235,73 +236,133 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mIvBack.setOnClickListener(this);
mIvPopupClose.setOnClickListener(this);
if (mUniqueSectionList != null) {
if (mUniqueSectionList.size() == 1) {
try {
String firstKey = (String) mUniqueSectionList.keySet().toArray()[0];
if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) {
mTvResearchSection.setText(firstKey.substring(1));
mResearchItems.setNestedScrollingEnabled(false);
mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
mResearchItems.setAdapter(mAdapterResearch);
mAdapterResearch.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mLlResearchItems.setVisibility(View.VISIBLE);
}
} catch (IndexOutOfBoundsException ex) {
ex.printStackTrace();
if (mUniqueSectionList != null && mUniqueSectionList.size() > 0) {
for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) {
String itemKey = set.getKey();
ArrayList<Campaign> itemValue = set.getValue();
if (itemKey.contains("1")) {
mTvResearchSection.setText(itemKey.substring(1));
mResearchItems.setNestedScrollingEnabled(false);
mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterResearch = new MoreCampaignAdapter(this, itemValue);
mResearchItems.setAdapter(mAdapterResearch);
mAdapterResearch.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mLlResearchItems.setVisibility(View.VISIBLE);
}
}
if (mUniqueSectionList.size() == 2) {
try {
String secondKey = (String) mUniqueSectionList.keySet().toArray()[1];
if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) {
mTvExclusiveSection.setText(secondKey.substring(1));
mExclusiveItems.setNestedScrollingEnabled(false);
mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
mExclusiveItems.setAdapter(mAdapterExclusive);
mAdapterExclusive.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mLlExclusiveItems.setVisibility(View.VISIBLE);
}
} catch (IndexOutOfBoundsException ex) {
ex.printStackTrace();
for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) {
String itemKey = set.getKey();
ArrayList<Campaign> itemValue = set.getValue();
if (itemKey.contains("2")) {
mTvExclusiveSection.setText(itemKey.substring(1));
mExclusiveItems.setNestedScrollingEnabled(false);
mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterExclusive = new MoreCampaignAdapter(this, itemValue);
mExclusiveItems.setAdapter(mAdapterExclusive);
mAdapterExclusive.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mLlExclusiveItems.setVisibility(View.VISIBLE);
}
}
if (mUniqueSectionList.size() == 3) {
try {
String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2];
if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) {
mTvContestSection.setText(thirdKey.substring(1));
mContestItems.setNestedScrollingEnabled(false);
mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
mContestItems.setAdapter(mAdapterContest);
mAdapterContest.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mLlContestItems.setVisibility(View.VISIBLE);
}
} catch (IndexOutOfBoundsException ex) {
ex.printStackTrace();
for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) {
String itemKey = set.getKey();
ArrayList<Campaign> itemValue = set.getValue();
if (itemKey.contains("3")) {
mTvContestSection.setText(itemKey.substring(1));
mContestItems.setNestedScrollingEnabled(false);
mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterContest = new MoreCampaignAdapter(this, itemValue);
mContestItems.setAdapter(mAdapterContest);
mAdapterContest.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
.doOnError(error -> {
})
.subscribe();
mLlContestItems.setVisibility(View.VISIBLE);
}
}
// if (mUniqueSectionList.size() == 1) {
// try {
// String firstKey = (String) mUniqueSectionList.keySet().toArray()[0];
// if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) {
// mTvResearchSection.setText(firstKey.substring(1));
// mResearchItems.setNestedScrollingEnabled(false);
// mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
// mResearchItems.setAdapter(mAdapterResearch);
// mAdapterResearch.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
//
// mLlResearchItems.setVisibility(View.VISIBLE);
// }
// } catch (IndexOutOfBoundsException ex) {
// ex.printStackTrace();
// }
// }
//
// if (mUniqueSectionList.size() == 2) {
// try {
// String secondKey = (String) mUniqueSectionList.keySet().toArray()[1];
// if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) {
// mTvExclusiveSection.setText(secondKey.substring(1));
// mExclusiveItems.setNestedScrollingEnabled(false);
// mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
// mExclusiveItems.setAdapter(mAdapterExclusive);
// mAdapterExclusive.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
//
// mLlExclusiveItems.setVisibility(View.VISIBLE);
// }
// } catch (IndexOutOfBoundsException ex) {
// ex.printStackTrace();
// }
// }
//
// if (mUniqueSectionList.size() == 3) {
// try {
// String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2];
// if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) {
// mTvContestSection.setText(thirdKey.substring(1));
// mContestItems.setNestedScrollingEnabled(false);
// mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
// mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
// mContestItems.setAdapter(mAdapterContest);
// mAdapterContest.getPositionClicks()
// .doOnNext(this::handleMoreItemClick)
// .doOnError(error -> {
// })
// .subscribe();
//
// mLlContestItems.setVisibility(View.VISIBLE);
// }
// } catch (IndexOutOfBoundsException ex) {
// ex.printStackTrace();
// }
// }
if (mContextualList != null && mContextualList.size() > 0) {
mTvContextualSection.setText(getString(R.string.cos_mfy_other));
mContextualItems.setNestedScrollingEnabled(false);
......