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

Commit ec83131

Browse files
committed
initial
0 parents  commit ec83131

File tree

205 files changed

+7907
-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.

205 files changed

+7907
-0
lines changed

Diff for: .gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
/.idea
11+
/.idea/misc.xml
12+
.DS_Store
13+
/build
14+
/captures
15+
.externalNativeBuild
16+
.cxx

Diff for: App/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

Diff for: App/build.gradle

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: "androidx.navigation.safeargs"
3+
4+
android {
5+
compileSdkVersion 29
6+
buildToolsVersion "29.0.3"
7+
8+
defaultConfig {
9+
applicationId "dsd.mdhfer.drongo"
10+
minSdkVersion 24
11+
targetSdkVersion 29
12+
versionCode 1
13+
versionName "1.0"
14+
15+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
compileOptions {
25+
sourceCompatibility = 1.8
26+
targetCompatibility = 1.8
27+
}
28+
testOptions {
29+
unitTests.returnDefaultValues = true
30+
unitTests.includeAndroidResources = true
31+
}
32+
splits {
33+
abi {
34+
enable true
35+
reset()
36+
include 'x86', 'armeabi-v7a'
37+
universalApk true
38+
}
39+
}
40+
41+
}
42+
43+
dependencies {
44+
implementation fileTree(dir: 'libs', include: ['*.jar'])
45+
46+
47+
/** Added libraries */
48+
implementation 'me.dm7.barcodescanner:zxing:1.9.13' /**< QR code scanner library */
49+
50+
51+
implementation 'com.github.GrenderG:Toasty:1.5.0'
52+
53+
54+
implementation 'androidx.appcompat:appcompat:1.2.0'
55+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
56+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
57+
implementation 'androidx.navigation:navigation-fragment:2.3.1'
58+
implementation 'androidx.navigation:navigation-ui:2.3.1'
59+
testImplementation 'junit:junit:4.13.1'
60+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
61+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
62+
implementation 'com.google.android.material:material:1.2.1'
63+
64+
// mockito
65+
testImplementation 'org.mockito:mockito-core:3.1.0'
66+
67+
68+
// navigation
69+
def nav_version = "2.3.1"
70+
71+
//Java
72+
implementation "androidx.navigation:navigation-fragment:$nav_version"
73+
implementation "androidx.navigation:navigation-ui:$nav_version"
74+
75+
76+
// Feature module Support
77+
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
78+
79+
// Testing Navigation
80+
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
81+
82+
// Jetpack Compose Integration
83+
implementation "androidx.navigation:navigation-compose:1.0.0-alpha02"
84+
85+
// Dependency for Zxing - added by Vaske
86+
implementation 'com.journeyapps:zxing-android-embedded:4.1.0'
87+
implementation 'androidx.appcompat:appcompat:1.0.2'
88+
89+
// Awesome QR - Library to generate custom QR codes
90+
implementation 'com.github.SumiMakito:AwesomeQRCode:1.2.0'
91+
92+
// Room
93+
def room_version = "2.2.5"
94+
95+
implementation "androidx.room:room-runtime:$room_version"
96+
annotationProcessor "androidx.room:room-compiler:$room_version"
97+
98+
99+
// Circle Image View for profile picture
100+
implementation 'de.hdodenhof:circleimageview:3.1.0'
101+
102+
// Library to load and take pictures
103+
implementation 'com.github.esafirm.android-image-picker:imagepicker:2.4.1'
104+
105+
// DiscreteScrollView - Carousel to choose avatars
106+
implementation 'com.yarolegovich:discrete-scrollview:1.5.1'
107+
108+
// Chat view
109+
implementation 'com.github.bassaer:chatmessageview:2.0.1'
110+
111+
// ChatKit - library for Chat View
112+
implementation 'com.github.stfalcon:chatkit:0.3.3'
113+
114+
implementation "net.zetetic:android-database-sqlcipher:4.4.2"
115+
implementation "androidx.sqlite:sqlite:2.0.1"
116+
117+
implementation "androidx.security:security-crypto:1.1.0-alpha03"
118+
119+
// Sweet alerts
120+
implementation 'com.github.f0ris.sweetalert:library:1.5.1'
121+
122+
123+
}

Diff for: App/proguard-rules.pro

+21
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package dsd.mdhfer.drongo;
2+
3+
import android.content.Context;
4+
5+
import androidx.room.Room;
6+
import androidx.test.core.app.ApplicationProvider;
7+
import androidx.test.ext.junit.runners.AndroidJUnit4;
8+
9+
import org.junit.After;
10+
import org.junit.Before;
11+
import org.junit.Test;
12+
import org.junit.runner.RunWith;
13+
14+
import java.io.IOException;
15+
16+
import dsd.mdhfer.drongo.dao.ContactDao;
17+
import dsd.mdhfer.drongo.database.AppDatabase;
18+
import dsd.mdhfer.drongo.models.Contact;
19+
20+
import static org.junit.Assert.assertEquals;
21+
import static org.junit.Assert.assertNull;
22+
23+
24+
@RunWith(AndroidJUnit4.class)
25+
public class ContactDbTest {
26+
private ContactDao contactDao;
27+
private AppDatabase db;
28+
29+
@Before
30+
public void createDb() {
31+
Context context = ApplicationProvider.getApplicationContext();
32+
db = Room.inMemoryDatabaseBuilder(context, AppDatabase.class).build();
33+
contactDao = db.contactDao();
34+
}
35+
36+
@After
37+
public void closeDb() throws IOException {
38+
db.close();
39+
}
40+
41+
@Test
42+
public void writeContactAndReadInList() throws Exception {
43+
Contact contact = new Contact();
44+
contact.setContactUsername("Emulator");
45+
contact.setContactUuid("123-456-XYZ");
46+
contactDao.insertContact(contact);
47+
Contact fromDatabase = contactDao.findByName("Emulator");
48+
assertEquals(fromDatabase.getContactUsername(), "Emulator");
49+
assertEquals(fromDatabase.getContactUuid(), "123-456-XYZ");
50+
}
51+
52+
@Test
53+
public void deleteContactTest() throws Exception {
54+
Contact contact = new Contact();
55+
contact.setContactUsername("Emulator");
56+
contact.setContactUuid("123-456-XYZ");
57+
contactDao.insertContact(contact);
58+
59+
contactDao.delete(contact);
60+
Contact fromDatabase = contactDao.findByID("123-456-XYZ");
61+
assertNull(fromDatabase);
62+
}
63+
64+
@Test
65+
public void deleteAllContactsTest() throws Exception {
66+
Contact contact = new Contact();
67+
contact.setContactUsername("Emulator");
68+
contact.setContactUuid("123-456-XYZ");
69+
contactDao.insertContact(contact);
70+
71+
Contact contact2 = new Contact();
72+
contact2.setContactUsername("Emulator2");
73+
contact2.setContactUuid("789-456-ABC");
74+
contactDao.insertContact(contact2);
75+
76+
contactDao.deleteAll();
77+
Contact fromDatabase = contactDao.findByID("123-456-XYZ");
78+
Contact fromDatabase2 = contactDao.findByID("789-456-ABC");
79+
assertNull(fromDatabase);
80+
assertNull(fromDatabase2);
81+
}
82+
83+
@Test
84+
public void updateContactUsernameTest() throws Exception {
85+
Contact contact = new Contact();
86+
contact.setContactUsername("Emulator");
87+
contact.setContactUuid("123-456-XYZ");
88+
contactDao.insertContact(contact);
89+
90+
contact.setContactUsername("Newtestname");
91+
contactDao.update(contact);
92+
93+
Contact fromDatabase = contactDao.findByName("Newtestname");
94+
assertEquals(fromDatabase.getContactUsername(), "Newtestname");
95+
assertEquals(fromDatabase.getContactUuid(), "123-456-XYZ");
96+
}
97+
98+
}
99+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package dsd.mdhfer.drongo;
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("dsd.mdhfer.drongo", appContext.getPackageName());
26+
}
27+
}

0 commit comments

Comments
 (0)