-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87771e0
commit 4ff5db6
Showing
13 changed files
with
532 additions
and
8 deletions.
There are no files selected for viewing
128 changes: 128 additions & 0 deletions
128
app/src/main/java/com/neosoft/neostore/adapter/TableAdapter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package com.neosoft.neostore.adapter; | ||
|
||
import android.content.Context; | ||
import android.content.res.Resources; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.ImageView; | ||
import android.widget.RatingBar; | ||
import android.widget.TextView; | ||
|
||
import com.neosoft.neostore.model.Product.DataModel; | ||
import com.neosoft.neostore.R; | ||
import com.neosoft.neostore.ui.TableFragment; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
public class TableAdapter extends BaseAdapter implements View.OnClickListener { | ||
private List<DataModel> mData; | ||
private static LayoutInflater inflater=null; | ||
public Resources res; | ||
DataModel tempValues=null; | ||
int i=0; | ||
|
||
public TableAdapter(Context context, List<DataModel> data, Resources resLocal) { | ||
mData=data; | ||
res = resLocal; | ||
inflater = ( LayoutInflater )context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
Log.v("TableAdapter", "=====Row button clicked====="); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
if(mData.size()<=0) | ||
return 1; | ||
return mData.size(); | ||
} | ||
|
||
@Override | ||
public Object getItem(int position) { | ||
return position; | ||
} | ||
|
||
@Override | ||
public long getItemId(int position) { | ||
return position; | ||
} | ||
|
||
public static class ViewHolder{ | ||
TextView tableName; | ||
TextView tableStoreName; | ||
TextView tableRs; | ||
TextView tablePrice; | ||
RatingBar tableRatingBar; | ||
ImageView tableImage; | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
|
||
View vi = convertView; | ||
ViewHolder holder; | ||
if(convertView==null){ | ||
vi = inflater.inflate(R.layout.row_tablelist, null); | ||
holder = new ViewHolder(); | ||
holder.tableName = (TextView) vi.findViewById(R.id.textTableName); | ||
holder.tableStoreName=(TextView)vi.findViewById(R.id.textTableStoreName); | ||
holder.tablePrice = (TextView) vi.findViewById(R.id.textTablePrice); | ||
holder.tableRs=(TextView)vi.findViewById(R.id.textTableRs); | ||
holder.tableRatingBar=(RatingBar) vi.findViewById(R.id.tableRatingBar); | ||
holder.tableImage=(ImageView)vi.findViewById(R.id.imgTables); | ||
vi.setTag( holder ); | ||
} | ||
else | ||
holder=(ViewHolder)vi.getTag(); | ||
|
||
if(mData.size()<=0) | ||
{ | ||
holder.tableName.setText("No Data"); | ||
|
||
} | ||
else | ||
{ | ||
tempValues=null; | ||
tempValues = ( DataModel ) mData.get( position ); | ||
|
||
|
||
Log.e("Table Title",mData.get(position).getTableTitle()); | ||
|
||
holder.tableName.setText( tempValues.getTableTitle() ); | ||
holder.tableStoreName.setText( tempValues.getTableShop() ); | ||
holder.tablePrice.setText( tempValues.getTablePrice() ); | ||
// holder.tableRs.setText( tempValues.getTableRs() ); | ||
// holder.tableRatingBar.setRating(Float.parseFloat(tempValues.getTableRating())); | ||
holder.tableImage.setImageResource(res.getIdentifier( | ||
""+tempValues.getTableImage() | ||
,null,null)); | ||
|
||
vi.setOnClickListener(new OnItemClickListener(position)); | ||
} | ||
return vi; | ||
} | ||
|
||
private class OnItemClickListener implements View.OnClickListener { | ||
|
||
private int mPosition; | ||
|
||
OnItemClickListener(int position){ | ||
mPosition = position; | ||
} | ||
|
||
@Override | ||
public void onClick(View arg0) { | ||
|
||
TableFragment fragment = new TableFragment(); | ||
fragment.onItemClick(mPosition); | ||
} | ||
} | ||
} | ||
|
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/neosoft/neostore/model/Product/DataModel.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.neosoft.neostore.model.Product; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
public class DataModel { | ||
|
||
@SerializedName("product_images") | ||
private String tableImage; | ||
|
||
@SerializedName("name") | ||
private String tableTitle; | ||
|
||
@SerializedName("producer") | ||
private String tableShop; | ||
|
||
@SerializedName("cost") | ||
private String tablePrice; | ||
|
||
@SerializedName("rating") | ||
private String tableRating; | ||
|
||
//private String tableRs; | ||
public String getTableImage() { | ||
return tableImage; | ||
} | ||
|
||
public void setTableImage(String tableImage) { | ||
this.tableImage = tableImage; | ||
} | ||
|
||
public String getTableTitle() { | ||
return tableTitle; | ||
} | ||
|
||
public void setTableTitle(String tableTitle) { | ||
this.tableTitle = tableTitle; | ||
} | ||
|
||
public String getTableShop() { | ||
return tableShop; | ||
} | ||
|
||
public void setTableShop(String tableShop) { | ||
this.tableShop = tableShop; | ||
} | ||
|
||
public String getTablePrice() { | ||
return tablePrice; | ||
} | ||
|
||
public void setTablePrice(String tablePrice) { | ||
this.tablePrice = tablePrice; | ||
} | ||
|
||
/*public String getTableRs() { | ||
return tableRs; | ||
} | ||
public void setTableRs(String tableRs) { | ||
this.tableRs = tableRs; | ||
}*/ | ||
|
||
public String getTableRating() { | ||
return tableRating; | ||
} | ||
|
||
public void setTableRating(String tableRating) { | ||
this.tableRating = tableRating; | ||
} | ||
|
||
|
||
} |
97 changes: 97 additions & 0 deletions
97
app/src/main/java/com/neosoft/neostore/model/Product/ProductResponseModel.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package com.neosoft.neostore.model.Product; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
import java.util.List; | ||
|
||
public class ProductResponseModel { | ||
@SerializedName("status") | ||
@Expose | ||
private Integer status; | ||
@SerializedName("data") | ||
@Expose | ||
private List<DataModel> data; | ||
@SerializedName("message") | ||
@Expose | ||
private String message; | ||
@SerializedName("user_msg") | ||
@Expose | ||
private String userMsg; | ||
|
||
/** | ||
* | ||
* @return | ||
* The status | ||
*/ | ||
public Integer getStatus() { | ||
return status; | ||
} | ||
|
||
/** | ||
* | ||
* @param status | ||
* The status | ||
*/ | ||
public void setStatus(Integer status) { | ||
this.status = status; | ||
} | ||
|
||
/** | ||
* | ||
* @return | ||
* The data | ||
*/ | ||
public List<DataModel> getData() { | ||
return data; | ||
} | ||
|
||
public void setData(List<DataModel> data) { | ||
this.data = data; | ||
} | ||
|
||
/** | ||
* | ||
* @return | ||
* The message | ||
*/ | ||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
/** | ||
* | ||
* @param message | ||
* The message | ||
*/ | ||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
/** | ||
* | ||
* @return | ||
* The userMsg | ||
*/ | ||
public String getUserMsg() { | ||
return userMsg; | ||
} | ||
|
||
/** | ||
* | ||
* @param userMsg | ||
* The user_msg | ||
*/ | ||
public void setUserMsg(String userMsg) { | ||
this.userMsg = userMsg; | ||
} | ||
|
||
@Override public String toString() { | ||
return "ProductResponseModel{" + | ||
"status=" + status + | ||
", data=" + data + | ||
", message='" + message + '\'' + | ||
", userMsg='" + userMsg + '\'' + | ||
'}'; | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.