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.view.View;
import android.app.Activity;
import java.text.NumberFormat;
import android.content.Context;
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
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("Log in to your assistant!")))),
aVerticalSpacer(25),
tvResult,
aVerticalSpacer(25),
aBold(aFontSize(20, aCenteredTextView("Your e-mail address:"))),
aCenterTextView(tvEmail),
aVerticalSpacer(25),
aFontSize(20, aCenteredTextView("Password:")),
aCenterTextView(tvPW),
aVerticalSpacer(30),
aButton("Log in", new Runnable() { public void run() { try {
final String mail = trim(aGetText(tvEmail));
if (empty(mail))
{ aSetText(tvResult, "Please enter your e-mail address"); return; }
if (!isValidEmailAddress_simple(mail))
{ aSetText(tvResult, "Invalid e-mail address"); return; }
String pw = trim(aGetText(tvPW));
saveTextFile(androidAssistant_userEmailFile(), mail);
if (empty(pw))
{ aSetText(tvResult, "Please enter the password!"); return; }
final String hash = assistant_hashPassword(pw);
saveTextFile(androidAssistant_hashedPWFile(), hash);
final Button btn = heldInstance(Button.class);
startThread(new Runnable() { public void run() { try {
AutoCloseable __0 = aTempDisable(btn); try {
AutoCloseable __1 = aTempSetText(btn, "Logging in..."); try {
aSetText(tvResult, postPage("http://botcompany.de:8083/checkPW", "email" , mail, "pwHash" , hash));
} finally { _close(__1); }} finally { _close(__0); }
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "AutoCloseable __0 = aTempDisable(btn); try {\r\n AutoCloseable __1 = aT..."; }});
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "final String mail = trim(aGetText(tvEmail));\r\n if (empty(mail))\r\n ..."; }})));
}
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