EylonYizhack

HackerU_app_2Pages

Mar 1st, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.74 KB | None | 0 0
  1. /////////////////////////// Main_Activity////////////////////////////////
  2.  
  3. public class MainActivity extends ActionBarActivity {
  4.  
  5.  
  6.     @Override
  7.     protected void onCreate(Bundle savedInstanceState) {
  8.         super.onCreate(savedInstanceState);
  9.         setContentView(R.layout.activity_main);
  10.         setPointer();
  11.         Intent intent = getIntent();
  12.     }
  13.     //set pointers
  14.     EditText txtUser;
  15.     EditText txtPass;
  16.  
  17.  
  18.     private void setPointer()
  19.     {
  20.         txtUser=(EditText)findViewById(R.id.user);
  21.         txtPass=(EditText)findViewById(R.id.password);
  22.     }
  23.  
  24.  
  25.             public void btnLogin(View v)
  26.             {
  27.                 String chkUser=txtUser.getText().toString();
  28.                 String chkPass=txtPass.getText().toString();
  29.                 if (chkUser.toLowerCase().equals("eylon") && chkPass.equals("123456"))
  30.                 {
  31.                     Toast.makeText(this, "hello user!", Toast.LENGTH_LONG).show();
  32.                     Intent intent = new Intent(MainActivity.this, Main2Activity.class);
  33.                     MainActivity.this.startActivity(intent);
  34.                 }
  35.                 else
  36.                     Toast.makeText(this, "Bad User or password", Toast.LENGTH_LONG).show();
  37.  
  38.             }
  39. }
  40.  
  41. //////////////////////////////Main2_Activity////////////////////////////////////
  42.  
  43. package com.example.eylonyizhack.login;
  44.  
  45. import android.os.Bundle;
  46. import android.support.v7.app.ActionBarActivity;
  47.  
  48. public class Main2Activity extends ActionBarActivity {
  49.  
  50.     @Override
  51.     protected void onCreate(Bundle savedInstanceState) {
  52.         super.onCreate(savedInstanceState);
  53.         setContentView(R.layout.activity_main2);
  54.         getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  55.     }
  56.  
  57. }
  58.  
  59. //////////////////////////////Activity_main - XML 1 //////////////////////////////////
  60.  
  61. <LinearLayout
  62.     android:orientation="vertical"
  63.     android:layout_width="match_parent"
  64.     android:layout_height="match_parent"
  65.     xmlns:android="http://schemas.android.com/apk/res/android" >
  66.  
  67.     <LinearLayout
  68.         android:orientation="vertical"
  69.         android:layout_width="match_parent"
  70.         android:layout_height="match_parent"
  71.         android:layout_weight="1">
  72.         <ImageView
  73.             android:layout_width="match_parent"
  74.             android:layout_height="match_parent"
  75.             android:src="@drawable/hucker"/>
  76.     </LinearLayout>
  77.  
  78.  
  79.  
  80.  
  81.     <RelativeLayout
  82.         android:orientation="vertical"
  83.         android:layout_height="match_parent"
  84.         android:layout_width="match_parent"
  85.         android:layout_weight="1">
  86.         <EditText
  87.             android:layout_width="match_parent"
  88.             android:layout_height="wrap_content"
  89.             android:hint="@string/username"
  90.             android:textSize="25sp"
  91.             android:layout_gravity="center_vertical"
  92.             android:inputType="text"
  93.             android:id="@+id/user"
  94.             android:gravity="center"
  95.             />
  96.         <EditText
  97.             android:layout_width="match_parent"
  98.             android:layout_height="wrap_content"
  99.             android:hint="@string/password"
  100.             android:textSize="25sp"
  101.             android:layout_gravity="center_vertical"
  102.             android:inputType="textPassword"
  103.             android:id="@+id/password"
  104.             android:gravity="center"
  105.             android:layout_below="@+id/user"/>
  106.     </RelativeLayout>
  107.  
  108.  
  109.  
  110.  
  111.     <LinearLayout
  112.         android:orientation="vertical"
  113.         android:layout_height="match_parent"
  114.         android:layout_width="match_parent"
  115.         android:layout_weight="1">
  116.         <Button
  117.             android:layout_width="wrap_content"
  118.             android:layout_height="wrap_content"
  119.             android:layout_gravity="center"
  120.             android:text="@string/Login"
  121.             android:textSize="35sp"
  122.             android:id="@+id/logInButton"
  123.             android:onClick="btnLogin"/>
  124.  
  125.     </LinearLayout>
  126.  
  127.  
  128. </LinearLayout>
  129.  
  130. ////////////////////////////////////////////Activity_main XML 2 //////////////////////////////////
  131.  
  132. <?xml version="1.0" encoding="utf-8"?>
  133. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  134.     android:layout_width="match_parent"
  135.     android:layout_height="wrap_content"
  136.     android:orientation="vertical">
  137.  
  138.  
  139.     <LinearLayout
  140.         android:layout_width="match_parent"
  141.         android:layout_height="wrap_content"
  142.         android:orientation="vertical"
  143.         android:paddingBottom="@dimen/activity_vertical_margin"
  144.         android:paddingLeft="@dimen/activity_horizontal_margin"
  145.         android:paddingRight="@dimen/activity_horizontal_margin"
  146.         android:paddingTop="@dimen/activity_vertical_margin">
  147.        <Button
  148.            android:layout_width="match_parent"
  149.            android:layout_height="wrap_content"
  150.            android:textSize="25sp"
  151.            android:text="קטלוג הקורסים"
  152.            android:id="@+id/btnKursim"
  153.            android:background="#22748F"
  154.            android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
  155.            android:textColor="#FFFFFF"/>
  156.         <Button
  157.             android:layout_width="match_parent"
  158.             android:layout_height="wrap_content"
  159.             android:textSize="25sp"
  160.             android:text=" חוות דעת"
  161.             android:id="@+id/btnHavotDaat"
  162.             android:layout_below="@+id/btnKursim"
  163.             android:background="#22748F"
  164.             android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
  165.             android:textColor="#FFFFFF"/>
  166.         <Button
  167.             android:layout_width="match_parent"
  168.             android:layout_height="wrap_content"
  169.             android:textSize="25sp"
  170.             android:text="סניפים"
  171.             android:id="@+id/btnSnifim"
  172.             android:layout_below="@+id/btnHavotDaat"
  173.             android:background="#22748F"
  174.             android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
  175.             android:textColor="#FFFFFF"/>
  176.         <Button
  177.             android:layout_width="match_parent"
  178.             android:layout_height="wrap_content"
  179.             android:textSize="25sp"
  180.             android:text="צור קשר"
  181.             android:id="@+id/btnTzruKesher"
  182.             android:layout_below="@+id/btnSnifim"
  183.             android:background="#22748F"
  184.             android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
  185.             android:textColor="#FFFFFF"/>
  186.         <Button
  187.             android:layout_width="match_parent"
  188.             android:layout_height="wrap_content"
  189.             android:textSize="25sp"
  190.             android:text="מבצעים והנחות"
  191.             android:id="@+id/btnMevtzaim"
  192.             android:layout_below="@+id/btnTzruKesher"
  193.             android:background="#22748F"
  194.             android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
  195.             android:textColor="#FFFFFF"/>
  196.         <Button
  197.             android:layout_width="match_parent"
  198.             android:layout_height="wrap_content"
  199.             android:textSize="25sp"
  200.             android:text="קבע פגישת יעוץ"
  201.             android:id="@+id/btnKvaPgisha"
  202.             android:layout_below="@+id/btnMevtzaim"
  203.             android:background="#22748F"
  204.             android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
  205.             android:textColor="#FFFFFF"/>
  206.     </LinearLayout>
  207.  
  208.     <LinearLayout
  209.         android:orientation="vertical"
  210.         android:layout_width="match_parent"
  211.         android:layout_height="match_parent"
  212.         >
  213.         <ImageView
  214.             android:layout_width="wrap_content"
  215.             android:layout_height="wrap_content"
  216.             android:src="@drawable/back"
  217.             />
  218.     </LinearLayout>
  219.  
  220.  
  221. </LinearLayout>
Add Comment
Please, Sign In to add comment