Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e15898d1
authored
Aug 22, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
working on tablet student license icon
parent
f2c56467
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
10 deletions
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/CustomList.java
android/Pictogram/tabletlibrary/src/main/res/layout/list_single.xml
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/login/CustomList.java
View file @
e15898d1
...
...
@@ -4,6 +4,7 @@ import android.app.Activity;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Color
;
import
android.graphics.Typeface
;
import
android.provider.ContactsContract
;
import
android.support.v4.content.ContextCompat
;
import
android.view.LayoutInflater
;
...
...
@@ -18,6 +19,10 @@ import com.yottacode.pictogram.tools.PCBcontext;
import
java.util.Vector
;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_certificate
;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_flask
;
import
static
com
.
yottacode
.
pictogram
.
R
.
string
.
fa_exclamation_triangle
;
/**
* Creates a View for each student on the list with a photo and his/her name.
* It uses list_single.xml for the layout creation.
...
...
@@ -28,6 +33,7 @@ public class CustomList extends ArrayAdapter<String>{
private
final
Activity
context
;
private
final
String
[]
name_surname
;
private
final
Vector
<
Bitmap
>
images
;
private
final
String
[]
licenses
;
/**
* @param context Context used for rendering the view
...
...
@@ -35,11 +41,12 @@ public class CustomList extends ArrayAdapter<String>{
* @param images List of students' photos
*/
public
CustomList
(
Activity
context
,
String
[]
name_surname
,
Vector
<
Bitmap
>
images
)
{
String
[]
name_surname
,
Vector
<
Bitmap
>
images
,
String
[]
licenses
)
{
super
(
context
,
R
.
layout
.
list_single
,
name_surname
);
this
.
context
=
context
;
this
.
name_surname
=
name_surname
;
this
.
images
=
images
;
this
.
licenses
=
licenses
;
this
.
color
=
true
;
}
...
...
@@ -53,8 +60,28 @@ public class CustomList extends ArrayAdapter<String>{
public
View
getView
(
int
position
,
View
view
,
ViewGroup
parent
)
{
LayoutInflater
inflater
=
context
.
getLayoutInflater
();
View
rowView
=
inflater
.
inflate
(
R
.
layout
.
list_single
,
null
,
true
);
// Name
TextView
txtTitle
=
(
TextView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentName
);
// License
TextView
licenseView
=
(
TextView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentLicense
);
switch
(
licenses
[
position
])
{
case
"pro"
:
licenseView
.
setText
(
fa_certificate
);
break
;
case
"b"
:
licenseView
.
setText
(
fa_flask
);
break
;
default
:
licenseView
.
setText
(
fa_exclamation_triangle
);
}
Typeface
font
=
Typeface
.
createFromAsset
(
getContext
().
getAssets
(),
"fonts/fontawesome-webfont.ttf"
);
licenseView
.
setTypeface
(
font
);
// Image
ImageView
imageView
=
(
ImageView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentPhoto
);
txtTitle
.
setText
(
name_surname
[
position
]);
...
...
android/Pictogram/tabletlibrary/src/main/res/layout/list_single.xml
View file @
e15898d1
...
...
@@ -36,15 +36,27 @@
android:layout_gravity=
"center"
/>
</FrameLayout>
<TextView
android:id=
"@+id/loginStudentName"
android:layout_width=
"150dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/loginStudentPhoto"
android:layout_centerHorizontal=
"true"
android:layout_gravity=
"center"
android:textAlignment=
"center"
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/loginStudentLicense"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"1dp"
/>
<TextView
android:id=
"@+id/loginStudentName"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/loginStudentPhoto"
android:layout_centerHorizontal=
"false"
android:layout_gravity=
"center"
android:layout_weight=
"1"
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
</LinearLayout>
</LinearLayout>
...
...
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