-
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
0 parents
commit f87758d
Showing
46 changed files
with
1,532 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,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
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,40 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 26 | ||
defaultConfig { | ||
applicationId "schoolofnet.com.requestshttp" | ||
minSdkVersion 23 | ||
targetSdkVersion 26 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
targetCompatibility 1.8 | ||
sourceCompatibility 1.8 | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation 'com.android.support:appcompat-v7:26.1.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.0.2' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.1' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' | ||
compile 'com.squareup.okhttp3:okhttp:3.9.0' | ||
compile 'com.google.code.gson:gson:2.8.2' | ||
compile 'me.dm7.barcodescanner:zbar:1.9.8' | ||
compile 'com.android.support:cardview-v7:26.1.0' | ||
compile 'com.github.yalantis:ucrop:2.2.1-native' | ||
} |
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 @@ | ||
# 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 | ||
-dontwarn com.yalantis.ucrop** | ||
-keep class com.yalantis.ucrop** { *; } | ||
-keep interface com.yalantis.ucrop** { *; } |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/schoolofnet/com/requestshttp/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 schoolofnet.com.requestshttp; | ||
|
||
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() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("schoolofnet.com.requestshttp", 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,48 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="schoolofnet.com.requestshttp"> | ||
|
||
<uses-feature android:name="android.hardware.camera2" /> | ||
<uses-feature android:name="android.hardware.camera" /> | ||
<uses-feature android:name="android.hardware.camera.autofocus" /> | ||
|
||
<uses-permission android:name="android.permission.CAMERA" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
|
||
<application | ||
android:largeHeap="true" | ||
android:hardwareAccelerated="true" | ||
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=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="com.yalantis.ucrop.UCropActivity" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/> | ||
<activity android:name=".AddContactActivity" /> | ||
<activity android:name=".DecoderActivity" /> | ||
<activity android:name=".DocumentActivity"></activity> | ||
|
||
<provider | ||
android:name="android.support.v4.content.FileProvider" | ||
android:authorities="schoolofnet.com.android.FileProvider" | ||
android:exported="false" | ||
android:grantUriPermissions="true"> | ||
<meta-data | ||
android:name="android.support.FILE_PROVIDER_PATHS" | ||
android:resource="@xml/file_paths"></meta-data> | ||
</provider> | ||
</application> | ||
|
||
</manifest> |
60 changes: 60 additions & 0 deletions
60
app/src/main/java/schoolofnet/com/requestshttp/AddContactActivity.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,60 @@ | ||
package schoolofnet.com.requestshttp; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
import schoolofnet.com.requestshttp.Utils.Http.Http; | ||
|
||
public class AddContactActivity extends AppCompatActivity { | ||
|
||
private EditText txtName; | ||
private EditText txtSobrenome; | ||
private EditText txtEmail; | ||
private EditText txtTelefone; | ||
|
||
private Button btn_save; | ||
|
||
|
||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.add_contact); | ||
|
||
txtName = findViewById(R.id.txt_nome); | ||
txtSobrenome = findViewById(R.id.txt_sobrenome); | ||
txtEmail = findViewById(R.id.txt_email); | ||
txtTelefone = findViewById(R.id.txt_telefone); | ||
this.btn_save = findViewById(R.id.btn_save); | ||
|
||
btn_save.setOnClickListener((view) -> { | ||
try { | ||
save(view); | ||
} catch (JSONException e) { | ||
e.printStackTrace(); | ||
} | ||
}); | ||
|
||
} | ||
|
||
|
||
public void save(View view) throws JSONException { | ||
|
||
JSONObject json = new JSONObject(); | ||
json.put("nome", "Igor Ferreira Praxedes"); | ||
|
||
Http http = new Http(); | ||
http.builder("http://192.168.1.185:3000/android") | ||
.POST(json.toString()); | ||
|
||
|
||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
app/src/main/java/schoolofnet/com/requestshttp/DecoderActivity.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,69 @@ | ||
package schoolofnet.com.requestshttp; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.widget.Button; | ||
import android.widget.Toast; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
import javax.xml.parsers.DocumentBuilderFactory; | ||
|
||
import me.dm7.barcodescanner.zbar.Result; | ||
import me.dm7.barcodescanner.zbar.ZBarScannerView; | ||
import schoolofnet.com.requestshttp.Utils.Http.Http; | ||
|
||
|
||
public class DecoderActivity extends AppCompatActivity implements ZBarScannerView.ResultHandler { | ||
|
||
private Button btn_scan; | ||
|
||
private ZBarScannerView zbar; | ||
|
||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_decoder); | ||
|
||
this.btn_scan = findViewById(R.id.btn_scan); | ||
this.btn_scan.setOnClickListener((view) -> { | ||
scan(); | ||
}); | ||
|
||
} | ||
|
||
private void scan() { | ||
this.zbar = new ZBarScannerView(getApplicationContext()); | ||
setContentView(this.zbar); | ||
this.zbar.setResultHandler(this); | ||
this.zbar.startCamera(); | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
super.onPause(); | ||
this.zbar.stopCamera(); | ||
} | ||
|
||
|
||
@Override | ||
public void handleResult(Result result) { | ||
Http http = new Http(); | ||
System.out.println(result.getContents()); | ||
http.builder("http://192.168.2.63/getCampos/" + result.getContents()); | ||
http.GET(); | ||
String resultado = http.getResult(); | ||
if (resultado != "false") { | ||
System.out.println(resultado); | ||
this.zbar.stopCamera(); | ||
Intent intent = new Intent(this, DocumentActivity.class); | ||
intent.putExtra("documento", resultado); | ||
startActivity(intent); | ||
} else { | ||
Toast.makeText(this, "Documento não encontrado", Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.