Skip to content
Browse files

Merge branch 'master' of https://github.com/jackquack/BitPredictor

  • Loading branch information...
2 parents da7ab4d + 0da0640 commit fb570e199ebb4038365086ab86ba8cc4e6d35f84 @jackquack committed
View
21 android/PredictionMarket/res/layout/contract_item.xml
@@ -5,10 +5,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
- android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingLeft="8dp"
- android:paddingRight="8dp" >
+ android:paddingRight="8dp"
+ android:paddingTop="2dp" >
<LinearLayout
android:layout_width="0dp"
@@ -20,8 +20,10 @@
<TextView
android:id="@+id/contractName"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge" />
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="#333333"
+ android:textStyle="bold" />
<TextView
android:id="@+id/contractExpiration"
@@ -29,16 +31,19 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceSmall" />
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="#888888" />
</LinearLayout>
<TextView
android:id="@+id/contractPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|right"
+ android:layout_gravity="right"
android:singleLine="true"
- android:textSize="24sp"
- android:textAppearance="?android:attr/textAppearanceLarge" />
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="#333333"
+ android:textSize="24sp"
+ android:textStyle="bold" />
</LinearLayout>
View
4 android/PredictionMarket/res/layout/header_item.xml
@@ -8,6 +8,8 @@
android:paddingTop="2dp"
android:singleLine="true"
android:textAllCaps="true"
+ android:textColor="#FFFFFF"
+ android:background="#777777"
android:textAppearance="?android:attr/textAppearanceLarge"
- android:textSize="24sp"
+ android:textSize="36sp"
android:textStyle="bold" />
View
39 android/PredictionMarket/res/layout/position_item.xml
@@ -10,35 +10,42 @@
android:paddingRight="8dp"
android:paddingTop="2dp" >
- <LinearLayout
+ <TextView
+ android:id="@+id/contractName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:orientation="vertical"
- android:paddingRight="8dp" >
+ android:paddingRight="8dp"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="#333333"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
<TextView
- android:id="@+id/contractName"
+ android:id="@+id/contractPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge" />
+ android:layout_gravity="right"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="#333333"
+ android:textSize="24sp"
+ android:textStyle="bold" />
<TextView
android:id="@+id/netProfitLoss"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:ellipsize="end"
+ android:layout_gravity="right"
android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceMedium" />
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="#333333"
+ android:textSize="24sp"
+ android:textStyle="bold" />
</LinearLayout>
- <TextView
- android:id="@+id/contractPrice"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|right"
- android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textSize="24sp" />
-
</LinearLayout>
View
20 android/PredictionMarket/src/com/bitcoin/predictionmarket/adapter/ContractListAdapter.java
@@ -11,6 +11,7 @@
import java.util.List;
import android.content.Context;
+import android.graphics.Color;
import android.os.AsyncTask;
import android.view.LayoutInflater;
import android.view.View;
@@ -26,7 +27,7 @@
public class ContractListAdapter extends BaseAdapter {
private static final int VIEW_TYPE_COUNT = 2;
private static final int TYPE_HEADER = 0;
- private static final int TYPE_CONTRACT = 1;
+ private static final int TYPE_CONTRACT = 1;
private final DecimalFormat doubleFormatter = new DecimalFormat("฿ 0.00");
private final DateFormat dateFormatter = SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG);
@@ -46,14 +47,16 @@ public void setList(List<Object> newListData) {
static class Header {
final String header;
+ final int backgroundColor;
- public Header(String header) {
+ public Header(String header, int backgroundColor) {
this.header = header;
+ this.backgroundColor = backgroundColor;
}
}
static class HeaderViewHolder {
- TextView header;
+ TextView header;
}
static class ContractViewHolder {
@@ -139,6 +142,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
final HeaderViewHolder viewHolder = (HeaderViewHolder) convertView.getTag();
viewHolder.header.setText(header.header);
+ viewHolder.header.setBackgroundColor(header.backgroundColor);
} else {
final Contract contract = (Contract) listData.get(position);
final ContractViewHolder viewHolder = (ContractViewHolder) convertView.getTag();
@@ -184,23 +188,23 @@ protected void onPreExecute() {
protected List<Object> doInBackground(Void... params) {
final List<Object> result = new ArrayList<Object>();
- result.add(new Header("Business"));
+ result.add(new Header("Business", Color.parseColor("#0099CC")));
result.add(new Contract("Apple share price above 500", new Date(1388606400000L), 8.73));
result.add(new Contract("Apple share price above 600", new Date(1388606400000L), 6.32));
result.add(new Contract("Apple share price above 700", new Date(1388606400000L), 3.47));
- result.add(new Header("Economy"));
+ result.add(new Header("Economy", Color.parseColor("#9933CC")));
result.add(new Contract("Dow Jones above 15000", new Date(1388606400000L), 9.74));
result.add(new Contract("Dow Jones above 20000", new Date(1388606400000L), 4.59));
result.add(new Contract("Dow Jones above 25000", new Date(1388606400000L), 2.43));
- result.add(new Header("Government"));
+ result.add(new Header("Government", Color.parseColor("#669900")));
result.add(new Contract("War with Iran declared by 2014", new Date(1388606400000L), 3.23));
result.add(new Contract("War with Iran declared by 2015", new Date(1420113600000L), 4.58));
result.add(new Contract("War with Iran declared by 2016", new Date(1451649600000L), 4.92));
- result.add(new Header("Health"));
+ result.add(new Header("Health", Color.parseColor("#FF8800")));
result.add(new Contract("Marijuana declared legal by 2014", new Date(1388606400000L), 1.42));
result.add(new Contract("Marijuana declared legal by 2015", new Date(1420113600000L), 2.74));
result.add(new Contract("Marijuana declared legal by 2016", new Date(1451649600000L), 3.47));
- result.add(new Header("Sports"));
+ result.add(new Header("Sports", Color.parseColor("#CC0000")));
result.add(new Contract("Canada wins at least 5 gold medals in the 2014 Olympics", new Date(1393588800000L), 9.32));
result.add(new Contract("Canada wins at least 8 gold medals in the 2014 Olympics", new Date(1393588800000L), 6.23));
result.add(new Contract("Canada wins at least 12 gold medals in the 2014 Olympics", new Date(1393588800000L), 4.438));
View
4 android/PredictionMarket/src/com/bitcoin/predictionmarket/adapter/PositionsAdapter.java
@@ -97,10 +97,10 @@ public View getView(int position, View convertView, ViewGroup parent) {
viewHolder.contractPrice.setText(doubleFormatter.format(contractPosition.contract.price));
if (contractPosition.netProfitLoss >= 0) {
- viewHolder.netProfitLoss.setText(context.getString(R.string.netProfit, doubleFormatter.format(contractPosition.netProfitLoss)));
+ viewHolder.netProfitLoss.setText(doubleFormatter.format(contractPosition.netProfitLoss));
viewHolder.netProfitLoss.setTextColor(Color.rgb(0, 128, 0));
} else {
- viewHolder.netProfitLoss.setText(context.getString(R.string.netLoss, doubleFormatter.format(contractPosition.netProfitLoss)));
+ viewHolder.netProfitLoss.setText(doubleFormatter.format(contractPosition.netProfitLoss));
viewHolder.netProfitLoss.setTextColor(Color.RED);
}

0 comments on commit fb570e1

Please sign in to comment.
Something went wrong with that request. Please try again.