Skip to content

Commit

Permalink
Added promotions list in promotions activity and fixed dynamic list v…
Browse files Browse the repository at this point in the history
…iew heights issue
  • Loading branch information
rajagopal28 committed Mar 19, 2015
1 parent 9df938b commit 93bed42
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
deviceIdList += deviceId;
}
GimbalPromotionsDataProcessor gpDataProcessor = new GimbalPromotionsDataProcessor(mActivity,
null, null, null,
null, null,
null, null,
null);
// Log.d("DEBUG", "Server URL = " + ServerURLUtil.getStoreServletServerURL(getResources()));
Map<String, String> paramsMap = ServerURLUtil.getBasicConfigParamsMap(getResources());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected void onCreate(Bundle savedInstanceState) {
ListView topBrowsedListView = (ListView) findViewById(R.id.top_browsed_list_view);
ListView bestSellersListView = (ListView) findViewById(R.id.best_sellers_list_view);
ListView recentlyViewedListView = (ListView) findViewById(R.id.recently_viewed_list_view);
ListView recommendationsListView = (ListView) findViewById(R.id.recommendations_list_view);

String selectedBeaconsList = getIntent().getStringExtra(GimbalStoreConstants.INTENT_EXTRA_ATTR_KEY.SELECTED_BEACONS_ID.toString());
Log.d("DEBUG", "selectedBeaconsList = " + selectedBeaconsList);
Expand All @@ -37,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) {
GimbalStoreConstants.DEFAULT_SPINNER_INFO_TEXT);
GimbalPromotionsDataProcessor gimbalPromotionsDataProcessor = new GimbalPromotionsDataProcessor(this,
topBrowsedListView, bestSellersListView,
recentlyViewedListView, progressDialog);
recentlyViewedListView, recommendationsListView, progressDialog);
Map<String, String> paramsMap = ServerURLUtil.getBasicConfigParamsMap(getResources());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ public class GimbalPromotionsDataProcessor implements AsyncResponseProcessor {
private Activity callingActivity;
private ListView topBrowsedListView;
private ListView bestSellersListView;
private ListView promotionsListView;
private ListView recentlyViewedListView;
private ProgressDialog progressDialog;

public GimbalPromotionsDataProcessor(Activity callingContext, ListView topBrowsed,
ListView bestSellers, ListView recentlyViewed,
ProgressDialog progressDialog) {
ListView promotionsView, ProgressDialog progressDialog) {
this.callingActivity = callingContext;
this.recentlyViewedListView = recentlyViewed;
this.topBrowsedListView = topBrowsed;
this.bestSellersListView = bestSellers;
this.promotionsListView = promotionsView;
this.progressDialog = progressDialog;
}

Expand Down Expand Up @@ -89,6 +91,7 @@ public void run() {
TypeConversionUtil.getPromotedProductsTitles(listPromotion));
topBrowsedListView.setAdapter(topBrowsedAdapter);
topBrowsedListView.refreshDrawableState();
AndroidUtil.setDynamicHeight(topBrowsedListView);
}
if (bestSellers != null && bestSellers.length != 0) {
List<PromotedProductBean> listPromotion = Arrays.asList(bestSellers);
Expand All @@ -97,6 +100,7 @@ public void run() {
TypeConversionUtil.getPromotedProductsTitles(listPromotion));
bestSellersListView.setAdapter(bestSellersAdapters);
bestSellersListView.refreshDrawableState();
AndroidUtil.setDynamicHeight(bestSellersListView);
}
if (recentlyViewed != null && recentlyViewed.length != 0) {
List<PromotedProductBean> listPromotion = Arrays.asList(recentlyViewed);
Expand All @@ -105,14 +109,16 @@ public void run() {
TypeConversionUtil.getPromotedProductsTitles(listPromotion));
recentlyViewedListView.setAdapter(bestSellersAdapters);
recentlyViewedListView.refreshDrawableState();
AndroidUtil.setDynamicHeight(recentlyViewedListView);
}
if (recommendations != null && recommendations.length != 0) {
List<PromotedProductBean> listPromotion = Arrays.asList(recommendations);
PromotedProductsAdapter bestSellersAdapters = new PromotedProductsAdapter(callingActivity,
recentlyViewedListView, listPromotion,
promotionsListView, listPromotion,
TypeConversionUtil.getPromotedProductsTitles(listPromotion));
recentlyViewedListView.setAdapter(bestSellersAdapters);
recentlyViewedListView.refreshDrawableState();
promotionsListView.setAdapter(bestSellersAdapters);
promotionsListView.refreshDrawableState();
AndroidUtil.setDynamicHeight(promotionsListView);
}
}
});
Expand Down
18 changes: 16 additions & 2 deletions app/src/main/res/layout/activity_promotions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,26 @@
android:layout_height="wrap_content"
android:layout_below="@+id/best_sellers_list_view"></ListView>


<TextView
android:id="@+id/recently_viewed_list_label"
android:id="@+id/recommendations_list_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/best_sellers_list_view"
android:text="@string/promotions_list_label" />
android:text="@string/recommendations_list_label" />

<ListView
android:id="@+id/recommendations_list_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/recommendations_list_label"></ListView>

<TextView
android:id="@+id/recently_viewed_list_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/recommendations_list_view"
android:text="@string/recently_viewed_list_label" />

<ListView
android:id="@+id/recently_viewed_list_view"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<string name="promotions_list_label">Promotions you may like!!</string>

<string name="best_sellers_list_label">Best Sellers</string>
<string name="recommendations_list_label">Near store promotions</string>
<string name="recently_viewed_list_label">Recently Viewed!!</string>
<string name="top_browsed_ist_view">Top Selling!!</string>

Expand Down

0 comments on commit 93bed42

Please sign in to comment.