CuneiPainter  Version 1.2
ResultAdapter Class Reference

Created by situx on 5/23/15. More...

Inheritance diagram for ResultAdapter:
Collaboration diagram for ResultAdapter:

Public Member Functions

int getCount ()
 
Object getItem (final int i)
 
long getItemId (final int i)
 
View getView (final int i, View view, final ViewGroup viewGroup)
 

Package Functions

 ResultAdapter (final Context context, final List< Tuple< String, String >> items)
 Constructor for this class. More...
 

Private Member Functions

void openDialog (String title, String text)
 Opens a dialog window to display additional information about the cuneiform character. More...
 

Private Attributes

final Typeface myTypeface
 
List< Tuple< String, String > > items
 
Context context
 

Detailed Description

Created by situx on 5/23/15.

Adapter class for displaying cuneiform character results.

Constructor & Destructor Documentation

ResultAdapter ( final Context  context,
final List< Tuple< String, String >>  items 
)
package

Constructor for this class.

Parameters
contextthe context of this adapter
itemsthe items to handle

References ResultAdapter.context, and ResultAdapter.items.

31  {
32  this.items=items;
33  this.context=context;
34  this.myTypeface = Typeface.createFromAsset(this.context.getAssets(), "akkadian.ttf");
35  }
Context context
Definition: ResultAdapter.java:24
List< Tuple< String, String > > items
Definition: ResultAdapter.java:22

Member Function Documentation

int getCount ( )

References ResultAdapter.items.

38  {
39  if(items==null){
40  return 1;
41  }
42  return this.items.size();
43  }
List< Tuple< String, String > > items
Definition: ResultAdapter.java:22
Object getItem ( final int  i)
46  {
47  return this.items.get(i);
48  }
long getItemId ( final int  i)
51  {
52  return 0;
53  }
View getView ( final int  i,
View  view,
final ViewGroup  viewGroup 
)

References ResultAdapter.context, and ResultAdapter.items.

56  {
57  TextView tview=new TextView(this.context);
58  tview.setTypeface(this.myTypeface);
59  tview.setTextColor(Color.WHITE);
60  tview.setTextSize(24);
61  if(this.items!=null)
62  tview.setText(ResultAdapter.this.items.get(i).getOne()+" ");
63  tview.setOnClickListener(new View.OnClickListener() {
64  @Override
65  public void onClick(final View view) {
66  if(ResultAdapter.this.items!=null)
67  ResultAdapter.this.openDialog(items.get(i).getOne(),items.get(i).getTwo());
68  }
69  });
70  return tview;
71  }
Context context
Definition: ResultAdapter.java:24
ResultAdapter(final Context context, final List< Tuple< String, String >> items)
Constructor for this class.
Definition: ResultAdapter.java:31
List< Tuple< String, String > > items
Definition: ResultAdapter.java:22
void openDialog ( String  title,
String  text 
)
private

Opens a dialog window to display additional information about the cuneiform character.

Parameters
titlethe title of the dialog window
textthe text of the dialog window

References ResultAdapter.context.

78  {
79  final Dialog dialog = new Dialog(context); // context, this etc.
80  dialog.setContentView(R.layout.dialog);
81  dialog.setTitle(title);
82  ((TextView)dialog.findViewById(android.R.id.title)).setTypeface(
83  Typeface.createFromAsset(this.context.getAssets(), "akkadian.ttf"));
84  TextView viewText = dialog.findViewById(R.id.dialog_info);
85  viewText.setTypeface(this.myTypeface);
86  viewText.setText(Html.fromHtml(text));
87  Button button=dialog.findViewById(R.id.dialog_ok);
88  button.setOnClickListener(new View.OnClickListener() {
89  @Override
90  public void onClick(final View view) {
91  dialog.cancel();
92  }
93  });
94  dialog.show();
95  }
Context context
Definition: ResultAdapter.java:24

Member Data Documentation

List<Tuple<String,String> > items
private
final Typeface myTypeface
private