Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Fix add profile userdata
Browse files Browse the repository at this point in the history
  • Loading branch information
AnGgIt86 committed Sep 27, 2024
1 parent 40e5855 commit 64c7c0d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/src/main/java/com/neko/splash/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class SplashActivity : BaseActivity() {

private lateinit var myDB: MyDatabaseHelper
private lateinit var arrID: ArrayList<String>
private lateinit var arrUsername: ArrayList<String>

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/java/com/neko/uwu/TambahActivity.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.neko.uwu

import android.content.Intent
import android.database.Cursor
import android.view.Menu
import android.view.MenuItem
import android.os.Bundle
Expand All @@ -11,6 +12,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.textfield.TextInputEditText
import com.neko.v2ray.R
import com.neko.v2ray.ui.BaseActivity
import com.neko.v2ray.ui.MainActivity
import com.neko.v2ray.util.SoftInputAssist

import com.neko.imageslider.ImageSlider
Expand All @@ -29,6 +31,7 @@ class TambahActivity : BaseActivity() {
private lateinit var etAge: TextInputEditText
private lateinit var etHobi: TextInputEditText
private lateinit var etTgl: TextInputEditText
private lateinit var arrID: ArrayList<String>
private lateinit var softInputAssist: SoftInputAssist

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -137,11 +140,35 @@ class TambahActivity : BaseActivity() {
else -> {
val myDB = MyDatabaseHelper(this@TambahActivity)
val eksekusi = myDB.tambahDatabase(getName, getUsername, getEmail, getAge, getHobi, getTgl)
val cursor: Cursor? = myDB.bacaSemuaData()

if (eksekusi == -1L) {
Toast.makeText(this@TambahActivity, "Failed", Toast.LENGTH_SHORT).show()
etName.requestFocus()
} else if (cursor == null || cursor.count == 0) {
// null
} else {
try {
val db = myDB.readableDatabase
val query = "SELECT * FROM nekoray"
val rs: Cursor = db.rawQuery(query, null)

if (rs.moveToFirst()) {
val arrID = rs.getString(rs.getColumnIndexOrThrow("id"))
val username = rs.getString(rs.getColumnIndexOrThrow("username"))
val posisi = 1

val intent = Intent(this@TambahActivity, MainActivity::class.java).apply {
putExtra("varID", arrID)
putExtra("varUsername", username)
putExtra("varPosisi", posisi)
}
startActivity(intent)
}
rs.close()
} finally {
cursor?.close()
}
Toast.makeText(this@TambahActivity, "Succeed", Toast.LENGTH_SHORT).show()
finish()
}
Expand Down

0 comments on commit 64c7c0d

Please sign in to comment.