login and my request issues reloved

parent ed08d6e6
......@@ -47,4 +47,5 @@ dependencies {
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
}
......@@ -52,7 +52,7 @@
android:name=".ui.LoginScreen"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden">
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
......
......@@ -81,21 +81,19 @@ public class MyRequestAdapter extends BaseAdapter {
String dueDate="Due : "+req.getDueDate();
holder.dueDate.setText(dueDate);
holder.shotrDescription.setText(req.getShotrDescription());
holder.approval.setText(req.getApproval());
if(!req.getApproval().isEmpty()) {
if (req.getApproval().equalsIgnoreCase("requested")) {
holder.approval.setText(mContext.getResources().getString (R.string.requested));
((GradientDrawable)holder.statusIndicator.getBackground()).setColor(Color.parseColor("#FFB400"));
//holder.statusIndicator.setBackgroundColor(Color.parseColor("#FFB400"));
} else if (req.getApproval().equalsIgnoreCase("not requested")) {
holder.approval.setText(mContext.getResources().getString (R.string.notrequest));
((GradientDrawable)holder.statusIndicator.getBackground()).setColor(Color.parseColor("#5CE1ED"));
// holder.statusIndicator.setBackgroundColor(Color.parseColor("#5CE1ED"));
} else if (req.getApproval().equalsIgnoreCase("approved")) {
// holder.statusIndicator.setBackgroundColor(Color.parseColor("#06D323"));
holder.approval.setText(mContext.getResources().getString (R.string.approved));
((GradientDrawable)holder.statusIndicator.getBackground()).setColor(Color.parseColor("#06D323"));
} else {
// holder.statusIndicator.setBackgroundColor(Color.parseColor("#FF0000"));
holder.approval.setText(mContext.getResources().getString (R.string.rejected));
((GradientDrawable)holder.statusIndicator.getBackground()).setColor(Color.parseColor("#FF0000"));
}
}
......
......@@ -2,10 +2,14 @@ package com.vsoft.uofl_catalogue.ui;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Toast;
import com.vsoft.uofl_catalogue.R;
......@@ -19,6 +23,9 @@ import com.vsoft.uofl_catalogue.db.models.UserApiValues;
import com.vsoft.uofl_catalogue.enums.SyncStatus;
import com.vsoft.uofl_catalogue.utils.PrefManager;
import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent;
import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEventListener;
import java.util.List;
import butterknife.BindView;
......@@ -35,24 +42,70 @@ public class LoginScreen extends Activity {
EditText userName;
@BindView(R.id.login_screen_password_edit_text)
EditText password;
@BindView(R.id.login_scroll)
ScrollView loginScrollview;
private List<UserApiValues> mUserDetails;
private PrefManager prefManager;
private String userNameStrng,passwordStrng;
private String firstName,lastName,sysId;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.login_screen);
setContentView(R.layout.activity_login);
prefManager = PrefManager.getInstance();
prefManager.init(LoginScreen.this);
CheckLoginValues();
KeyboardVisibilityEvent.setEventListener(LoginScreen.this, new KeyboardVisibilityEventListener() {
@Override
public void onVisibilityChanged(boolean isOpen) {
if (isOpen) {
loginScrollview.post(new Runnable() {
@Override
public void run() {
loginScrollview.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
}
});
ButterKnife.bind(this);
}
private void CheckLoginValues() {
SharedPreferences sharedPreferences = getSharedPreferences(PrefManager.PREFERENCES_USER_VALUES_KEY, Context.MODE_PRIVATE);
sysId = sharedPreferences.getString(PrefManager.PREFERENCE_SYS_ID, "");
if(!TextUtils.isEmpty(sysId)){
startActivity(new Intent(LoginScreen.this, HomeScreen.class));
finish();
}
}
@OnClick(R.id.login_screen_login_text_view)
void onLoginClicked() {
//startActivity(new Intent(LoginScreen.this, HomeScreen.class));
userNameStrng=userName.getText().toString().trim();
passwordStrng=password.getText().toString().trim();
if(TextUtils.isEmpty(userNameStrng)) {
userName.setError(getResources().getString (R.string.user_error));
return;
}else if(TextUtils.isEmpty(passwordStrng)) {
password.setError(getResources().getString (R.string.pasw_error));
return;
}
else if(TextUtils.isEmpty(userNameStrng)||TextUtils.isEmpty(passwordStrng)) {
userName.setError(getResources().getString (R.string.user_error));
password.setError(getResources().getString (R.string.pasw_error));
return;
}else if(!TextUtils.isEmpty(userNameStrng) && !TextUtils.isEmpty(passwordStrng)){
new LoginDetailsSendToServer().execute(userName.getText().toString().trim(), password.getText().toString().trim());
}
}
class LoginDetailsSendToServer extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog;
......@@ -131,6 +184,7 @@ public class LoginScreen extends Activity {
String sysid=mUserDetails.get(0).getSysId();
PrefManager.saveUserDetailsInPreferences(LoginScreen.this, firstname, lasrname, sysid);
startActivity(new Intent(LoginScreen.this, HomeScreen.class));
finish();
}
} else {
Toast.makeText(LoginScreen.this, "Invalid username and password", Toast.LENGTH_SHORT).show();
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_login_layout_bg"/>
<item>
<shape
android:shape="line">
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#FFF"
android:gravity="center"
android:orientation="vertical">
<ScrollView
android:id="@+id/login_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_login_background"
android:scrollbarStyle="insideOverlay"
android:animateLayoutChanges="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_login_banner"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/login_screen_layout_margin_top"
android:layout_marginLeft="@dimen/login_screen_layout_margin_left"
android:layout_marginRight="@dimen/login_screen_layout_margin_right"
android:layout_marginBottom="@dimen/login_screen_layout_margin_bottom"
android:orientation="vertical">
android:background="@drawable/login_layout_bg"
android:orientation="vertical"
>
<EditText
android:id="@+id/login_screen_username_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/username_under_bg_box"
android:layout_marginLeft="@dimen/login_screen_margin_left"
android:layout_marginRight="@dimen/login_screen_margin_right"
android:drawableLeft="@mipmap/ic_user_icon"
android:text="a0kuma18"
android:hint="@string/login_screen_user_name_string"
android:lines="1"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:padding="10dp"
android:text=""
android:drawableLeft="@mipmap/ic_user_icon"
android:singleLine="true"
android:textCursorDrawable="@null" />
android:textCursorDrawable="@null"/>
<EditText
android:id="@+id/login_screen_password_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/login_screen_password_string"
android:inputType="textPassword"
android:lines="1"
android:text="v$0ftA$win"
android:background="@drawable/username_under_bg_box"
android:layout_marginLeft="@dimen/login_screen_margin_left"
android:layout_marginRight="@dimen/login_screen_margin_right"
android:hint="@string/login_screen_password_string"
android:text=""
android:drawableLeft="@mipmap/ic_password_icon"
android:inputType="textPassword"
android:padding="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textCursorDrawable="@null"
android:singleLine="true"
android:textCursorDrawable="@null"/>
/>
<TextView
android:id="@+id/login_screen_login_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/login_screen_login_bottom"
android:background="@drawable/login_bg"
android:layout_height="40dp"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin"
android:text="@string/login_screen_login_string"
android:textAlignment="center"
android:layout_marginLeft="@dimen/login_screen_margin_left"
android:layout_marginRight="@dimen/login_screen_margin_right"
android:background="@drawable/login_bg"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:text="Sign in"
android:textColor="@android:color/white"
android:textSize="@dimen/extra_normal_text_size" />
android:textSize="@dimen/extra_normal_text_size"
android:textAlignment="center"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="@+id/login_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="insideOverlay"
android:animateLayoutChanges="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_margin="@dimen/normal_margin"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_extra_large_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical"
>
<EditText
android:id="@+id/login_screen_username_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_marginRight="@dimen/normal_margin"
android:layout_marginTop="@dimen/activity_normal_top_margin"
android:background="@drawable/username_under_bg_box"
android:padding="@dimen/normal_margin"
android:singleLine="true" />
<EditText
android:id="@+id/login_screen_password_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/normal_margin"
android:background="@drawable/username_under_bg_box"
android:inputType="textPassword"
android:padding="@dimen/normal_margin"
android:singleLine="true" />
<Button
android:id="@+id/login_screen_login_text_view"
android:layout_width="@dimen/activity_save_button_width"
android:layout_height="@dimen/activity_save_button_height"
android:layout_gravity="left"
android:layout_marginBottom="@dimen/activity_normal_top_margin"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_marginTop="@dimen/normal_margin"
android:background="@drawable/login_bg"
android:padding="@dimen/normal_margin"
android:textAllCaps="false"
android:text="@string/login_screen_login_string"
android:textColor="@android:color/white"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
......@@ -9,13 +9,13 @@
android:layout_height="wrap_content"
android:text="Large Text"
android:id="@+id/number"
android:textSize="20dp"
android:textSize="@dimen/ruquest_descps_text_size"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"/>
android:layout_marginTop="@dimen/my_request_top"
android:layout_marginLeft="@dimen/my_request_left"/>
<TextView
android:layout_width="wrap_content"
......@@ -23,10 +23,11 @@
android:text="Large Text"
android:id="@+id/dueDate"
android:textColor="#8e8e8e"
android:textSize="15dp"
android:layout_marginTop="15dp"
android:textSize="@dimen/ruquest_descps_text_size"
android:visibility="gone"
android:layout_marginTop="@dimen/my_request_top"
android:layout_below="@+id/number"
android:layout_marginRight="15dp"
android:layout_marginRight="@dimen/my_request_top"
android:layout_alignParentRight="true"
android:layout_alignBaseline="@+id/number"
/>
......@@ -36,32 +37,33 @@
android:layout_height="wrap_content"
android:text="Large Text"
android:id="@+id/shotrDescription"
android:textSize="20dp"
android:textSize="@dimen/ruquest_descps_text_size"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:layout_marginTop="@dimen/my_request_top"
android:layout_below="@+id/number"
android:layout_alignLeft="@+id/number"
android:layout_alignStart="@+id/number" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_width="@dimen/my_request_top"
android:layout_height="@dimen/my_request_top"
android:id="@+id/approval_image"
android:background="@drawable/circle"
android:layout_alignTop="@+id/approval"
android:layout_marginTop="@dimen/my_request_text_bottom"
android:layout_alignLeft="@+id/shotrDescription"
android:layout_alignStart="@+id/shotrDescription"
android:layout_marginBottom="15dp"/>
android:layout_marginBottom="@dimen/my_request_top"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:id="@+id/approval"
android:textSize="15dp"
android:textSize="@dimen/ruquest_status_text_size"
android:textColor="#8e8e8e"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="@dimen/my_request_right"
android:layout_marginTop="@dimen/my_request_new_top"
android:layout_toRightOf="@+id/approval_image"
android:layout_below="@+id/shotrDescription"/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--Margins-->
<dimen name="small_margin">5dp</dimen>
<dimen name="normal_margin">5dp</dimen>
<dimen name="large_margin">10dp</dimen>
<!--Text size-->
<dimen name="small_text_size">12sp</dimen>
<dimen name="normal_text_size">16sp</dimen>
<dimen name="extra_normal_text_size">24sp</dimen>
<dimen name="large_text_size">20sp</dimen>
<dimen name="large_text_size">18sp</dimen>
<dimen name="catalogue_category_and_item_list_view_divider_height">5dp</dimen>
<dimen name="list_view_divider_height">1dp</dimen>
......@@ -33,4 +26,63 @@
<dimen name="login_screen_layout_margin_top">10dp</dimen>
<!--Spinner Item height-->
<dimen name="spinner_item_height">40dp</dimen>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="border_line_width">1dp</dimen>
<dimen name="text_view_height">48dp</dimen>
<dimen name="edit_text_view_height">36dp</dimen>
<dimen name="edit_text_view_large_height">64dp</dimen>
<!--Margins-->
<dimen name="small_margin">5dp</dimen>
<dimen name="normal_margin">10dp</dimen>
<dimen name="large_margin">15dp</dimen>
<dimen name="extra_large_margin">20dp</dimen>
<dimen name="elevation_margin">4dp</dimen>
<!--Text size-->
<dimen name="small_text_size">12sp</dimen>
<dimen name="below_normal_text_size">14sp</dimen>
<dimen name="normal_text_size">16sp</dimen>
<dimen name="extra_normal_text_size">18sp</dimen>
<dimen name="ruquest_status_text_size">15sp</dimen>
<dimen name="ruquest_descps_text_size">18sp</dimen>
<!--Add New Expense-->
<dimen name="attach_screen_image_size">100dp</dimen>
<dimen name="pragress_bar_padding_size">13dp</dimen>
<!-- Login Activity-->
<dimen name="activity_scroll_large_margin">20dp</dimen>
<dimen name="activity_scroll_normal_margin">12dp</dimen>
<dimen name="activity_padding_normal_margin">12dp</dimen>
<dimen name="activity_normal_top_margin">30dp</dimen>
<dimen name="activity_extra_large_margin">30dp</dimen>
<dimen name="activity_save_button_width">105dp</dimen>
<dimen name="activity_save_button_height">40dp</dimen>
<!-- MyRequest Activity-->
<dimen name="my_request_top">15dp</dimen>
<dimen name="my_request_left">15dp</dimen>
<dimen name="my_request_right">10dp</dimen>
<dimen name="my_request_bottom">15dp</dimen>
<dimen name="my_request_new_top">18dp</dimen>
<dimen name="my_request_text_bottom">2dp</dimen>
<!--Alert Popup-->
<dimen name="custom_layout_height">170dp</dimen>
<dimen name="custom_alert_title_height">45dp</dimen>
<dimen name="expense_details_edit_button_width">40dp</dimen>
<dimen name="expense_details_edit_button_height">40dp</dimen>
<dimen name="small_padding_size">7sp</dimen>
<dimen name="expense_details_refresh_button_width">40dp</dimen>
<dimen name="expense_details_refresh_button_height">40dp</dimen>
</resources>
\ No newline at end of file
......@@ -17,6 +17,15 @@
<string name="view_not_implemented_string">Not Implemented: %s</string>
<string name="no_variables_string">No Variables&#8230;</string>
<string name="approved">Approved</string>
<string name="notrequest">Not Yet Requested</string>
<string name="requested">Requested</string>
<string name="rejected">Rejected</string>
<string name="user_error">Please Enter UserName</string>
<string name="pasw_error">Please Enter Password</string>
<string name="date_string">%1$s %2$s, %3$s</string>
<string name="date_and_time_string"> %1$s:%2$s</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment