使用DSL我可以做类似的事情:
public class BlankFragment extends Fragment
{
ImageView image;
GestureDetector mDetector;
GestureDetector.OnGestureListener gestureListener;
public BlankFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
cr = getActivity().getContentResolver();
mDetector = new GestureDetector(getActivity().getApplicationContext(),new MyFlingGesture());
image = new ImageView(getActivity().getApplicationContext());
image.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
mDetector.onTouchEvent(motionEvent);
return true;
}
});
return image;
}
class MyFlingGesture extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.remove(// what to pass here);
// or what is the other ways?
return super.onFling(e1, e2, velocityX, velocityY);
}
}
}
这很棒。它似乎设置了下游作业的BUILD_NUMBER var。但是,显示名称仍然是增加的自动编号,如果我之后手动启动作业,它将从错误的编号增加编号(不是作为参数传递的编号)。我想还需要另一个动作作为shell脚本或设置BUILD_NUMBER和Displayname的东西,并将其保存在配置中作为nextBuildNumber文件递增。也许这个插件可以提供帮助:
https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin
问题是,是否有更好的方法,或者我应该继续朝同一方向努力?有没有更好的方法将下游作业的内部版本号设置为与构建流程作业相同?