Skip to content
This repository was archived by the owner on Jan 3, 2022. It is now read-only.

Commit 10deda3

Browse files
committed
Git
1 parent 5428c50 commit 10deda3

File tree

62 files changed

+2723
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2723
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.0"
6+
defaultConfig {
7+
applicationId "androidbootcamp.net.myapplication"
8+
minSdkVersion 19
9+
targetSdkVersion 29
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
implementation 'androidx.appcompat:appcompat:1.0.2'
25+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
26+
implementation 'com.android.volley:volley:1.1.0'
27+
testImplementation 'junit:junit:4.12'
28+
androidTestImplementation 'androidx.test:runner:1.1.1'
29+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
30+
implementation 'com.android.support:recyclerview-v7:29.0.0'
31+
implementation 'com.android.support:cardview-v7:29.0.0'
32+
implementation 'com.github.mancj:MaterialSearchBar:+'
33+
implementation 'androidx.room:room-runtime:2.1.0'
34+
annotationProcessor 'androidx.room:room-compiler:2.1.0'
35+
implementation 'org.jetbrains:annotations-java5:15.0'
36+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package androidbootcamp.net.myapplication;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
25+
assertEquals("androidbootcamp.net.myapplication", appContext.getPackageName());
26+
}
27+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:dist="http://schemas.android.com/apk/distribution"
4+
package="androidbootcamp.net.myapplication">
5+
6+
<application
7+
android:allowBackup="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme">
13+
<activity android:name=".EditViewActivity"></activity>
14+
<activity android:name=".SearchActivity" />
15+
<activity android:name=".AddDataActivity" />
16+
<activity android:name=".EditDataActivity" />
17+
<activity android:name=".ListDataActivity" />
18+
<activity android:name=".MainMenu" />
19+
<activity android:name=".Register" />
20+
<activity android:name=".MainActivity">
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN" />
23+
24+
<category android:name="android.intent.category.LAUNCHER" />
25+
</intent-filter>
26+
</activity>
27+
</application>
28+
29+
<uses-permission android:name="android.permission.INTERNET" />
30+
31+
<dist:module dist:instant="true" />
32+
33+
</manifest>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package androidbootcamp.net.myapplication;
2+
3+
import androidx.appcompat.app.AppCompatActivity;
4+
5+
import android.content.Intent;
6+
import android.os.Bundle;
7+
import android.view.View;
8+
import android.widget.Button;
9+
import android.widget.EditText;
10+
import android.widget.Toast;
11+
12+
import androidbootcamp.net.myapplication.Databases.DatabaseHelper;
13+
import androidbootcamp.net.myapplication.R;
14+
15+
public class AddDataActivity extends AppCompatActivity {
16+
17+
18+
DatabaseHelper mDatabaseHelper;
19+
private Button btnAdd, btnViewData, btnSearch, btnSearchName;
20+
@Override
21+
protected void onCreate(Bundle savedInstanceState) {
22+
super.onCreate(savedInstanceState);
23+
setContentView(R.layout.activity_add_data);
24+
//Declare variable
25+
final EditText editText = (EditText) findViewById(R.id.editText);
26+
final EditText editText2=(EditText) findViewById(R.id.editText2);
27+
28+
btnAdd = (Button) findViewById(R.id.btnAdd);
29+
btnViewData = (Button) findViewById(R.id.btnView);
30+
btnSearchName= (Button) findViewById(R.id.btnSearchName);
31+
32+
mDatabaseHelper = new DatabaseHelper(this);
33+
34+
btnAdd.setOnClickListener(new View.OnClickListener() {
35+
@Override
36+
public void onClick(View v) {
37+
String newEntry = editText.getText().toString();
38+
String amount = editText2.getText().toString();
39+
if (editText.length() != 0 || editText2.length() != 0) {
40+
AddData(newEntry, amount);
41+
editText.setText("");
42+
editText2.setText("");
43+
} else {
44+
toastMessage("You must put something in the text field!");
45+
}
46+
}
47+
});
48+
49+
btnViewData.setOnClickListener(new View.OnClickListener() {
50+
@Override
51+
public void onClick(View v) {
52+
Intent intent = new Intent(AddDataActivity.this, ListDataActivity.class);
53+
startActivity(intent);
54+
}
55+
});
56+
57+
58+
btnSearchName.setOnClickListener(new View.OnClickListener() {
59+
@Override
60+
public void onClick(View v) {
61+
Intent intent = new Intent(AddDataActivity.this, SearchActivity.class);
62+
startActivity(intent);
63+
}
64+
});
65+
}
66+
67+
public void AddData(String newEntry, String amount) {
68+
69+
boolean insertData = mDatabaseHelper.addData(newEntry,amount);
70+
if (insertData) {
71+
toastMessage("Data Successfully Inserted!");
72+
} else {
73+
toastMessage("Something went wrong");
74+
}
75+
}
76+
77+
/**
78+
* customizable toast
79+
* @param message
80+
*/
81+
private void toastMessage(String message){
82+
Toast.makeText(this,message, Toast.LENGTH_SHORT).show();
83+
}
84+
}

0 commit comments

Comments
 (0)