Commit d9d26fdd authored by Pearl Jen Santos's avatar Pearl Jen Santos

edited the layout to include the landing search screen with 'working' time picker

parent a5d30287
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ubus_logo_final"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" android:theme="@style/AppTheme" >
android:icon="@mipmap/ubus_logo_final">
<!--android:icon="@mipmap/logo"--> <!-- android:icon="@mipmap/logo" -->
<activity <activity
android:name=".Login_Screen" android:name=".Login_Screen"
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".SignUp" /> android:value=".SignUp" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -25,8 +27,7 @@ ...@@ -25,8 +27,7 @@
<activity <activity
android:name=".ActionBarAttempt" android:name=".ActionBarAttempt"
android:label="@string/app_name" android:label="@string/app_name"
android:parentActivityName=".Login_Screen" android:parentActivityName=".Login_Screen" >
>
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".Login_Screen" /> android:value=".Login_Screen" />
...@@ -39,8 +40,10 @@ ...@@ -39,8 +40,10 @@
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".Login_Screen" /> android:value=".Login_Screen" />
</activity> </activity>
<activity
android:name=".TimePicker"
android:label="@string/title_activity_time_picker" >
</activity>
</application> </application>
</manifest> </manifest>
...@@ -6,6 +6,7 @@ import android.content.Intent; ...@@ -6,6 +6,7 @@ import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.res.ResourcesCompat; import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.GravityCompat; import android.support.v4.view.GravityCompat;
...@@ -122,32 +123,32 @@ public class ActionBarAttempt extends AppCompatActivity { ...@@ -122,32 +123,32 @@ public class ActionBarAttempt extends AppCompatActivity {
if (mDrawerToggle.onOptionsItemSelected(item)) { if (mDrawerToggle.onOptionsItemSelected(item)) {
return true; return true;
} }
Fragment fragment = null; // Fragment fragment = null;
Bundle args = new Bundle(); // Bundle args = new Bundle();
FragmentManager fragmentManager = null; // FragmentManager fragmentManager = null;
// Handle action buttons // // Handle action buttons
switch(item.getItemId()) { // switch(item.getItemId()) {
case R.id.action_search: // case R.id.action_search:
//insert what needs to be done when chosen // //insert what needs to be done when chosen
return true; // return true;
case R.id.action_aboutUs: // case R.id.action_aboutUs:
fragment = new About(); // fragment = new About();
fragmentManager = getSupportFragmentManager(); // fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
return true; // return true;
case R.id.action_help: // case R.id.action_help:
fragment = new Help(); // fragment = new Help();
fragmentManager = getSupportFragmentManager(); // fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
return true; // return true;
case R.id.action_settings: // case R.id.action_settings:
//insert what needs to be done when chosen // //insert what needs to be done when chosen
return true; // return true;
default: // default:
return super.onOptionsItemSelected(item); // return super.onOptionsItemSelected(item);
} // }
return true;
} }
/* The click listner for ListView in the navigation drawer */ /* The click listner for ListView in the navigation drawer */
...@@ -165,19 +166,24 @@ public class ActionBarAttempt extends AppCompatActivity { ...@@ -165,19 +166,24 @@ public class ActionBarAttempt extends AppCompatActivity {
switch(position){ switch(position){
case 0: case 0:
fragment = new Schedules(); Fragment fa = new SearchFragment();
break; break;
case 1: case 1:
fragment = new ChangeInfoFragment(); fragment = new Schedules();
break; break;
case 2: case 2:
fragment = new PastTrips(); fragment = new ChangeInfoFragment();
break; break;
case 3: case 3:
fragment = new Help(); fragment = new PastTrips();
break; break;
case 4: case 4:
fragment = new About();//must be changed for dialog //settings
fragment = new Help();
break;
case 5:
//logout
fragment = new Help();
break; break;
default: default:
break; break;
......
...@@ -17,7 +17,7 @@ public class Help extends Fragment { ...@@ -17,7 +17,7 @@ public class Help extends Fragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_about, container, false); View rootView = inflater.inflate(R.layout.dummylayout, container, false);
return rootView; return rootView;
} }
} }
package com.example.pearlsantos.project;
import android.app.TimePickerDialog;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.DigitalClock;
/**
* A placeholder fragment containing a simple view.
*/
public class SearchFragment extends Fragment {
public SearchFragment() {
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle SavedInstance) {
View rootView = inflater.inflate(R.layout.fragment_search, container, false);
DigitalClock clk = (DigitalClock) rootView.findViewById(R.id.digitalClock);
clk.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
TimePicker newDialog = new TimePicker();
newDialog.show(getActivity().getSupportFragmentManager(), "timePicker");
}
});
return rootView;
}
}
package com.example.pearlsantos.project;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.Menu;
import android.view.MenuItem;
import java.util.Calendar;
public class TimePicker extends DialogFragment implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState){
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
return new TimePickerDialog(getActivity(), this, hour, minute, DateFormat.is24HourFormat(getActivity()));
}
@Override
public void onTimeSet(android.widget.TimePicker view, int hourOfDay, int minute) {
//hi EJ, I think this is where you put what you want to do with the time the user picks. Just tell me if you need help
//actually, here's one thing you can do, since I kinda forgot how to SharedPreferences
//1) get the time set using this time picker
//2) send it to SearchFragment
//3) set the digital clock to the said time
//4) other things you need to do :)
}
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.pearlsantos.project.TimePicker">
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Coming Soon"
android:id="@+id/textView3"
android:layout_gravity="center_horizontal" />
</LinearLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.pearlsantos.project.SearchFragment"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Saan ka pupunta?"
android:layout_marginBottom="5dp"
android:id="@+id/destinationLabel" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="GALING"
android:id="@+id/fromLabelSearch"
android:layout_marginBottom="5dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pangunahing Terminal"
android:id="@+id/fromSearch"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="PAPUNTANG"
android:id="@+id/toLabelSearch"
android:layout_marginBottom="5dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Destinasyon"
android:id="@+id/toSearch"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="BUS LINER"
android:id="@+id/busLinersLabel"
android:layout_marginBottom="5dp" />
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/busLiners"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="ANONG ORAS?"
android:id="@+id/timeLabel"
android:layout_marginBottom="5dp" />
<DigitalClock
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/digitalClock"
android:onClick="showTimeDialog" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ULITIN"
android:id="@+id/reset"
android:layout_gravity="center_horizontal" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="HANAPIN"
android:id="@+id/searchFor"
android:layout_gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.pearlsantos.project.TimePicker">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
</menu>
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<string name="drawer_open">open</string> <string name="drawer_open">open</string>
<string name="drawer_close">close</string> <string name="drawer_close">close</string>
<string-array name="options"> <string-array name="options">
<item>Search</item>
<item>Schedules</item> <item>Schedules</item>
<item>Edit Profile</item> <item>Edit Profile</item>
<item>View Past Trips</item> <item>View Past Trips</item>
...@@ -24,4 +25,6 @@ ...@@ -24,4 +25,6 @@
<string name="hello_blank_fragment">Hello blank fragment</string> <string name="hello_blank_fragment">Hello blank fragment</string>
<string name="title_activity_change_info_fragment">ChangeInfoFragment</string> <string name="title_activity_change_info_fragment">ChangeInfoFragment</string>
<string name="title_activity_past_trips">PastTrips</string> <string name="title_activity_past_trips">PastTrips</string>
<string name="title_activity_search">Search</string>
<string name="title_activity_time_picker">TimePicker</string>
</resources> </resources>
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 to comment