Showing
3 changed files
with
90 additions
and
30 deletions
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
| 2 | 2 | ||
| 3 | ext { | 3 | ext { |
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
| 5 | - PUBLISH_VERSION = '4.5.4.6rc75' | 5 | + PUBLISH_VERSION = '4.5.4.6rc76' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 7 | } |
| 8 | 8 | ... | ... |
| ... | @@ -23,6 +23,7 @@ import org.json.JSONObject; | ... | @@ -23,6 +23,7 @@ import org.json.JSONObject; |
| 23 | import java.io.Serializable; | 23 | import java.io.Serializable; |
| 24 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
| 25 | import java.util.HashMap; | 25 | import java.util.HashMap; |
| 26 | +import java.util.Iterator; | ||
| 26 | import java.util.Map; | 27 | import java.util.Map; |
| 27 | import java.util.TreeMap; | 28 | import java.util.TreeMap; |
| 28 | 29 | ||
| ... | @@ -235,15 +236,16 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -235,15 +236,16 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 235 | mIvBack.setOnClickListener(this); | 236 | mIvBack.setOnClickListener(this); |
| 236 | mIvPopupClose.setOnClickListener(this); | 237 | mIvPopupClose.setOnClickListener(this); |
| 237 | 238 | ||
| 238 | - if (mUniqueSectionList != null) { | 239 | + if (mUniqueSectionList != null && mUniqueSectionList.size() > 0) { |
| 239 | - if (mUniqueSectionList.size() == 1) { | 240 | + for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) { |
| 240 | - try { | 241 | + String itemKey = set.getKey(); |
| 241 | - String firstKey = (String) mUniqueSectionList.keySet().toArray()[0]; | 242 | + ArrayList<Campaign> itemValue = set.getValue(); |
| 242 | - if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) { | 243 | + |
| 243 | - mTvResearchSection.setText(firstKey.substring(1)); | 244 | + if (itemKey.contains("1")) { |
| 245 | + mTvResearchSection.setText(itemKey.substring(1)); | ||
| 244 | mResearchItems.setNestedScrollingEnabled(false); | 246 | mResearchItems.setNestedScrollingEnabled(false); |
| 245 | mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 247 | mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
| 246 | - mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); | 248 | + mAdapterResearch = new MoreCampaignAdapter(this, itemValue); |
| 247 | mResearchItems.setAdapter(mAdapterResearch); | 249 | mResearchItems.setAdapter(mAdapterResearch); |
| 248 | mAdapterResearch.getPositionClicks() | 250 | mAdapterResearch.getPositionClicks() |
| 249 | .doOnNext(this::handleMoreItemClick) | 251 | .doOnNext(this::handleMoreItemClick) |
| ... | @@ -253,19 +255,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -253,19 +255,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 253 | 255 | ||
| 254 | mLlResearchItems.setVisibility(View.VISIBLE); | 256 | mLlResearchItems.setVisibility(View.VISIBLE); |
| 255 | } | 257 | } |
| 256 | - } catch (IndexOutOfBoundsException ex) { | ||
| 257 | - ex.printStackTrace(); | ||
| 258 | - } | ||
| 259 | } | 258 | } |
| 260 | 259 | ||
| 261 | - if (mUniqueSectionList.size() == 2) { | 260 | + for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) { |
| 262 | - try { | 261 | + String itemKey = set.getKey(); |
| 263 | - String secondKey = (String) mUniqueSectionList.keySet().toArray()[1]; | 262 | + ArrayList<Campaign> itemValue = set.getValue(); |
| 264 | - if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) { | 263 | + |
| 265 | - mTvExclusiveSection.setText(secondKey.substring(1)); | 264 | + if (itemKey.contains("2")) { |
| 265 | + mTvExclusiveSection.setText(itemKey.substring(1)); | ||
| 266 | mExclusiveItems.setNestedScrollingEnabled(false); | 266 | mExclusiveItems.setNestedScrollingEnabled(false); |
| 267 | mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 267 | mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
| 268 | - mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); | 268 | + mAdapterExclusive = new MoreCampaignAdapter(this, itemValue); |
| 269 | mExclusiveItems.setAdapter(mAdapterExclusive); | 269 | mExclusiveItems.setAdapter(mAdapterExclusive); |
| 270 | mAdapterExclusive.getPositionClicks() | 270 | mAdapterExclusive.getPositionClicks() |
| 271 | .doOnNext(this::handleMoreItemClick) | 271 | .doOnNext(this::handleMoreItemClick) |
| ... | @@ -275,19 +275,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -275,19 +275,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 275 | 275 | ||
| 276 | mLlExclusiveItems.setVisibility(View.VISIBLE); | 276 | mLlExclusiveItems.setVisibility(View.VISIBLE); |
| 277 | } | 277 | } |
| 278 | - } catch (IndexOutOfBoundsException ex) { | ||
| 279 | - ex.printStackTrace(); | ||
| 280 | - } | ||
| 281 | } | 278 | } |
| 282 | 279 | ||
| 283 | - if (mUniqueSectionList.size() == 3) { | 280 | + for (Map.Entry<String, ArrayList<Campaign>> set : mUniqueSectionList.entrySet()) { |
| 284 | - try { | 281 | + String itemKey = set.getKey(); |
| 285 | - String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2]; | 282 | + ArrayList<Campaign> itemValue = set.getValue(); |
| 286 | - if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) { | 283 | + |
| 287 | - mTvContestSection.setText(thirdKey.substring(1)); | 284 | + if (itemKey.contains("3")) { |
| 285 | + mTvContestSection.setText(itemKey.substring(1)); | ||
| 288 | mContestItems.setNestedScrollingEnabled(false); | 286 | mContestItems.setNestedScrollingEnabled(false); |
| 289 | mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 287 | mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
| 290 | - mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); | 288 | + mAdapterContest = new MoreCampaignAdapter(this, itemValue); |
| 291 | mContestItems.setAdapter(mAdapterContest); | 289 | mContestItems.setAdapter(mAdapterContest); |
| 292 | mAdapterContest.getPositionClicks() | 290 | mAdapterContest.getPositionClicks() |
| 293 | .doOnNext(this::handleMoreItemClick) | 291 | .doOnNext(this::handleMoreItemClick) |
| ... | @@ -297,11 +295,74 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -297,11 +295,74 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 297 | 295 | ||
| 298 | mLlContestItems.setVisibility(View.VISIBLE); | 296 | mLlContestItems.setVisibility(View.VISIBLE); |
| 299 | } | 297 | } |
| 300 | - } catch (IndexOutOfBoundsException ex) { | ||
| 301 | - ex.printStackTrace(); | ||
| 302 | - } | ||
| 303 | } | 298 | } |
| 304 | 299 | ||
| 300 | +// if (mUniqueSectionList.size() == 1) { | ||
| 301 | +// try { | ||
| 302 | +// String firstKey = (String) mUniqueSectionList.keySet().toArray()[0]; | ||
| 303 | +// if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) { | ||
| 304 | +// mTvResearchSection.setText(firstKey.substring(1)); | ||
| 305 | +// mResearchItems.setNestedScrollingEnabled(false); | ||
| 306 | +// mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
| 307 | +// mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); | ||
| 308 | +// mResearchItems.setAdapter(mAdapterResearch); | ||
| 309 | +// mAdapterResearch.getPositionClicks() | ||
| 310 | +// .doOnNext(this::handleMoreItemClick) | ||
| 311 | +// .doOnError(error -> { | ||
| 312 | +// }) | ||
| 313 | +// .subscribe(); | ||
| 314 | +// | ||
| 315 | +// mLlResearchItems.setVisibility(View.VISIBLE); | ||
| 316 | +// } | ||
| 317 | +// } catch (IndexOutOfBoundsException ex) { | ||
| 318 | +// ex.printStackTrace(); | ||
| 319 | +// } | ||
| 320 | +// } | ||
| 321 | +// | ||
| 322 | +// if (mUniqueSectionList.size() == 2) { | ||
| 323 | +// try { | ||
| 324 | +// String secondKey = (String) mUniqueSectionList.keySet().toArray()[1]; | ||
| 325 | +// if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) { | ||
| 326 | +// mTvExclusiveSection.setText(secondKey.substring(1)); | ||
| 327 | +// mExclusiveItems.setNestedScrollingEnabled(false); | ||
| 328 | +// mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
| 329 | +// mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); | ||
| 330 | +// mExclusiveItems.setAdapter(mAdapterExclusive); | ||
| 331 | +// mAdapterExclusive.getPositionClicks() | ||
| 332 | +// .doOnNext(this::handleMoreItemClick) | ||
| 333 | +// .doOnError(error -> { | ||
| 334 | +// }) | ||
| 335 | +// .subscribe(); | ||
| 336 | +// | ||
| 337 | +// mLlExclusiveItems.setVisibility(View.VISIBLE); | ||
| 338 | +// } | ||
| 339 | +// } catch (IndexOutOfBoundsException ex) { | ||
| 340 | +// ex.printStackTrace(); | ||
| 341 | +// } | ||
| 342 | +// } | ||
| 343 | +// | ||
| 344 | +// if (mUniqueSectionList.size() == 3) { | ||
| 345 | +// try { | ||
| 346 | +// String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2]; | ||
| 347 | +// if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) { | ||
| 348 | +// mTvContestSection.setText(thirdKey.substring(1)); | ||
| 349 | +// mContestItems.setNestedScrollingEnabled(false); | ||
| 350 | +// mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
| 351 | +// mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); | ||
| 352 | +// mContestItems.setAdapter(mAdapterContest); | ||
| 353 | +// mAdapterContest.getPositionClicks() | ||
| 354 | +// .doOnNext(this::handleMoreItemClick) | ||
| 355 | +// .doOnError(error -> { | ||
| 356 | +// }) | ||
| 357 | +// .subscribe(); | ||
| 358 | +// | ||
| 359 | +// mLlContestItems.setVisibility(View.VISIBLE); | ||
| 360 | +// } | ||
| 361 | +// } catch (IndexOutOfBoundsException ex) { | ||
| 362 | +// ex.printStackTrace(); | ||
| 363 | +// } | ||
| 364 | +// } | ||
| 365 | + | ||
| 305 | if (mContextualList != null && mContextualList.size() > 0) { | 366 | if (mContextualList != null && mContextualList.size() > 0) { |
| 306 | mTvContextualSection.setText(getString(R.string.cos_mfy_other)); | 367 | mTvContextualSection.setText(getString(R.string.cos_mfy_other)); |
| 307 | mContextualItems.setNestedScrollingEnabled(false); | 368 | mContextualItems.setNestedScrollingEnabled(false); | ... | ... |
-
Please register or login to post a comment