1- XML modification Add following tag in your xml. This will assist us in showing list. android:id="@+id/listProject" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="#b5b5b5" android:dividerHeight="1dp" android:listSelector="@drawable/list_selector">
2- Now add Items in list.Create a new *.xml and add below code in it. This xmls define what you want to show in above image We are showing only Project name in the list
// Click event for single list row and send the data to sprint page. list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView parent, View view, int position, long id) {
Intent i = new Intent(); i.setClass(ProjectPageActivity.this, SprintPageActivity.class); // parameters i.putExtra("projectId", projectDataCollection.get(position).get(KEY_PROJECT_ID)); i.putExtra("projectViewId", projectViewId); // start the sample activity startActivity(i); } });
}
catch (Exception ex) { //Toast.makeText(getApplicationContext(), "System Error Please try after some time !!!!!",Toast.LENGTH_SHORT).show(); ex.printStackTrace(); } 4- Create a new class ProjectBinderData
public class ProjectBinderData extends BaseAdapter {
static final String KEY_PROJECT_ID = "KEY_PROJECT_ID"; static final String KEY_PROJECT_NAME= "KEY_PROJECT_NAME";
LayoutInflater inflater; List> projectDataCollection; ViewHolder holder; public ProjectBinderData() { // TODO Auto-generated constructor stub }
public ProjectBinderData(Activity act, List> map) {
1- XML class to tag Deco View element xmlns:custom="http://schemas.android.com/apk/res-auto" custom:dv_lineWidth="5dp" android:id="@+id/dynamicArcView" android:layout_width="100dp" android:layout_height="100dp" android:layout_toRightOf="@+id/tvProjectEndDate" android:layout_above="@+id/projectStatus" android:layout_alignParentTop="true">
2- Make following change in corresponding Activity JAVA class. //Adding the coe to show the graph start
//SeriesItem seriesItem = new SeriesItem.Builder(Color.parseColor("#00B0CA")) SeriesItem seriesItem = new SeriesItem.Builder(Color.parseColor("#e60000")) .setRange(0, 100, 0) .build(); //first 0 indicate start, second 100 indicate we have to cover 100% area of the round graph and thrid 0 indidate current starting point. final DecoView decoView = (com.hookedonplay.decoviewlib.DecoView)vi.findViewById(R.id.dynamicArcView);
final int backIndex = decoView.addSeries(seriesItem);
/*decoView.addEvent(new DecoEvent.Builder(50) .setIndex(backIndex) .build());cmd */ int series1Index = decoView.addSeries(seriesItem);
final TextView textPercentage = (TextView)vi.findViewById(R.id.percentage); final float totalSprint = Float.parseFloat(projectDataCollection.get(position).get(KEY_TOTAL_SPRINT)); final float completedSprint = Float.parseFloat(projectDataCollection.get(position).get(KEY_COMPLETED_SPRINT)); float percentBuild = (completedSprint/totalSprint); //Above code is to calculate perfect % Value that need to be show inside graph decoView.addEvent(new DecoEvent.Builder(percentBuild * 100f) .setIndex(backIndex) .build());
//--------------------------------------------------
class clicker implements Button.OnClickListener
{
public void onClick(View v) {
if("".equals(userNameText1.getText().toString()))
{
Toast.makeText(getApplicationContext(), "Please Enter Name to Search", Toast.LENGTH_SHORT).show();
}else if(null != userNameText1.getText())
{
searchName = userNameText1.getText().toString();
travellerInfoDataTable = (TableLayout) findViewById(R.id.main_table);
travellerInfoDataTable.removeAllViews();
//Create instance for AsyncCallWS
AsyncCallWS task = new AsyncCallWS();
//Call execute
task.execute();
//Create instance for AsyncCallWS for Getting Sprint Task informations
travellerInfoDataTable = (TableLayout) findViewById(R.id.main_table);
travellerInfoDataTable.removeAllViews();
TableRow tr_head = new TableRow(this);
//tr_head.setId(20);
tr_head.setBackgroundColor(Color.GRAY);
tr_head.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
TextView label_list_of_kpi = new TextView(this);
//label_date.setId(20);
label_list_of_kpi.setText("Name");
label_list_of_kpi.setTextColor(Color.BLUE);
label_list_of_kpi.setPadding(5, 5, 5, 5);
tr_head.addView(label_list_of_kpi);// add the column to the table row here
TextView label_actual_kpi_value = new TextView(this);
//label_weight_kg.setId(21);// define id that must be unique
label_actual_kpi_value.setText("Descriptions"); // set the text for the header
label_actual_kpi_value.setTextColor(Color.BLUE); // set the color
label_actual_kpi_value.setPadding(5, 5, 5, 5); // set the padding (if required)
tr_head.addView(label_actual_kpi_value); // add the column to the table row here
travellerInfoDataTable.addView(tr_head, new TableLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
//Create instance for AsyncCallWS
if ((!"".equals(travellerName) && !"Select Data..".equals(travellerName)) && (!"".equals(travellerLocation) && !"Select Data..".equals(travellerLocation))) {
AsyncTravellerInfoCallWS travellerInformation = new AsyncTravellerInfoCallWS();
//Call execute
travellerInformation.execute();
travellerInfoDataTable = (TableLayout) findViewById(R.id.main_table);
travellerInfoDataTable.removeAllViews();
}
}
//System.out.println("soapResponse >>>>>>>>>>>>>>>>>>>>>" + soapResponse);
if (null == soapTravellerResponse) {
Toast.makeText(getApplicationContext(), "No Record Found", Toast.LENGTH_SHORT).show();
} else {
//Fill details of information in Table
// Create the table row
TableRow tr = new TableRow(getApplicationContext());
tr.setBackgroundColor(Color.LTGRAY);
tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
//Create two columns to add as table data
// Create a TextView to add date
TextView labelDropTime = new TextView(getApplicationContext());
labelDropTime.setText("Drop Time");
labelDropTime.setPadding(2, 0, 5, 0);
labelDropTime.setTextColor(Color.BLACK);
tr.addView(labelDropTime);
TextView labelactualDropTime = new TextView(getApplicationContext());
labelactualDropTime.setText(DROP_TIME);
labelactualDropTime.setTextColor(Color.BLACK);
tr.addView(labelactualDropTime);
travellerInfoDataTable.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
TableRow trOne = new TableRow(getApplicationContext());
trOne.setBackgroundColor(Color.LTGRAY);
trOne.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
TextView labelactualLocation= new TextView(getApplicationContext());
labelactualLocation.setText(LOCATION);
labelactualLocation.setTextColor(Color.BLACK);
trSix.addView(labelactualLocation);
// finally add this to the table row
travellerInfoDataTable.addView(trSix, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
TableRow trSeven = new TableRow(getApplicationContext());
trSeven.setBackgroundColor(Color.LTGRAY);
trSeven.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
TextView labelactualCabNo= new TextView(getApplicationContext());
labelactualCabNo.setText(CABNO);
labelactualCabNo.setTextColor(Color.BLACK);
trSeven.addView(labelactualCabNo);
// finally add this to the table row
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "System Error Please try after some time !!!!!",Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
@Override
public void onNothingSelected(AdapterView arg0) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(),"No Value selected" ,Toast.LENGTH_LONG).show();
}
@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_main, 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;
}