-
Notifications
You must be signed in to change notification settings - Fork 2
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
2ac83ee
commit 141d75d
Showing
45 changed files
with
961 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,10 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,39 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "br.com.whatsappandroid.cursoandroid.whatsapp2" | ||
minSdkVersion 15 | ||
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']) | ||
//noinspection GradleCompatible | ||
implementation 'com.android.support:appcompat-v7:28.0.0-beta01' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.2' | ||
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' | ||
|
||
// Firebase | ||
implementation 'com.google.firebase:firebase-core:16.0.1' | ||
implementation 'com.google.firebase:firebase-database:16.0.1' | ||
// Design | ||
implementation 'com.android.support:design:28.0.0-beta01' | ||
// Mascara de formatação | ||
implementation 'com.github.rtoshiro.mflibrary:mflibrary:1.0.0' | ||
} | ||
|
||
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,55 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "265704152899", | ||
"firebase_url": "https://whatsapp2-41b23.firebaseio.com", | ||
"project_id": "whatsapp2-41b23", | ||
"storage_bucket": "whatsapp2-41b23.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:265704152899:android:80b88204209220e7", | ||
"android_client_info": { | ||
"package_name": "br.com.whatsappandroid.cursoandroid.whatsapp2" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "265704152899-teb113ssp3lrmo359kc3qvmhkd8h777q.apps.googleusercontent.com", | ||
"client_type": 1, | ||
"android_info": { | ||
"package_name": "br.com.whatsappandroid.cursoandroid.whatsapp2", | ||
"certificate_hash": "dfe5abb0df77c288d8f01cf6a9078fa5d6a90cf2" | ||
} | ||
}, | ||
{ | ||
"client_id": "265704152899-din5dentpg0a37hno8nh1n795lj3l2sn.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyB5SJD3KuzZhTHs4Ts3L1dZNM8uQm2Uyw4" | ||
} | ||
], | ||
"services": { | ||
"analytics_service": { | ||
"status": 1 | ||
}, | ||
"appinvite_service": { | ||
"status": 2, | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "265704152899-din5dentpg0a37hno8nh1n795lj3l2sn.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
] | ||
}, | ||
"ads_service": { | ||
"status": 2 | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
...droidTest/java/br/com/whatsappandroid/cursoandroid/whatsapp2/ExampleInstrumentedTest.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,26 @@ | ||
package br.com.whatsappandroid.cursoandroid.whatsapp2; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("br.com.whatsappandroid.cursoandroid.whatsapp2", appContext.getPackageName()); | ||
} | ||
} |
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,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="br.com.whatsappandroid.cursoandroid.whatsapp2"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".activity.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".activity.LoginActivity"></activity> | ||
</application> | ||
|
||
</manifest> |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/br/com/whatsappandroid/cursoandroid/whatsapp2/activity/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,15 @@ | ||
package br.com.whatsappandroid.cursoandroid.whatsapp2.activity; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
|
||
import br.com.whatsappandroid.cursoandroid.whatsapp2.R; | ||
|
||
public class LoginActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_login); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/br/com/whatsappandroid/cursoandroid/whatsapp2/activity/MainActivity.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,23 @@ | ||
package br.com.whatsappandroid.cursoandroid.whatsapp2.activity; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
|
||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
|
||
import br.com.whatsappandroid.cursoandroid.whatsapp2.R; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
private DatabaseReference referenciaFirebase = FirebaseDatabase.getInstance().getReference(); | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
referenciaFirebase.child("pontos").setValue(100); | ||
|
||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/br/com/whatsappandroid/cursoandroid/whatsapp2/helper/Permissao.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,41 @@ | ||
package br.com.whatsappandroid.cursoandroid.whatsapp2.helper; | ||
|
||
import android.app.Activity; | ||
import android.content.pm.PackageManager; | ||
import android.os.Build; | ||
import android.support.v4.app.ActivityCompat; | ||
import android.support.v4.content.ContextCompat; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class Permissao { | ||
|
||
public static boolean validaPermissoes(int requestCode, Activity activity, String[] permissoes) { | ||
|
||
if (Build.VERSION.SDK_INT >= 23) { | ||
|
||
List<String> listaPermissoes = new ArrayList<String>(); | ||
|
||
/*Percorre as permissões passadas, verificando uma a uma | ||
* se já tem a permissao liberada */ | ||
for (String permissao : permissoes) { | ||
Boolean validaPermissao = ContextCompat.checkSelfPermission(activity, permissao) == PackageManager.PERMISSION_GRANTED; | ||
if (!validaPermissao) listaPermissoes.add(permissao); | ||
} | ||
|
||
/*Caso a lista esteja vazia, não é necessário solicitar permissão*/ | ||
if (listaPermissoes.isEmpty()) return true; | ||
|
||
String[] novasPermissoes = new String[listaPermissoes.size()]; | ||
listaPermissoes.toArray(novasPermissoes); | ||
|
||
//Solicita permissão | ||
ActivityCompat.requestPermissions(activity, novasPermissoes, requestCode); | ||
|
||
} | ||
|
||
return true; | ||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/br/com/whatsappandroid/cursoandroid/whatsapp2/helper/Preferencias.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,20 @@ | ||
package br.com.whatsappandroid.cursoandroid.whatsapp2.helper; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
|
||
public class Preferencias { | ||
|
||
private Context contexto; | ||
private SharedPreferences preferences; | ||
private final String NOME_ARQUIVO = "whatsapp.preferencias"; | ||
private final int MODE = 0; | ||
private SharedPreferences.Editor editor; | ||
|
||
public Preferencias( Context contextoParametro) { | ||
contexto = contextoParametro; | ||
preferences = contexto.getSharedPreferences(NOME_ARQUIVO, MODE ); | ||
editor = preferences.edit(); | ||
} | ||
|
||
} |
Oops, something went wrong.