Advertisement
Guest User

הקוד של כל האפלקציה

a guest
Sep 6th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 30.38 KB | None | 0 0
  1. MainActivity.java
  2. ========================================================================
  3.  
  4. package com.example.adm.myapplication;
  5.  
  6. import android.app.Activity;
  7. import android.app.Fragment;
  8. import android.content.DialogInterface;
  9. import android.content.Intent;
  10. import android.content.SharedPreferences;
  11. import android.net.Uri;
  12. import android.support.v7.app.AlertDialog;
  13. import android.support.v7.app.AppCompatActivity;
  14. import android.os.Bundle;
  15. import android.view.LayoutInflater;
  16. import android.view.View;
  17. import android.widget.Button;
  18. import android.widget.EditText;
  19. import android.widget.TextView;
  20. import android.widget.Toast;
  21. import android.content.Context;
  22.  
  23. import com.google.android.gms.appindexing.Action;
  24. import com.google.android.gms.appindexing.AppIndex;
  25. import com.google.android.gms.common.api.GoogleApiClient;
  26.  
  27. import java.util.Objects;
  28.  
  29. public class MainActivity extends AppCompatActivity {
  30.  
  31.  
  32.     EditText txtUserName;
  33.     EditText txtUserPassword;
  34.     TextView lblMsg;
  35.     Context context;
  36.     private int totalTry = 5;
  37.     Button btnLogin;
  38.     Button btnRegister;
  39.     EditText txtUser,txtPass,txtPass2;
  40.  
  41.  
  42.     @Override
  43.     protected void onCreate(Bundle savedInstanceState) {
  44.         super.onCreate(savedInstanceState);
  45.         setContentView(R.layout.activity_main);
  46.         setPointer();
  47.         this.context = this;
  48.  
  49.  
  50.     }
  51.  
  52.     private void setPointer() {
  53.         this.context = this;
  54.  
  55.  
  56.         lblMsg = (TextView) findViewById(R.id.lblMsg);
  57.         btnLogin = (Button) findViewById(R.id.btnLogin);
  58.         btnRegister = (Button) findViewById(R.id.btnRegister);
  59.         txtUser = (EditText) findViewById(R.id.txtUserName);
  60.         txtPass = (EditText) findViewById(R.id.txtPassword);
  61.         txtPass2 = (EditText) findViewById(R.id.txtPassword2);
  62.         txtUserName = (EditText) findViewById(R.id.txtUserName);
  63.         txtUserPassword = (EditText) findViewById(R.id.txtUserPassword);
  64.  
  65.  
  66.  
  67.  
  68.  
  69.         //listerners
  70.     btnLogin.setOnClickListener(new View.OnClickListener() {
  71.         @Override
  72.         public void onClick(View view) {
  73.             login();
  74.         }
  75.     });
  76.  
  77.     btnRegister.setOnClickListener(new View.OnClickListener() {
  78.         @Override
  79.         public void onClick(View view) {
  80.             register();
  81.         }
  82.     });
  83. }
  84.  
  85.  
  86.  
  87.     private void login() {
  88.         String getUser=txtUserName.getText().toString();
  89.         String getPass=txtUserPassword.getText().toString();
  90.  
  91.         if (totalTry == 0) {
  92.             Toast.makeText(MainActivity.this, R.string.blocked, Toast.LENGTH_SHORT).show();
  93.             return;
  94.         }
  95.         utlShared shared = new utlShared(this);
  96.         if (shared.checkUserPassword(getUser, getPass)) {
  97.             lblMsg.setText(R.string.userLoged);
  98.             Intent intent = new Intent(this, Welcom.class);
  99.             intent.putExtra("userName", getUser);
  100.  
  101.             startActivity(intent);
  102.             finish();
  103.  
  104.  
  105.         } else {
  106.  
  107.             if (shared.checkUser(getUser)) {
  108.                 Toast.makeText(MainActivity.this, R.string.wrongpass, Toast.LENGTH_LONG).show();
  109.             } else {
  110.                 showLoginErrorDialog();
  111.             }
  112.         }
  113.     }
  114.  
  115.  
  116.     public void register() {
  117.         //create builder
  118.         android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
  119.         //set title
  120.         builder.setTitle(R.string.register);
  121.  
  122.         //inflate view from layout ->custom layout,null,false as defualt values
  123.         View viewInflated = LayoutInflater.from(context).inflate(R.layout.dlg_new_task, null, true);
  124.  
  125.         final EditText txtUser = (EditText)viewInflated.findViewById(R.id.txtUserName);
  126.         final EditText txtPass = (EditText)viewInflated.findViewById(R.id.txtPassword);
  127.         final EditText txtPass2 = (EditText)viewInflated.findViewById(R.id.txtPassword2);
  128.  
  129.         builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
  130.             @Override
  131.             public void onClick(DialogInterface dialogInterface, int i) {
  132.                 dialogInterface.dismiss();
  133.             }
  134.         });
  135.  
  136.  
  137.  
  138.         final utlShared myShared = new utlShared(context);
  139.         builder.setPositiveButton(R.string.register, new DialogInterface.OnClickListener() {
  140.  
  141.             @Override
  142.             public void onClick(DialogInterface dialogInterface, int i) {
  143.                 dialogInterface.dismiss();
  144.  
  145.                 String pass1=txtPass.getText().toString();
  146.                 String pass2=txtPass2.getText().toString();
  147.  
  148.                 if (!pass1.equals(pass2)) {
  149.                     Toast.makeText(context, R.string.errorSamepass, Toast.LENGTH_LONG).show();
  150.                     register();
  151.                     return;
  152.                 }
  153.  
  154.                 utlShared myShared = new utlShared(context);
  155.                 String userName=txtUser.getText().toString();
  156.  
  157.                 //check if user exists
  158.                 if (myShared.checkUser(userName)) {
  159.                     Toast.makeText(context, R.string.userExixst, Toast.LENGTH_SHORT).show();
  160.                     register();
  161.                     return;
  162.                 }
  163.                 //running the method of add user
  164.                 myShared.addUser(userName,pass1);
  165.  
  166.  
  167.  
  168.             }
  169.         });
  170.  
  171.         //display our inflated view in screen
  172.         builder.setView(viewInflated);
  173.         //show the dialog
  174.         builder.show();
  175.  
  176.     }
  177.  
  178.  
  179.  
  180.     private void showLoginErrorDialog() {
  181.         final String getUser = txtUser.getText().toString();
  182.         final utlShared shared = new utlShared(context);
  183.  
  184.         if (! shared.checkUser(getUser)) {
  185.             new AlertDialog.Builder(context).setTitle(R.string.user_not_found)
  186.                     .setMessage(R.string.wantToRegist)
  187.                     .setPositiveButton(R.string.register, new DialogInterface.OnClickListener() {
  188.                         @Override
  189.                         public void onClick(DialogInterface dialogInterface, int i) {
  190.  
  191.  
  192.                             dialogInterface.dismiss();
  193.                             register();
  194.  
  195.                         }
  196.  
  197.                     })
  198.  
  199.                     .setNegativeButton(R.string.tryAgain, new DialogInterface.OnClickListener() {
  200.                         @Override
  201.                         public void onClick(DialogInterface dialogInterface, int i) {
  202.                             Toast.makeText(context, R.string.tryAgain, Toast.LENGTH_SHORT).show();
  203.                             dialogInterface.dismiss();
  204.                         }
  205.                     })
  206.  
  207.                     .show();
  208.         }
  209.         }
  210.  
  211.  
  212. }
  213.  
  214.  
  215. ======================================================================
  216. TaskAdabter.java
  217. ======================================================================
  218.  
  219. package com.example.adm.myapplication;
  220.  
  221. import android.content.Context;
  222. import android.content.SharedPreferences;
  223. import android.view.LayoutInflater;
  224. import android.view.View;
  225. import android.view.ViewGroup;
  226. import android.widget.BaseAdapter;
  227. import android.widget.Switch;
  228. import android.widget.TextView;
  229. import android.widget.Toast;
  230.  
  231. import java.util.ArrayList;
  232. import java.util.List;
  233. import java.util.Map;
  234.  
  235. /**
  236.  * Created by ADM on 9/3/2016.
  237.  */
  238. public class TaskAdapter extends BaseAdapter {
  239.  
  240.     //transfer context
  241.     Context context;
  242.     //transfer user to use for shared preferences
  243.     String userName;
  244.     //create a list of tasks.....
  245.     List<taskItem> myTasks;
  246.  
  247.     //constructor, for creating the adapter we need from the user context and userName
  248.     public TaskAdapter(Context context,String userName) {
  249.         this.context = context;
  250.         this.userName=userName;
  251.         //go to user shared preferences and fill the list
  252.         getData();
  253.     }
  254.  
  255.     //how many item to display
  256.     @Override
  257.     public int getCount() {
  258.         //return the myTasks size....
  259.         return myTasks.size();
  260.     }
  261.  
  262.     //return a specific item by index
  263.     @Override
  264.     public Object getItem(int i) {
  265.         return myTasks.get(i);
  266.     }
  267.  
  268.     //return index number
  269.     @Override
  270.     public long getItemId(int i) {
  271.         return 0;
  272.     }
  273.  
  274.     //create our view
  275.     @Override
  276.     public View getView(int index, View view, ViewGroup viewGroup) {
  277.         //inflate the view inside view object -> viewInflated
  278.         View viewInflated = LayoutInflater.from(context).inflate(R.layout.task_item,null,false);
  279.  
  280.         //set our inflated view behiver
  281.  
  282.         //set pointer for our inflated view
  283.  
  284.         //set pointer for task name....
  285.         final TextView txtTaskName=(TextView)viewInflated.findViewById(R.id.taskName);
  286.         //set pointer for task status....
  287.         final Switch swTask=(Switch)viewInflated.findViewById(R.id.taskDone);
  288.  
  289.         //set task name, by the index of my myTasks collection
  290.         txtTaskName.setText(myTasks.get(index).taskName);
  291.         //set task status , switch is getting true/false
  292.         swTask.setChecked(myTasks.get(index).taskStatus);
  293.  
  294.  
  295.         //create listener event, when switch is pressed
  296.         swTask.setOnClickListener(new View.OnClickListener() {
  297.             @Override
  298.             public void onClick(View view) {
  299.                 //we using utlShared to update task status
  300.                 //create instance of utlShared
  301.                 utlShared myShared = new utlShared(context);
  302.                 //calling method of task, and giving userName(shared preferences, taskName, taskStatus)
  303.                 myShared.task(userName,txtTaskName.getText().toString(),swTask.isChecked());
  304.                 //we sending a message to the user, and inform him/her about the change
  305.                 Toast.makeText(context, swTask.isChecked()?"task done" :"Task undone...", Toast.LENGTH_SHORT).show();
  306.             }
  307.         });
  308.  
  309.         //return the view with the behiver.....
  310.         return viewInflated;
  311.     }
  312.  
  313.     private void getData()
  314.     {
  315.         //go to specific shared preferences by user name.....
  316.         SharedPreferences taskPref=context.getSharedPreferences(userName,context.MODE_PRIVATE);
  317.  
  318.         //create instance of our myTasks list
  319.         myTasks = new ArrayList<>();
  320.         //get all tasks from shared preferances
  321.         //the shared preferences is by key and value, therefor we will use Map collection
  322.         //we know that the key is String, but we don't know what type of value we will get. <K,?>
  323.         Map<String,?> tasks=taskPref.getAll();
  324.         // transfer the data from map collection to list collection , single item is like the defination of the tasks <String,?>
  325.         //Entry -> record , enterSet -> set of records
  326.         for(Map.Entry<String,?> singleTask:tasks.entrySet())
  327.         {
  328.             //insert task to list by Key and Value, we check if value is equal to 1, becuase 1=true 0=false
  329.             myTasks.add(new taskItem(singleTask.getKey(),singleTask.getValue().equals("1")));
  330.         }
  331.     }
  332.  
  333.  
  334.  
  335. =======================================================================
  336. taskItem.java
  337. ==================================================================
  338.  
  339. package com.example.adm.myapplication;
  340.  
  341. /**
  342.  * Created by ADM on 9/3/2016.
  343.  */
  344. public class taskItem {
  345.     public String taskName;
  346.     public boolean taskStatus;
  347.  
  348.     public taskItem(String taskName, boolean taskStatus) {
  349.         this.taskName = taskName;
  350.         this.taskStatus = taskStatus;
  351.     }
  352. }
  353.  
  354.  
  355.  
  356. ===============================================================================
  357. utlShared.java
  358. ====================================================================================
  359.  
  360. package com.example.adm.myapplication;
  361.  
  362. import android.content.Context;
  363. import android.content.SharedPreferences;
  364. import android.renderscript.Sampler;
  365. import android.text.Editable;
  366. import android.util.Log;
  367.  
  368. import java.util.jar.Attributes;
  369.  
  370. /**
  371.  * Created by ADM on 8/26/2016.
  372.  */
  373. public class utlShared {
  374.     //context to use later
  375.     Context context;
  376.     //declatrtion of shared preferences object
  377.     private SharedPreferences userPref;
  378.     //declaration of shared preferences editor
  379.     private SharedPreferences.Editor editor;
  380.  
  381.     public utlShared() {}
  382.  
  383.     public utlShared(Context context)
  384.     {
  385.         //get context to use it
  386.         this.context=context;
  387.         //declaretion of shared preferences with file name and file mode (private,public)
  388.         userPref=context.getSharedPreferences("users",Context.MODE_PRIVATE);
  389.         //declaration of editor
  390.         editor=userPref.edit();
  391.     }
  392.  
  393.     //get user and password
  394.     public void addUser(String userName, String password)
  395.     {
  396.         //stores in the phone device under data\data\package name
  397.         //put in shared preferences user name and password
  398.         editor.putString(userName,password);
  399.         //commit (save/apply) the changes.
  400.         editor.commit();
  401.     }
  402.  
  403.     public boolean checkUser(String userName)
  404.     {
  405.         //get name by key->userName
  406.         String checkString = userPref.getString(userName,"na");
  407.  
  408.         //print to logcat a custom message.....
  409.         Log.e("checkUser", "checkUser: "+checkString );
  410.         //check if userName equals to responded data, if it's na, we don't havce the user...
  411.         return !checkString.equals("na");
  412.     }
  413.  
  414.     public boolean checkUserPassword(String userName, String userPassword)
  415.     {
  416.         String checkString = userPref.getString(userName,"na");
  417.         return checkString.equals(userPassword);
  418.     }
  419.  
  420.     public void task(String userName,String taskName,boolean taskDone)
  421.     {
  422.         //pointer to user task shared preferances
  423.         SharedPreferences taskPref=context.getSharedPreferences(userName,Context.MODE_PRIVATE);
  424.         //create editor to change the specific shared preferences
  425.         SharedPreferences.Editor taskEditor=taskPref.edit();
  426.  
  427.         //add new task -> if true write 1 else write 0
  428.         taskEditor.putString(taskName,taskDone?"1":"0");
  429.         //apply the changes
  430.         taskEditor.commit();
  431.     }
  432.  
  433.     public void res(String userName) {
  434.         SharedPreferences taskPref = context.getSharedPreferences(userName, context.MODE_PRIVATE);
  435.         SharedPreferences.Editor taskEditor = taskPref.edit();
  436.         taskEditor.clear();
  437.         taskEditor.commit();
  438.  
  439.  
  440.     }
  441. }
  442.  
  443. ========================================================================================================
  444. Welcom.java
  445. ===================================================================================================================================
  446.  
  447. package com.example.adm.myapplication;
  448.  
  449.  
  450. import android.app.AlertDialog;
  451. import android.content.Context;
  452.  
  453. import android.content.DialogInterface;
  454. import android.content.Intent;
  455. import android.media.Image;
  456. import android.support.v7.app.AppCompatActivity;
  457. import android.os.Bundle;
  458. import android.text.InputType;
  459. import android.view.LayoutInflater;
  460. import android.view.Menu;
  461. import android.view.MenuInflater;
  462. import android.view.MenuItem;
  463. import android.view.View;
  464. import android.view.Window;
  465. import android.widget.EditText;
  466. import android.widget.ImageView;
  467. import android.widget.ListView;
  468. import android.widget.TextView;
  469. import android.widget.Toast;
  470.  
  471. public class Welcom extends AppCompatActivity {
  472.  
  473.  
  474.     String userName;
  475.     Context context;
  476.     utlShared myUtl;
  477.     ListView taskList;
  478.     @Override
  479.     protected void onCreate(Bundle savedInstanceState) {
  480.         super.onCreate(savedInstanceState);
  481.         setContentView(R.layout.activity_welcom);
  482.         setPointer();
  483.  
  484.     }
  485.  
  486.     private void setPointer()
  487.     {
  488.         this.context=this;
  489.         userName=getIntent().getStringExtra("userName");
  490.         myUtl = new utlShared(context);
  491.         taskList=(ListView)findViewById(R.id.taskList);
  492.         setListData();
  493.         Toast.makeText(Welcom.this, "Welcome " +userName, Toast.LENGTH_SHORT).show();
  494.     }
  495.  
  496.     private void setListData()
  497.     {
  498.         TaskAdapter adapter = new TaskAdapter(context,userName);
  499.         taskList.setAdapter(adapter);
  500.     }
  501.  
  502.  
  503.  
  504.  
  505.     public void addCustomTask(View view)
  506.     {
  507.         //create builder
  508.         AlertDialog.Builder builder = new AlertDialog.Builder(context);
  509.         //set title
  510.         builder.setTitle(R.string.addnewtask);
  511.  
  512.         //inflate view from layout ->custom layout,null,false as defualt values
  513.         View viewInflated= LayoutInflater.from(context).inflate(R.layout.weed,null,false);
  514.  
  515.         final EditText txtCustomTask = (EditText)viewInflated.findViewById(R.id.txtTask);
  516.  
  517.         builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
  518.             @Override
  519.             public void onClick(DialogInterface dialogInterface, int i) {
  520.                 dialogInterface.dismiss();
  521.             }
  522.         });
  523.  
  524.         builder.setPositiveButton(R.string.addtask, new DialogInterface.OnClickListener() {
  525.             @Override
  526.             public void onClick(DialogInterface dialogInterface, int i) {
  527.                 dialogInterface.dismiss();
  528.                 String myTask = txtCustomTask.getText().toString();
  529.                 //Toast.makeText(context, "task is:"+myText, Toast.LENGTH_SHORT).show();
  530.                 myUtl.task(userName,myTask,false);
  531.                 /////
  532.                 setListData();
  533.             }
  534.         });
  535.  
  536.         //display our inflated view in screen
  537.         builder.setView(viewInflated);
  538.         //show the dialog
  539.         builder.show();
  540.  
  541.     }
  542.  
  543.     public boolean onCreateOptionsMenu(Menu menu) {
  544.         //create MenuInflater object
  545.         MenuInflater inflater=getMenuInflater();
  546.         //inflate the menu
  547.         inflater.inflate(R.menu.menu,menu);
  548.         return super.onCreateOptionsMenu(menu);
  549.  
  550.     }
  551.  
  552.     @Override
  553.     public boolean onOptionsItemSelected(MenuItem item) {
  554.         switch (item.getItemId())
  555.         {
  556.             case R.id.itemLogOut:
  557.  
  558.                 Intent intent = new Intent(this,MainActivity .class);
  559.                 startActivity(intent);
  560.                 finish();
  561.                 break;
  562.             case R.id.itemReset:
  563.                 new AlertDialog.Builder(context).setTitle(R.string.reset)
  564.                         .setMessage(R.string.suretorest)
  565.                         .setPositiveButton(R.string.reset, new DialogInterface.OnClickListener() {
  566.                             @Override
  567.                             public void onClick(DialogInterface dialogInterface, int i) {
  568.  
  569.                                 taskList.setAdapter(null);
  570.                                 myUtl.res(userName);
  571.                                 dialogInterface.dismiss();
  572.  
  573.  
  574.                             }
  575.  
  576.                         })
  577.  
  578.                         .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
  579.                             @Override
  580.                             public void onClick(DialogInterface dialogInterface, int i) {
  581.                                 Toast.makeText(context, R.string.cancel, Toast.LENGTH_SHORT).show();
  582.                                 dialogInterface.dismiss();
  583.                             }
  584.                         })
  585.  
  586.                         .show();
  587.                 break;
  588.  
  589.  
  590.  
  591.  
  592.  
  593.                 case R.id.itemAbout:
  594.                 android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
  595.                 //set title
  596.                 builder.setTitle(R.string.about);
  597.  
  598.                 //inflate view from layout ->custom layout,null,false as defualt values
  599.                 View viewInflated = LayoutInflater.from(context).inflate(R.layout.about_msg, null, true);
  600.                 TextView txtView = new TextView(context);
  601.  
  602.  
  603.                 //positive button to dissmiss the dialog by pressing OK
  604.                 builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
  605.                     @Override
  606.                     public void onClick(DialogInterface dialogInterface, int i) {
  607.                         dialogInterface.dismiss();
  608.                     }
  609.                 });
  610.                 //show the builder...
  611.                 builder.setView(viewInflated);
  612.                 builder.show();
  613.         }
  614.         return super.onOptionsItemSelected(item);
  615.     }
  616.  
  617. }
  618.  
  619. =================================================================================================
  620. about_msg.xml
  621. ===================================================================================================================
  622.  
  623. <?xml version="1.0" encoding="utf-8"?>
  624. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  625.     android:orientation="vertical"
  626.     android:layout_width="wrap_content"
  627.     android:layout_height="wrap_content">
  628.  
  629.  
  630.  
  631.     <ImageView
  632.         android:id="@+id/goProDialogImage"
  633.         android:layout_width="wrap_content"
  634.         android:layout_height="300dp"
  635.         android:src="@drawable/sexypolice"/>
  636.  
  637.     <TextView
  638.         android:layout_width="match_parent"
  639.         android:layout_height="wrap_content"
  640.         android:text="@string/adamBuild"
  641.         android:textSize="30sp"
  642.         android:gravity="center"/>
  643.  
  644.     <TextView
  645.         android:layout_width="match_parent"
  646.         android:layout_height="wrap_content"
  647.         android:text="@string/date"
  648.         android:textSize="30sp"
  649.         android:gravity="center"/>
  650.  
  651.     <TextView
  652.         android:layout_width="match_parent"
  653.         android:layout_height="wrap_content"
  654.         android:text="@string/zeev"
  655.         android:textSize="30sp"
  656.         android:gravity="center"/>
  657. </LinearLayout>
  658.  
  659.  
  660.  
  661. ==========================================================================================================
  662. activity_main.xml
  663. =====================================================================
  664.  
  665. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  666.     android:layout_width="match_parent"
  667.     android:layout_height="match_parent"
  668.     android:orientation="vertical">
  669.  
  670.     <LinearLayout
  671.         android:layout_width="match_parent"
  672.         android:layout_height="150dp"
  673.         android:orientation="vertical">
  674.  
  675.         <TextView
  676.             android:layout_width="match_parent"
  677.             android:layout_height="match_parent"
  678.             android:gravity="center"
  679.             android:text="@string/myLogo"
  680.             android:textSize="50sp">
  681.  
  682.         </TextView>
  683.     </LinearLayout>
  684.  
  685.     <LinearLayout
  686.         android:layout_width="match_parent"
  687.         android:layout_height="100dp"
  688.         android:orientation="vertical">
  689.  
  690.         <EditText
  691.             android:id="@+id/txtUserName"
  692.             android:layout_width="match_parent"
  693.             android:layout_height="wrap_content"
  694.             android:hint="@string/user_name"
  695.             android:gravity="center"
  696.             android:inputType="text"
  697.             android:textSize="22sp" />
  698.  
  699.         <EditText
  700.             android:id="@+id/txtUserPassword"
  701.             android:layout_width="match_parent"
  702.             android:layout_height="wrap_content"
  703.             android:hint="@string/password1"
  704.             android:gravity="center"
  705.             android:inputType="textPassword"
  706.             android:textSize="22sp" />
  707.     </LinearLayout>
  708.  
  709.     <LinearLayout
  710.         android:layout_width="match_parent"
  711.         android:layout_height="150dp"
  712.         android:orientation="vertical">
  713.  
  714.         <Button
  715.             android:layout_width="match_parent"
  716.             android:layout_height="wrap_content"
  717.             android:text="@string/login"
  718.             android:background="#00BFFF"
  719.             android:textColor="#ffffff"
  720.             android:textSize="32sp"
  721.             android:id="@+id/btnLogin"
  722.             android:layout_marginBottom="20dp"/>
  723.  
  724.         <Button
  725.             android:layout_width="match_parent"
  726.             android:layout_height="wrap_content"
  727.             android:text="@string/register"
  728.             android:background="#00BFFF"
  729.             android:textColor="#ffffff"
  730.             android:textSize="32sp"
  731.             android:id="@+id/btnRegister"/>
  732.     </LinearLayout>
  733.  
  734.     <LinearLayout
  735.         android:layout_width="match_parent"
  736.         android:layout_height="match_parent"
  737.         android:orientation="vertical">
  738.         <TextView
  739.             android:layout_width="match_parent"
  740.             android:layout_height="match_parent"
  741.             android:textSize="32sp"
  742.             android:text="@string/my_login_system"
  743.             android:gravity="center"
  744.             android:id="@+id/lblMsg"/>
  745.     </LinearLayout>
  746. </LinearLayout>
  747.  
  748.  
  749. ===================================================================
  750. activity_welcom.xml
  751. ================================================================================
  752.  
  753. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  754.     android:layout_width="match_parent"
  755.     android:layout_height="match_parent"
  756.     android:orientation="vertical"
  757.     >
  758.  
  759.  
  760.     <Button android:layout_width="match_parent"
  761.         android:layout_height="wrap_content"
  762.         android:text="@string/addtask"
  763.         android:onClick="addCustomTask"
  764.  
  765.         />
  766.  
  767.     <ListView
  768.         android:layout_width="match_parent"
  769.         android:layout_height="match_parent"
  770.         android:id="@+id/taskList"
  771.         />
  772. </LinearLayout>
  773.  
  774.  
  775.  
  776.  
  777. ==================================================================================
  778. dlg_new_task.xml
  779. =======================================================================================
  780.  
  781. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  782.     android:layout_width="match_parent"
  783.     android:layout_height="wrap_content"
  784.     android:orientation="vertical"
  785.     android:gravity="center">
  786.  
  787.     <ImageView
  788.         android:layout_width="100dp"
  789.         android:layout_height="100dp"
  790.         android:src="@drawable/task"/>
  791.  
  792.     <EditText
  793.     android:layout_width="200dp"
  794.     android:layout_height="wrap_content"
  795.     android:hint="@string/user_name"
  796.     android:id="@+id/txtUserName"/>
  797.  
  798.     <EditText
  799.     android:layout_width="200dp"
  800.     android:layout_height="wrap_content"
  801.     android:hint="@string/password1"
  802.     android:id="@+id/txtPassword"/>
  803.  
  804.     <EditText
  805.         android:layout_width="200dp"
  806.         android:layout_height="wrap_content"
  807.         android:hint="@string/password2"
  808.         android:id="@+id/txtPassword2"/>
  809. </LinearLayout>
  810.  
  811.  
  812. ===============================================================================================
  813. task_item.xml
  814. ==========================================================================================================================
  815.  
  816. <?xml version="1.0" encoding="utf-8"?>
  817. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  818.     android:layout_width="match_parent"
  819.     android:layout_height="50dp"
  820.     android:orientation="horizontal"
  821.     android:layoutDirection="rtl"
  822.     android:layout_margin="20dp"
  823.     >
  824.  
  825.     <Switch
  826.         android:layout_width="40dp"
  827.         android:layout_height="wrap_content"
  828.         android:id="@+id/taskDone"
  829.         />
  830.     <TextView
  831.         android:layout_width="match_parent"
  832.         android:layout_height="wrap_content"
  833.         android:textSize="22sp"
  834.         android:id="@+id/taskName"
  835.         android:text="EXAMPLE FOR TASK"
  836.         />
  837. </LinearLayout>
  838.  
  839. ==============================================================================================================================
  840. weed.xml
  841. ========================================================================================================================
  842.  
  843. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  844.     android:layout_width="match_parent"
  845.     android:layout_height="wrap_content"
  846.     android:orientation="vertical"
  847.     android:gravity="center">
  848.  
  849.     <ImageView
  850.         android:layout_width="100dp"
  851.         android:layout_height="100dp"
  852.         android:src="@drawable/task"/>
  853.  
  854.     <EditText
  855.         android:layout_width="match_parent"
  856.         android:layout_height="wrap_content"
  857.         android:hint="@string/addtask"
  858.         android:id="@+id/txtTask"/>
  859. </LinearLayout>
  860.  
  861.  
  862. ===================================================================
  863. menu.xml
  864. =========================================================================
  865.  
  866. <?xml version="1.0" encoding="utf-8"?>
  867. <menu xmlns:android="http://schemas.android.com/apk/res/android">
  868.     <item
  869.         android:id="@+id/itemLogOut"
  870.         android:title="@string/logout"/>
  871.     <item
  872.         android:id="@+id/itemReset"
  873.         android:title="@string/reset"/>
  874.     <item
  875.         android:id="@+id/itemAbout"
  876.         android:title="@string/about"/>
  877. </menu>
  878.  
  879.  
  880.  
  881. =============================================================================
  882. strings.xml
  883. =============================================================================
  884.  
  885. <resources>
  886.     <string name="app_name"> האפלקציה שלי </string>
  887.     <string name="user_name"> שם משתמש </string>
  888.     <string name="password1"> סיסמה </string>
  889.     <string name="password2"> סיסמה עוד פעם</string>
  890.     <string name="register">  הרשמה </string>
  891.     <string name="login"> כניסה </string>
  892.     <string name="cancel"> חזרה </string>
  893.     <string name="regist_accept"> נרשמת בהצלחה </string>
  894.     <string name="welcome"> ברוך הבא </string>
  895.     <string name="myLogo"> הלוגו שלי </string>
  896.     <string name="my_login_system"> מערכת הרשמה שלי </string>
  897.     <string name="user_not_found"> משתמש לא נמצא </string>
  898.     <string name="wantToRegist"> רוצה להירשם </string>
  899.     <string name="tryAgain">  נסה שוב </string>
  900.     <string name="errorSamepass"> סיסמאות לא זהות </string>
  901.     <string name="userExixst"> משתמש קיים </string>
  902.     <string name="userLoged"> משתמש נכנס </string>
  903.     <string name="blocked"> נחסמת </string>
  904.     <string name="wrongpass"> סיסמה שגויה </string>
  905.     <string name="addnewtask"> הוספ משימה חדשה </string>
  906.     <string name="addtask"> הוסף משימה </string>
  907.     <string name="taskis"> משימה היא </string>
  908.     <string name="taskdone"> משימה בוצעה </string>
  909.     <string name="taskUndone"> משיצה לא בומעה </string>
  910.     <string name="reset"> איפוס כל המשימות </string>
  911.     <string name="logout"> יציאה </string>
  912.     <string name="about"> עלינו </string>
  913.     <string name="ok"> סבבה </string>
  914.     <string name="adamBuild"> פטריות הזיה </string>
  915.     <string name="date"> 9/6/2016 </string>
  916.     <string name="zeev">זאאב זה מה שרציתה</string>
  917.     <string name="suretorest"> בטוח שרוצה לאפס </string>
  918.  
  919. </resources>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement