Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
Lavina
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
75abc3a6
authored
May 14, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
activity collection done
parent
b4d22dc8
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
154 additions
and
27 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/com/example/paktalin/lavina/CollectionActivity.java
app/src/main/java/com/example/paktalin/lavina/MainActivity.java
app/src/main/java/com/example/paktalin/lavina/WineBottle.java
app/src/main/java/com/example/paktalin/lavina/WineAdapterCollection.java → app/src/main/java/com/example/paktalin/lavina/adapters/WineAdapterCollection.java
app/src/main/java/com/example/paktalin/lavina/WineAdapterMain.java → app/src/main/java/com/example/paktalin/lavina/adapters/WineAdapterMain.java
app/src/main/res/layout/activity_collection.xml
app/src/main/res/layout/item_wine_collection.xml
app/src/main/res/layout/item_wine_main.xml
app/src/main/res/values-v21/styles.xml
app/src/main/res/values/strings.xml
app/src/main/res/values/styles.xml
app/src/main/AndroidManifest.xml
View file @
75abc3a6
...
...
@@ -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
app/src/main/java/com/example/paktalin/lavina/CollectionActivity.java
View file @
75abc3a6
...
...
@@ -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
,
wine
Dates
,
wine
Prices
;
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
],
wine
Dates
[
i
],
wineShops
[
i
],
wine
Prices
[
i
],
winePics
[
i
]);
}
}
...
...
app/src/main/java/com/example/paktalin/lavina/MainActivity.java
View file @
75abc3a6
...
...
@@ -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
{
...
...
app/src/main/java/com/example/paktalin/lavina/WineBottle.java
View file @
75abc3a6
...
...
@@ -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
;
}
}
app/src/main/java/com/example/paktalin/lavina/WineAdapterCollection.java
→
app/src/main/java/com/example/paktalin/lavina/
adapters/
WineAdapterCollection.java
View file @
75abc3a6
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_
mai
n
,
null
);
convertView
=
inflater
.
inflate
(
R
.
layout
.
item_wine_
collectio
n
,
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
());
...
...
app/src/main/java/com/example/paktalin/lavina/WineAdapterMain.java
→
app/src/main/java/com/example/paktalin/lavina/
adapters/
WineAdapterMain.java
View file @
75abc3a6
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
());
...
...
app/src/main/res/layout/activity_collection.xml
View file @
75abc3a6
...
...
@@ -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>
...
...
app/src/main/res/layout/item_wine_collection.xml
View file @
75abc3a6
...
...
@@ -15,21 +15,22 @@
<TextView
android:id=
"@+id/wine_title"
android:layout_width=
"1
8
0dp"
android:layout_width=
"1
7
0dp"
android:layout_height=
"wrap_content"
android:textColor=
"@color/colorPrimary
Dark
"
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/colorPrimary
Dark
"
android:layout_marginTop=
"5dp"
android:textS
tyle=
"bold
"
android:text
Size=
"20sp
"
android:textS
ize=
"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
app/src/main/res/layout/item_wine_main.xml
View file @
75abc3a6
...
...
@@ -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"
...
...
app/src/main/res/values-v21/styles.xml
View file @
75abc3a6
...
...
@@ -5,4 +5,5 @@
<item
name=
"windowNoTitle"
>
true
</item>
<item
name=
"android:statusBarColor"
>
@android:color/transparent
</item>
</style>
</resources>
app/src/main/res/values/strings.xml
View file @
75abc3a6
...
...
@@ -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>
app/src/main/res/values/styles.xml
View file @
75abc3a6
...
...
@@ -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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment