abdulmajeed albaqami

mail@pastecode.io avatar
unknown
plain_text
2 years ago
6.7 kB
1
Indexable
Never
abdulmajeed albaqami

<?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/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="160dp"
        android:layout_marginTop="80dp"
        android:layout_marginEnd="186dp"
        android:backgroundTint="#000000"
        android:text="enter GB value"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:ignore="MissingConstraints" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="350dp"
        android:layout_marginTop="200dp"
        android:layout_marginEnd="26dp"
        android:text="ميجا بايت :"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:ignore="MissingConstraints" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="350dp"
        android:layout_marginTop="81dp"
        android:layout_marginEnd="33dp"
        android:text="كيلو بايت :"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView3"
        tools:ignore="MissingConstraints" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="360dp"
        android:layout_marginTop="81dp"
        android:layout_marginEnd="36dp"
        android:text="بالبايت :"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView4"
        tools:ignore="MissingConstraints" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="360dp"
        android:layout_marginTop="80dp"
        android:layout_marginEnd="44dp"
        android:layout_marginBottom="280dp"
        android:text="بالبت :"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView5"
        tools:ignore="MissingConstraints" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="155dp"
        android:layout_marginTop="501dp"
        android:layout_marginEnd="154dp"
        android:layout_marginBottom="2dp"
        android:backgroundTint="#FF000000"
        android:text="اضغط هنا للتحويل"
        app:layout_constraintBottom_toTopOf="@+id/button2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView2"
        tools:ignore="MissingConstraints" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="175dp"
        android:layout_marginTop="2dp"
        android:layout_marginEnd="174dp"
        android:layout_marginBottom="101dp"
        android:backgroundTint="#F91313"
        android:text="خروج"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/button"
        tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

______________ __________________ ____________________

package com.example.capacitiesconverter

import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AlertDialog

private var Nothing?.text: Any
    get() = Unit
    set(value) {

    }

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

        val button = null
        button.setOnClickListener({
            val editTextNumber = null
            var x=editTextNumber.text.toString()
            var result=0.0
            if (x.toDouble()>60000 ) {
                var Al= AlertDialog.Builder(this)
                Al.setTitle("Warnning")
                Al.setMessage("Enter a reasonable tempreture !!")
                Al.setPositiveButton("?????"){DialogInterface,which-> Toast.makeText(this,"DONE",Toast.LENGTH_SHORT).show() }
                Al.setNeutralButton("????") {DialogInterface, which-> Toast.makeText(this,"OK",Toast.LENGTH_SHORT).show()}
                val alertDialog: AlertDialog = Al.create()
                alertDialog.show()
            }

            else
            { result=(x.toDouble()*1024)*1024
                val textView = null
                textView.text=result.toString()
                val t= Toast.makeText(this,"DONE",Toast.LENGTH_SHORT)
                t.show()

            }
        })
        val box = android.androidx.compose.foundation.layout.Box {
            setOnClickListener {

                val openUrl = Intent(Intent.ACTION_VIEW)

                openUrl.data = Uri.parse("https://www.unitconverters.com/")

                startActivity(openUrl)
            }
        }
    }

    private fun setOnClickListener(any: () -> Unit) {
        TODO("Not yet implemented")
    }
}

private fun Nothing?.setOnClickListener(any: Any) {

}