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
b4d22dc8
authored
May 14, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
activity collection created
parent
641df47b
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
234 additions
and
9 deletions
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/MapActivity.java
app/src/main/java/com/example/paktalin/lavina/WineAdapter.java → app/src/main/java/com/example/paktalin/lavina/WineAdapterCollection.java
app/src/main/java/com/example/paktalin/lavina/WineAdapterMain.java
app/src/main/res/layout/activity_collection.xml
app/src/main/res/layout/map_activity.xml → app/src/main/res/layout/activity_map.xml
app/src/main/res/layout/wine_item.xml → app/src/main/res/layout/item_wine_collection.xml
app/src/main/res/layout/item_wine_main.xml
app/src/main/res/menu/activity_main_drawer.xml
app/src/main/java/com/example/paktalin/lavina/CollectionActivity.java
0 → 100644
View file @
b4d22dc8
package
com
.
example
.
paktalin
.
lavina
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
android.widget.ListView
;
/**
* Created by Paktalin on 14/05/2018.
*/
public
class
CollectionActivity
extends
AppCompatActivity
{
Bitmap
[]
winePics
;
String
[]
wineTitles
,
winePrices
;
WineBottle
[]
wines
;
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_collection
);
extractWinePics
();
extractWineTitles
();
extractWinePrices
();
setWineArray
();
WineAdapterCollection
adapter
=
new
WineAdapterCollection
(
CollectionActivity
.
this
,
wines
);
ListView
listView
=
findViewById
(
R
.
id
.
list_view
);
listView
.
setAdapter
(
adapter
);
}
private
void
extractWinePrices
()
{
winePrices
=
new
String
[]
{
"€7.90"
,
"€8.85"
,
"€13.50"
,
"€5.74"
,
"€8.00"
,
"€15.90"
,
"€11.50"
,
"€9.79"
};
}
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
]);
}
}
private
void
extractWineTitles
()
{
wineTitles
=
new
String
[]
{
"Colli Euganei Bianco Olivetani Ca' Lustra 2015"
,
"Pecorino Volo Di Berardino 2017"
,
"Langhe Nebbiolo Bric Cenciurio 2016"
,
"Grignolino Raniero Castello di Gabiano 2016"
,
"Le Fattorie Tenuta di Frassineto 2014"
,
"Doglio La Brugherata 2008"
,
"Lagrein Hofstätter 2016"
,
"Vermentino di Sardegna Cala Silente Santadi 2017"
};
}
private
void
extractWinePics
()
{
winePics
=
new
Bitmap
[
8
];
winePics
[
0
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine1
);
winePics
[
1
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine2
);
winePics
[
2
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine3
);
winePics
[
3
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine4
);
winePics
[
4
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine5
);
winePics
[
5
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine6
);
winePics
[
6
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine7
);
winePics
[
7
]
=
BitmapFactory
.
decodeResource
(
getResources
(),
R
.
drawable
.
wine8
);
}
}
app/src/main/java/com/example/paktalin/lavina/MainActivity.java
View file @
b4d22dc8
...
@@ -17,7 +17,6 @@ import android.widget.ListView;
...
@@ -17,7 +17,6 @@ import android.widget.ListView;
public
class
MainActivity
extends
AppCompatActivity
public
class
MainActivity
extends
AppCompatActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
{
implements
NavigationView
.
OnNavigationItemSelectedListener
{
Bitmap
[]
winePics
;
Bitmap
[]
winePics
;
String
[]
wineTitles
,
winePrices
;
String
[]
wineTitles
,
winePrices
;
WineBottle
[]
wines
;
WineBottle
[]
wines
;
...
@@ -33,7 +32,7 @@ public class MainActivity extends AppCompatActivity
...
@@ -33,7 +32,7 @@ public class MainActivity extends AppCompatActivity
setWineArray
();
setWineArray
();
WineAdapter
adapter
=
new
WineAdapter
(
MainActivity
.
this
,
wines
);
WineAdapter
Main
adapter
=
new
WineAdapterMain
(
MainActivity
.
this
,
wines
);
ListView
listView
=
findViewById
(
R
.
id
.
list_view
);
ListView
listView
=
findViewById
(
R
.
id
.
list_view
);
listView
.
setAdapter
(
adapter
);
listView
.
setAdapter
(
adapter
);
...
@@ -139,6 +138,8 @@ public class MainActivity extends AppCompatActivity
...
@@ -139,6 +138,8 @@ public class MainActivity extends AppCompatActivity
}
else
if
(
id
==
R
.
id
.
wine
)
{
}
else
if
(
id
==
R
.
id
.
wine
)
{
}
else
if
(
id
==
R
.
id
.
collection
)
{
}
else
if
(
id
==
R
.
id
.
collection
)
{
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
CollectionActivity
.
class
);
startActivity
(
intent
);
}
else
if
(
id
==
R
.
id
.
community
)
{
}
else
if
(
id
==
R
.
id
.
community
)
{
...
...
app/src/main/java/com/example/paktalin/lavina/MapActivity.java
View file @
b4d22dc8
...
@@ -12,6 +12,6 @@ public class MapActivity extends AppCompatActivity {
...
@@ -12,6 +12,6 @@ public class MapActivity extends AppCompatActivity {
@Override
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
map_activity
);
setContentView
(
R
.
layout
.
activity_map
);
}
}
}
}
app/src/main/java/com/example/paktalin/lavina/WineAdapter.java
→
app/src/main/java/com/example/paktalin/lavina/WineAdapter
Collection
.java
View file @
b4d22dc8
...
@@ -12,12 +12,12 @@ import android.widget.TextView;
...
@@ -12,12 +12,12 @@ import android.widget.TextView;
* Created by Paktalin on 14/05/2018.
* Created by Paktalin on 14/05/2018.
*/
*/
public
class
WineAdapter
extends
BaseAdapter
{
public
class
WineAdapter
Collection
extends
BaseAdapter
{
private
LayoutInflater
inflater
;
private
LayoutInflater
inflater
;
private
WineBottle
[]
wines
;
private
WineBottle
[]
wines
;
WineAdapter
(
Context
context
,
WineBottle
[]
wines
)
{
WineAdapter
Collection
(
Context
context
,
WineBottle
[]
wines
)
{
this
.
wines
=
wines
;
this
.
wines
=
wines
;
inflater
=
(
LayoutInflater
)
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
inflater
=
(
LayoutInflater
)
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
}
}
...
@@ -42,7 +42,7 @@ public class WineAdapter extends BaseAdapter {
...
@@ -42,7 +42,7 @@ public class WineAdapter extends BaseAdapter {
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
if
(
convertView
==
null
)
{
if
(
convertView
==
null
)
{
convertView
=
inflater
.
inflate
(
R
.
layout
.
wine_item
,
null
);
convertView
=
inflater
.
inflate
(
R
.
layout
.
item_wine_main
,
null
);
}
}
WineBottle
bottle
=
(
WineBottle
)
getItem
(
position
);
WineBottle
bottle
=
(
WineBottle
)
getItem
(
position
);
...
...
app/src/main/java/com/example/paktalin/lavina/WineAdapterMain.java
0 → 100644
View file @
b4d22dc8
package
com
.
example
.
paktalin
.
lavina
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
/**
* Created by Paktalin on 14/05/2018.
*/
public
class
WineAdapterMain
extends
BaseAdapter
{
private
LayoutInflater
inflater
;
private
WineBottle
[]
wines
;
WineAdapterMain
(
Context
context
,
WineBottle
[]
wines
)
{
this
.
wines
=
wines
;
inflater
=
(
LayoutInflater
)
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
}
@Override
public
int
getCount
()
{
return
wines
.
length
;
}
@Override
public
Object
getItem
(
int
position
)
{
return
wines
[
position
];
}
@Override
public
long
getItemId
(
int
position
)
{
return
position
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
if
(
convertView
==
null
)
{
convertView
=
inflater
.
inflate
(
R
.
layout
.
item_wine_main
,
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
());
((
ImageView
)
convertView
.
findViewById
(
R
.
id
.
wine_image
)).
setImageBitmap
(
bottle
.
getImage
());
return
convertView
;
}
}
app/src/main/res/layout/activity_collection.xml
0 → 100644
View file @
b4d22dc8
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/red_background"
>
<RelativeLayout
android:id=
"@+id/header"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:background=
"@android:color/transparent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"My collection"
android:textColor=
"@android:color/white"
android:layout_centerHorizontal=
"true"
android:layout_centerVertical=
"true"
android:textSize=
"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"
>
</ListView>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/
map_activity
.xml
→
app/src/main/res/layout/
activity_map
.xml
View file @
b4d22dc8
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
android:background=
"@drawable/red_background"
>
android:background=
"@drawable/red_background"
>
<RelativeLayout
<RelativeLayout
android:id=
"@+id/
map_title
"
android:id=
"@+id/
header
"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_height=
"50dp"
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<ImageView
<ImageView
android:id=
"@+id/imageView2"
android:id=
"@+id/imageView2"
android:layout_below=
"@+id/
map_title
"
android:layout_below=
"@+id/
header
"
android:layout_width=
"400dp"
android:layout_width=
"400dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/locationmap1"
android:background=
"@drawable/locationmap1"
...
...
app/src/main/res/layout/
wine_item
.xml
→
app/src/main/res/layout/
item_wine_collection
.xml
View file @
b4d22dc8
File moved
app/src/main/res/layout/item_wine_main.xml
0 → 100644
View file @
b4d22dc8
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
android:padding=
"10dp"
>
<RelativeLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_toEndOf=
"@+id/wine_image"
android:layout_toRightOf=
"@+id/wine_image"
>
<TextView
android:id=
"@+id/wine_title"
android:layout_width=
"180dp"
android:layout_height=
"wrap_content"
android:textColor=
"@color/colorPrimaryDark"
android:textSize=
"14sp"
android:layout_marginLeft=
"20dp"
/>
<TextView
android:id=
"@+id/wine_price"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/wine_title"
android:textColor=
"@color/colorPrimary"
android:layout_marginTop=
"5dp"
android:textStyle=
"bold"
android:textSize=
"20sp"
android:layout_alignLeft=
"@+id/wine_title"
/>
</RelativeLayout>
<ImageView
android:id=
"@+id/wine_image"
android:layout_width=
"80dp"
android:layout_height=
"80dp"
android:layout_centerVertical=
"true"
/>
<ImageButton
android:id=
"@+id/arrow"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
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"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/menu/activity_main_drawer.xml
View file @
b4d22dc8
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<item
<item
android:id=
"@+id/collection"
android:id=
"@+id/collection"
android:icon=
"@drawable/favorites_icon"
android:icon=
"@drawable/favorites_icon"
android:title=
"
Your
collection"
/>
android:title=
"
My
collection"
/>
<item
<item
android:id=
"@+id/community"
android:id=
"@+id/community"
android:icon=
"@drawable/community_icon"
android:icon=
"@drawable/community_icon"
...
...
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