Professional Documents
Culture Documents
writting down the xml code for the home user interface :
<?xml
version="1.0"
encoding="utf-
8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.csumb.cgieg.mainmenu">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainMenu">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.CustomerCreate"
android:label="@string/title_activity_customer_create">
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.CustomerPlaceHold"
android:label="@string/title_activity_customer_place_hold">
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.CustomerLogin"
android:label="@string/title_activity_customer_login">
</activity>
Student ID:
<activity
android:name="edu.csumb.cgieg.mainmenu.CustomerConfirmation"
android:label="@string/title_activity_customer_confirmation">
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.CustomerCancelHold"
android:label="@string/title_activity_customer_cancel_hold">
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.LibrarianLogin"
android:label="@string/title_activity_librarian_login">
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.LibrarianLogs"
android:label="@string/title_activity_librarian_logs">
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.LibrarianAddBook"
android:label="@string/title_activity_librarian_add_book">
</activity>
<activity
android:name="edu.csumb.cgieg.mainmenu.LibrarianConfirmation"
android:label="@string/title_activity_librarian_confirmation">
</activity>
</application>
</manifest>
Student ID:
This application is using for sharing the books. So , it is better to share or sell it by
communicate with the customers and knowing their needs. For communication we can
directly communicate with them .so , we can say the permission shown by the system
when we call request permissions . It will say what permission my app wants but doesn’t
say why . In some cases the user may find the puzzle to solve. Its better to explain to
the user that app wants the permission before calling request .
Preliminary analysis. On this stage costs and benefits are described, alternative
solutions are proposed and submitted a preliminary plan.
Systems Analysis. On this stage the functions of the application are defined.
Yes , Database Is there needed for developing the application. I used Firebase realtime
database here in my application .
Realtime: The data stored in the Firebase Realtime Database will be reflected
at realtime i.e. if there is a change in the values in the database then that
change will be reflected back to all the users at that instant only and no dealy
will be there.
Large Accessibility: The Firebase Realtime Database can be accessed from
various platforms like Android, iOS, Web. So, you need not write the same code
for different platforms a number of times.
Offline Mode: This is the best advantage of using Firebase Realtime Database.
If you are not connected with the internet and you changed something on your
application then that change will be reflected in your application at that time
only but on the Firebase Database, the change will be updated once you are
online i.e. your device is connected to the internet. So, even if there is no
internet, the user feels like using the services the same as done when there is
the internet.
No Application Server: There is no need for application server here because
the data is directly accessed from the mobile device.
Control access to data: By default, no one is allowed to change the data in
the Firebase Realtime Database but you can control the access of data i.e. you can
set which user can access the data.
Step 1: Open Android Studio and create a new project or open an existing project.
Step 2: In Android Studio, log in with email. You can find the login button at the top
right corner of the Android Studio.
Step 3: Open the Firebase Website and login into it. (use the same email id as used in
Android Studio for login)
Step 4: After login, click on the "Go To Console" button that is present of the upper
right side of the website.
Step 6: Enter the required details of the project and click on submit
Step 7: After creating a project, you will see the below image of your project
dashboard.
Student ID:
Step 8: Click on "Database" and then in the Realtime Database section, click on
"Create Database".
Step 9: Since we are just using the database for our practice purpose. So, select the
"Start in test mode" option and click on enable.
Step 10: Now, come back to your Android Studio project. We have to connect our
Firebase project with the Android Studio project. So, click on Tools > Firebase >
Realtime Database > Save and retrieve data.
Step 11: After that click on "Connect to Firebase". A list of projects will be shown to
you. Select the project that you have created on the Firebase website and click on
"Connect to Firebase".
Step 12: Lastly, you have to add the dependency of Firebase Realtime Database in
your project by clicking on "Add Firebase Realtime Database to your app" button
and then "Accept changes".
package
edu.csumb.cgieg.mainmenu;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.content.Intent;
@Override
protected void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
SaraManageSystemBtn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.SaraCreateAccountBtn:
// redirect to customer create activity
Log.d(TAG, "Create Account clicked");
Intent CustomerCreate = new
Intent(getApplicationContext(),
CustomerCreate.class);
startActivity(customerCreate);
break;
case R.id.SaraPlaceHoldBtn:
// redirect to customer place hold activity
Student ID:
package
edu.csumb.cgieg.mainm
enu;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
Student ID:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Student ID:
setContentView(R.layout.activity_customer_login);
@Override
public void onClick(View v) {
if (v.getId() == R.id.SaraCustomerLoginBtn) {
Log.d(TAG, "Login clicked");
String message = "";
String prompt = "Please try again.";
if (validLogin()) { // customer login is valid
Log.d(TAG, "customer is valid");
Toast.makeText(this, "You are now logged in",
Toast.LENGTH_LONG).show(); // special toast
SaraCustomerLoginMessageTextView.setText("");
Bundle extras = getIntent().getExtras();
username =
SaraCustomerUsernameEditText.getText().toString(); //
do this before extras != null
if (extras != null) { // get confirmation variables
from SaraCustomerPlaceHold
pickupDateHour =
extras.getString("sqlPickupDateHour");
returnDateHour =
extras.getString("sqlReturnDateHour");
bookTitle = extras.getString("bookTitle");
Student ID:
bookFeePerHour =
extras.getDouble("bookFeePerHour");
}
Bundle extraInfo = new Bundle();
extraInfo.putString("username", username);
extraInfo.putString("sqlPickupDateHour",
pickupDateHour);
extraInfo.putString("sqlReturnDateHour",
returnDateHour);
extraInfo.putString("bookTitle", bookTitle);
extraInfo.putDouble("bookFeePerHour",
bookFeePerHour);
if (pickupDateHour.equals("")) { // customer is
trying to cancel holds
Log.d(TAG, "redirect to customer cancel
hold");
// redirect to customer cancel hold activity
Intent customerCancelHold = new
Intent(getApplicationContext(),
CustomerCancelHold.class);
SaraCustomerCancelHold.putExtras(extraInfo);
startActivity(customerCancelHold);
}
else {
Log.d(TAG, "redirect to customer
confirmation");
// redirect to customer confirmation activity
Intent customerConfirm = new
Intent(getApplicationContext(),
CustomerConfirmation.class);
customerConfirm.putExtras(extraInfo); //
pass confirmation variables to customerConfirm
startActivity(customerConfirm);
}
}
else {
Log.d(TAG, "customer username and/or
password is invalid");
message = "Username and/or password is
invalid";
SaraCustomerLoginMessageTextView.setText(message
+ ". " + prompt);
attempts++;
}
Student ID:
if (attempts == 2) {
attempts = 0;
SaraCustomerUsernameEditText.setFocusable(false);
SaraCustomerPasswordEditText.setFocusable(false);
SaraCustomerLoginBtn.setVisibility(View.GONE);
SaracustomerLoginMessageTextView.setText("");
SaraCustomerLoginMessageTextView.setText(message
+ " again. Click OK to go to the main menu.");
SaraCustomerLoginOkBtn.setVisibility(View.VISIBLE);
}
}
else if (v.getId() == R.id.SaraCustomerLoginOkBtn)
{ // OK clicked
Log.d(TAG, "OK clicked");
Log.d(TAG, "redirect to main menu");
Intent mainMenu = new
Intent(getApplicationContext(), MainMenu.class);
startActivity(mainMenu);
}
}
}
Student ID:
Student ID: