Commit 75abc3a6 by Paktalin

activity collection done

parent b4d22dc8
......@@ -28,6 +28,7 @@
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".MapActivity"/>
<activity android:name=".CollectionActivity"/>
</application>
</manifest>
\ No newline at end of file
......@@ -7,6 +7,8 @@ import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;
import com.example.paktalin.lavina.adapters.WineAdapterCollection;
/**
* Created by Paktalin on 14/05/2018.
*/
......@@ -14,8 +16,9 @@ import android.widget.ListView;
public class CollectionActivity extends AppCompatActivity {
Bitmap[] winePics;
String[] wineTitles, winePrices;
String[] wineTitles, wineDates, winePrices;
WineBottle[] wines;
private String[] wineShops;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
......@@ -24,7 +27,10 @@ public class CollectionActivity extends AppCompatActivity {
extractWinePics();
extractWineTitles();
extractWineDates();
extractWineShops();
extractWinePrices();
setWineArray();
WineAdapterCollection adapter = new WineAdapterCollection(CollectionActivity.this, wines);
......@@ -32,6 +38,30 @@ public class CollectionActivity extends AppCompatActivity {
listView.setAdapter(adapter);
}
private void extractWineShops() {
wineShops = new String[]{
"Meat & Wine",
"Meat & Wine",
"Wine Not?",
"Restoran Dominic",
"Restoran Gloria",
"Wine Not?",
"Wine Not?",
"Amalfi | Italian restaurant"};
}
private void extractWineDates() {
wineDates = new String[] {
"11 May",
"7 May",
"1 May",
"20 Apr",
"13 Apr",
"8 Apr",
"2 Apr",
"30 Mar"};
}
private void extractWinePrices() {
winePrices = new String[] {
"€7.90",
......@@ -47,7 +77,7 @@ public class CollectionActivity extends AppCompatActivity {
private void setWineArray() {
wines = new WineBottle[8];
for (int i = 0; i < wines.length; i++) {
wines[i] = new WineBottle(wineTitles[i], winePrices[i], winePics[i]);
wines[i] = new WineBottle(wineTitles[i], wineDates[i], wineShops[i], winePrices[i], winePics[i]);
}
}
......
......@@ -14,6 +14,8 @@ import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import com.example.paktalin.lavina.adapters.WineAdapterMain;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
......
......@@ -6,10 +6,9 @@ import android.graphics.Bitmap;
* Created by Paktalin on 14/05/2018.
*/
class WineBottle {
public class WineBottle {
private String title;
private String price;
private String title, price, date, shop;
private Bitmap image;
WineBottle(String title, String price, Bitmap image) {
......@@ -18,6 +17,14 @@ class WineBottle {
this.image = image;
}
WineBottle(String title, String date, String shop, String price, Bitmap image) {
this.title = title;
this.date = date;
this.shop = shop;
this.price = price;
this.image = image;
}
public String getTitle() {
return title;
}
......@@ -29,4 +36,12 @@ class WineBottle {
public Bitmap getImage() {
return image;
}
public String getDate() {
return date;
}
public String getShop() {
return shop;
}
}
package com.example.paktalin.lavina;
package com.example.paktalin.lavina.adapters;
import android.content.Context;
import android.view.LayoutInflater;
......@@ -8,6 +8,9 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.paktalin.lavina.R;
import com.example.paktalin.lavina.WineBottle;
/**
* Created by Paktalin on 14/05/2018.
*/
......@@ -17,7 +20,7 @@ public class WineAdapterCollection extends BaseAdapter {
private LayoutInflater inflater;
private WineBottle[] wines;
WineAdapterCollection(Context context, WineBottle[] wines) {
public WineAdapterCollection(Context context, WineBottle[] wines) {
this.wines = wines;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
......@@ -42,13 +45,14 @@ public class WineAdapterCollection extends BaseAdapter {
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_wine_main, null);
convertView = inflater.inflate(R.layout.item_wine_collection, null);
}
WineBottle bottle = (WineBottle)getItem(position);
((TextView)convertView.findViewById(R.id.wine_title)).setText(bottle.getTitle());
((TextView)convertView.findViewById(R.id.wine_price)).setText(bottle.getPrice());
((TextView)convertView.findViewById(R.id.wine_date)).setText(bottle.getDate());
((TextView)convertView.findViewById(R.id.wine_shop)).setText(bottle.getShop());
((ImageView)convertView.findViewById(R.id.wine_image)).setImageBitmap(bottle.getImage());
......
package com.example.paktalin.lavina;
package com.example.paktalin.lavina.adapters;
import android.content.Context;
import android.view.LayoutInflater;
......@@ -8,6 +8,9 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.paktalin.lavina.R;
import com.example.paktalin.lavina.WineBottle;
/**
* Created by Paktalin on 14/05/2018.
*/
......@@ -17,7 +20,7 @@ public class WineAdapterMain extends BaseAdapter {
private LayoutInflater inflater;
private WineBottle[] wines;
WineAdapterMain(Context context, WineBottle[] wines) {
public WineAdapterMain(Context context, WineBottle[] wines) {
this.wines = wines;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
......@@ -48,7 +51,7 @@ public class WineAdapterMain extends BaseAdapter {
WineBottle bottle = (WineBottle)getItem(position);
((TextView)convertView.findViewById(R.id.wine_title)).setText(bottle.getTitle());
((TextView)convertView.findViewById(R.id.wine_price)).setText(bottle.getPrice());
((TextView)convertView.findViewById(R.id.wine_shop)).setText(bottle.getPrice());
((ImageView)convertView.findViewById(R.id.wine_image)).setImageBitmap(bottle.getImage());
......
......@@ -21,12 +21,40 @@
android:textSize="20dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/sort_by"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="@+id/header"
android:background="@android:color/transparent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SORT BY"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:textColor="@android:color/white"
android:layout_marginLeft="20dp" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/sort_by"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="20dp"
android:layout_alignParentRight="true"
style="@style/Widget.MyTheme.HeaderBar.Spinner"
android:layout_marginRight="20dp" />
</RelativeLayout>
<ListView
android:id="@+id/list_view"
android:background="@android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/header">
android:layout_below="@+id/sort_by">
</ListView>
......
......@@ -15,21 +15,22 @@
<TextView
android:id="@+id/wine_title"
android:layout_width="180dp"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimaryDark"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
android:text="Recorino Volo Di Berardino 2017"
android:layout_marginLeft="20dp" />
<TextView
android:id="@+id/wine_price"
android:id="@+id/wine_shop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/wine_title"
android:textColor="@color/colorPrimary"
android:textColor="@color/colorPrimaryDark"
android:layout_marginTop="5dp"
android:textStyle="bold"
android:textSize="20sp"
android:textSize="12sp"
android:text="Amalfi Italian Restaurant"
android:layout_alignLeft="@+id/wine_title" />
</RelativeLayout>
......@@ -40,15 +41,37 @@
android:layout_height="80dp"
android:layout_centerVertical="true" />
<ImageButton
android:id="@+id/arrow"
android:layout_width="35dp"
android:layout_height="35dp"
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:background="@drawable/order_button3"
android:layout_marginRight="30dp"
android:layout_alignParentRight="true" />
>
<TextView
android:id="@+id/wine_price"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/colorPrimaryDark"
android:textStyle="bold"
android:textSize="18dp"
android:text="$7.90"/>
<TextView
android:id="@+id/wine_date"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/colorPrimaryDark"
android:layout_below="@id/wine_price"
android:textSize="12dp"
android:text="11 May"/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -22,7 +22,7 @@
android:layout_marginLeft="20dp" />
<TextView
android:id="@+id/wine_price"
android:id="@+id/wine_shop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/wine_title"
......@@ -41,7 +41,7 @@
android:layout_centerVertical="true" />
<ImageButton
android:id="@+id/arrow"
android:id="@+id/button_order"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentEnd="true"
......
......@@ -5,4 +5,5 @@
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>
......@@ -22,4 +22,11 @@
<string name="action_settings">Settings</string>
<string name="restaurant_name"><![CDATA[Meat & Wine]]></string>
<string-array name="sort_by">
<item>Date</item>
<item>Price: low</item>
<item>Price : high</item>
<item>Place</item>
</string-array>
</resources>
......@@ -17,4 +17,15 @@
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="Widget.MyTheme.HeaderBar.Spinner" parent="Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:theme">@style/ActionBarThemeOverlay</item>
</style>
<style name="ActionBarThemeOverlay" parent="">
<item name="android:textColorPrimary">#ffffff</item>
<item name="colorControlNormal">#ffffff</item>
<item name="colorControlHighlight">#ff33b5e5</item>
</style>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment