Abdulaziz Almutairi

 avatar
unknown
plain_text
3 years ago
5.6 kB
4
Indexable
name: Abdulaziz Almutairi number: 441228224

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="#CCFFFF"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="100dp"
        android:layout_height="62dp"
        android:text="Capacities Converter!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.022"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.023" />

    <Button
        android:id="@+id/button"
        android:layout_width="409dp"
        android:layout_height="83dp"
        android:text="التحويل الى سعة تخزين مختلفة"
        app:backgroundTint="#000000"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="502dp" />

    <Button
        android:id="@+id/button2"
        android:layout_width="121dp"
        android:layout_height="96dp"
        android:text="الخروج"
        app:backgroundTint="#F91313"
        tools:layout_editor_absoluteX="152dp"
        tools:layout_editor_absoluteY="602dp" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="410dp"
        android:layout_height="24dp"
        android:text="لحجم الإجمالي بالميجا"
        app:backgroundTint="#F00000"
        tools:layout_editor_absoluteX="-5dp"
        tools:layout_editor_absoluteY="85dp" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="410dp"
        android:layout_height="24dp"
        android:text="لحجم الإجمالي بالكيلو بايت"
        app:backgroundTint="#F00000"
        tools:layout_editor_absoluteX="7dp"
        tools:layout_editor_absoluteY="173dp" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="410dp"
        android:layout_height="24dp"
        android:text="لحجم الإجمالي بايت"
        app:backgroundTint="#F00000"
        tools:layout_editor_absoluteX="7dp"
        tools:layout_editor_absoluteY="262dp" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="410dp"
        android:layout_height="24dp"
        android:text="لحجم الإجمالي بالبت"
        app:backgroundTint="#F00000"
        tools:layout_editor_absoluteX="-4dp"
        tools:layout_editor_absoluteY="372dp" />

</androidx.constraintlayout.widget.ConstraintLayout>


--------------------------------------------------------------------------------------------------------------------------------------------------------------------



package com.example.abdulaziz
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity

@Suppress("DEPRECATION")
class MainActivity : AppCompatActivity() {
    private var retest=3
    private var wrong_question=0
    private var Right_question=0
    private var questionNo = 0
    private var questions = arrayList04("")

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val button:Button = findViewById(R.id.button)
        val button2:Button = findViewById(R.id.button2)
        val button3:Button = findViewById(R.id.button3)
        val button4:Button = findViewById(R.id.button4)



        button.setOnClickListener {
            showToast(1)
        }

        button2.setOnClickListener {
            showToast(2)
        }

        button3.setOnClickListener {
            showToast(3)
        }
        button4.setOnClickListener {
            showToast(4)

        }

        val right: TextView = findViewById(R.id.textView1)
        val wrong: TextView = findViewById(R.id.textView6)
        val builder = AlertDialog.Builder(this)
        builder.setTitle("Attention")
        builder.setMessage("retest exam, are you sure?\n\n you have $retest attempt")
        builder.setPositiveButton(android.R.string.yes) { _, _ ->
            if (retest > 0) {
                retest-=1




}

private fun showToast(answer: Int) {
    val right: TextView = findViewById(R.id.textView4)
    val wrong: TextView = findViewById(R.id.textView6)

}


fun findViewById(textView4: Int): TextView {
    TODO("Not yet implemented")
}

private fun updateQuestion() {
    val right: TextView = findViewById(R.id.textView4)
    val wrong: TextView = findViewById(R.id.textView6)
    val awesome: TextView = findViewById(R.id.textView7)
    val textView:TextView = findViewById(R.id.textView)
    var GB =1024
    if(1024.also { GB = it }) {
        textView.text = GB[GB]
    }





    private operator fun Int.get(gb: Int): CharSequence? {
        TODO("Not yet implemented")
    }
Editor is loading...