Cleaned up

This commit is contained in:
peet 2020-12-07 16:06:12 +01:00
parent 2d8df647cf
commit e18fdfbd99
6 changed files with 16 additions and 77 deletions

View File

@ -3,9 +3,18 @@
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" withSubpackages="false" static="false" />
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
<package name="io.ktor" withSubpackages="true" static="false" />
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<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>
</option>
</JetCodeStyleSettings>

View File

@ -15,7 +15,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<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" />
</component>
<component name="ProjectType">

View File

@ -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) {
}
}
}

View File

@ -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(){
}
}

View File

@ -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