Skip to content

Commit 5fafd24

Browse files
committed
UWU UI update
1 parent a95a5ff commit 5fafd24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3090
-567
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,16 @@
239239
android:screenOrientation="portrait"
240240
android:exported="false" />
241241

242+
<activity android:name="com.neko.uwu.TambahActivity"
243+
android:theme="@style/AppThemeDayNight.NoActionBar"
244+
android:screenOrientation="portrait"
245+
android:exported="false" />
246+
247+
<activity android:name="com.neko.uwu.UbahActivity"
248+
android:theme="@style/AppThemeDayNight.NoActionBar"
249+
android:screenOrientation="portrait"
250+
android:exported="false" />
251+
242252
<service
243253
android:name=".service.V2RayVpnService"
244254
android:enabled="true"

app/src/main/java/com/neko/splash/SplashActivity.kt

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,57 @@
11
package com.neko.splash
22

33
import android.content.Intent
4+
import android.database.Cursor
45
import android.os.Bundle
56
import android.os.Handler
67
import android.os.Looper
78
import android.view.View
89
import com.neko.v2ray.R
910
import com.neko.v2ray.ui.BaseActivity
1011
import com.neko.v2ray.ui.MainActivity
12+
import com.neko.uwu.*
1113

1214
class SplashActivity : BaseActivity() {
1315

16+
private lateinit var myDB: MyDatabaseHelper
17+
private lateinit var arrID: ArrayList<String>
18+
private lateinit var arrUsername: ArrayList<String>
19+
1420
override fun onCreate(savedInstanceState: Bundle?) {
1521
super.onCreate(savedInstanceState)
1622
setContentView(R.layout.uwu_activity_splash)
23+
myDB = MyDatabaseHelper(this)
1724

1825
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
1926
or View.SYSTEM_UI_FLAG_FULLSCREEN)
2027

2128
Handler(Looper.getMainLooper()).postDelayed({
22-
startActivity(Intent(this@SplashActivity, MainActivity::class.java))
29+
val cursor: Cursor? = myDB.bacaSemuaData()
30+
if (cursor == null || cursor.count == 0) {
31+
startActivity(Intent(this@SplashActivity, MainActivity::class.java))
32+
} else {
33+
try {
34+
val db = myDB.readableDatabase
35+
val query = "SELECT * FROM nekoray"
36+
val rs: Cursor = db.rawQuery(query, null)
37+
38+
if (rs.moveToFirst()) {
39+
val arrID = rs.getString(rs.getColumnIndexOrThrow("id"))
40+
val username = rs.getString(rs.getColumnIndexOrThrow("username"))
41+
val posisi = 1
42+
43+
val intent = Intent(this@SplashActivity, MainActivity::class.java).apply {
44+
putExtra("varID", arrID)
45+
putExtra("varUsername", username)
46+
putExtra("varPosisi", posisi)
47+
}
48+
startActivity(intent)
49+
}
50+
rs.close()
51+
} finally {
52+
cursor?.close()
53+
}
54+
}
2355
finish()
2456
}, 1000)
2557
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.neko.uwu
2+
3+
import android.app.AlertDialog
4+
import android.content.Context
5+
import android.content.Intent
6+
import android.view.LayoutInflater
7+
import android.view.View
8+
import android.view.ViewGroup
9+
import android.widget.TextView
10+
import android.widget.Toast
11+
import androidx.recyclerview.widget.RecyclerView
12+
import com.neko.v2ray.R
13+
import com.neko.v2ray.ui.MainActivity
14+
import com.google.android.material.card.MaterialCardView
15+
16+
class AdapterDatabase(
17+
private val ctx: Context,
18+
private val arrID: ArrayList<*>,
19+
private val arrName: ArrayList<*>,
20+
private val arrUsername: ArrayList<*>,
21+
private val arrEmail: ArrayList<*>,
22+
private val arrAge: ArrayList<*>,
23+
private val arrHobi: ArrayList<*>,
24+
private val arrTgl: ArrayList<*>
25+
) : RecyclerView.Adapter<AdapterDatabase.ViewHolderDatabase>() {
26+
27+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolderDatabase {
28+
val view = LayoutInflater.from(ctx).inflate(R.layout.card_item, parent, false)
29+
return ViewHolderDatabase(view)
30+
}
31+
32+
override fun onBindViewHolder(holder: ViewHolderDatabase, position: Int) {
33+
val alphabet: List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9')
34+
val randomString: String = List(15) { alphabet.random() }.joinToString("")
35+
36+
holder.tvID.text = arrID[position].toString()
37+
holder.uwuID.text = randomString
38+
holder.tvName.text = arrName[position].toString()
39+
holder.tvUsername.text = arrUsername[position].toString()
40+
holder.tvEmail.text = arrEmail[position].toString()
41+
holder.tvAge.text = arrAge[position].toString()
42+
holder.tvHobi.text = arrHobi[position].toString()
43+
holder.tvTgl.text = arrTgl[position].toString()
44+
}
45+
46+
override fun getItemCount(): Int = arrName.size
47+
48+
inner class ViewHolderDatabase(itemView: View) : RecyclerView.ViewHolder(itemView) {
49+
val tvID: TextView = itemView.findViewById(R.id.tv_id)
50+
val uwuID: TextView = itemView.findViewById(R.id.uwu_id)
51+
val tvName: TextView = itemView.findViewById(R.id.tv_name)
52+
val tvUsername: TextView = itemView.findViewById(R.id.tv_username)
53+
val tvEmail: TextView = itemView.findViewById(R.id.tv_email)
54+
val tvAge: TextView = itemView.findViewById(R.id.tv_age)
55+
val tvHobi: TextView = itemView.findViewById(R.id.tv_hobi)
56+
val tvTgl: TextView = itemView.findViewById(R.id.tv_tgl)
57+
val cvDatabase: MaterialCardView = itemView.findViewById(R.id.cv_database)
58+
}
59+
}
60+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package com.neko.uwu
2+
3+
import android.content.ContentValues
4+
import android.content.Context
5+
import android.database.Cursor
6+
import android.database.sqlite.SQLiteDatabase
7+
import android.database.sqlite.SQLiteOpenHelper
8+
9+
class MyDatabaseHelper(context: Context) : SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
10+
private val ctx: Context = context
11+
12+
companion object {
13+
private const val DATABASE_NAME = "neko.db"
14+
private const val DATABASE_VERSION = 1
15+
16+
private const val TABLE_NAME = "nekoray"
17+
private const val FIELD_ID = "id"
18+
private const val FIELD_NAME = "name"
19+
private const val FIELD_USERNAME = "username"
20+
private const val FIELD_EMAIL = "email"
21+
private const val FIELD_AGE = "age"
22+
private const val FIELD_HOBI = "hobi"
23+
private const val FIELD_TGL = "tgl"
24+
}
25+
26+
override fun onCreate(db: SQLiteDatabase) {
27+
val query = "CREATE TABLE $TABLE_NAME (" +
28+
"$FIELD_ID INTEGER PRIMARY KEY AUTOINCREMENT, " +
29+
"$FIELD_NAME TEXT, " +
30+
"$FIELD_USERNAME TEXT, " +
31+
"$FIELD_EMAIL TEXT, " +
32+
"$FIELD_AGE TEXT, " +
33+
"$FIELD_HOBI TEXT, " +
34+
"$FIELD_TGL TEXT );"
35+
36+
db.execSQL(query)
37+
}
38+
39+
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
40+
db.execSQL("DROP TABLE IF EXISTS $TABLE_NAME")
41+
onCreate(db)
42+
}
43+
44+
fun tambahDatabase(name: String, username: String, email: String, age: String, hobi: String, tgl: String): Long {
45+
val db = this.writableDatabase
46+
val cv = ContentValues()
47+
48+
cv.put(FIELD_NAME, name)
49+
cv.put(FIELD_USERNAME, username)
50+
cv.put(FIELD_EMAIL, email)
51+
cv.put(FIELD_AGE, age)
52+
cv.put(FIELD_HOBI, hobi)
53+
cv.put(FIELD_TGL, tgl)
54+
55+
return db.insert(TABLE_NAME, null, cv)
56+
}
57+
58+
fun ubahDatabase(id: String, name: String, username: String, email: String, age: String, hobi: String, tgl: String): Long {
59+
val db = this.writableDatabase
60+
val cv = ContentValues()
61+
62+
cv.put(FIELD_NAME, name)
63+
cv.put(FIELD_USERNAME, username)
64+
cv.put(FIELD_EMAIL, email)
65+
cv.put(FIELD_AGE, age)
66+
cv.put(FIELD_HOBI, hobi)
67+
cv.put(FIELD_TGL, tgl)
68+
69+
return db.update(TABLE_NAME, cv, "id = ?", arrayOf(id)).toLong()
70+
}
71+
72+
fun hapusDatabase(id: String): Long {
73+
val db = this.writableDatabase
74+
return db.delete(TABLE_NAME, "id = ?", arrayOf(id)).toLong()
75+
}
76+
77+
fun bacaSemuaData(): Cursor? {
78+
val query = "SELECT * FROM $TABLE_NAME"
79+
val db = this.readableDatabase
80+
81+
return db?.rawQuery(query, null)
82+
}
83+
}

0 commit comments

Comments
 (0)