From dc3d78c222119832d08c99e2c0ccd7e435821a8e Mon Sep 17 00:00:00 2001 From: StupidDummy Date: Tue, 20 Oct 2015 14:05:54 +0700 Subject: [PATCH] apapun apapun --- .idea/inspectionProfiles/Project_Default.xml | 10 ++++ .../inspectionProfiles/profiles_settings.xml | 7 +++ app/app.iml | 1 + app/src/main/AndroidManifest.xml | 4 ++ .../cz2006androidproject/ScheduleAdapter.java | 4 +- .../cz2006androidproject/TabHostSchedule.java | 51 +++++++++++++++++++ .../cz2006androidproject/calendar.java | 10 +++- .../cz2006androidproject/displayListView.java | 4 +- .../res/layout/activity_tab_host_schedule.xml | 37 ++++++++++++++ .../res/layout/activity_view_schedule.xml | 6 +-- .../main/res/menu/menu_tab_host_schedule.xml | 7 +++ app/src/main/res/values/strings.xml | 1 + 12 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 app/src/main/java/com/example/android/cz2006androidproject/TabHostSchedule.java create mode 100644 app/src/main/res/layout/activity_tab_host_schedule.xml create mode 100644 app/src/main/res/menu/menu_tab_host_schedule.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..4691897 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/app.iml b/app/app.iml index f773878..423ac8e 100644 --- a/app/app.iml +++ b/app/app.iml @@ -86,6 +86,7 @@ + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c5f14db..4d829f6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -29,6 +29,10 @@ android:name=".ViewSchedule" android:label="@string/title_activity_view_schedule" > + + diff --git a/app/src/main/java/com/example/android/cz2006androidproject/ScheduleAdapter.java b/app/src/main/java/com/example/android/cz2006androidproject/ScheduleAdapter.java index f384c66..56c67a3 100644 --- a/app/src/main/java/com/example/android/cz2006androidproject/ScheduleAdapter.java +++ b/app/src/main/java/com/example/android/cz2006androidproject/ScheduleAdapter.java @@ -25,11 +25,11 @@ public View getView(int position, View convertView,ViewGroup parent){ View theView = theInflater.inflate(R.layout.activity_view_schedule, parent, false); String places = getItem(position); - TextView theTextView = (TextView) theView.findViewById(R.id.textView1); + TextView theTextView = (TextView) theView.findViewById(R.id.Placename); theTextView.setText(places); - ImageView theImageView =(ImageView) theView.findViewById(R.id.imageView1); + ImageView theImageView =(ImageView) theView.findViewById(R.id.weatherlogo); theImageView.setImageResource(logos[position]); return theView; } diff --git a/app/src/main/java/com/example/android/cz2006androidproject/TabHostSchedule.java b/app/src/main/java/com/example/android/cz2006androidproject/TabHostSchedule.java new file mode 100644 index 0000000..ece89d1 --- /dev/null +++ b/app/src/main/java/com/example/android/cz2006androidproject/TabHostSchedule.java @@ -0,0 +1,51 @@ +package com.example.android.cz2006androidproject; + +import android.app.TabActivity; +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.TabHost; + +public class TabHostSchedule extends TabActivity { + TabHost tabHost; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_tab_host_schedule); + tabHost = getTabHost(); + + TabHost.TabSpec ts1 = tabHost.newTabSpec("page1"); + ts1.setIndicator("List View"); + ts1.setContent(new Intent(this, displayListView.class)); + tabHost.addTab(ts1); + TabHost.TabSpec ts2 = tabHost.newTabSpec("page2"); + ts2.setIndicator("ETC"); + ts2.setContent(new Intent(this, calendar.class)); + tabHost.addTab(ts2); + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_tab_host_schedule, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/example/android/cz2006androidproject/calendar.java b/app/src/main/java/com/example/android/cz2006androidproject/calendar.java index d0ed872..a0b5389 100644 --- a/app/src/main/java/com/example/android/cz2006androidproject/calendar.java +++ b/app/src/main/java/com/example/android/cz2006androidproject/calendar.java @@ -20,11 +20,19 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_calendar); cal = (CalendarView) findViewById(R.id.calendar); + cal.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + } + }); + cal.setOnDateChangeListener(new CalendarView.OnDateChangeListener() { @Override public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) { Toast.makeText(getApplicationContext(), dayOfMonth + "/" + (month+1) + "/" + year, Toast.LENGTH_LONG).show(); + } }); } @@ -62,7 +70,7 @@ public void homePageClicked(View view) { //Move to SearchPage public void searchPageClicked(View view) { - Intent intent = new Intent(calendar.this, search.class); + Intent intent = new Intent(calendar.this, TabHostSchedule.class); startActivity(intent); } } diff --git a/app/src/main/java/com/example/android/cz2006androidproject/displayListView.java b/app/src/main/java/com/example/android/cz2006androidproject/displayListView.java index bf46336..f504907 100644 --- a/app/src/main/java/com/example/android/cz2006androidproject/displayListView.java +++ b/app/src/main/java/com/example/android/cz2006androidproject/displayListView.java @@ -29,10 +29,10 @@ protected void onCreate(Bundle savedInstanceState) { theListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, int position, long l) { - String Placekicked ="Detail" + + String Placepicked ="Detail" + String.valueOf(adapterView.getItemAtPosition(position)); - Toast.makeText(displayListView.this, Placekicked, Toast.LENGTH_SHORT).show(); + Toast.makeText(displayListView.this, Placepicked, Toast.LENGTH_SHORT).show(); } }); diff --git a/app/src/main/res/layout/activity_tab_host_schedule.xml b/app/src/main/res/layout/activity_tab_host_schedule.xml new file mode 100644 index 0000000..08e4f53 --- /dev/null +++ b/app/src/main/res/layout/activity_tab_host_schedule.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_view_schedule.xml b/app/src/main/res/layout/activity_view_schedule.xml index bdf92a3..9df4d1f 100644 --- a/app/src/main/res/layout/activity_view_schedule.xml +++ b/app/src/main/res/layout/activity_view_schedule.xml @@ -3,17 +3,17 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" - tools:context="com.example.windows7.schedule.MainActivity"> + tools:context="com.example.android.cz2006androidproject.displayListView"> + android:id ="@+id/weatherlogo"/> diff --git a/app/src/main/res/menu/menu_tab_host_schedule.xml b/app/src/main/res/menu/menu_tab_host_schedule.xml new file mode 100644 index 0000000..c450f98 --- /dev/null +++ b/app/src/main/res/menu/menu_tab_host_schedule.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 07f2ffb..e188a5c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -5,4 +5,5 @@ Settings calendar ViewSchedule + TabHostSchedule