Detailspublic class Details extends android.app.Activity
Fields Summary |
---|
MenuItem.OnMenuItemClickListener | mRequery | MenuItem.OnMenuItemClickListener | mPrintToStdout | android.widget.LinearLayout | mLinearLayout | android.widget.ScrollView | mScrollView | ArrayList | mData |
Methods Summary |
---|
void | addDataViews()
int oldScroll = 0;
if (mLinearLayout != null) {
mScrollView.removeView(mLinearLayout);
}
mLinearLayout = new LinearLayout(this);
mScrollView.addView(mLinearLayout, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
mLinearLayout.setOrientation(LinearLayout.VERTICAL);
// Here in onStart, we're given data. We use that because some
// data that we show is transient and can't be retrieved from a url.
// We'll try to use that in requery
int count = mData.size();
for (int i=0; i<count; i++) {
ColumnData cd = mData.get(i);
TextView label = makeView(cd.key, true, 12);
TextView contents = makeView(cd.value, false, 12);
contents.setPadding(3, 0, 0, i==count-1?0:3);
mLinearLayout.addView(label, lazy());
mLinearLayout.addView(contents, lazy());
}
| LinearLayout.LayoutParams | lazy()
return new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT, 0);
| android.widget.TextView | makeView(java.lang.String str, boolean bold, int fontSize)
if (str == null) {
str = "(null)";
}
TextView v = new TextView(this);
v.setText(str);
v.setTextSize(fontSize);
if (bold) {
v.setTypeface(Typeface.DEFAULT_BOLD);
}
return v;
| public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
Intent intent = getIntent();
String title = intent.getStringExtra("title");
if (title == null) {
title = "Details";
}
setTitle(title);
mScrollView = new ScrollView(this);
setContentView(mScrollView);
mScrollView.setFocusable(true);
mData = (ArrayList<ColumnData>)getIntent().getExtra("data");
addDataViews();
| public boolean | onCreateOptionsMenu(android.view.Menu menu)
super.onCreateOptionsMenu(menu);
menu.add(0, 0, 0, "Requery").setOnMenuItemClickListener(mRequery);
menu.add(0, 0, 0, "Print to stdout").setOnMenuItemClickListener(mPrintToStdout);
return true;
| public void | onResume()
super.onResume();
|
|