Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.41 KB | None | 0 0
  1. //TaskAdapter
  2. --------------------
  3. package com.example.esra.myloginapp.Adapters;
  4.  
  5. import android.content.Context;
  6. import android.content.DialogInterface;
  7. import android.provider.ContactsContract;
  8. import android.support.v7.app.AlertDialog;
  9. import android.view.LayoutInflater;
  10. import android.view.View;
  11. import android.view.ViewGroup;
  12. import android.widget.BaseAdapter;
  13. import android.widget.CheckBox;
  14. import android.widget.ImageView;
  15. import android.widget.ListView;
  16. import android.widget.TextView;
  17.  
  18. import com.example.esra.myloginapp.Cls.ClsTask;
  19. import com.example.esra.myloginapp.R;
  20. import com.example.esra.myloginapp.UtlTask;
  21.  
  22. import java.util.List;
  23.  
  24. /**
  25.  * Created by esra on 1/17/2017.
  26.  */
  27.  
  28. public class TaskAdapter extends BaseAdapter {
  29.     Context context;
  30.     String spUser;
  31.     List<ClsTask> myTaskList;
  32.  
  33.  
  34.     public TaskAdapter(Context context, List<ClsTask> myTaskList, String spUser) {
  35.         this.context = context;
  36.         this.myTaskList = myTaskList;
  37.         this.spUser = spUser;
  38.     }
  39.  
  40.     @Override
  41.     public int getCount() {
  42.         return myTaskList.size();
  43.     }
  44.  
  45.     @Override
  46.     public Object getItem(int position) {
  47.         return null;
  48.     }
  49.  
  50.     @Override
  51.     public long getItemId(int position) {
  52.         return 0;
  53.     }
  54.  
  55.     @Override
  56.     public View getView(final int position, View convertView, ViewGroup parent) {
  57.         final ClsTask singleItem = myTaskList.get(position);
  58.         View singleTask = LayoutInflater.from(context).inflate(R.layout.task_layout, null, false);
  59.         TextView txtTask = (TextView) singleTask.findViewById(R.id.txtTask);
  60.         txtTask.setText(singleItem.taskName);
  61.  
  62.         CheckBox cbIsDone = (CheckBox) singleTask.findViewById(R.id.cbIsDone);
  63.         cbIsDone.setChecked(singleItem.taskIsDone);
  64.         /*cbIsDone.setOnClickListener(new View.OnClickListener() {
  65.             @Override
  66.             public void onClick(View v) {
  67.                 AlertDialog.Builder adConfirmStatus=new AlertDialog.Builder(context);
  68.                 adConfirmStatus.setTitle("Warning!");
  69.                 adConfirmStatus.setMessage("Are you sure you want to toggle this task?");
  70.                 adConfirmStatus.setPositiveButton("Change Status", new DialogInterface.OnClickListener() {
  71.                     @Override
  72.                     public void onClick(DialogInterface dialog, int which) {
  73.                         UtlTask.taskStatusToggle(context,spUser,singleItem.taskName);
  74.                         notifyDataSetChanged();
  75.                     }
  76.                 });
  77.                 adConfirmStatus.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  78.                     @Override
  79.                     public void onClick(DialogInterface dialog, int which) {
  80.                         dialog.dismiss();
  81.                     }
  82.                 });
  83.                 adConfirmStatus.show();
  84.             }
  85.         });*/
  86.         ImageView btnTrash = (ImageView) singleTask.findViewById(R.id.btnTrash);
  87.         btnTrash.setOnClickListener(new View.OnClickListener() {
  88.             @Override
  89.             public void onClick(View v) {
  90.                 AlertDialog.Builder adConfirmDelete=new AlertDialog.Builder(context);
  91.                 adConfirmDelete.setTitle("Warning!");
  92.                 adConfirmDelete.setMessage("are you sure you want to delete this task?");
  93.                 adConfirmDelete.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
  94.                     @Override
  95.                     public void onClick(DialogInterface dialog, int which) {
  96.                         UtlTask.removeTask(context, spUser, singleItem.taskName);
  97.                         myTaskList.remove(position);
  98.                         notifyDataSetChanged();
  99.                     }
  100.                 });
  101.                 adConfirmDelete.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  102.                     @Override
  103.                     public void onClick(DialogInterface dialog, int which) {
  104.                         dialog.dismiss();
  105.                     }
  106.                 });
  107.             adConfirmDelete.show();
  108.             }
  109.         });
  110.         return singleTask;
  111.     }
  112. }
  113. ---------------------------
  114. //ClsTask
  115. -------------------------
  116. package com.example.esra.myloginapp.Cls;
  117.  
  118. import java.util.Date;
  119.  
  120. /**
  121.  * Created by esra on 1/17/2017.
  122.  */
  123.  
  124. public class ClsTask {
  125.     public Date taskDate;
  126.     public Date taskDue;
  127.     public String taskName;
  128.     public String taskDetail;
  129.     public Boolean taskIsDone;
  130.     public ClsTask(String userTask,String myData)
  131.     {
  132.         String[]myTaskInfo=myData.split(",");
  133.         this.taskDate=new Date();
  134.         this.taskDue=new Date();
  135.         this.taskName=userTask;
  136.         this.taskDetail=myTaskInfo[3];
  137.         this.taskIsDone=myTaskInfo[4].equals("1");
  138.     }
  139.  
  140. }
  141. --------------------------
  142. //LoginActivity
  143. -------------------------
  144. package com.example.esra.myloginapp;
  145.  
  146. import android.content.Context;
  147. import android.content.Intent;
  148. import android.graphics.Color;
  149. import android.os.Bundle;
  150. import android.support.v7.app.AppCompatActivity;
  151. import android.view.View;
  152. import android.widget.Button;
  153. import android.widget.EditText;
  154. import android.widget.TextView;
  155. import android.widget.Toast;
  156.  
  157.  
  158. public class LoginActivity extends AppCompatActivity {
  159.     EditText txtUserName,txtPass;
  160.     TextView logo;
  161.     Button btnLogin,btnReg;
  162.     Context context;
  163.  
  164.     @Override
  165.     protected void onCreate(Bundle savedInstanceState) {
  166.         super.onCreate(savedInstanceState);
  167.         setContentView(R.layout.activity_login);
  168.         setPointers();
  169.     }
  170.     private void setPointers()
  171.     {
  172.         this.context=this;
  173.         txtUserName=(EditText)findViewById(R.id.txtUserName);
  174.         txtPass=(EditText)findViewById(R.id.txtPass);
  175.         logo=(TextView)findViewById(R.id.txtLogo);
  176.         btnLogin=(Button)findViewById(R.id.btnLogin);
  177.         btnReg=(Button)findViewById(R.id.btnReg);
  178.         logo.setOnLongClickListener(new View.OnLongClickListener()
  179.         {
  180.             public boolean onLongClick(View v)
  181.             {
  182.                 Toast.makeText(context,context.getResources().getString(R.string.msgLogo),Toast.LENGTH_SHORT).show();
  183.             return true;
  184.             }
  185.         });
  186.         final int ORG_COLOR=txtUserName.getCurrentTextColor();
  187.         btnLogin.setOnClickListener(new View.OnClickListener() {
  188.             UtlShared utl=new UtlShared(context);
  189.             public void onClick(View v) {
  190.                 txtPass.setHintTextColor(ORG_COLOR);
  191.                 txtUserName.setHintTextColor(ORG_COLOR);
  192.                 if(txtUserName.getText().toString().length()<2||txtPass.getText().toString().length()<2)
  193.                 {
  194.                     Toast.makeText(context,"you had not fill the userName or the password",Toast.LENGTH_SHORT).show();
  195.                     txtUserName.setText("");
  196.                     txtPass.setText("");
  197.                     txtUserName.setHintTextColor(Color.RED);
  198.                     txtPass.setHintTextColor(Color.RED);
  199.                     return;
  200.                 }
  201.                 if(!(utl.checkPass((txtUserName.getText().toString()),(txtPass.getText().toString()))))
  202.                 {
  203.                     Toast.makeText(context,"the user name or the password are not correct",Toast.LENGTH_SHORT).show();
  204.                     return;
  205.                 }
  206.                 Intent myIntent=new Intent(context,TaskActivity.class);
  207.                 myIntent.putExtra("userName",utl.getNickName(txtUserName.getText().toString()));
  208.                 myIntent.putExtra("user",txtUserName.getText().toString());
  209.                 startActivity(myIntent);
  210.                 finish();
  211.             }
  212.         });
  213.         btnReg.setOnClickListener(new View.OnClickListener() {
  214.             @Override
  215.             public void onClick(View v) {
  216.                 Intent myIntent=new Intent(context,RegisterActivity.class);
  217.                 startActivity(myIntent);
  218.             }
  219.         });
  220.     }
  221. }
  222. -------------------------
  223. //RegisterActivity
  224. -------------------------
  225. package com.example.esra.myloginapp;
  226.  
  227. import android.content.Context;
  228. import android.support.v7.app.AppCompatActivity;
  229. import android.os.Bundle;
  230. import android.view.View;
  231. import android.widget.Button;
  232. import android.widget.EditText;
  233. import android.widget.Toast;
  234.  
  235. public class RegisterActivity extends AppCompatActivity {
  236.     Context context;
  237.     EditText txtUser,txtPass,checkPass,nickNmae;
  238.     Button btnReg,btnCancel;
  239.  
  240.     @Override
  241.     protected void onCreate(Bundle savedInstanceState) {
  242.         super.onCreate(savedInstanceState);
  243.         setContentView(R.layout.activity_register);
  244.         setPointers();
  245.     }
  246.     private void setPointers()
  247.     {
  248.         this.context=this;
  249.         txtUser=(EditText)findViewById(R.id.regTxtUser);
  250.         txtPass=(EditText)findViewById(R.id.regTxtPass);
  251.         checkPass=(EditText)findViewById(R.id.checkPass);
  252.         nickNmae=(EditText)findViewById(R.id.nickName);
  253.         btnReg=(Button)findViewById(R.id.regBtnReg);
  254.         btnCancel=(Button)findViewById(R.id.regBtnCancel);
  255.         btnReg.setOnClickListener(new View.OnClickListener() {
  256.             @Override
  257.             public void onClick(View v) {
  258.                 btnReg();
  259.             }
  260.         });
  261.         btnCancel.setOnClickListener(new View.OnClickListener() {
  262.             @Override
  263.             public void onClick(View v) {
  264.                 finish();
  265.             }
  266.         });
  267.  
  268.     }
  269.     private  void btnReg()
  270.     {
  271.         UtlShared utl=new UtlShared(context);
  272.         if(txtUser.getText().toString().length()<2||nickNmae.getText().toString().length()<2)
  273.         {
  274.             Toast.makeText(context,"your name or nickName is less than 2 chars",Toast.LENGTH_SHORT).show();
  275.             return;
  276.         }
  277.         if(utl.checkUser(txtUser.getText().toString()))
  278.         {
  279.             Toast.makeText(context, "user is exists", Toast.LENGTH_SHORT).show();
  280.             return;
  281.         }
  282.         if(txtPass.getText().toString().length()<3)
  283.         {
  284.             Toast.makeText(context,"the password is less than 3 chars",Toast.LENGTH_SHORT).show();
  285.             return;
  286.         }
  287.         if(!txtPass.getText().toString().equals(checkPass.getText().toString()))
  288.         {
  289.             Toast.makeText(context, "the passwords don't match", Toast.LENGTH_SHORT).show();
  290.             return;
  291.         }
  292.         utl.addUser(txtUser.getText().toString(),txtPass.getText().toString(),nickNmae.getText().toString());
  293.         finish();
  294.     }
  295. }
  296. --------------------------------
  297. //TaskActivity
  298. ------------------------------
  299. package com.example.esra.myloginapp;
  300.  
  301. import android.app.Dialog;
  302. import android.content.Context;
  303. import android.content.DialogInterface;
  304. import android.support.v7.app.AlertDialog;
  305. import android.support.v7.app.AppCompatActivity;
  306. import android.os.Bundle;
  307. import android.view.LayoutInflater;
  308. import android.view.View;
  309. import android.widget.Button;
  310. import android.widget.EditText;
  311. import android.widget.ListView;
  312. import android.widget.TextView;
  313. import android.widget.Toast;
  314.  
  315. import com.example.esra.myloginapp.Adapters.TaskAdapter;
  316.  
  317. public class TaskActivity extends AppCompatActivity {
  318.     Context context;
  319.     TextView taskLogo;
  320.     Button btnAddTask;
  321.     String spUser="";
  322.     ListView lvTask;
  323.     @Override
  324.     protected void onCreate(Bundle savedInstanceState) {
  325.         super.onCreate(savedInstanceState);
  326.         setContentView(R.layout.activity_task);
  327.         setPointers();
  328.         getExtra();
  329.         showData();
  330.     }
  331.     private void showData()
  332.     {
  333.         TaskAdapter myAdapter=new TaskAdapter(context,UtlTask.getAllTask(context,spUser),spUser);
  334.         lvTask.setAdapter(myAdapter);
  335.     }
  336.     private void getExtra()
  337.     {
  338.         String myData=getIntent().getStringExtra("userName");
  339.         taskLogo.setText("Hello "+myData);
  340.         Toast.makeText(context,"user"+myData+"is logged in",Toast.LENGTH_SHORT).show();
  341.         spUser=getIntent().getStringExtra("user");
  342.     }
  343.     private void setPointers()
  344.     {
  345.         this.context=this;
  346.         taskLogo=(TextView)findViewById(R.id.taskLogo);
  347.         btnAddTask=(Button)findViewById(R.id.btnAddTask);
  348.         btnAddTask.setOnClickListener(new View.OnClickListener() {
  349.             @Override
  350.             public void onClick(View v) {
  351.                 showAdAddTask();
  352.             }
  353.         });
  354.         lvTask=(ListView)findViewById(R.id.lvTask);
  355.     }
  356.     private void showAdAddTask()
  357.     {
  358.         AlertDialog.Builder adTask=new AlertDialog.Builder(context);
  359.         View inflatedTask= LayoutInflater.from(context).inflate(R.layout.alert_dialog_new_task,null,false);
  360.         final EditText myNewTask=(EditText)inflatedTask.findViewById(R.id.txtNewTask);
  361.         adTask.setView(inflatedTask);
  362.         adTask.setPositiveButton(getResources().getString(R.string.adPosBtn), new DialogInterface.OnClickListener() {
  363.             @Override
  364.             public void onClick(DialogInterface dialog, int which) {
  365.                 String myTask=myNewTask.getText().toString();
  366.                 UtlTask.addTask(context,spUser,myTask);
  367.                 showData();
  368.             }
  369.         });
  370.         adTask.setNegativeButton(getResources().getString(R.string.adNegBtn), new DialogInterface.OnClickListener() {
  371.             @Override
  372.             public void onClick(DialogInterface dialog, int which) {
  373.                 dialog.dismiss();
  374.             }
  375.         });
  376.         adTask.show();
  377.  
  378.     }
  379.  
  380. }
  381. -----------------------------
  382. //UtlShared
  383. ---------------------------
  384. package com.example.esra.myloginapp;
  385.  
  386. import android.content.Context;
  387. import android.content.SharedPreferences;
  388. import android.os.StrictMode;
  389.  
  390. import java.util.ArrayList;
  391. import java.util.List;
  392. import java.util.Map;
  393.  
  394. /**
  395.  * Created by esra on 1/14/2017.
  396.  */
  397.  
  398. public class UtlShared {
  399.     Context context;
  400.     SharedPreferences userPref;
  401.     SharedPreferences.Editor editor;
  402.     public UtlShared(Context context)
  403.     {
  404.         this.context=context;
  405.         userPref=context.getSharedPreferences("users",Context.MODE_PRIVATE);
  406.         editor=userPref.edit();
  407.     }
  408.     //return true if user excists
  409.     //else return false
  410.     public boolean checkUser(String userName)
  411.     {
  412.         String checkString=userPref.getString(userName,"n/a");
  413.         return !checkString.equals("n/a");
  414.     }
  415.     //returns true if password matches the user name
  416.     //else returns false
  417.     public boolean checkPass(String userName,String password)
  418.     {
  419.         if(!checkUser(userName))return false;
  420.         String[] values=userPref.getString(userName,"n/a").split(",");
  421.         String pass=values[0];
  422.         return pass.equals(password);
  423.     }
  424.     public void addUser(String userName,String pass,String nickName)
  425.     {
  426.         editor.putString(userName,(pass+","+nickName));
  427.         editor.commit();
  428.     }
  429.     public String getNickName(String userName)
  430.     {
  431.         String[] values=userPref.getString(userName,"n/a").split(",");
  432.         return values[1];
  433.     }
  434.  
  435.  
  436.  
  437. }
  438. -------------------------
  439. //UtlTask
  440. -------------------------
  441. package com.example.esra.myloginapp;
  442.  
  443. import android.content.Context;
  444. import android.content.SharedPreferences;
  445.  
  446. import com.example.esra.myloginapp.Cls.ClsTask;
  447.  
  448. import java.util.ArrayList;
  449. import java.util.List;
  450. import java.util.Map;
  451.  
  452. /**
  453.  * Created by esra on 1/17/2017.
  454.  */
  455.  
  456. public class UtlTask {
  457.     public static void removeTask(Context context,String spUser,String userTask)
  458.     {
  459.         SharedPreferences myPref=context.getSharedPreferences(spUser,Context.MODE_PRIVATE);
  460.         SharedPreferences.Editor editor=myPref.edit();
  461.         editor.remove(userTask);
  462.         editor.commit();
  463.     }
  464.     public static void taskStatusToggle(Context context,String spUser,String userTask)
  465.     {
  466.         SharedPreferences myPref=context.getSharedPreferences(spUser,Context.MODE_PRIVATE);
  467.         SharedPreferences.Editor editor=myPref.edit();
  468.         boolean taskStatus=!(myPref.getString(userTask,"0").equals("1"));
  469.         editor.putString(userTask,taskStatus?"1":"0");
  470.         editor.commit();
  471.     }
  472.  
  473.  
  474.     public static List<ClsTask> getAllTask(Context context, String spUser)
  475.     {
  476.         SharedPreferences myPref=context.getSharedPreferences(spUser,Context.MODE_PRIVATE);
  477.  
  478.         List<ClsTask> myTasks=new ArrayList<>();
  479.         Map<String,?> tasks=myPref.getAll();
  480.         for(Map.Entry<String,?> singleTask:tasks.entrySet())
  481.         {
  482.             myTasks.add(new ClsTask(singleTask.getKey(),singleTask.getValue().toString()));
  483.         }
  484.         return myTasks;
  485.     }
  486.     public static void addTask(Context context,String spUser,String userTask)
  487.     {
  488.         SharedPreferences myPref=context.getSharedPreferences(spUser,Context.MODE_PRIVATE);
  489.         SharedPreferences.Editor editor=myPref.edit();
  490.         editor.putString(userTask,"date"+","+"date"+","+userTask+","+"userDetail"+","+"0");
  491.         editor.commit();
  492.  
  493.     }
  494. }
  495. ------------------------------------
  496. //activity_login
  497. -------------------------------
  498. <LinearLayout android:layout_width="match_parent"
  499.     android:layout_height="match_parent"
  500.     android:orientation="vertical"
  501.     xmlns:android="http://schemas.android.com/apk/res/android" >
  502.     <!--my logo linearLayout-->
  503.     <LinearLayout
  504.         android:layout_width="match_parent"
  505.         android:layout_height="match_parent"
  506.         android:orientation="vertical"
  507.         android:layout_weight="1">
  508.         <TextView
  509.             android:layout_width="match_parent"
  510.             android:layout_height="match_parent"
  511.             android:text="@string/logo_login"
  512.             android:gravity="center"
  513.             android:textSize="@dimen/logo"
  514.             android:id="@+id/txtLogo"/>
  515.     </LinearLayout>
  516.     <!--my user and pass linearLayout-->
  517.     <LinearLayout
  518.         android:layout_width="match_parent"
  519.         android:layout_height="match_parent"
  520.         android:orientation="vertical"
  521.         android:layout_weight="1">
  522.         <EditText
  523.             android:layout_width="match_parent"
  524.             android:layout_height="match_parent"
  525.             android:hint="@string/username_hint"
  526.             android:layout_weight="1"
  527.             android:id="@+id/txtUserName"/>
  528.         <EditText
  529.             android:layout_width="match_parent"
  530.             android:layout_height="match_parent"
  531.             android:layout_weight="1"
  532.             android:hint="@string/pass_hint"
  533.             android:id="@+id/txtPass"/>
  534.     </LinearLayout>
  535.     <LinearLayout
  536.         android:layout_width="match_parent"
  537.         android:layout_height="match_parent"
  538.         android:layout_weight="1"
  539.         android:orientation="horizontal">
  540.         <Button
  541.             android:layout_width="match_parent"
  542.             android:layout_height="wrap_content"
  543.             android:text="@string/btn_login"
  544.             android:layout_weight="1"
  545.             android:layout_margin="@dimen/btn_margin"
  546.             android:id="@+id/btnLogin"/>
  547.         <Button
  548.             android:layout_width="match_parent"
  549.             android:layout_height="wrap_content"
  550.             android:text="@string/btn_reg"
  551.             android:layout_weight="1"
  552.             android:layout_margin="@dimen/btn_margin"
  553.             android:id="@+id/btnReg"/>
  554.     </LinearLayout>
  555. </LinearLayout>
  556. --------------------------
  557. //activity_register
  558. --------------------------
  559. <LinearLayout android:layout_width="match_parent"
  560.     android:layout_height="match_parent"
  561.     android:orientation="vertical"
  562.     xmlns:android="http://schemas.android.com/apk/res/android">
  563.     <LinearLayout
  564.         android:layout_width="match_parent"
  565.         android:layout_height="match_parent"
  566.         android:layout_weight="3">
  567.         <TextView
  568.             android:layout_width="match_parent"
  569.             android:layout_height="match_parent"
  570.             android:text="@string/reg_logo"
  571.             android:textSize="@dimen/regLogo"
  572.             android:gravity="center"
  573.             />
  574.     </LinearLayout>
  575.     <LinearLayout
  576.         android:layout_width="match_parent"
  577.         android:layout_height="match_parent"
  578.         android:layout_weight="1"
  579.         android:orientation="vertical">
  580.         <EditText
  581.             android:layout_width="match_parent"
  582.             android:layout_height="match_parent"
  583.             android:layout_weight="1"
  584.             android:hint="@string/regHintUserName"
  585.             android:id="@+id/regTxtUser"
  586.             />
  587.         <EditText
  588.             android:layout_width="match_parent"
  589.             android:layout_height="match_parent"
  590.             android:layout_weight="1"
  591.             android:hint="@string/regHintPass"
  592.             android:id="@+id/regTxtPass"
  593.         />
  594.         <EditText
  595.             android:layout_width="match_parent"
  596.             android:layout_height="match_parent"
  597.             android:layout_weight="1"
  598.             android:hint="@string/checkPass"
  599.             android:id="@+id/checkPass"
  600.         />
  601.         <EditText
  602.             android:layout_width="match_parent"
  603.             android:layout_height="match_parent"
  604.             android:layout_weight="1"
  605.             android:hint="@string/nickName"
  606.             android:id="@+id/nickName"
  607.         />
  608.     </LinearLayout>
  609.     <LinearLayout
  610.         android:layout_width="match_parent"
  611.         android:layout_height="match_parent"
  612.         android:orientation="horizontal"
  613.         android:layout_weight="3">
  614.         <Button
  615.             android:layout_width="match_parent"
  616.             android:layout_height="match_parent"
  617.             android:layout_margin="@dimen/btn_margin"
  618.             android:text="@string/btn_reg"
  619.             android:layout_weight="1"
  620.             android:id="@+id/regBtnReg"/>
  621.         <Button
  622.             android:layout_width="match_parent"
  623.             android:layout_height="match_parent"
  624.             android:text="@string/btn_cancel"
  625.             android:layout_weight="1"
  626.             android:layout_margin="@dimen/btn_margin"
  627.             android:id="@+id/regBtnCancel"/>
  628.     </LinearLayout>
  629. </LinearLayout>
  630. -----------------------
  631. //activity_task
  632. ------------------------
  633. <LinearLayout android:layout_width="match_parent"
  634.     android:layout_height="match_parent"
  635.     android:orientation="vertical"
  636.     xmlns:android="http://schemas.android.com/apk/res/android">
  637.     <TextView
  638.         android:layout_width="match_parent"
  639.         android:layout_height="wrap_content"
  640.         android:text="@string/task_logo"
  641.         android:gravity="center"
  642.         android:textSize="@dimen/taskLogo"
  643.         android:id="@+id/taskLogo" />
  644.     <Button
  645.         android:layout_width="match_parent"
  646.         android:layout_height="wrap_content"
  647.         android:text="@string/add_task"
  648.         android:id="@+id/btnAddTask" />
  649.     <ListView
  650.         android:layout_width="match_parent"
  651.         android:layout_height="wrap_content"
  652.         android:id="@+id/lvTask">
  653.     </ListView>
  654. </LinearLayout>
  655. ---------------------------
  656. //alert_dialog_new_task
  657. ----------------------------
  658. <?xml version="1.0" encoding="utf-8"?>
  659. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  660.     android:orientation="vertical" android:layout_width="match_parent"
  661.     android:layout_height="wrap_content">
  662.     <TextView
  663.         android:layout_width="match_parent"
  664.         android:layout_height="match_parent"
  665.         android:text="@string/adLogo"
  666.         android:gravity="center"
  667.         android:textSize="@dimen/newTaskLogo"
  668.         android:layout_weight="1.3"/>
  669.     <EditText
  670.         android:layout_width="match_parent"
  671.         android:layout_height="match_parent"
  672.         android:layout_weight="1"
  673.         android:hint="@string/adTxtHint"
  674.         android:id="@+id/txtNewTask" />
  675. </LinearLayout>
  676. ----------------------------
  677. //task_layout
  678. --------------------------
  679. <?xml version="1.0" encoding="utf-8"?>
  680. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  681.     android:orientation="horizontal" android:layout_width="match_parent"
  682.     android:layout_height="match_parent">
  683.     <CheckBox
  684.         android:layout_width="match_parent"
  685.         android:layout_height="wrap_content"
  686.         android:id="@+id/cbIsDone"
  687.         android:layout_weight="5"/>
  688.     <TextView
  689.         android:layout_width="match_parent"
  690.         android:layout_height="wrap_content"
  691.         android:id="@+id/txtTask"
  692.         android:layout_weight="1"
  693.         />
  694. <ImageView
  695.     android:layout_width="match_parent"
  696.     android:layout_height="wrap_content"
  697.     android:id="@+id/btnTrash"
  698.     android:layout_weight="5"
  699.     android:src="@drawable/delete_task"/>
  700. </LinearLayout>
  701. ----------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement