示例#1
0
 public boolean startPlotting(MenuItem v) {
   mapFragment.startPlotting();
   return true;
 }
示例#2
0
  // implement action handlers into fragments
  public boolean donePlotting(MenuItem v) {
    plot.coordinates = mapFragment.onSaveInstanceState();
    plot.plotArea = (float) mapFragment.getPlotArea();

    LayoutInflater layoutInflater =
        (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    plotEditPopoverView = layoutInflater.inflate(R.layout.plot_edit_popover, null);

    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);

    popWindow = new PopupWindow(plotEditPopoverView, size.x - 50, size.y - 500, true);

    popWindow.setFocusable(true);
    popWindow.setOutsideTouchable(true);
    popWindow.setBackgroundDrawable(
        new ColorDrawable(
            Color
                .LTGRAY)); // popWindow.setAnimationStyle(android.R.anim.an); // call this before
                           // showing the popup

    popWindow.showAtLocation(
        findViewById(R.id.main_bar_view),
        Gravity.BOTTOM,
        0,
        150); // 0 - X postion and 150 - Y position

    /*//set up fertilizerSpinner
    Spinner fertilizerSpinner;
    try{
        fertilizerSpinner = (Spinner)findViewById(R.id.fertilizer_spinner);
        // Spinner Drop down elements
        List<String> categories = new ArrayList<String>();
        categories.add("Cow");
        categories.add("Chicken");
        categories.add("Sheep");
        categories.add("Swine");
        categories.add("Urea");

        // Creating adapter for spinner
        ArrayAdapter<String> fertilizerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories);

        fertilizerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Specify the layout to use when the list of choices appears
        fertilizerSpinner.setAdapter(fertilizerAdapter);    // Apply the adapter to the spinner
    } catch (Exception e){
        Log.d("TT","ERROOURURURU : "+e.getLocalizedMessage());
    }

    //set up cropSpinner
    Spinner cropSpinner;
    try{
        cropSpinner = (Spinner)findViewById(R.id.crop_spinner);

        // Spinner Drop down elements
        List<String> categories2 = new ArrayList<String>();
        categories2.add("Corn");
        categories2.add("Rice");
        categories2.add("Grain");
        categories2.add("Soybean");

        // Creating adapter for spinner
        ArrayAdapter<String> cropAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories2);

        cropAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Specify the layout to use when the list of choices appears
        cropSpinner.setAdapter(cropAdapter);    // Apply the adapter to the spinner
    } catch (Exception e){
        Log.d("TT","ERROOURURURU2222222 : "+e.getLocalizedMessage());
    }
    */

    return true;
  }