// Path: src/fr/xtof54/jsgo/EventManager.java
// enum eventType {loginStarted, loginEnd, downloadListStarted, downloadListEnd, downloadListGamesEnd, downloadGameStarted, downloadGameEnd, GameOK, moveSentStart, moveSentEnd, gobanReady,
// 	msgSendStart, msgSendEnd, ladderStart, ladderEnd, ladderChallengeStart, ladderChallengeEnd, showMessage, copyEidogoStart, copyEidogoEnd};
// 
// Path: src/fr/xtof54/jsgo/ServerConnection.java
// public interface DetLogger {
//     public void showMsg(String s);
// }


import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;
import org.json.JSONException;
import org.json.JSONObject;
import fr.xtof54.jsgo.R;
import fr.xtof54.jsgo.EventManager.eventType;
import fr.xtof54.jsgo.ServerConnection.DetLogger;
import android.net.TrafficStats;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Environment;
import android.os.Handler;
import android.os.Process;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.AssetManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebChromeClient;
import android.webkit.ConsoleMessage;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.view.MotionEvent;
					public Dialog onCreateDialog(Bundle savedInstanceState) {
						final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
						// Get the layout inflater
						LayoutInflater inflater = getActivity().getLayoutInflater();
						ArrayAdapter<String> adapter = new ArrayAdapter<String>(main, R.layout.detlistitem, androidServer.ladd.getCachedLadder());
						// Inflate and set the layout for the dialog
						// Pass null as the parent view because it's going in the dialog layout
						View listFrameview = inflater.inflate(R.layout.ladder, null);
						{
							TextView ladderlab = (TextView)listFrameview.findViewById(R.id.ladderlab);
							String s = "on "+androidServer.ladd.getCacheTime()+" your rk: "+androidServer.ladd.userRank;
							ladderlab.setText(s);
						}
						final ListView ladder = (ListView)listFrameview.findViewById(R.id.ladderList);
						ladder.setAdapter(adapter);
						ladder.setOnItemClickListener(new OnItemClickListener() {
							@Override
							public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
								androidServer.ladd.lastClicked = position;
							}
						});
						builder.setView(listFrameview);

						builder.setPositiveButton("Challenge", new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog, int id) {
								int i = androidServer.ladd.lastClicked;
								//                                showMessage("selected item "+i);
								if (i>=0) {
									ladderChallenge(i);
								}
// Path: src/fr/xtof54/jsgo/EventManager.java
// enum eventType {loginStarted, loginEnd, downloadListStarted, downloadListEnd, downloadListGamesEnd, downloadGameStarted, downloadGameEnd, GameOK, moveSentStart, moveSentEnd, gobanReady,
// 	msgSendStart, msgSendEnd, ladderStart, ladderEnd, ladderChallengeStart, ladderChallengeEnd, showMessage, copyEidogoStart, copyEidogoEnd};
// 
// Path: src/fr/xtof54/jsgo/ServerConnection.java
// public interface DetLogger {
//     public void showMsg(String s);
// }


// Path: src/fr/xtof54/jsgo/GoJsActivity.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.concurrent.ArrayBlockingQueue;
import org.json.JSONException;
import org.json.JSONObject;
import fr.xtof54.jsgo.R;
import fr.xtof54.jsgo.EventManager.eventType;
import fr.xtof54.jsgo.ServerConnection.DetLogger;
import android.net.TrafficStats;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Environment;
import android.os.Handler;
import android.os.Process;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.AssetManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebChromeClient;
import android.webkit.ConsoleMessage;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.view.MotionEvent;

					public Dialog onCreateDialog(Bundle savedInstanceState) {
						final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
						// Get the layout inflater
						LayoutInflater inflater = getActivity().getLayoutInflater();
						ArrayAdapter<String> adapter = new ArrayAdapter<String>(main, R.layout.detlistitem, androidServer.ladd.getCachedLadder());
						// Inflate and set the layout for the dialog
						// Pass null as the parent view because it's going in the dialog layout
						View listFrameview = inflater.inflate(R.layout.ladder, null);
						{
							TextView ladderlab = (TextView)listFrameview.findViewById(R.id.ladderlab);
							String s = "on "+androidServer.ladd.getCacheTime()+" your rk: "+androidServer.ladd.userRank;
							ladderlab.setText(s);
						}
						final ListView ladder = (ListView)listFrameview.findViewById(R.id.ladderList);
						ladder.setAdapter(adapter);
						ladder.setOnItemClickListener(new OnItemClickListener() {
							@Override
							public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
								androidServer.ladd.lastClicked = position;
							}
						});
						builder.setView(listFrameview);

						builder.setPositiveButton("Challenge", new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog, int id) {
								int i = androidServer.ladd.lastClicked;
								//                                showMessage("selected item "+i);
								if (i>=0) {
									ladderChallenge(i);
								}
								DetListDialogFragment.this.getDialog().dismiss();