Cleaned up
This commit is contained in:
parent
2d8df647cf
commit
e18fdfbd99
@ -3,9 +3,18 @@
|
|||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
<value>
|
<value>
|
||||||
<package name="java.util" withSubpackages="false" static="false" />
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
<package name="io.ktor" withSubpackages="true" static="false" />
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
<option name="useQualifiedModuleNames" value="true" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +1,17 @@
|
|||||||
package org.ddnss.sfs.git.wdg.vokabel_trainer;
|
package org.ddnss.sfs.git.wdg.vokabel_trainer;
|
||||||
|
|
||||||
import android.database.sqlite.*;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
|
|
||||||
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private DataHandler dbHandler;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -28,10 +26,5 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
|
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
|
||||||
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
|
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
|
||||||
NavigationUI.setupWithNavController(navView, navController);
|
NavigationUI.setupWithNavController(navView, navController);
|
||||||
dbHandler = new DataHandler(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addEntry(){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
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
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
Reference in New Issue
Block a user