This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6064a8
commit 724308b
Showing
7 changed files
with
107 additions
and
55 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/src/main/java/squiddle/sheshire/apomalyn/qc/ca/nearumix/AlertReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package squiddle.sheshire.apomalyn.qc.ca.nearumix; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.location.LocationManager; | ||
|
||
/** | ||
* Created by sheshire on 17-10-19. | ||
*/ | ||
|
||
public class AlertReceiver extends BroadcastReceiver { | ||
|
||
@Override | ||
|
||
public void onReceive(Context context, Intent intent) { | ||
|
||
// Vaudra true par défaut si on ne trouve pas l'extra booléen dont la clé est LocationManager.KEY_PROXIMITY_ENTERING | ||
|
||
boolean entrer = (boolean)(intent.getBooleanExtra(LocationManager.KEY_PROXIMITY_ENTERING, true)); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,18 @@ | |
import com.google.android.gms.auth.api.signin.GoogleSignInResult; | ||
import com.google.android.gms.common.ConnectionResult; | ||
import com.google.android.gms.common.SignInButton; | ||
import com.google.android.gms.common.api.GoogleApiClient; | ||
import com.google.android.gms.common.api.OptionalPendingResult; | ||
import com.google.android.gms.common.api.ResultCallback; | ||
import com.google.android.gms.common.api.Status; | ||
|
||
import org.json.JSONObject; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import squiddle.sheshire.apomalyn.qc.ca.nearumix.DAO.BaseDeDonnees; | ||
import squiddle.sheshire.apomalyn.qc.ca.nearumix.DAO.UtilisateurDAO; | ||
|
||
import static android.Manifest.permission.READ_CONTACTS; | ||
import static squiddle.sheshire.apomalyn.qc.ca.nearumix.R.styleable.CustomTextView; | ||
|
@@ -43,14 +48,11 @@ public class VueConnexion extends AppCompatActivity implements | |
private GoogleApiClient mGoogleApiClient; | ||
private ProgressDialog mProgressDialog; | ||
|
||
private UtilisateurDAO utilisateurDAO = null; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.vue_connexion); | ||
|
||
this.utilisateurDAO = UtilisateurDAO.getInstance(); | ||
// Button listeners | ||
findViewById(R.id.sign_in_button).setOnClickListener(this); | ||
|
||
|
@@ -162,16 +164,23 @@ private void handleSignInResult(GoogleSignInResult result) { | |
if (result.isSuccess()) { | ||
// Signed in successfully, show authenticated UI. | ||
GoogleSignInAccount acct = result.getSignInAccount(); | ||
findViewById(R.id.sign_in_button).setVisibility(View.GONE); | ||
|
||
Intent changementVersCarte; | ||
if(utilisateurDAO.setUtilisateurCourant(acct.getEmail()) == null){ | ||
changementVersCarte = new Intent(VueConnexion.this, VueConnexion.class); | ||
}else{ | ||
changementVersCarte = new Intent(VueConnexion.this, VueMenu.class); | ||
} | ||
startActivity(changementVersCarte); | ||
updateUI(true); | ||
} else { | ||
updateUI(false); | ||
} | ||
BaseDeDonnees bd = new BaseDeDonnees(); | ||
HashMap<String, String> map = new HashMap<>(); | ||
map.put("email", "[email protected]"); | ||
Log.d(TAG, new JSONObject(bd.envoyerRequete(BaseDeDonnees.GET_UTILISATEUR, map)).toString()); | ||
//Intent changementVersCarte = new Intent(VueConnexion.this, VueCarte.class); | ||
//startActivity(changementVersCarte); | ||
Intent changementVersCarte = new Intent(VueConnexion.this, VueMenu.class); | ||
startActivity(changementVersCarte); | ||
} | ||
|
||
private void updateUI(boolean signedIn) { | ||
if (signedIn) { | ||
findViewById(R.id.sign_in_button).setVisibility(View.GONE); | ||
} else { | ||
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters