Skip to content

Commit

Permalink
fixed and merged, added digit support
Browse files Browse the repository at this point in the history
  • Loading branch information
FahadSaleem committed May 25, 2020
2 parents 19769b6 + bbda370 commit 2c948e0
Show file tree
Hide file tree
Showing 63 changed files with 1,787 additions and 1,997 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
23 changes: 4 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
app/debug/
app/release/

=======
# Built application files

Expand Down Expand Up @@ -51,13 +42,7 @@ captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches
.idea/

# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
Expand Down
116 changes: 0 additions & 116 deletions .idea/codeStyles/Project.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/misc.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![codecov](https://codecov.io/gh/Crazy-Marvin/Morse/branch/master/graph/badge.svg)](https://codecov.io/gh/Crazy-Marvin/Morse)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/morse/localized.svg)](https://crowdin.com/project/morse)
[![Known Vulnerabilities](https://snyk.io/test/github/Crazy-Marvin/Morse/badge.svg?targetFile=app%2Fbuild.gradle)](https://snyk.io/test/github/Crazy-Marvin/Morse?targetFile=app%2Fbuild.gradle)
[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat-square)](https://android-arsenal.com/api?level=19)
[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19)
![F-Droid](https://img.shields.io/f-droid/v/rocks.poopjournal.morse.svg)
[![Google Play](https://badgen.net/badge/icon/googleplay?icon=googleplay&label)](https://play.google.com/store/apps/details?id=rocks.poopjournal.morse)

Expand Down
1 change: 0 additions & 1 deletion app/.gitignore

This file was deleted.

27 changes: 15 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,30 @@ android {
applicationId "rocks.poopjournal.morse"
minSdkVersion 19
targetSdkVersion 29
versionCode 3
versionName "1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionCode 4
versionName "1.4"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
encoding = 'UTF-8'
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
exclude 'META-INF/*'
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'


implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
}
21 changes: 0 additions & 21 deletions app/proguard-rules.pro

This file was deleted.

This file was deleted.

3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="rocks.poopjournal.morse">

<uses-permission android:name="android.permission.CAMERA" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

Expand All @@ -17,6 +19,7 @@
tools:ignore="GoogleAppIndexingWarning">
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<activity android:name=".MainActivity" android:windowSoftInputMode="adjustNothing">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
30 changes: 13 additions & 17 deletions app/src/main/java/rocks/poopjournal/morse/DBHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;


import java.util.ArrayList;
import java.util.Calendar;

public class DBHelper extends SQLiteOpenHelper {

Expand Down Expand Up @@ -44,49 +42,47 @@ public void onCreate(SQLiteDatabase db) {
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

}
public void addPhrase(String text, String morse){

for (PhrasebookModel model: getAllPhrases()){
if (model.text.trim().equals(text.trim())){
public void addPhrase(String text, String morse) {

for (PhrasebookModel model : getAllPhrases()) {
if (model.text.trim().equals(text.trim())) {
deleteNote(model.id);
Log.d("debug_star","deleted note, now returning");
Log.d("debug_star", "deleted note, now returning");
return;
}
}

Log.d("debug_star","adding note, now returning");
Log.d("debug_star", "adding note, now returning");
SQLiteDatabase db = this.getWritableDatabase();

ContentValues values = new ContentValues();
values.put("sentence", text);
values.put("morse",morse);
values.put("morse", morse);

db.insert(TABLE_PHRASEBOOK, null,values);
db.insert(TABLE_PHRASEBOOK, null, values);
db.close(); // Closing database connection
}





public void deleteNote(int id){
public void deleteNote(int id) {

SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_PHRASEBOOK,"id= " + id,null);
db.delete(TABLE_PHRASEBOOK, "id= " + id, null);
db.close(); // Closing database connection

}

public ArrayList<PhrasebookModel> getAllPhrases() {
String selectQuery = "SELECT * FROM " + TABLE_PHRASEBOOK;
ArrayList<PhrasebookModel> mList = new ArrayList<PhrasebookModel>();
ArrayList<PhrasebookModel> mList = new ArrayList<>();

try {
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
while (cursor.moveToNext()) {
mList.add(new PhrasebookModel(cursor.getInt(0),cursor.getString(1),cursor.getString(2)));
// Log.d(TAG, "title"+cursor.getString(3)+" notes="+cursor.getString(4));
mList.add(new PhrasebookModel(cursor.getInt(0), cursor.getString(1), cursor.getString(2)));
// Log.d(TAG, "title"+cursor.getString(3)+" notes="+cursor.getString(4));
}
db.close();
return mList;
Expand Down
Loading

0 comments on commit 2c948e0

Please sign in to comment.