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 index 4874739..784c539 100644 --- 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 @@ -2,13 +2,19 @@ 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 DEUTSCH = "deutsch"; + public static final String GERMAN = "german"; public static final String ENGLISH = "english"; private Context ctx; @@ -35,4 +41,22 @@ public class DataHandler { 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/MainActivity.java b/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/ui/MainActivity.java similarity index 91% rename from app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/MainActivity.java rename to app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/ui/MainActivity.java index 52265de..58b7cb5 100644 --- a/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/MainActivity.java +++ b/app/src/main/java/org/ddnss/sfs/git/wdg/vokabel_trainer/ui/MainActivity.java @@ -13,6 +13,8 @@ import androidx.navigation.ui.NavigationUI; public class MainActivity extends AppCompatActivity { + private DataHandler dbHandler; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -26,5 +28,10 @@ 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/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml index 18f48ee..efbbd54 100644 --- a/app/src/main/res/layout/fragment_notifications.xml +++ b/app/src/main/res/layout/fragment_notifications.xml @@ -36,4 +36,15 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.186" /> + +