</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
<activity android:name="com.facebook.LoginActivity"></activity>
+ <activity android:name="loginActivity"></activity>
</application>
</manifest>
\ No newline at end of file
android:orientation="vertical" >
<TextView
- android:id="@+id/welcome"
- android:layout_width="122dp"
+ android:id="@+id/textView1"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="TextView" />
+ android:text="Log in"
+ android:textAlignment="center"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
-</LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.00" >
+
+ <TextView
+ android:id="@+id/textView2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="User:"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <EditText
+ android:id="@+id/editText1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:ems="10" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:id="@+id/textView3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Pass:"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <EditText
+ android:id="@+id/editText2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.62"
+ android:ems="10"
+ android:inputType="textPassword" >
+
+ <requestFocus />
+ </EditText>
+ </LinearLayout>
+
+ <Button
+ android:id="@+id/button1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Log In" />
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item android:id="@+id/item1" android:title="New Event" android:visible="true"></item>
+
+
+</menu>
--- /dev/null
+package ro.ieval.unical;
+
+public class Utils {
+ public static boolean loginSuccess(String user, String pass) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+}
--- /dev/null
+package ro.ieval.unical;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class loginActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.login);
+
+ final EditText user=(EditText) findViewById(R.id.editText1);
+ final EditText pass=(EditText) findViewById(R.id.editText2);
+ final Button logIn=(Button) findViewById(R.id.button1);
+
+ logIn.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ // TODO Auto-generated method stub
+ if(Utils.loginSuccess(user.getText().toString(),pass.getText().toString())) {
+ setContentView(R.layout.eventview);
+ }
+ }
+ });
+ }
+}
import com.google.gson.Gson;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
+import android.preference.PreferenceManager;
import android.util.Base64;
+import android.view.View;
+import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.facebook.model.*;
public class mainActivity extends android.app.Activity {
- Event[] getEventList() {
- Event events[];
- URL hostUrlJson;
- InputStreamReader in;
- try {
- hostUrlJson=new URL(Constants.searchUrl);
- HttpsURLConnection calConnection = (HttpsURLConnection) hostUrlJson.openConnection();
- calConnection.setDoOutput(true);
- calConnection.setUseCaches(false);
- calConnection.setRequestProperty("Authorization", "Basic "+Base64.encodeToString( (Constants.user+':'+Constants.password).getBytes(), Base64.NO_WRAP));
- //calConnection.setRequestMethod("POST");
- //calConnection.setDoInput(true);
- //calConnection.connect();
-
- final PrintWriter ps=new PrintWriter(calConnection.getOutputStream());
- ps.print("{}");
- ps.close();
-
- in = new InputStreamReader(calConnection.getInputStream());
- Gson gson=new Gson();
- events=gson.fromJson(in,Event[].class);
- in.close();
-
- return events;
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- System.err.println("catch1");
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- System.err.println("catch2");
- e.printStackTrace();
- }
- throw new AssertionError();
- }
@Override
protected void onCreate(Bundle savedInstanceState) {
// All Begins here :)
// And here it began the olympic app that does olympic thing
- super.onCreate(savedInstanceState);
- setContentView(R.layout.login);
- /*setContentView(R.layout.eventview);
- final TextView eventTitle= (TextView) findViewById(R.id.eventTitle);
- final TextView date=(TextView) findViewById(R.id.date);
- final TextView description=(TextView) findViewById(R.id.description);
-
- final Handler h=new Handler();
- new Thread(new Runnable() {
- public void run() {
- final Event events[]=getEventList();
- h.post(new Runnable() {
- public void run() {
- // aici incepe
-
- eventTitle.setText(events[0].title);
- date.setText((new Date(events[0].date)).toString());
- description.setText(events[0].description);
- DatabaseInteract db=new DatabaseInteract(mainActivity.this);
- }
- });
- }
- }).start();*/
+ //log in
+ super.onCreate(savedInstanceState);
+ final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
+ if(prefs.getBoolean("FirstTime", true)) {
+ prefs.edit().putBoolean("FirstTime", false).commit();
+ Intent i=new Intent(this,loginActivity.class);
+ startActivity(i);
+ }
}
}