Advertisement
zeev

myTasks v1

Sep 25th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.05 KB | None | 0 0
  1. MainActivity.java
  2. =====================
  3. package com.example.teacher.mytasks;
  4.  
  5. import android.content.Intent;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.os.Bundle;
  8. import android.view.View;
  9. import android.widget.Toast;
  10.  
  11. public class MainActivity extends AppCompatActivity implements View.OnClickListener{
  12.  
  13.     @Override
  14.     protected void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.activity_main);
  17.     }
  18.  
  19.     @Override
  20.     public void onClick(View view) {
  21.         switch (view.getId()){
  22.             case R.id.btnLogin:
  23.                 //checkLogin();
  24.                 Intent intent = new Intent(this, Tasks.class);
  25.                 intent.putExtra("userName","Zeevik");
  26.                 startActivity(intent);
  27.                 break;
  28.  
  29.             case R.id.btnRegister:
  30.                 startActivity(new Intent(this,Register.class));
  31.                 break;
  32.  
  33.             default:
  34.                 Toast.makeText(this, "Error in button", Toast.LENGTH_SHORT).show();
  35.         }
  36.     }
  37.  
  38.     private void checkLogin() {
  39.     }
  40. }
  41.  
  42.  
  43.  
  44. activity_main.xml
  45. ======================
  46. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  47.     android:layout_width="match_parent"
  48.     android:layout_height="match_parent"
  49.     android:orientation="vertical">
  50.  
  51.     <LinearLayout
  52.         android:layout_width="match_parent"
  53.         android:layout_height="match_parent"
  54.         android:orientation="vertical"
  55.         android:layout_weight="1">
  56.         <ImageView
  57.             android:layout_width="match_parent"
  58.             android:layout_height="match_parent"
  59.             android:src="@drawable/task"/>
  60.     </LinearLayout>
  61.  
  62.     <LinearLayout
  63.         android:layout_width="match_parent"
  64.         android:layout_height="match_parent"
  65.         android:orientation="vertical"
  66.         android:layout_weight="1">
  67.         <EditText
  68.             android:layout_width="match_parent"
  69.             android:layout_height="wrap_content"
  70.             android:id="@+id/userLogin"
  71.             android:hint="Enter user name..."
  72.             android:layout_marginTop="20dp"/>
  73.         <EditText
  74.             android:layout_width="match_parent"
  75.             android:layout_height="wrap_content"
  76.             android:id="@+id/userPass"
  77.             android:hint="Enter user pass..."
  78.             android:inputType="textPassword"
  79.             android:layout_marginTop="20dp"/>
  80.     </LinearLayout>
  81.  
  82.     <LinearLayout
  83.         android:layout_width="match_parent"
  84.         android:layout_height="match_parent"
  85.         android:layout_weight="1"
  86.         android:orientation="horizontal">
  87.  
  88.         <Button
  89.             android:id="@+id/btnLogin"
  90.             android:layout_width="match_parent"
  91.             android:layout_height="wrap_content"
  92.             android:layout_margin="20dp"
  93.             android:layout_weight="1"
  94.             android:background="#009fff"
  95.             android:onClick="onClick"
  96.             android:text="Login"
  97.             android:textColor="#ffffff"
  98.             android:textSize="22sp"
  99.             />
  100.  
  101.         <Button
  102.             android:id="@+id/btnRegister"
  103.             android:layout_width="match_parent"
  104.             android:layout_height="wrap_content"
  105.             android:layout_margin="20dp"
  106.             android:layout_weight="1"
  107.             android:background="#009fff"
  108.             android:onClick="onClick"
  109.             android:text="Register"
  110.             android:textColor="#ffffff"
  111.             android:textSize="22sp" />
  112.     </LinearLayout>
  113.  
  114.     <LinearLayout
  115.         android:layout_width="match_parent"
  116.         android:layout_height="match_parent"
  117.         android:orientation="vertical"
  118.         android:layout_weight="1">
  119.         <TextView
  120.             android:layout_width="match_parent"
  121.             android:layout_height="wrap_content"
  122.             android:textSize="18dp"
  123.             android:text="in memory of Tomer, which didn't bring chocolate to the class, shame you!!!"
  124.             android:gravity="center"/>
  125.     </LinearLayout>
  126.  
  127. </LinearLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement