Add basic DialogFrame support to parking

This commit is contained in:
bspeice 2013-11-13 23:53:53 -05:00
parent 9337d0e111
commit 7edb481d70
4 changed files with 130 additions and 21 deletions

View File

@ -34,14 +34,16 @@
android:layout_height="wrap_content"
android:text="@string/puple_lot"
android:textColor="@color/black"
android1:textColorLink="@color/pressed_unccgameday" />
android1:textColorLink="@color/pressed_unccgameday"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonGreen"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/green_lot"
android1:textColor="@color/black"/>
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
@ -49,73 +51,72 @@
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/silver_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonYellow"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/yellow_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonBlue"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/blue_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonBlack"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/black_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonGold"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/gold_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonWhite"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/white_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonPink"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/pink_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonRed"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/red_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
<RadioButton
android1:id="@+id/radioButtonOrange"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:text="@string/orange_lot"
android1:textColor="@color/black" />
android1:textColor="@color/black"
android:onClick="onRadioButtonClick" />
</RadioGroup>
<Button
android1:id="@+id/button1"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:layout_alignParentBottom="true"
android1:layout_centerHorizontal="true"
android:textColor="@color/black"
android1:text="@string/button_get_lot_info"
android1:textColorLink="@color/pressed_unccgameday" />
</RelativeLayout>

14
res/layout/lot_view.xml Normal file
View File

@ -0,0 +1,14 @@
<?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" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Filled Status:"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

View File

@ -1,8 +1,13 @@
package com.uncc.gameday.activities;
import android.app.FragmentManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.uncc.gameday.R;
import com.uncc.gameday.activities.parking.LotViewFragment;
import com.uncc.gameday.parking.ParkingChoice;
public class Parking extends MenuActivity {
@ -12,4 +17,49 @@ public class Parking extends MenuActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_parking);
}
public void onRadioButtonClick(View v) {
FragmentManager fm = this.getFragmentManager();
LotViewFragment f = new LotViewFragment();
Bundle fBundle = new Bundle();
switch (v.getId()) {
case R.id.radioButtonBlack:
fBundle.putCharArray("CHOICE", ParkingChoice.BLACK.getValue().toCharArray());
break;
case R.id.radioButtonBlue:
fBundle.putCharArray("CHOICE", ParkingChoice.BLUE.getValue().toCharArray());
break;
case R.id.radioButtonGold:
fBundle.putCharArray("CHOICE", ParkingChoice.GOLD.getValue().toCharArray());
break;
case R.id.radioButtonGreen:
fBundle.putCharArray("CHOICE", ParkingChoice.GREEN.getValue().toCharArray());
break;
case R.id.radioButtonOrange:
fBundle.putCharArray("CHOICE", ParkingChoice.ORANGE.getValue().toCharArray());
break;
case R.id.radioButtonPink:
fBundle.putCharArray("CHOICE", ParkingChoice.PINK.getValue().toCharArray());
break;
case R.id.radioButtonPurple:
fBundle.putCharArray("CHOICE", ParkingChoice.PURPLE.getValue().toCharArray());
break;
case R.id.radioButtonRed:
fBundle.putCharArray("CHOICE", ParkingChoice.RED.getValue().toCharArray());
break;
case R.id.radioButtonSilver:
fBundle.putCharArray("CHOICE", ParkingChoice.SILVER.getValue().toCharArray());
break;
case R.id.radioButtonWhite:
fBundle.putCharArray("CHOICE", ParkingChoice.WHITE.getValue().toCharArray());
break;
case R.id.radioButtonYellow:
fBundle.putCharArray("CHOICE", ParkingChoice.YELLOW.getValue().toCharArray());
break;
}
f.setArguments(fBundle);
f.show(fm, "lot_view");
}
}

View File

@ -0,0 +1,44 @@
package com.uncc.gameday.activities.parking;
import com.uncc.gameday.R;
import com.uncc.gameday.parking.ParkingChoice;
import android.app.DialogFragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class LotViewFragment extends DialogFragment {
public LotViewFragment(){
}
private void initializeData(ParkingChoice pc){
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ParkingChoice pc;
Bundle args = this.getArguments();
if (args.containsKey("CHOICE"))
pc = ParkingChoice.valueOf(String.valueOf((char[])args.get("CHOICE")));
else
pc = ParkingChoice.BLACK;
initializeData(pc);
View view = inflater.inflate(R.layout.lot_view, container);
getDialog().setTitle(pc.getValue());
if (view == null)
Log.e("LotViewFragment", "Unable to instantiate view!");
return view;
}
}