import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
import android.app.*;
import android.widget.*;
import android.view.*;
import android.view.KeyEvent;
import android.view.inputmethod.*;
import android.text.*;
import android.app.*;
import android.widget.*;
import android.view.*;
import android.view.KeyEvent;
import android.view.inputmethod.*;
import android.text.*;
import android.app.Activity;
import android.view.View;
import android.view.*;
import android.widget.*;
import android.content.*;
public class main {
public static void main(String[] args) throws Exception {
androidUI(new Runnable() { public void run() { try {
final EditText et = new EditText(androidActivity ());
et.setInputType(InputType.TYPE_CLASS_TEXT); // Hopefully turns off multiline
et.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
}
return false;
}
});
androidShow (aNorthAndCenter (et,
new AndroidList (ll("a", "b")).view()));
} catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); } } });
}
static ArrayList ll(A... a) {
return litlist(a);
}
static void androidUI( final Runnable r) {
androidActivity ().runOnUiThread(r);
}
static LinearLayout aNorthAndCenter (View n, View c) {
LinearLayout ll = new LinearLayout(androidActivity ());
ll.setOrientation(ll.VERTICAL);
c.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
ll.addView(n);
ll.addView(c);
return ll;
}
static Activity androidActivity() {
return (Activity) androidContext_gen();
}
static void androidShow(final View view) {
androidActivity().runOnUiThread(new Runnable() { public void run() { try {
androidActivity().setContentView(view);
} catch (Exception __e) { throw __e instanceof RuntimeException ? (RuntimeException) __e : new RuntimeException(__e); } } });
}
static ArrayList litlist(A... a) {
return new ArrayList(Arrays.asList(a));
}
static Object androidContext_gen() {
return getAndroidContext_gen();
}
static Object androidContext;
static Object getAndroidContext_gen() {
return androidContext;
}
static class AndroidList {
ListView lv;
Object onClick;
View view() { return lv; }
AndroidList(List l) {
lv = new ListView(androidActivity());
lv.setAdapter(new MyAdapter(androidActivity (), toStringArray(l)));
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> arg0, View arg1,
int position, long id) {
callF(onClick, position);
}
});
}
class MyAdapter extends ArrayAdapter {
public MyAdapter(Context context, String[] strings) {
super(context, -1, -1, strings);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout listLayout = new LinearLayout(getContext ());
listLayout.setLayoutParams(new AbsListView.LayoutParams(
AbsListView.LayoutParams.FILL_PARENT,
AbsListView.LayoutParams.WRAP_CONTENT));
listLayout.setId(View.generateViewId());
TextView listText = new TextView(getContext());
listText.setId(View.generateViewId());
listLayout.addView(listText);
listText.setText(super.getItem(position));
return listLayout;
}
}
}
static Object callF(Object f, Object... args) {
return callFunction(f, args);
}
static String[] toStringArray(List list) {
return list.toArray(new String[list.size()]);
}
static String[] toStringArray(Object o) {
if (o instanceof String[])
return (String[]) o;
else if (o instanceof List)
return toStringArray((List) o);
else
throw fail("Not a list or array: " + structure(o));
}
static int getContext_n = 3;
static String getContext(String text, int lineNr) {
List l = new ArrayList();
List lines = toLines(text);
int from = max(0, lineNr-1-getContext_n);
int to = min(l(lines), lineNr+getContext_n);
for (int i = from; i < to; i++)
l.add((i == lineNr-1 ? "* " : ". ") + lines.get(i));
return fromLines(l);
}
static int max(int a, int b) {
return Math.max(a, b);
}
static long max(int a, long b) {
return Math.max((long) a, b);
}
static long max(long a, long b) {
return Math.max(a, b);
}
static double max(int a, double b) {
return Math.max((double) a, b);
}
static float max(float a, float b) {
return Math.max(a, b);
}
static int max(Collection c) {
int x = Integer.MIN_VALUE;
for (int i : c) x = max(x, i);
return x;
}
static double max(double[] c) {
if (c.length == 0) return Double.MIN_VALUE;
double x = c[0];
for (int i = 1; i < c.length; i++) x = Math.max(x, c[i]);
return x;
}
static byte max(byte[] c) {
byte x = -128;
for (byte d : c) if (d > x) x = d;
return x;
}
static Object callFunction(Object f, Object... args) {
if (f == null) return null;
if (f instanceof Runnable) {
((Runnable) f).run();
return null;
} else if (f instanceof String)
return call(mc(), (String) f, args);
else
return call(f, "get", args);
//else throw fail("Can't call a " + getClassName(f));
}
static String fromLines(List lines) {
StringBuilder buf = new StringBuilder();
if (lines != null)
for (String line : lines)
buf.append(line).append('\n');
return buf.toString();
}
static String fromLines(String... lines) {
return fromLines(asList(lines));
}
static int l(Object[] a) { return a == null ? 0 : a.length; }
static int l(boolean[] a) { return a == null ? 0 : a.length; }
static int l(byte[] a) { return a == null ? 0 : a.length; }
static int l(int[] a) { return a == null ? 0 : a.length; }
static int l(float[] a) { return a == null ? 0 : a.length; }
static int l(char[] a) { return a == null ? 0 : a.length; }
static int l(Collection c) { return c == null ? 0 : c.size(); }
static int l(Map m) { return m == null ? 0 : m.size(); }
static int l(CharSequence s) { return s == null ? 0 : s.length(); }
static int l(Object o) {
return l((List) o); // incomplete
}
static String structure(Object o) {
HashSet refd = new HashSet();
return structure_2(structure_1(o, new structure_Data(refd)), refd);
}
// leave to false, unless unstructure() breaks
static boolean structure_allowShortening = false;
static int structure_shareStringsLongerThan = 20;
static class structure_Data {
int stringSizeLimit;
IdentityHashMap