diff --git a/app/build.gradle b/app/build.gradle index b1eb9bc..6569b5e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e24737d..6b756d3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,6 +17,8 @@ + \ No newline at end of file diff --git a/app/src/main/java/org/communiquons/android/comunic/client/Account.java b/app/src/main/java/org/communiquons/android/comunic/client/Account.java index 464ce3d..e88cf91 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/Account.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/Account.java @@ -46,17 +46,8 @@ class Account { mContext = context; utils = new Utilities(context); - //Initializate tokens array + //Initialize tokens array tokens = new ArrayList<>(); - - //Debug test - /*ArrayList 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"));*/ } /** diff --git a/app/src/main/java/org/communiquons/android/comunic/client/LoginActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/LoginActivity.java new file mode 100644 index 0000000..10da188 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/LoginActivity.java @@ -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); + } +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java index d3d8244..1ed3336 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java @@ -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); + } } } diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml new file mode 100644 index 0000000..3da19c1 --- /dev/null +++ b/app/src/main/res/layout/activity_login.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +