Faisal sultan almasloukhi

mail@pastecode.io avatar
unknown
plain_text
2 years ago
7.1 kB
1
Indexable
Never
<?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="match_parent"
    android:layout_height="match_parent"
    android:background="#CCFFFF"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/textView3"
        android:layout_width="415dp"
        android:layout_height="45dp"
        android:background="#1F3EED"
        android:text="Capacities Converter"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0" />

    <EditText
        android:id="@+id/enterG"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#B5B3B3"
        android:backgroundTint="#B5B3B3"
        android:ems="10"
        android:gravity="center"
        android:hint="ادخل قيمة بالجيجا بايت"
        android:inputType="number"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.497"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.078" />

    <TextView
        android:id="@+id/showM"
        android:layout_width="419dp"
        android:layout_height="28dp"
        android:background="#CDDC39"
        android:backgroundTint="#60F3FF7C"
        android:text="لحجم الاجمالي بالميجا"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.153" />

    <TextView
        android:id="@+id/showK"
        android:layout_width="419dp"
        android:layout_height="26dp"
        android:background="#CDDC39"
        android:backgroundTint="#60F3FF7C"
        android:text="لحجم الاجمالي بالكيلو بايت"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.314" />

    <TextView
        android:id="@+id/showB"
        android:layout_width="417dp"
        android:layout_height="33dp"
        android:background="#CDDC39"
        android:backgroundTint="#60F3FF7C"
        android:text="لحجم الاجمالي بالبايت"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/showBT"
        android:layout_width="427dp"
        android:layout_height="29dp"
        android:background="#CDDC39"
        android:backgroundTint="#60F3FF7C"
        android:text="لحجم الاجمالي بالبت"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.666"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/textView3"
        app:layout_constraintVertical_bias="0.678" />

    <Button
        android:id="@+id/exitB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#F91313"
        android:text="خروج"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.498"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.95" />

    <Button
        android:id="@+id/switchB"
        android:layout_width="422dp"
        android:layout_height="43dp"
        android:background="#000000"
        android:text="اضغط هنا للتحويل"
        android:textColor="#FFFFFF"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.488"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.812" />

</androidx.constraintlayout.widget.ConstraintLayout>


package com.example.myapplication6456456

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.content.DialogInterface
import androidx.appcompat.app.AlertDialog
import kotlinx.android.synthetic.main.activity_main.*



class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        var enterGiga = ""


        enterG.setOnClickListener(){


        }


        switchB.setOnClickListener(){

                var enterr:Int=enterG.toString().toInt()
                if (enterr>60000){
                    message.text="Enter a reasonable temperature"}
        }

        switchB.setOnClickListener(){
            Toast.makeText(this,"DONE",Toast.LENGTH_SHORT).show()
        }


        showM.setOnClickListener(){
            var MB = 1024 * 1024

        }

        showK.setOnClickListener() {
            var KB = 1024 * 1024 * 1024

        }

        showB.setOnClickListener(){
            var Byte = 1024 * 1024 * 1024 * 1024
        }

        showBT.setOnClickListener(){
            var Bit = 1024 * 1024 * 1024 * 1024
        }

        exitB.setOnClickListener(){

            val builder=AlertDialog.Builder(this)


            builder.setTitle("تحذير ")
            builder.setMessage("هل ترغب في اغلاق البرنامج ؟ ")

            builder.setPositiveButton("نعم",{ dialogInterface: DialogInterface, i: Int ->
                finish()
            })

            builder.setNegativeButton("الغاء",{ dialogInterface: DialogInterface, i: Int ->  })
            builder.show()

        }

    }
}