Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
package com.example.poftabuna
import android.R
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.text.Layout
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
fun click_proteine(view: View)
{
text_proteine.setBackgroundColor(Color.WHITE);
text_carbohidrati.setBackgroundColor(Color.BLACK);
text_grasimi.setBackgroundColor(Color.BLACK);
text_fructe.setBackgroundColor(Color.BLACK);
val color = (text_cu.getBackground() as ColorDrawable).color
if(color!=Color.BLACK) {
text_cu.setBackgroundColor(Color.YELLOW);
}
val color2 = (text_fara.getBackground() as ColorDrawable).color
if(color2!=Color.BLACK) {
text_cu.setBackgroundColor(Color.YELLOW);
}
text_fara.setBackgroundColor(Color.GREEN);
text_iritanti.setBackgroundColor(Color.GREEN);
layout_proteine.removeAllViews()
}
fun restart(view: View)
{
intent = Intent(this, MainActivity::class.java)
startActivity(intent)
}
}