Commit c667ff9c by Kunj Gupta

Code Review:

1. Removed unused res.
2. Optimize complete code.
parent c66910c1
Showing with 96 additions and 322 deletions
......@@ -31,7 +31,7 @@ android {
defaultConfig {
applicationId "com.vsoft.uoflservicenow"
minSdkVersion 15
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "0.0.7"
......@@ -62,8 +62,7 @@ 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'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.android.gms:play-services-analytics:9.4.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
transitive = true;
}
......
#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
#Fri Sep 02 13:13:58 IST 2016
apiSecret=86619d978f2c755766adfcd904e0da433b5fe19937891d49074426fb8d263c24
......@@ -40,6 +40,7 @@ public class CatalogueApiManager {
stringBuilder.append(Catalogue.Json.URL_PARAM_CATALOGUE_SYSPRM_QUERY_VALUE);
stringBuilder.append("=e0d08b13c3330100c8b837659bba8fb4");
stringBuilder.append("^active=true");
stringBuilder.append("^parent=");
CatalogueLog.d("CatalogueApiManager: getCatalogues: request parameter: "+stringBuilder.toString());
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
......
package com.vsoft.uoflservicenow.ui;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.GridView;
......@@ -56,6 +54,7 @@ public class HomeScreen extends AppCompatActivity {
String[] gridValuesArray = getResources().getStringArray(R.array.home_screen_array);
TypedArray gridViewIcons = getResources().obtainTypedArray(R.array.home_screen_icon_array);
HomeScreenAdapter adapter = new HomeScreenAdapter(this, gridValuesArray, gridViewIcons);
gridViewIcons.recycle();
mGridView.setAdapter(adapter);
}
......
......@@ -3,20 +3,14 @@ package com.vsoft.uoflservicenow.ui;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.analytics.Tracker;
......@@ -34,42 +28,30 @@ import com.vsoft.uoflservicenow.utils.NetworkUtil;
import com.vsoft.uoflservicenow.utils.PrefManager;
import com.vsoft.uoflservicenow.utils.Util;
import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent;
import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEventListener;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.internal.Utils;
/**
* Created by Kunj on 11/8/16.
*/
public class LoginScreen extends Activity {
@BindView(R.id.login_screen_username_edit_text)
EditText userName;
@BindView(R.id.login_screen_password_edit_text)
EditText password;
@BindView(R.id.login_scroll)
ScrollView loginScrollview;
@BindView(R.id.login_screen_username_edit_text) EditText userName;
@BindView(R.id.login_screen_password_edit_text) EditText password;
private List<UserApiValues> mUserDetails;
private PrefManager prefManager;
private String userNameStrng, passwordStrng;
private String sysId;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
prefManager = PrefManager.getInstance();
PrefManager prefManager = PrefManager.getInstance();
prefManager.init(LoginScreen.this);
ButterKnife.bind(this);
CheckLoginValues();
CheckLoginValues();
password.setOnKeyListener(new View.OnKeyListener()
{
......@@ -91,20 +73,6 @@ public class LoginScreen extends Activity {
}
});
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);
}
});
}
}
});
CatalogueApplication application = (CatalogueApplication) getApplication();
Tracker tracker = application.getDefaultTracker();
// Send initial screen view hit.
......@@ -113,7 +81,7 @@ public class LoginScreen extends Activity {
private void CheckLoginValues() {
SharedPreferences sharedPreferences = getSharedPreferences(PrefManager.PREFERENCES_USER_VALUES_KEY, Context.MODE_PRIVATE);
sysId = sharedPreferences.getString(PrefManager.PREFERENCE_SYS_ID, "");
String sysId = sharedPreferences.getString(PrefManager.PREFERENCE_SYS_ID, "");
if (!TextUtils.isEmpty(sysId)) {
startActivity(new Intent(LoginScreen.this, HomeScreen.class));
finish();
......@@ -121,16 +89,16 @@ public class LoginScreen extends Activity {
}
private void callLoginAPI(){
userNameStrng = userName.getText().toString().trim();
passwordStrng = password.getText().toString().trim();
String userNameString = userName.getText().toString().trim();
String passwordString = password.getText().toString().trim();
if (TextUtils.isEmpty(userNameStrng)) {
if (TextUtils.isEmpty(userNameString)) {
userName.setError(getResources().getString(R.string.user_error));
}
if (TextUtils.isEmpty(passwordStrng)) {
if (TextUtils.isEmpty(passwordString)) {
password.setError(getResources().getString(R.string.pasw_error));
}
if (!TextUtils.isEmpty(userNameStrng) && !TextUtils.isEmpty(passwordStrng)) {
if (!TextUtils.isEmpty(userNameString) && !TextUtils.isEmpty(passwordString)) {
KeyboardUtil.hideKeyboard(LoginScreen.this);
boolean networkStatus = NetworkUtil.getConnectivityStatus(getApplicationContext());
if (networkStatus) {
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#E41B23"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="35dp"
android:height="45dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF0000"
android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"/>
</vector>
<?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
......@@ -8,6 +8,7 @@
>
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#e51b23"/>
<solid android:color="@android:color/transparent"/>
</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"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/login_scroll"
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_height="match_parent"
android:scrollbarStyle="insideOverlay">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="insideOverlay"
android:animateLayoutChanges="true">
android:layout_height="wrap_content"
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="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:background="@drawable/ic_login_layout_bg"
android:orientation="vertical">
<ImageView
<EditText
android:id="@+id/login_screen_username_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_login_banner" />
<LinearLayout
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/username_under_bg_box"
android:drawableLeft="@mipmap/ic_user_icon"
android:hint="Username"
android:padding="@dimen/normal_margin"
android:singleLine="true"
android:lines="1"/>
<EditText
android:id="@+id/login_screen_password_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/extra_large_margin"
android:layout_marginRight="@dimen/extra_large_margin"
android:background="@drawable/username_under_bg_box"
android:drawableLeft="@mipmap/ic_password_icon"
android:hint="Password"
android:inputType="textPassword"
android:padding="@dimen/normal_margin"
android:singleLine="true"
android:lines="1"/>
<TextView
android:id="@+id/login_screen_login_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_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:hint="Username"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:padding="10dp"
android:text=""
android:drawableLeft="@mipmap/ic_user_icon"
android:singleLine="true" />
<EditText
android:id="@+id/login_screen_password_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/username_under_bg_box"
android:hint="Password"
android:drawableLeft="@mipmap/ic_password_icon"
android:inputType="textPassword"
android:padding="10dp"
android:text=""
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:singleLine="true" />
<TextView
android:id="@+id/login_screen_login_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:textColor="@color/white"
android:background="@drawable/login_bg"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textSize="@dimen/large_text_size"
android:text="@string/login_screen_login_string"
android:textAlignment="center" />
android:gravity="center"
android:layout_marginBottom="@dimen/normal_margin"
android:layout_marginLeft="@dimen/extra_large_margin"
android:layout_marginRight="@dimen/extra_large_margin"
android:layout_marginTop="@dimen/normal_margin"
android:background="@drawable/login_bg"
android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin"
android:text="@string/login_screen_login_string"
android:textColor="@android:color/white"
android:textSize="@dimen/large_text_size" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
</LinearLayout>
</ScrollView>
\ 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
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:background="@android:color/white"
android:minHeight="?attr/actionBarSize"
app:titleTextColor="@color/tool_bar_title_color">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true">
<ImageView
android:id="@+id/nav_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@mipmap/ic_home_icon"
android:layout_alignParentLeft="true"
/>
android:layout_centerVertical="true"
android:src="@mipmap/ic_home_icon" />
<TextView
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
......@@ -35,15 +37,16 @@
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<GridView
android:id="@+id/home_screen_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:verticalSpacing="@dimen/large_margin"
android:background="@color/home_screen_bg_color"
android:horizontalSpacing="@dimen/large_margin"
android:stretchMode="columnWidth"
android:numColumns="2"
android:padding="@dimen/large_margin"
android:background="@color/home_screen_bg_color"
android:numColumns="2"/>
android:stretchMode="columnWidth"
android:verticalSpacing="@dimen/large_margin" />
</LinearLayout>
\ No newline at end of file
......@@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@color/white"
android:background="@android:color/white"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
app:contentInsetEnd="0dp"
......@@ -22,7 +22,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:background="@color/white"
android:background="@android:color/white"
android:divider="#8e8e8e"
android:dividerHeight="0.5dp"
android:padding="10dp"
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tool_bar_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:minHeight="?attr/actionBarSize"
app:titleTextColor="@color/tool_bar_title_color">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true">
<ImageView
android:id="@+id/nav_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@drawable/ic_arrow_back_black_24dp"
android:layout_alignParentLeft="true"
/>
<TextView
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="@string/my_reques_string"
android:textColor="@color/tool_bar_title_color" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
\ No newline at end of file
......@@ -11,7 +11,6 @@
<color name="home_screen_bg_color">@color/colorPrimary</color>
<color name="white">#ffffff</color>
<color name="screen_bg_color">#c2d1d3</color>
<color name="bg_border_color">#d6d6d6</color>
......
......@@ -19,76 +19,20 @@
<dimen name="list_item_height">100dp</dimen>
<!--Login Screen-->
<dimen name="login_screen_margin_left">30dp</dimen>
<dimen name="login_screen_margin_right">30dp</dimen>
<dimen name="login_screen_login_bottom">15dp</dimen>
<dimen name="login_screen_layout_margin_left">20dp</dimen>
<dimen name="login_screen_layout_margin_right">20dp</dimen>
<dimen name="login_screen_layout_margin_bottom">35dp</dimen>
<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="below_normal_text_size">14sp</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>
=======
<!--My Request screen-->
<dimen name="my_request_approval_image_height">15dp</dimen>
<dimen name="my_request_approval_image_width">15dp</dimen>
>>>>>>> 32b7d4f976a19b786b41f856760d0e25b09812f8
</resources>
\ No newline at end of file
......@@ -17,7 +17,6 @@
<string name="name_null_view_string">Not rendering (name not available)</string>
<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>
......@@ -40,8 +39,6 @@
<string name="failed_to_fetch_incident_string">Failed to fetch Incident.</string>
<!--Login Screen-->
<string name="login_screen_user_name_string">Username</string>
<string name="login_screen_password_string">Password</string>
<string name="login_screen_login_string">Login</string>
<!--Variable Screen-->
......
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