mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-12-26 21:48:58 +00:00
Create login layout file
This commit is contained in:
parent
aeba9a615b
commit
4a7c5dfc1f
@ -26,5 +26,6 @@ dependencies {
|
||||
})
|
||||
compile 'com.android.support:appcompat-v7:26.+'
|
||||
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
compile 'com.android.support:design:26.+'
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".LoginActivity"
|
||||
android:label="@string/activity_login_header"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -46,17 +46,8 @@ class Account {
|
||||
mContext = context;
|
||||
utils = new Utilities(context);
|
||||
|
||||
//Initializate tokens array
|
||||
//Initialize tokens array
|
||||
tokens = new ArrayList<>();
|
||||
|
||||
//Debug test
|
||||
/*ArrayList<String> tokens = new ArrayList<>();
|
||||
tokens.add("cXNkZjVxNnM1NGRmNTRxczZkNGZxc2RmNAo");
|
||||
tokens.add("cXNkZjVxNnM1cXM4ZDdmODdxczhkZ3FzZGp");
|
||||
save_new_tokens(tokens);
|
||||
Log.v("Account", utils.file_get_content(tokFilename));
|
||||
|
||||
Log.v("Account", "You are signed in: " + (signed_in() ? "Yes" : "No"));*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,13 @@
|
||||
package org.communiquons.android.comunic.client;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package org.communiquons.android.comunic.client;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
@ -15,6 +16,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
//Initialize account object
|
||||
account = new Account(this);
|
||||
|
||||
//Check if user is signed in or not
|
||||
if(!account.signed_in()){
|
||||
|
||||
//Open the login activity
|
||||
Intent intent = new Intent(this, LoginActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
77
app/src/main/res/layout/activity_login.xml
Normal file
77
app/src/main/res/layout/activity_login.xml
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical"
|
||||
tools:context="org.communiquons.android.comunic.client.LoginActivity">
|
||||
|
||||
<!-- Login loading progress -->
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<!-- Login form -->
|
||||
<ScrollView
|
||||
android:id="@+id/login_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Email field -->
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/email_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/activity_login_email_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<!-- Password field -->
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/activity_login_password_hint"
|
||||
android:inputType="textPassword"
|
||||
/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
<!-- Sign in button -->
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/activity_login_submit_form"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
@ -1,3 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">Comunic</string>
|
||||
<string name="activity_login_header">Login</string>
|
||||
<string name="activity_login_email_hint">Email address</string>
|
||||
<string name="activity_login_password_hint">Password</string>
|
||||
<string name="activity_login_submit_form">Login</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user