congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ChopsticksFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
ChopsticksFactory
in
cn.campusapp.chopsticks

Best Java code snippets using cn.campusapp.chopsticks.ChopsticksFactory (Showing top 7 results out of 315)

origin: campusappcn/chopsticks

/**
 * To get a helper for a view in relative layout
 * The view in the factory should HAS default layout param, usually inflated from xml
 *
 * @return helper to layout isInRelative layout
 */
public RelativeLayoutStick isInRelative() {
  return (RelativeLayoutStick) isInLayout(RelativeLayout.LayoutParams.class, true, 0, 0);
}
origin: campusappcn/chopsticks

/**
 * Choose the right builder stick according to layout params type
 *
 * @param layoutParamsType say {@link android.widget.LinearLayout.LayoutParams}
 * @param useExistingLayoutParams if true, no LayoutParams will be instantiated
 * @param width if not useExistingLayoutParams, new LayoutParams will use this as its width
 * @param height if not useExistingLayoutParams, new LayoutParams will use this as its height
 * @param <LP> the LayoutParam generic type
 * @return the corresponding builder stick
 */
private <LP extends ViewGroup.LayoutParams> Chopstick isInLayout(Class<LP> layoutParamsType, boolean useExistingLayoutParams,
                             int width, int height){
  LP lp = useExistingLayoutParams
      ? useExistingLayoutParams(layoutParamsType)
      : useNewLayoutParams(layoutParamsType, width, height);
  if (RelativeLayout.LayoutParams.class.equals(layoutParamsType)) {
    return new RelativeLayoutStick((RelativeLayout.LayoutParams) lp, mView);
  }
  else if(LinearLayout.LayoutParams.class.equals(layoutParamsType)){
    return new LinearLayoutStick((LinearLayout.LayoutParams)lp, mView);
  }
  throw new UnsupportedOperationException("This Layout is not currently supported. A PR is welcome!");
}
origin: campusappcn/chopsticks

public static ChopsticksFactory chop(@NonNull View view){
  return new ChopsticksFactory(view);
}
origin: campusappcn/chopsticks

chop(findViewById(R.id.top_right)).isInRelative()
    .alignParentTop()
    .alignParentRight()
    .stick();
chop(findViewById(R.id.center)).isInRelative()
    .centerInParent()
    .stick();
chop(findViewById(R.id.below_center_align_left)).isInRelative()
    .below(R.id.center)
    .alignLeft(R.id.center)
chop(findViewById(R.id.center_left_align_top)).isInRelative()
    .toLeftOf(R.id.center)
    .alignTop(R.id.center)
textView.setText("BOTTOM CENTER HORIZONTAL");
textView.setId(R.id.bottom_center_horizontal);
chop(textView).isInRelative(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
    .alignParentBottom()
    .centerHorizontal()
origin: campusappcn/chopsticks

/**
 * To get a helper for a view in relative layout
 * The view in the factory should HAS NO default layout param, usually instantiated programmatically
 *
 * @param width  mostly the {@link ViewGroup.LayoutParams#WRAP_CONTENT} or {@link ViewGroup.LayoutParams#MATCH_PARENT}
 * @param height mostly the {@link ViewGroup.LayoutParams#WRAP_CONTENT} or {@link ViewGroup.LayoutParams#MATCH_PARENT}
 * @return helper to layout isInRelative layout
 */
public RelativeLayoutStick isInRelative(int width, int height){
  return (RelativeLayoutStick) isInLayout(RelativeLayout.LayoutParams.class, false, width, height);
}
origin: campusappcn/chopsticks

public LinearLayoutStick isInLinear(){
  return (LinearLayoutStick) isInLayout(LinearLayout.LayoutParams.class, true, 0, 0);
}
origin: campusappcn/chopsticks

public LinearLayoutStick isInLinear(int width, int height){
  return (LinearLayoutStick) isInLayout(LinearLayout.LayoutParams.class, false, width, height);
}
cn.campusapp.chopsticksChopsticksFactory

Javadoc

Factory to get the builder should be used according to parent layout type Created by nius on 10/9/15.

Most used methods

  • <init>
  • isInLayout
    Choose the right builder stick according to layout params type
  • isInRelative
    To get a helper for a view in relative layout The view in the factory should HAS NO default layout p
  • useExistingLayoutParams
  • useNewLayoutParams

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • setRequestProperty (URLConnection)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JFileChooser (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now