Advertisement
Guest User

Untitled

a guest
Jan 14th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 26.19 KB | None | 0 0
  1. //TaskActivity
  2. //-----------------------
  3. package com.example.zeevm.mylogin;
  4.  
  5. import android.app.AlertDialog;
  6. import android.content.Context;
  7. import android.content.DialogInterface;
  8. import android.support.v7.app.AppCompatActivity;
  9. import android.os.Bundle;
  10. import android.view.LayoutInflater;
  11. import android.view.View;
  12. import android.widget.Button;
  13. import android.widget.EditText;
  14. import android.widget.TextView;
  15. import android.widget.Toast;
  16.  
  17. public class TaskActivity extends AppCompatActivity {
  18.  
  19.     Button btnAddTask,btnTest;
  20.     Context context;
  21.     TextView txtLogo;
  22.     boolean isBackPressed=false;
  23.     String spUser="";
  24.  
  25.     @Override
  26.     protected void onCreate(Bundle savedInstanceState) {
  27.         super.onCreate(savedInstanceState);
  28.         setContentView(R.layout.activity_task);
  29.         setPointer();
  30.         getExtra();
  31.     }
  32.  
  33.     private void setPointer()
  34.     {
  35.         this.context=this;
  36.         txtLogo=(TextView)findViewById(R.id.txtHello);
  37.         btnAddTask=(Button)findViewById(R.id.btnAddTask);
  38.         btnAddTask.setOnClickListener(new View.OnClickListener() {
  39.             @Override
  40.             public void onClick(View v) {
  41.                 showAdAddTask();
  42.             }
  43.         });
  44.         btnTest=(Button)findViewById(R.id.btnTest);
  45.         btnTest.setOnClickListener(new View.OnClickListener() {
  46.             @Override
  47.             public void onClick(View v) {
  48.                 //show all the tasks.....
  49.                 String taskTest = UtlShared.getAllTask(context,spUser);
  50.                 Toast.makeText(context, taskTest, Toast.LENGTH_LONG).show();
  51.             }
  52.         });
  53.     }
  54.  
  55.     private void showAdAddTask()
  56.     {
  57.         //create alert dialog builder
  58.         AlertDialog.Builder adTask = new AlertDialog.Builder(context);
  59.         //set the title
  60.         //adTask.setTitle(getResources().getString(R.string.adTtlNewTask));
  61.  
  62.         /*
  63.         //create new EditText instance
  64.         EditText txtTask = new EditText(context);
  65.         //set hint to the Edit Text
  66.         txtTask.setHint(getResources().getString(R.string.adTaskHint));
  67.         //add the EditText(View) to the Alert Dialog
  68.         adTask.setView(txtTask);
  69.         */
  70.  
  71.         //we are going to inflate our view (insert the entire layout to View object)
  72.         View inflatedTask = LayoutInflater.from(context).inflate(R.layout.alert_dialog_new_task,null,false);
  73.         //we setting pointer to our inflated view , and not the activity layout
  74.         final EditText myNewTask = (EditText)inflatedTask.findViewById(R.id.txtNewTask);
  75.  
  76.         adTask.setView(inflatedTask);
  77.  
  78.         //set positive button
  79.         adTask.setPositiveButton(getResources().getString(R.string.btnAddTask),
  80.                 new DialogInterface.OnClickListener() {
  81.                     @Override
  82.                     public void onClick(DialogInterface dialog, int which) {
  83.                         //handle add task.... (utl shared)
  84.                         String myTask = myNewTask.getText().toString();
  85.                         UtlShared.addTask(context,spUser,myTask);
  86.                     }
  87.                 });
  88.         //set negative button
  89.         adTask.setNegativeButton(getResources().getString(R.string.regBtnCancel), new DialogInterface.OnClickListener() {
  90.             @Override
  91.             public void onClick(DialogInterface dialog, int which) {
  92.                 dialog.dismiss();
  93.             }
  94.         });
  95.         //show message
  96.         adTask.show();
  97.  
  98.     }
  99.  
  100.  
  101.     private void getExtra()
  102.     {
  103.         String myData = getIntent().getStringExtra("userName");
  104.         txtLogo.setText("Hello "+myData);
  105.         //Toast.makeText(context, "user "+myData+" is loged in...", Toast.LENGTH_SHORT).show();
  106.         spUser=getIntent().getStringExtra("user");
  107.     }
  108.  
  109.     @Override
  110.     public void onBackPressed() {
  111.         if (!isBackPressed)
  112.         {
  113.             isBackPressed=true;
  114.             Toast.makeText(context, "Press again to exit", Toast.LENGTH_SHORT).show();
  115.         }
  116.         else
  117.         {
  118.             finish();
  119.         }
  120.     }
  121. }
  122. ////////////////////////
  123. //UtlShared
  124. //-------------------------
  125. package com.example.zeevm.mylogin;
  126.  
  127. import android.content.Context;
  128. import android.content.SharedPreferences;
  129. import android.icu.text.DateFormat;
  130.  
  131. import java.util.ArrayList;
  132. import java.util.List;
  133. import java.util.Map;
  134.  
  135. /**
  136.  * Created by zeevm on 09/01/2017.
  137.  */
  138.  
  139. public class UtlShared {
  140.     //getting context
  141.     Context context;
  142.     //declaration of shared preferences object
  143.     SharedPreferences userPref;
  144.     //declaration of shared preferences editor
  145.     SharedPreferences.Editor editor;
  146.  
  147.     public UtlShared(Context context) {
  148.         //get context to use it
  149.         this.context = context;
  150.         //declartion of shared preferences with file name and file mode(private)
  151.         userPref = context.getSharedPreferences("users", Context.MODE_PRIVATE);
  152.         //declartion of editor, for updating,changing,etc...
  153.         editor = userPref.edit();
  154.     }
  155.  
  156.     //add new user
  157.     public void addUser(String userName, String userPass, String userNickName) {
  158.         //stores in the phone device under data\data\package name
  159.         //put in shared preferences user name and password
  160.         editor.putString(userName, (userPass+","+userNickName));
  161.         //commit (save/apply) the changes.
  162.         editor.commit();
  163.     }
  164.  
  165.     //check if user exists
  166.     //return true if user exists, false if user not exists
  167.     public boolean checkUser(String userName) {
  168.         //get name by key->user name
  169.         String checkString = userPref.getString(userName, "n/a");
  170.         //check if username equals to responded data, if it's n/a , we dont have the user
  171.         return !checkString.equals("n/a");
  172.     }
  173.  
  174.     //check user name and password
  175.     public String checkUserPassword(String userName, String userPass)
  176.     {
  177.         String checkString = userPref.getString(userName,"n/a"); // 1234|zeevik
  178.         String[] myData = checkString.split(","); //myData[0]=1234 ; myData[1]=zeevik
  179.         return userPass.equals(myData[0])?myData[1]:""; //1234 (password)
  180.     }
  181.  
  182.     public static void addTask(Context context,String spUser, String userTask )
  183.     {
  184.         //declaration of shared prefences
  185.         SharedPreferences myPref = context.getSharedPreferences(spUser,Context.MODE_PRIVATE);
  186.         //declaration of shared prefences editor
  187.         SharedPreferences.Editor editor=myPref.edit();
  188.         //add new task (editor is working with key and value)
  189.         editor.putString(userTask,"0");
  190.         //apply/save changes
  191.         editor.commit();
  192.     }
  193.  
  194.     public static void taskStatusToggle(Context context, String spUser, String userTask)
  195.     {
  196.         //declaration of shared prefences
  197.         SharedPreferences myPref = context.getSharedPreferences(spUser,Context.MODE_PRIVATE);
  198.         //declaration of shared prefences editor
  199.         SharedPreferences.Editor editor=myPref.edit();
  200.         //get the current value
  201.         boolean taskStatus=!(myPref.getString(userTask,"0").equals("1"));
  202.         editor.putString(userTask,taskStatus?"1":"0");
  203.         editor.commit();
  204.     }
  205.  
  206.     public static String getAllTask(Context context,String spUser)
  207.     {
  208.         //go to specific preferences by user name....
  209.         SharedPreferences taskPref = context.getSharedPreferences(spUser,context.MODE_PRIVATE);
  210.  
  211.         List<String> myTasks = new ArrayList<>();
  212.         //get all tasks from shared preferences
  213.         //the shared preferences is by key and value
  214.         //therefor we will use Map Collection
  215.         //we know that the key is string, but we don't know or sure
  216.         //if the value is string, so we will be using <k,?>
  217.         Map<String,?> tasks=taskPref.getAll();
  218.         //transfer the data from map collection to list colliection
  219.         //single item is like the defination of the tasks<String,?>
  220.         //entry->record, entrySet -> set of records
  221.         for (Map.Entry<String,?> singleTask:tasks.entrySet())
  222.         {
  223.             //insert task to list by key and value
  224.             //we check if value is equal to 1, because 1=true/0=false
  225.             myTasks.add(singleTask.getKey());
  226.         }
  227.         return myTasks.toString();
  228.  
  229.     }
  230. }
  231. ----------------------------
  232. //RegisterActivity
  233. ------------------------
  234. package com.example.zeevm.mylogin;
  235.  
  236. import android.content.Context;
  237. import android.support.v7.app.AppCompatActivity;
  238. import android.os.Bundle;
  239. import android.view.View;
  240. import android.widget.Button;
  241. import android.widget.EditText;
  242. import android.widget.Toast;
  243.  
  244. public class RegisterActivity extends AppCompatActivity {
  245.  
  246.     EditText txtUser,txtPass,txtPassCheck, txtNick;
  247.     Button btnRegister,btnCancel;
  248.     Context context;
  249.  
  250.     @Override
  251.     protected void onCreate(Bundle savedInstanceState) {
  252.         super.onCreate(savedInstanceState);
  253.         setContentView(R.layout.activity_register);
  254.         setPointer();
  255.     }
  256.  
  257.     private void setPointer()
  258.     {
  259.         this.context=this;
  260.         txtUser=(EditText)findViewById(R.id.regUser);
  261.         txtPass=(EditText)findViewById(R.id.regPass);
  262.         txtPassCheck=(EditText)findViewById(R.id.regCheck);
  263.         btnRegister=(Button)findViewById(R.id.regBtnRegister);
  264.         btnRegister.setOnClickListener(new View.OnClickListener() {
  265.             @Override
  266.             public void onClick(View v) {
  267.                 btnReg();
  268.             }
  269.         });
  270.         btnCancel=(Button)findViewById(R.id.regBtnCancel);
  271.         btnCancel.setOnClickListener(new View.OnClickListener() {
  272.             @Override
  273.             public void onClick(View v) {
  274.                 finish();
  275.             }
  276.         });
  277.         txtNick=(EditText)findViewById(R.id.regNick);
  278.     }
  279.  
  280.     private void btnReg()
  281.     {
  282.         //validation
  283.         UtlShared utl = new UtlShared(context);
  284.         //check if we have minimum length of user name
  285.         if (txtUser.getText().toString().length()<2 ||
  286.                 txtNick.getText().toString().length()<2)
  287.         {
  288.             Toast.makeText(context, "Minimum of 2 chars for user or nick name", Toast.LENGTH_SHORT).show();
  289.             return;
  290.         }
  291.         //check if user exists
  292.         if (utl.checkUser(txtUser.getText().toString()))
  293.         {
  294.             Toast.makeText(context, "User exists", Toast.LENGTH_SHORT).show();
  295.             return;
  296.         }
  297.  
  298.         //check password
  299.         if ((!txtPass.getText().toString().equals(txtPassCheck.getText().toString()) ||
  300.                 (txtPass.getText().toString().length()<3))) {
  301.             Toast.makeText(context, "Password not match or less then 3 char", Toast.LENGTH_SHORT).show();
  302.             return;
  303.         }
  304.         //register new user and finish
  305.         utl.addUser(txtUser.getText().toString(),txtPass.getText().toString(),txtNick.getText().toString());
  306.         finish();
  307.     }
  308.  
  309. }
  310. -----------------------
  311. //LoginActivity
  312. -----------------------
  313. package com.example.zeevm.mylogin;
  314. import android.app.AlertDialog;
  315. import android.content.Context;
  316. import android.content.DialogInterface;
  317. import android.content.Intent;
  318. import android.graphics.Color;
  319. import android.support.v7.app.AppCompatActivity;
  320. import android.os.Bundle;
  321. import android.util.Log;
  322. import android.view.View;
  323. import android.widget.Button;
  324. import android.widget.EditText;
  325. import android.widget.TextView;
  326. import android.widget.Toast;
  327.  
  328. public class LoginActivity extends AppCompatActivity {
  329.  
  330.     final String TAG="LoginScreen";
  331.  
  332.     EditText txtUser,txtPass;
  333.     Button btnLogin,btnRegister;
  334.     TextView txtLogo;
  335.     //final String USER_NAME="Firas",USER_PASS="12345";
  336.     Context context;
  337.     UtlShared utl;
  338.     //we need a flag to indicate registrion mode.
  339.     boolean needReg=false;
  340.  
  341.     @Override
  342.     protected void onCreate(Bundle savedInstanceState) {
  343.         super.onCreate(savedInstanceState);
  344.         setContentView(R.layout.activity_login);
  345.         setPointer();
  346.     }
  347.  
  348.     private void setPointer()
  349.     {
  350.         this.context=this;
  351.         utl = new UtlShared(context);
  352.         txtUser=(EditText) findViewById(R.id.txtUser);
  353.         txtPass=(EditText)findViewById(R.id.txtPass);
  354.         txtLogo=(TextView)findViewById(R.id.txtLogo);
  355.         txtLogo.setOnLongClickListener(new View.OnLongClickListener() {
  356.             @Override
  357.             public boolean onLongClick(View v) {
  358.                 Toast.makeText(context, context.getResources().getString(R.string.msgLogo), Toast.LENGTH_SHORT).show();
  359.                 return true;
  360.             }
  361.         });
  362.  
  363.         final int orgHintColor=txtLogo.getCurrentHintTextColor();
  364.         btnLogin=(Button)findViewById(R.id.btnLogin);
  365.         btnLogin.setOnClickListener(new View.OnClickListener() {
  366.             @Override
  367.             public void onClick(View roni) {
  368.                 String userName=txtUser.getText().toString();
  369.                 String userPass=txtPass.getText().toString();
  370.                 //validation for user name
  371.                 if (userName.length()<1)
  372.                 {
  373.                     txtUser.setText("");
  374.                     txtUser.setHintTextColor(Color.RED);
  375.                     return;
  376.                 }
  377.                 if (userPass.length()<1)
  378.                 {
  379.                     txtPass.setText("");
  380.                     txtPass.setHintTextColor(Color.RED);
  381.                     return;
  382.                 }
  383.                 //check user
  384.                 //if (Utl.checkUser(userName,userPass,USER_NAME,USER_PASS))
  385.                 String userNick =utl.checkUserPassword(userName,userPass);
  386.                 if (userNick.length()>1)
  387.                 {
  388.                     //move now to second screen - which is our main screen
  389.                     Intent myIntent = new Intent(context,TaskActivity.class);
  390.                     myIntent.putExtra("userName",userNick);
  391.                     myIntent.putExtra("user",txtUser.getText().toString());
  392.                     startActivity(myIntent);
  393.                     finish();
  394.                     Log.i(TAG, "onClick: User OK");
  395.                 }
  396.                 else
  397.                 {
  398.                    userNotFound();
  399.                 }
  400.             }
  401.         });
  402.         btnRegister=(Button)findViewById(R.id.btnRegister);
  403.         btnRegister.setOnClickListener(new View.OnClickListener() {
  404.             @Override
  405.             public void onClick(View v) {
  406.                 Intent myIntent = new Intent(context,RegisterActivity.class);
  407.                 startActivity(myIntent);
  408.             }
  409.         });
  410.     }
  411.  
  412.     //create alert dialog builder using instance of AlertDialog
  413.     private void userNotFound()
  414.     {
  415.         //create two strings to hold Alert Dialog Title and Message
  416.         String adMsg,adTitle,adPos;
  417.         //getting user not found in our UtlShared
  418.         UtlShared mySP = new UtlShared(context);
  419.         //check if user exists or we have wrong password
  420.         if (mySP.checkUser(txtUser.getText().toString()))
  421.         {
  422.             //user exists....
  423.             adTitle = getResources().getString(R.string.adMsgTtlPassword);
  424.             adMsg = getResources().getString(R.string.adMsgErrorPassword);
  425.             adPos = getResources().getString(R.string.adBtnOK);
  426.         }
  427.         else
  428.         {
  429.             //user not exists...
  430.             adTitle = getResources().getString(R.string.adTtlUserNotFound);
  431.             adMsg = getResources().getString(R.string.adMsgZeStamMebalbel);
  432.             adPos = getResources().getString(R.string.adBtnRegister);
  433.             needReg=true;
  434.         }
  435.  
  436.  
  437.         //create builder
  438.         AlertDialog.Builder adUser = new AlertDialog.Builder(context);
  439.         //create title
  440.         adUser.setTitle(adTitle);
  441.         //create message
  442.         adUser.setMessage(adMsg);
  443.         //create positive button
  444.         adUser.setPositiveButton(adPos
  445.                 , new DialogInterface.OnClickListener() {
  446.                     @Override
  447.                     public void onClick(DialogInterface dialog, int which) {
  448.                         if (needReg)
  449.                         {
  450.                             // go to registration activity
  451.                             Intent myIntent = new Intent(context,RegisterActivity.class);
  452.                             startActivity(myIntent);
  453.  
  454.                         }
  455.                         else
  456.                         {
  457.                             dialog.dismiss();
  458.                         }
  459.  
  460.                     }
  461.                 });
  462.         //show the negative button only if user not exists
  463.         if (needReg) {
  464.             adUser.setNegativeButton(getResources().getString(R.string.adBtnCancel), new DialogInterface.OnClickListener() {
  465.                 @Override
  466.                 public void onClick(DialogInterface dialog, int which) {
  467.                     dialog.dismiss();
  468.                 }
  469.             });
  470.         }
  471.         //show alert dialog.
  472.         adUser.show();
  473.     }
  474.  
  475.     /*
  476.     // user not found, using alert dialog in anonymous method
  477.     private void userNotFound()
  478.     {
  479.         //user is incorrect -false
  480.         txtPass.setText("");
  481.         //Toast.makeText(context, "You are not allowed!!", Toast.LENGTH_LONG).show();
  482.  
  483.         //create alert dialog
  484.         new AlertDialog.Builder(context)
  485.             //create title for our alert dialog
  486.             .setTitle(getResources().getString(R.string.adTtlUserError))
  487.                 //create message for our alert dialog
  488.             .setMessage(getResources().getString(R.string.adMsgError))
  489.                 //create our OK button
  490.             .setPositiveButton(getResources().getString(R.string.adBtnOK), new DialogInterface.OnClickListener() {
  491.                 @Override
  492.                 public void onClick(DialogInterface dialog, int which) {
  493.                     dialog.dismiss();
  494.                 }
  495.             })
  496.                 //show Dialog
  497.             .show();
  498.  
  499.  
  500.         Log.e(TAG, "onClick: Incorrect User" );
  501.     }
  502.     */
  503. }
  504. ------------------------------------
  505. //alert_dialog_new_task
  506. -----------------------------------
  507. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  508.     android:orientation="vertical" android:layout_width="match_parent"
  509.     android:layout_height="wrap_content"
  510.     android:layout_margin="@dimen/activity_vertical_margin">
  511.  
  512.     <TextView
  513.         android:layout_width="match_parent"
  514.         android:layout_height="wrap_content"
  515.         android:text="@string/adTtlNewTask"
  516.         android:textSize="26sp"
  517.         android:gravity="center"
  518.         android:id="@+id/textView" />
  519.  
  520.     <EditText
  521.         android:layout_width="match_parent"
  522.         android:layout_height="wrap_content"
  523.         android:hint="@string/adTaskHint"
  524.         android:layout_marginTop="20dp"
  525.         android:id="@+id/txtNewTask"
  526.         />
  527.  
  528. </LinearLayout>
  529. ---------------------------
  530. //activity_task
  531. -----------------------------
  532. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  533.     android:layout_width="match_parent"
  534.     android:layout_height="match_parent"
  535.     android:orientation="vertical">
  536.  
  537.     <TextView
  538.         android:layout_width="match_parent"
  539.         android:layout_height="wrap_content"
  540.         android:textSize="32sp"
  541.         android:text="place holder"
  542.         android:gravity="center"
  543.         android:layout_marginTop="15dp"
  544.         android:id="@+id/txtHello"/>
  545.  
  546.     <Button
  547.         android:layout_width="match_parent"
  548.         android:layout_height="wrap_content"
  549.         android:background="@color/btnBackground"
  550.         android:textColor="@color/btnText"
  551.         android:text="@string/btnAddTask"
  552.         android:textSize="@dimen/regBtn"
  553.         android:layout_margin="@dimen/regBtnMargin"
  554.         android:id="@+id/btnAddTask"/>
  555.  
  556.     <Button
  557.         android:layout_width="match_parent"
  558.         android:layout_height="wrap_content"
  559.         android:text="show all task"
  560.         android:id="@+id/btnTest"/>
  561. </LinearLayout>
  562. ----------------------
  563. //activity_register
  564. -------------------------
  565. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  566.     android:layout_width="match_parent"
  567.     android:layout_height="match_parent"
  568.     android:orientation="vertical">
  569.  
  570.     <LinearLayout
  571.         android:layout_width="match_parent"
  572.         android:layout_height="match_parent"
  573.         android:orientation="vertical"
  574.         android:layout_weight="1">
  575.         <TextView
  576.             android:layout_width="match_parent"
  577.             android:layout_height="match_parent"
  578.             android:gravity="center"
  579.             android:text="@string/ttlRegister"
  580.             android:textSize="@dimen/ttl"/>
  581.     </LinearLayout>
  582.  
  583.     <LinearLayout
  584.         android:layout_width="match_parent"
  585.         android:layout_height="match_parent"
  586.         android:orientation="vertical"
  587.         android:layout_weight="1">
  588.         <EditText
  589.             android:layout_width="match_parent"
  590.             android:layout_height="match_parent"
  591.             android:layout_weight="1"
  592.             android:hint="@string/regUserName"
  593.             android:textSize="@dimen/regEditText"
  594.             android:inputType="text"
  595.             android:id="@+id/regUser"/>
  596.         <EditText
  597.             android:layout_width="match_parent"
  598.             android:layout_height="match_parent"
  599.             android:layout_weight="1"
  600.             android:hint="@string/regNick"
  601.             android:textSize="@dimen/regEditText"
  602.             android:inputType="text"
  603.             android:id="@+id/regNick"/>
  604.  
  605.         <EditText
  606.             android:layout_width="match_parent"
  607.             android:layout_height="match_parent"
  608.             android:layout_weight="1"
  609.             android:hint="@string/regUserPass"
  610.             android:textSize="@dimen/regEditText"
  611.             android:inputType="textPassword"
  612.             android:id="@+id/regPass"
  613.             />
  614.         <EditText
  615.             android:layout_width="match_parent"
  616.             android:layout_height="match_parent"
  617.             android:layout_weight="1"
  618.             android:hint="@string/regUserCheck"
  619.             android:textSize="@dimen/regEditText"
  620.             android:inputType="textPassword"
  621.             android:id="@+id/regCheck"/>
  622.  
  623.     </LinearLayout>
  624.  
  625.     <LinearLayout
  626.         android:layout_width="match_parent"
  627.         android:layout_height="match_parent"
  628.         android:orientation="horizontal"
  629.         android:layout_weight="1"
  630.         android:gravity="center">
  631.         <Button
  632.             android:layout_width="match_parent"
  633.             android:layout_height="wrap_content"
  634.             android:layout_weight="1"
  635.             android:background="@color/btnBackground"
  636.             android:textColor="@color/btnText"
  637.             android:text="@string/regBtnRegister"
  638.             android:layout_margin="@dimen/regBtnMargin"
  639.             android:textSize="@dimen/regBtn"
  640.             android:id="@+id/regBtnRegister"/>
  641.         <Button
  642.             android:layout_width="match_parent"
  643.             android:layout_height="wrap_content"
  644.             android:layout_weight="1"
  645.             android:background="@color/btnBackground"
  646.             android:textColor="@color/btnText"
  647.             android:text="@string/regBtnCancel"
  648.             android:layout_margin="@dimen/regBtnMargin"
  649.             android:textSize="@dimen/regBtn"
  650.             android:id="@+id/regBtnCancel"/>
  651.     </LinearLayout>
  652.  
  653. </LinearLayout>
  654. ------------------------------
  655. //activity_login
  656. --------------------------------
  657. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  658.     android:layout_width="match_parent"
  659.     android:layout_height="match_parent"
  660.     android:orientation="vertical">
  661.  
  662.     <!-- my logo layout -->
  663.     <LinearLayout
  664.         android:layout_width="match_parent"
  665.         android:layout_height="match_parent"
  666.         android:orientation="vertical"
  667.         android:layout_weight="1"
  668.         >
  669.         <TextView
  670.             android:layout_width="match_parent"
  671.             android:layout_height="match_parent"
  672.             android:text="@string/myLogo"
  673.             android:textSize="@dimen/ttl"
  674.             android:gravity="center"
  675.             android:id="@+id/txtLogo"
  676.             />
  677.     </LinearLayout>
  678.  
  679.     <!-- my Edit text box -->
  680.     <LinearLayout
  681.         android:layout_width="match_parent"
  682.         android:layout_height="match_parent"
  683.         android:orientation="vertical"
  684.         android:layout_weight="1">
  685.         <EditText
  686.             android:layout_width="match_parent"
  687.             android:layout_height="match_parent"
  688.             android:hint="@string/hintUserName"
  689.             android:textSize="@dimen/regEditText"
  690.             android:layout_weight="1"
  691.             android:id="@+id/txtUser"/>
  692.         <LinearLayout
  693.             android:layout_width="match_parent"
  694.             android:layout_height="5px"
  695.             android:orientation="vertical"
  696.             android:background="#000"
  697.             android:visibility="gone"/>
  698.         <EditText
  699.             android:layout_width="match_parent"
  700.             android:layout_height="match_parent"
  701.             android:hint="@string/hintPassword"
  702.             android:textSize="@dimen/regEditText"
  703.             android:inputType="numberPassword"
  704.             android:layout_weight="1"
  705.             android:id="@+id/txtPass"
  706.             />
  707.  
  708.     </LinearLayout>
  709.  
  710.     <!-- my Login Button -->
  711.     <LinearLayout
  712.         android:layout_width="match_parent"
  713.         android:layout_height="match_parent"
  714.         android:orientation="horizontal"
  715.         android:layout_weight="1">
  716.         <Button
  717.             android:layout_width="match_parent"
  718.             android:layout_height="wrap_content"
  719.             android:background="#009fff"
  720.             android:textColor="#ffffff"
  721.             android:text="@string/btnLogin"
  722.             android:textSize="@dimen/regBtn"
  723.             android:id="@+id/btnLogin"
  724.             android:layout_weight="1"
  725.             android:layout_margin="@dimen/regBtnMargin"/>
  726.         <Button
  727.             android:layout_width="match_parent"
  728.             android:layout_height="wrap_content"
  729.             android:background="@color/btnBackground"
  730.             android:textColor="@color/btnText"
  731.             android:text="@string/regBtnRegister"
  732.             android:layout_weight="1"
  733.             android:textSize="@dimen/regBtn"
  734.             android:layout_margin="@dimen/regBtnMargin"
  735.             android:id="@+id/btnRegister"/>
  736.     </LinearLayout>
  737. </LinearLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement