+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:fillViewport="true">
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#ffffff">
-
- <!-- Header Starts-->
- <LinearLayout android:id="@+id/header"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/header_gradient"
- android:paddingTop="5dip"
- android:paddingBottom="5dip">
- <!-- Logo Start-->
- <ImageView android:src="@drawable/evergreen_logo"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"/>
- <!-- Logo Ends -->
- </LinearLayout>
-
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/first_config_message"
- android:textColor="#372c24"
- android:id="@+id/first_launch_test_message"
- android:layout_below="@id/header"
- android:layout_marginLeft="10dp"
- android:layout_marginTop="10dp"
- />
- <!-- Header Ends -->
- <!-- Footer Start -->
-
- <!-- Footer Ends -->
-
- <!-- Login Form -->
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="10dip"
- android:layout_below="@id/first_launch_test_message">
- <!-- Email Label -->
-
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:textStyle="bold"
- android:text="@string/server_name"/>
- <EditText
- android:id="@+id/server_http_adress"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:text="http://"
- android:singleLine="true"/>
-
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:text="@string/username"
- android:textStyle="bold"/>
- <EditText
- android:id="@+id/username"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:singleLine="true"/>
- <!-- Password Label -->
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:text="@string/password"
- android:textStyle="bold"
- />
- <EditText
- android:id="@+id/password"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:singleLine="true"
- android:password="true"/>
- <!-- Login button -->
- <Button
- android:id="@+id/connect_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dip"
- android:text="@string/connect_button"/>
- <!-- Link to Registration Screen -->
-
-
- </LinearLayout>
- <!-- Login Form Ends -->
- </RelativeLayout>
-</ScrollView>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2012 Evergreen Open-ILS
- * @author Daniel-Octavian Rizea
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * or the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be usefull,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-package org.evergreen.android.views;
-
-import org.evergreen.android.R;
-import org.evergreen.android.accountAccess.AccountAccess;
-import org.evergreen.android.globals.GlobalConfigs;
-import org.evergreen.android.globals.Utils;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.Toast;
-
-public class ConfigureApplicationActivity extends Activity {
-
- private String TAG = "ConfigureApplicationActivity";
-
- private ProgressDialog progressDialog = null;
-
- private EditText server_http;
-
- private EditText username;
-
- private EditText password;
-
- private Context context;
-
- public static final int RESULT_CONFIGURE_SUCCESS = 10;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.configure_application);
- context = this;
- server_http = (EditText) findViewById(R.id.server_http_adress);
-
- SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
- server_http.setText(preferences.getString("library_url", "https://bark.cwmars.org"));
-
- Button connect = (Button) findViewById(R.id.connect_button);
-
- connect.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
-
- Thread checkConn = new Thread(new Runnable() {
- @Override
- public void run() {
-
- boolean server_address = false;
- boolean auth = false;
-
- server_address = Utils
- .checkIfNetAddressIsReachable(server_http
- .getText().toString());
-
- if (server_address == true) {
- SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
- SharedPreferences.Editor editor = preferences.edit();
- editor.putString("library_url", server_http.getText().toString());
- editor.commit();
- GlobalConfigs.httpAddress = server_http.getText().toString();
- AccountAccess accountAccess = AccountAccess.getAccountAccess(GlobalConfigs.httpAddress);
- try {
- auth = accountAccess.reauthenticate(ConfigureApplicationActivity.this);
- } catch (Exception e) {
- Log.w(TAG, "caught", e);
- }
-
- if (auth == true) {
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- progressDialog.dismiss();
- setResult(RESULT_CONFIGURE_SUCCESS);
- finish();
- }
- });
-
- } else {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- progressDialog.dismiss();
- Toast.makeText(context,
- "Bad user login information",
- Toast.LENGTH_LONG).show();
- }
- });
- }
-
- } else {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- progressDialog.dismiss();
- Toast.makeText(context,
- "Bad library server url",
- Toast.LENGTH_LONG).show();
- }
- });
- }
- }
- });
-
- progressDialog = ProgressDialog.show(context, "Please wait",
- "Checking user credentials");
- checkConn.start();
- }
-
- });
- }
-}