From e18fdfbd990a68e5ffbc5866ae91c3c6bf062393 Mon Sep 17 00:00:00 2001 From: peet Date: Mon, 7 Dec 2020 16:06:12 +0100 Subject: [PATCH] Cleaned up --- .idea/codeStyles/Project.xml | 15 ++++- .idea/gradle.xml | 1 - .idea/misc.xml | 2 +- .../git/wdg/vokabel_trainer/DataHandler.java | 62 ------------------- .../{ui => }/MainActivity.java | 11 +--- build.gradle | 2 +- 6 files changed, 16 insertions(+), 77 deletions(-) delete mode 100644 app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/DataHandler.java rename app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/{ui => }/MainActivity.java (89%) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index d6c2ebe..2ea5962 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -3,9 +3,18 @@ + diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 23a89bb..ac6b0ae 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -15,7 +15,6 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index d5d35ec..39c65f6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/DataHandler.java b/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/DataHandler.java deleted file mode 100644 index 784c539..0000000 --- a/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/DataHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.ddnss.sfs.git.wdg.vokabel_trainer; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Toast; - -import androidx.annotation.Nullable; - -public class DataHandler { - public static final String DATABASENAME = "vocabDB"; - public static final int DATABASE_VERSION = 1; - - public static final String TABLE_NAME = "vocabTable"; - public static final String GERMAN = "german"; - public static final String ENGLISH = "english"; - - private Context ctx; - private DataBaseHelper dbHelper; - private SQLiteDatabase db; - - public DataHandler(Context ctx){ - this.ctx = ctx; - dbHelper = new DataBaseHelper(ctx,DATABASENAME,null,DATABASE_VERSION); - } - - public void openWrite(){ - db = dbHelper.getWritableDatabase(); - } - - public void openRead(){ - db = dbHelper.getReadableDatabase(); - } - - public void close(){ - dbHelper.close(); - } - - public void addEntry(String voc1, String voc2){ - db.execSQL("insert into vocabTable (deutsch, english) values ('vocab1', 'vocab2')"); - } - - private static class DataBaseHelper extends SQLiteOpenHelper { - - public DataBaseHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) { - super(context, DATABASENAME, null, DATABASE_VERSION); - } - - @Override - public void onCreate(SQLiteDatabase db) { - String command = "create table if not exists vocTable(german text not null, englisch text not null);"; - db.execSQL(command); - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - - } - } -} diff --git a/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/ui/MainActivity.java b/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/MainActivity.java similarity index 89% rename from app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/ui/MainActivity.java rename to app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/MainActivity.java index 58b7cb5..de89575 100644 --- a/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/ui/MainActivity.java +++ b/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/MainActivity.java @@ -1,19 +1,17 @@ package org.ddnss.sfs.git.wdg.vokabel_trainer; -import android.database.sqlite.*; import android.os.Bundle; -import com.google.android.material.bottomnavigation.BottomNavigationView; - import androidx.appcompat.app.AppCompatActivity; import androidx.navigation.NavController; import androidx.navigation.Navigation; import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.NavigationUI; +import com.google.android.material.bottomnavigation.BottomNavigationView; + public class MainActivity extends AppCompatActivity { - private DataHandler dbHandler; @Override protected void onCreate(Bundle savedInstanceState) { @@ -28,10 +26,5 @@ public class MainActivity extends AppCompatActivity { NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); NavigationUI.setupWithNavController(navView, navController); - dbHandler = new DataHandler(this); - } - - public void addEntry(){ - } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6754c23..1e1003e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath "com.android.tools.build:gradle:4.0.1" + classpath 'com.android.tools.build:gradle:4.0.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files