Android Open Source - FlangeAssist Welding Frag






From Project

Back to project page FlangeAssist.

License

The source code is released under:

MIT License

If you think the Android project FlangeAssist listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.atasoft.flangeassist.fragments;
/*from   w ww. j a  v a 2s  .  co m*/
import android.os.*;
import android.support.v4.app.*;
import android.view.*;
import android.widget.*;
import com.atasoft.flangeassist.*;

public class WeldingFrag extends Fragment implements NumberPicker.OnValueChangeListener
{
    View thisFrag;

  @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.welding_reference, container, false);
        this.thisFrag = v;

    setupElectrodeViews();
    //setupSymbolViews();
    return v;
    }
  
  @Override
  public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
      //switch(picker.getId()){}
    updateElectrodeOutputs();
    
  }
  
  //-------------------Weld Electrodes Functions-----------
  public static final String[][] STRENGTHS = new String[][] {
    {"60","70","80", "90", "100", "110", "120"},
    {"60,000 PSI (CSA 43 MPa)", 
    "70,000 PSI (CSA 49 MPa)", 
    "80,000 PSI (CSA 55 MPa)",
    "90,000 PSI (CSA 62 MPa)",
    "100,000 PSI (CSA 69 MPa)",
    "110,000 PSI (CSA 76 MPa)",
    "120,000 PSI (CSA 83 MPa)"}};
  public static final String[][] POSITIONS = new String[][] {
    {"1","2","3"},
    {"All Positions", "Flat and Horizontal", "Flat Only"}};
  public static final String[][] COATINGS = new String[][] {
    {"0","1","2","3","4","5","6","7","8"},
    {"High Cellulose Sodium.",
    "High Cellulose Potassium.",
    "High Titania Sodium.",
    "High Titania Potassium.",
    "Iron Powder Titania.",
    "Low Hydrogen Sodium.",
    "Low Hydrogen Potassium.",
    "Iron Powder, Iron Oxide.",
    "Iron Powder Low Hydrogen."},
    {"DCRP", "AC, DCSP", "AC, DCSP", "AC, DCRP", "AC, DCRP, DCSP", "DCRP", "AC, DCRP", "AC, DCRP, DCSP", "AC, DCRP"}
  };
  public static final String footNotes = 
    "*DCRP = Reverse Polarity (Electrode +ve).\n*DCSP = Straight Polarity (Electrode -ve)";
  public static final String EXCEPTION = "AC, DCRP, DCSP"; //xx20
    
  private NumberPicker strengthPicker;
  private NumberPicker positionPicker;
  private NumberPicker coatingPicker;
  //private NumberPicker suffixPicker;
  private TextView strengthBlurb;
  private TextView positionBlurb;
  private TextView coatingBlurb;
  private TextView polarityBlurb;
  private TextView footNoteText;
  private void setupElectrodeViews() {
    this.strengthPicker = (NumberPicker) thisFrag.findViewById(R.id.weld_strength_picker);
    this.positionPicker = (NumberPicker) thisFrag.findViewById(R.id.weld_position_picker);
    this.coatingPicker = (NumberPicker) thisFrag.findViewById(R.id.weld_coating_picker);
    //this.suffixPicker = (NumberPicker) thisFrag.findViewById(R.id.weld_suffix_picker);
    this.strengthBlurb = (TextView) thisFrag.findViewById(R.id.weld_strengthBlurb);
    this.positionBlurb = (TextView) thisFrag.findViewById(R.id.weld_positionBlurb);
    this.coatingBlurb = (TextView) thisFrag.findViewById(R.id.weld_coatingBlurb);
    this.polarityBlurb = (TextView) thisFrag.findViewById(R.id.weld_polarityBlurb);
    this.footNoteText = (TextView) thisFrag.findViewById(R.id.weld_footNotes);
    
    footNoteText.setText(footNotes);
    
    setPicker(strengthPicker, STRENGTHS[0]);
    setPicker(positionPicker, POSITIONS[0]);
    setPicker(coatingPicker, COATINGS[0]);
    
    strengthPicker.setOnValueChangedListener(this);
    positionPicker.setOnValueChangedListener(this);
    coatingPicker.setOnValueChangedListener(this);
    
    updateElectrodeOutputs();
    return;
  }
  
  private void setPicker(NumberPicker picker, String[] strings){
    picker.setMinValue(0);
    picker.setMaxValue(strings.length - 1);
    picker.setDisplayedValues(strings);
    picker.setWrapSelectorWheel(false);
  }
  
  private void updateElectrodeOutputs(){
    int coatingVal = coatingPicker.getValue();
    int posVal = positionPicker.getValue();
    //xx20, (posVal[1] = "2")
    String polarityString = (posVal == 1 && coatingVal == 0) ? EXCEPTION : COATINGS[2][coatingVal];
    
    strengthBlurb.setText(STRENGTHS[1][strengthPicker.getValue()]);  
    positionBlurb.setText(POSITIONS[1][posVal]);
    coatingBlurb.setText(COATINGS[1][coatingVal]);
    polarityBlurb.setText(polarityString);
  }
  
  //-----------------Weld Symbol Generator Functions---------------
  
  public class SymbolChunk{
    public static final int SURFACE = 0;
    public static final int FILLET = 1;
    public static final int PLUG = 2;
    public static final int SQUARE = 3;
    public static final int VPREP = 4;
    public static final int BEVEL = 6;
    public static final int UPREP = 7;
    public static final int JPREP = 8;
    public static final int FLAREV = 9;
    public static final int FLAREBEV = 10;
    
    public final String[] NAME_STRINGS = {"Surface Weld", "Fillet Weld", "Plug Weld", "Square Weld", 
      "V-Groove", "Bevel Weld", "U-Groove", "J-Groove", "Flared V", "Flared Bevel"};
    
    public final String[] FILLET_SUBS = {
      "Weld Throat", "Weld Length", "Distance Between Welds"};
      
    public final String[] GROOVE_SUBS = {
      "Prep Depth", "Weld Size", "Angle", "Melt Through", "Backing Bar"
    };
    
    public final String[] SQUARE_SUBS = {
      "Weld Size", "Gap Width" 
    };
    
    String[] subs = null;
      
    //String[] subOptions; //children symbols
    boolean canDouble = false;  //weld both sides
    
    public SymbolChunk(int type){
      if(type == VPREP || type == FILLET || type == BEVEL)
        this.canDouble = true;
      
      switch(type){
      case SURFACE:
        
        break;
        
      }
    }
  }
  
  /*
  LinearLayout symbolLinear;
  ArrayList<Spinner> spinnerStack;
  private void setupSymbolViews(){
    this.symbolLinear = (LinearLayout) thisFrag.findViewById(R.id.symbol_linear);
    
    
    return;
  }
  
  private void addSpinnerToStack(SymbolChunk spinHold){
    
  }
  */
  
}




Java Source Code List

com.atasoft.adapters.ExListAd.java
com.atasoft.adapters.ExpandableGroup.java
com.atasoft.adapters.TabsPagerAdapter.java
com.atasoft.flangeassist.FragFramer.java
com.atasoft.flangeassist.MainActivity.java
com.atasoft.flangeassist.PreferenceMenu.java
com.atasoft.flangeassist.ToolsActivity.java
com.atasoft.flangeassist.fragments.AboutFragment.java
com.atasoft.flangeassist.fragments.CashCounter.java
com.atasoft.flangeassist.fragments.FlangeFragment.java
com.atasoft.flangeassist.fragments.HallFragment.java
com.atasoft.flangeassist.fragments.NozzleCalc.java
com.atasoft.flangeassist.fragments.PaychequeFragment.java
com.atasoft.flangeassist.fragments.RigTrig.java
com.atasoft.flangeassist.fragments.ShapeCalcFrag.java
com.atasoft.flangeassist.fragments.TorqueFragment.java
com.atasoft.flangeassist.fragments.UnitConFragment.java
com.atasoft.flangeassist.fragments.WageCPIEstimate.java
com.atasoft.flangeassist.fragments.WeldingFrag.java
com.atasoft.helpers.AtaMathUtils.java
com.atasoft.helpers.AtaTimePicker.java
com.atasoft.helpers.ConvDataHold.java
com.atasoft.helpers.JsonPuller.java
com.atasoft.helpers.ShapeCalcHold.java
com.atasoft.helpers.TaxManager.java