2 * Copyright (C) 2013 by Raphael Michel under the MIT license:
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the Software
9 * is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
22 package de.geeksfactory.opacclient.frontend;
24 import java.io.InterruptedIOException;
27 import org.holoeverywhere.app.Activity;
28 import org.holoeverywhere.app.AlertDialog;
30 import android.content.Intent;
31 import android.os.Bundle;
32 import android.view.View;
33 import android.view.View.OnClickListener;
34 import android.widget.Button;
35 import de.geeksfactory.opacclient.OpacClient;
36 import de.geeksfactory.opacclient.OpacTask;
37 import jp.sourceforge.worldopac.R;
39 public class WelcomeActivity extends Activity {
40 protected OpacClient app;
41 protected AlertDialog dialog;
43 public static int getLayoutResource() {
44 return R.layout.activity_welcome;
48 public void onCreate(Bundle savedInstanceState) {
49 super.onCreate(savedInstanceState);
50 app = (OpacClient) getApplication();
51 setContentView(getLayoutResource());
53 Button btAddAccount = (Button) findViewById(R.id.btAddAccount);
54 btAddAccount.setOnClickListener(new OnClickListener() {
56 public void onClick(View arg0) {
63 public void onBackPressed() {
65 super.onBackPressed();
69 Intent i = new Intent(this, LibraryListActivity.class);
70 i.putExtra("welcome", true);
74 public class InitTask extends OpacTask<Integer> {
76 protected Integer doInBackground(Object... arg0) {
77 super.doInBackground(arg0);
80 } catch (java.net.UnknownHostException e) {
82 } catch (java.net.SocketException e) {
84 } catch (InterruptedIOException e) {
86 } catch (Exception e) {
87 ACRA.getErrorReporter().handleException(e);
93 protected void onPostExecute(Integer result) {
95 Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
96 startActivity(intent);
101 protected void onStop() {
103 if (dialog != null) {
104 if (dialog.isShowing()) {