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 java.util.concurrent.locks.*; 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.graphics.*; import android.widget.*; import android.app.*; import android.widget.Button; import android.view.*; import android.view.KeyEvent; import android.view.inputmethod.*; import android.text.*; import android.content.*; import android.view.View; import android.app.Activity; import javax.net.ssl.*; import java.security.SecureRandom; import java.security.cert.X509Certificate; import android.content.Context; import java.text.SimpleDateFormat; import java.text.NumberFormat; class main { public static void main(final String[] args) throws Exception { final EditText tvEmail = aTextInput(androidAssistant_userEmail()); final EditText tvPW = aPasswordInput(); final TextView tvResult = aFontSize(20, aForeground(aRed(), aCenteredTextView())); aShow(aVerticalStack( aForeground(aBlack(), aBold(aFontSize(24, aCenteredTextView("Register to start using your personal assistant!")))), aVerticalSpacer(25), tvResult, aVerticalSpacer(25), aBold(aFontSize(20, aCenteredTextView("Your e-mail address:"))), aCenterTextView(tvEmail), aVerticalSpacer(25), aFontSize(20, aCenteredTextView("Please choose a password:")), aCenterTextView(tvPW), aVerticalSpacer(30), aButton("Register", new Runnable() { public void run() { try { final Button btn = heldInstance(Button.class); startThread(new Runnable() { public void run() { try { AutoCloseable __0 = aTempDisable(btn); try { String pw = aGetText(tvPW); String error = assistant_checkPasswordStructure(pw); if (nempty(error)) { aSetText(tvResult, error); return; } AutoCloseable __1 = aTempSetText(btn, "Registering..."); try { aSetText(tvResult, postPage("http://botcompany.de:8083/register", "email" , aGetText(tvEmail), "pwHash" , assistant_hashPassword(pw))); } finally { _close(__1); }} finally { _close(__0); } } catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "AutoCloseable __0 = aTempDisable(btn); try {\r\n String pw = aGetText(tv..."; }}); } catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "final Button btn = heldInstance(Button);\r\n thread {\r\n AutoClosea..."; }}))); aFocus(tvEmail); aSelectAll(tvEmail); aShowKeyboard(); } static EditText aTextInput() { return aSingleLineEditText(); } static EditText aTextInput(String text) { return aSingleLineEditText(text); } static String androidAssistant_userEmail() { return loadTextFile(androidAssistant_userEmailFile()); } static EditText aPasswordInput() { EditText t = aTextInput(); t.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); return t; } static EditText aPasswordInput(String text) { return aSetText(aPasswordInput(), text); } static TextView aFontSize(final float size, final TextView a) { if (a == null) return a; androidUI(new Runnable() { public void run() { try { a.setTextSize(size) ; } catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "a.setTextSize(size)"; }}); return a; } static TextView aForeground(int color, TextView a) { return aSetForeground(color, a); } static int aRed() { return 0xFFFF0000; } static TextView aCenteredTextView(String text) { final TextView tv = aTextView(text); androidUI(new Runnable() { public void run() { try { tv.setGravity(Gravity.CENTER_HORIZONTAL) ; } catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "tv.setGravity(Gravity.CENTER_HORIZONTAL)"; }}); return tv; } static TextView aCenteredTextView() { return aCenteredTextView(""); } static void aShow(View view) { androidShow(view); } static LinearLayout aVerticalStack(View... views) { return aVerticalLinearLayout(views); } static int aBlack() { return 0xFF000000; } static A aBold(final A a) { if (a != null) { androidUI(new Runnable() { public void run() { try { a.setTypeface(null, Typeface.BOLD); } catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "a.setTypeface(null, Typeface.BOLD);"; }}); } return a; } static View aVerticalSpacer(final int height) { final Space s = aSpace(); { androidUI(new Runnable() { public void run() { try { s.setLayoutParams(new LinearLayout.LayoutParams(1, height)); } catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "s.setLayoutParams(new LinearLayout.LayoutParams(1, height));"; }}); } return s; } static A aCenterTextView(final A tv) { if (tv != null) { androidUI(new Runnable() { public void run() { try { tv.setGravity(Gravity.CENTER_HORIZONTAL); } catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "tv.setGravity(Gravity.CENTER_HORIZONTAL);"; }}); } return tv; } static Button aButton(String text, final Runnable action) { final Button b = aButton(text); if (action != null) b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { AutoCloseable __4 = holdInstance(b); try { pcallF(action); } finally { _close(__4); }} }); return b; } static Button aButton(String text) { Button b = aButton(); b.setText(text); return b; } static Button aButton() { return androidUI(new F0