-
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
7a8c51e
commit 99c45f5
Showing
45 changed files
with
3,186 additions
and
0 deletions.
There are no files selected for viewing
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,40 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "wififingerprintlocator" | ||
minSdkVersion 21 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
implementation 'com.google.firebase:firebase-core:16.0.4' | ||
implementation 'com.google.firebase:firebase-database:16.0.3' | ||
implementation 'com.google.firebase:firebase-auth:16.0.4' | ||
implementation 'com.google.firebase:firebase-storage:16.0.5' | ||
implementation 'com.squareup.picasso:picasso:2.71828' | ||
implementation 'com.github.chrisbanes:PhotoView:2.0.0' | ||
implementation 'com.android.support:cardview-v7:28.0.0' | ||
implementation 'com.android.support:recyclerview-v7:28.0.0' | ||
implementation 'com.google.zxing:core:3.3.2' | ||
implementation 'com.journeyapps:zxing-android-embedded:3.6.0' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
} | ||
|
||
apply plugin: 'com.google.gms.google-services' |
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,40 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http:https://schemas.android.com/apk/res/android" | ||
package="wififingerprintlocator"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/fingerprint" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity" /> | ||
<activity android:name=".Login.LoginActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".Login.RegisterActivity" /> | ||
<activity android:name=".StartLocating" /> | ||
<activity android:name=".ShowMap"> | ||
android:screenOrientation="landscape" | ||
</activity> | ||
<activity android:name=".UserLocation" /> | ||
<activity android:name=".UserPremium"></activity> | ||
</application> | ||
|
||
</manifest> |
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,47 @@ | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import java.util.List; | ||
|
||
public class APadapter extends RecyclerView.Adapter<APadapter.MyViewHolder> { | ||
|
||
private List<AccessPoint> APList; | ||
|
||
public class MyViewHolder extends RecyclerView.ViewHolder { | ||
public TextView ssid, bssid, rssi; | ||
|
||
public MyViewHolder(View view) { | ||
super(view); | ||
ssid = view.findViewById(R.id.title); | ||
bssid = view.findViewById(R.id.genre); | ||
rssi = view.findViewById(R.id.year); | ||
} | ||
} | ||
public APadapter(List<AccessPoint> APList) { | ||
this.APList = APList; | ||
} | ||
|
||
@Override | ||
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
View itemView = LayoutInflater.from(parent.getContext()) | ||
.inflate(R.layout.accesspoint_list_row, parent, false); | ||
|
||
return new MyViewHolder(itemView); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(MyViewHolder holder, int position) { | ||
AccessPoint ap = APList.get(position); | ||
holder.ssid.setText(ap.getSSID()); | ||
holder.bssid.setText(ap.getBSSID()); | ||
holder.rssi.setText(ap.getAvgRSSI()+""); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return APList.size(); | ||
} | ||
} |
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,55 @@ | ||
public class AccessPoint { | ||
|
||
private String BSSID; | ||
private String SSID; | ||
private Integer avgRSSI; | ||
|
||
public AccessPoint(){} | ||
|
||
public AccessPoint(String BSSID, String SSID, Integer avgRSSI) | ||
{ | ||
this.BSSID = BSSID; | ||
this.SSID = SSID; | ||
this.avgRSSI = avgRSSI; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
AccessPoint ap = (AccessPoint) obj; | ||
if (ap.BSSID.equals(BSSID) && ap.SSID.equals(SSID) && ap.avgRSSI.equals(avgRSSI)) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return ( 37 * 4 + BSSID.hashCode() ) + | ||
( 37 * 4 + SSID.hashCode() ); | ||
} | ||
|
||
public String getBSSID() { | ||
return BSSID; | ||
} | ||
|
||
public void setBSSID(String BSSID) { | ||
this.BSSID = BSSID; | ||
} | ||
|
||
public String getSSID() { | ||
return SSID; | ||
} | ||
|
||
public void setSSID(String SSID) { | ||
this.SSID = SSID; | ||
} | ||
|
||
public Integer getAvgRSSI() { | ||
return avgRSSI; | ||
} | ||
|
||
public void setAvgRSSI(Integer avgRSSI) { | ||
this.avgRSSI = avgRSSI; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
app/src/main/java/wififingerprintlocator/AccessPointConfirmation.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,45 @@ | ||
public class AccessPointConfirmation { | ||
|
||
private String BSSID; | ||
private String SSID; | ||
|
||
public AccessPointConfirmation() { | ||
} | ||
|
||
public AccessPointConfirmation(String BSSID, String SSID) { | ||
this.BSSID = BSSID; | ||
this.SSID = SSID; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
AccessPointConfirmation apc = (AccessPointConfirmation) obj; | ||
if (apc.BSSID.equals(BSSID) && apc.SSID.equals(SSID)) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return ( 37 * 4 + BSSID.hashCode() ) + | ||
( 37 * 4 + SSID.hashCode() ); | ||
} | ||
|
||
public String getBSSID() { | ||
return BSSID; | ||
} | ||
|
||
public void setBSSID(String BSSID) { | ||
this.BSSID = BSSID; | ||
} | ||
|
||
public String getSSID() { | ||
return SSID; | ||
} | ||
|
||
public void setSSID(String SSID) { | ||
this.SSID = SSID; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/wififingerprintlocator/DatabaseConfiguration.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,28 @@ | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
|
||
public class DatabaseConfiguration { | ||
|
||
private static DatabaseReference databaseRef; | ||
private static FirebaseAuth auth; | ||
|
||
public static DatabaseReference getFirebase() | ||
{ | ||
if(databaseRef == null) | ||
{ | ||
databaseRef = FirebaseDatabase.getInstance().getReference(); | ||
} | ||
return databaseRef; | ||
} | ||
|
||
public static FirebaseAuth getFirebaseAuthentication() | ||
{ | ||
if(auth == null) | ||
{ | ||
auth = FirebaseAuth.getInstance(); | ||
} | ||
return auth; | ||
} | ||
|
||
} |
120 changes: 120 additions & 0 deletions
120
app/src/main/java/wififingerprintlocator/Login/LoginActivity.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,120 @@ | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
import android.widget.Toast; | ||
|
||
import com.google.android.gms.tasks.OnCompleteListener; | ||
import com.google.android.gms.tasks.Task; | ||
import com.google.firebase.auth.AuthResult; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.auth.FirebaseUser; | ||
import com.google.firebase.database.DataSnapshot; | ||
import com.google.firebase.database.DatabaseError; | ||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
import com.google.firebase.database.ValueEventListener; | ||
|
||
import wififingerprintlocator.DatabaseConfiguration; | ||
import wififingerprintlocator.MainActivity; | ||
import wififingerprintlocator.R; | ||
import wififingerprintlocator.Users; | ||
|
||
public class LoginActivity extends AppCompatActivity { | ||
|
||
private EditText username; | ||
private EditText password; | ||
private Button btnLogin; | ||
private Button btnSignUp; | ||
private FirebaseAuth mAuth; | ||
private FirebaseAuth.AuthStateListener mAuthListener; | ||
private FirebaseUser fUser; | ||
private Users users; | ||
private String tipo; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_login); | ||
|
||
username = findViewById(R.id.user); | ||
password = findViewById(R.id.pass); | ||
btnLogin = findViewById(R.id.log); | ||
btnSignUp = findViewById(R.id.signup); | ||
|
||
mAuth = FirebaseAuth.getInstance(); | ||
|
||
mAuthListener = new FirebaseAuth.AuthStateListener() { | ||
@Override | ||
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { | ||
|
||
FirebaseUser user = firebaseAuth.getCurrentUser(); | ||
if(user != null){ | ||
//user sign in | ||
} | ||
else{ | ||
//user signed out | ||
} | ||
|
||
} | ||
}; | ||
|
||
btnLogin.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
if(!username.getText().toString().equals("") || password.getText().toString().equals("")) | ||
{ | ||
users = new Users(); | ||
users.setEmail(username.getText().toString()); | ||
users.setPass(password.getText().toString()); | ||
validateLogin(); | ||
} | ||
else | ||
{ | ||
Toast.makeText(LoginActivity.this, "Please enter your info!", Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
}); | ||
|
||
btnSignUp.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class); | ||
startActivity(intent); | ||
//LoginActivity.this.finish(); | ||
} | ||
}); | ||
} | ||
|
||
private void validateLogin() | ||
{ | ||
mAuth = DatabaseConfiguration.getFirebaseAuthentication(); | ||
mAuth.signInWithEmailAndPassword(users.getEmail(), users.getPass()).addOnCompleteListener(new OnCompleteListener<AuthResult>() { | ||
@Override | ||
public void onComplete(@NonNull Task<AuthResult> task) { | ||
if(task.isSuccessful()) | ||
{ | ||
//fUser = FirebaseAuth.getInstance().getCurrentUser(); | ||
//String u = fUser.getUid(); | ||
//Toast.makeText(LoginActivity.this, "Success! " + u, Toast.LENGTH_SHORT).show(); | ||
String tipo = username.getText().toString(); | ||
|
||
Intent intent = new Intent(LoginActivity.this, MainActivity.class); | ||
intent.putExtra("TYPE", tipo); //TESTE | ||
startActivity(intent); | ||
LoginActivity.this.finish(); | ||
} | ||
else | ||
{ | ||
Toast.makeText(LoginActivity.this, "Wrong info!", Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.