Skip to content

Commit

Permalink
Merge pull request #85 from ApplETS/dev
Browse files Browse the repository at this point in the history
Mise en production ÉTSMobile 2.21
  • Loading branch information
zaclimon authored May 31, 2017
2 parents 383c707 + 14f212d commit 05adfac
Show file tree
Hide file tree
Showing 19 changed files with 228 additions and 382 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ android {
applicationId "ca.etsmtl.applets.etsmobile"
minSdkVersion 15
targetSdkVersion 21
versionCode 23
versionName "2.20"
versionCode 24
versionName "2.21"
multiDexEnabled true
}

Expand Down Expand Up @@ -103,6 +103,7 @@ dependencies {
transitive = true
}
compile 'com.github.markushi:circlebutton:1.1'
compile 'com.flaviofaria:kenburnsview:1.0.7'


}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
android:windowSoftInputMode="adjustResize|stateVisible" />
<activity
android:name="ca.etsmtl.applets.etsmobile.ui.activity.UrgenceActivity"
android:parentActivityName="ca.etsmtl.applets.etsmobile.ui.activity.MainActivity"
android:screenOrientation="portrait" />
<activity
android:name="ca.etsmtl.applets.etsmobile.ui.activity.MoodleCourseActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,29 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.octo.android.robospice.persistence.exception.SpiceException;
import com.octo.android.robospice.request.listener.RequestListener;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.net.URL;
import com.squareup.picasso.Picasso;

import ca.etsmtl.applets.etsmobile.ApplicationManager;
import ca.etsmtl.applets.etsmobile.http.AuthentificationPortailTask;
import ca.etsmtl.applets.etsmobile.http.DataManager;
import ca.etsmtl.applets.etsmobile.model.Etudiant;
import ca.etsmtl.applets.etsmobile.model.UserCredentials;
import ca.etsmtl.applets.etsmobile.service.RegistrationIntentService;
import ca.etsmtl.applets.etsmobile.util.Constants;
import ca.etsmtl.applets.etsmobile.util.SecurePreferences;
import ca.etsmtl.applets.etsmobile.widget.TodayWidgetProvider;
import ca.etsmtl.applets.etsmobile2.R;

Expand All @@ -61,6 +49,7 @@ public class LoginActivity extends AccountAuthenticatorActivity implements Reque
private View mLoginFormView;
private View mLoginStatusView;
private TextView mLoginStatusMessageView;
private ProgressBar mLoginStatusProgressBar;

private DataManager dataManager;
private UserCredentials userCredentials;
Expand All @@ -76,6 +65,8 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.activity_login);

setUpBackground();

accountManager = AccountManager.get(getBaseContext());

// Set up the login form.
Expand All @@ -98,6 +89,9 @@ public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
mLoginFormView = findViewById(R.id.login_form);
mLoginStatusView = findViewById(R.id.login_status);
mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
mLoginStatusProgressBar = (ProgressBar) findViewById(R.id.login_status_progress);
mLoginStatusProgressBar.getIndeterminateDrawable().setColorFilter(getResources().
getColor(R.color.white), android.graphics.PorterDuff.Mode.SRC_ATOP);

findViewById(R.id.sign_in_button).setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -107,6 +101,28 @@ public void onClick(View view) {
});
}

private void setUpBackground() {
runOnUiThread(new Runnable() {
@Override
public void run() {
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int width = displayMetrics.widthPixels;
int height = displayMetrics.heightPixels;

ImageView bgEtsIv = (ImageView) findViewById(R.id.bg_image_view);

Picasso.with(getApplicationContext())
.load(R.drawable.bg_ets)
.error(R.drawable.ets_background)
.resize(width, height)
.onlyScaleDown()
.centerCrop()
.into(bgEtsIv);
}
});
}

/**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ private void initDrawer() {
ProfilManager profilManager = new ProfilManager(this);
Etudiant etudiant = profilManager.getEtudiant();
if (etudiant != null) {

studentName = profilManager.getEtudiant().prenom.replace(" ", "") + " " + profilManager.getEtudiant().nom.replace(" ", "");
codeUniversel = profilManager.getEtudiant().codePerm;
String prenom = etudiant.prenom != null ? etudiant.prenom.trim() : "";
String nom = etudiant.nom != null ? etudiant.nom.trim() : "";
studentName = prenom + " " + nom;
codeUniversel = etudiant.codePerm != null ? etudiant.codePerm : "";
}
headerResult = new AccountHeaderBuilder()
.withActivity(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class MoodleCourseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("MoodleActivity", "entered onCreate");
setContentView(R.layout.activity_moodle_course);


Expand Down Expand Up @@ -79,9 +78,7 @@ protected void onResume() {
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt("idCours", idCours);
Log.d("onSaveInstanceState", "registering idCours value = " + idCours);
outState.putString("nameCours", nameCours);
Log.d("onSaveInstanceState", "registering nameCours = " + nameCours);
}

@Override
Expand Down
Loading

0 comments on commit 05adfac

Please sign in to comment.