PlantUML 使用


用了一款android studio的 画图插件,觉得还行,推荐给大家下。        

安装方式:
首先安装好 Graphviz,然后安装 android studio 插件即可

详细使用网址:
http://plantuml.com/classes.html (官网)
http://archive.3zso.com/archives/plantuml-quickstart.html (快速指南) 

上效果图:


     

画图的代码如下:
@startuml


interface LScreen
interface LScreenContainer
abstract class LScreenImpl
class LScreenManager
abstract class UIModule


interface LScreen{
    View getScreenView();
    void setOnTouchListener(OnTouchListener var1);
    void onShowScreen();
    void onBackPressed();
    void onCreate(Bundle var1, Intent var2);
    void onStart();
    void onHideScreen();
    void onScroll(float var1);
    void onResume();
    void onPause();
    void onStop();
    void onDestroy();
    void onSaveInstanceState(Bundle var1);
    void onRestoreInstanceState(Bundle var1);
    void onActivityResult(int var1, int var2, Intent var3);
    void onRequestPermissionsResult(int var1, String[] var2, int[] var3);
}

interface LScreenContainer{
    Context getContext();
    void registCallBack(LifeCycleCallBack callBack);
    void unregistCallBack(LifeCycleCallBack callBack);
    void runNUITask(Runnable run);
    void runUiTask(Runnable run);
    void doRefreshAll();
}


abstract class LScreenImpl{
    private final ArrayList<LifeCycleCallBack> mActivityLifecycleCallbacks = new ArrayList<LifeCycleCallBack>();
    private Context context;
    private Handler handler;
    private Handler nuiHandler;
    private HandlerThread handleThread;
    public LScreenImpl(Context context);
    public Context getContext();
    public void registCallBack(LifeCycleCallBack callBack);
    public void unregistCallBack(LifeCycleCallBack callBack);
    protected abstract List<UIModule<View>> generateModules();
    public final void runNUITask(Runnable run);
    public final void runUiTask(Runnable run);
    public void onCreate(Bundle b, Intent startIntent);
    public void onStart() ;
    public void onResume();
    public void onPause();
    public void onStop() ;
    public void onDestroy() ;
    public void onSaveInstanceState(Bundle bundle);
    public void onRestoreInstanceState(Bundle bundle) ;
    public void onActivityResult(int requestCode, int resultCode, Intent data) ;
    public void onShowScreen();
}


class LScreenManager{
 private List<UIModule<View>> mModules;
 public static LScreenManager getInstance();
 public LScreenManager(Context context);
 public Activity getActivity();
 private void initOneTouchStream();
 public View getScreenView();
 public void onShowScreen();
 public void showScreenAll();
 public void doRefreshAll();
 protected List<UIModule<View>> generateModules()
}


abstract class UIModule<UI>{
   private LScreenContainer mContainer;
   private LifeCycleCallBack mLifecycleCallback;
   protected UIModuleBridge moduleBridge;
    public UIModule(LScreenContainer container);
    public void init();
    public Context getContext();
    public LScreenContainer getContainer();
    protected void runUITask(Runnable run);
    protected void runNUITask(Runnable run);
    public void startActivityForResult(Intent intent, int requestCode);
    public void onCreate(Bundle bundle);
    public void onSaveInstance(Bundle bundle);
    public void onRestoreInstance(Bundle bundle);
    public void onStart();
    public void onPause();
    public void onResume();
    public void onStop();
    public void onDestroy();
    public void onActivityResult(int requestCode, int resultCode, Intent data);
    public void onRefresh()
    public void onShowScreen()
    public abstract UI getUI();
    private void initCallback(LScreenContainer container) ;
    protected void setRefreshComplete(boolean succeed)
    protected void setRefreshComplete(boolean succeed, String errorMsg);
    public void onHideScreen()
    protected void setLoadMoreComplete(boolean hasMore);
    protected void setLoadMoreComplete(boolean hasMore, boolean success, String errorMsg);
    public static interface UIModuleBridge
    protected void reportRefreshResult(boolean success);
}


abstract class AbstractScreenView{
   public AbstractScreenView(LScreenContainer container)
   public boolean isNeedRefresh()
   public void init() //@Override
   public View getUI()
   protected abstract View getContentView()
   protected abstract void initViews(View contentView);
}

abstract class AScreenView{
   ABaseView mBaseView;
   public AScreenView(LScreenContainer container)
   protected View getContentView()
   protected void initViews(View contentView)
   public void onRefresh()
   public void onDestroy()
   protected boolean onBaseViewCacheRefresh()
   abstract protected ABaseView configBaseView(Context context, AbstractScreenView screenView);
   public ABaseView getBaseView()
}

class ABaseView{
   private View mContentView;// 根视图
   View loadingLayout;// 加载中视图
    View loadFailureLayout;// 加载失败视图
    View contentLayout;// 内容视图
    View emptyLayout;// 空视图
    private TaskManager taskManager;// 管理线程
    public ABaseView(Context context)
    public void onRunning();
    public void onDestroy();
    abstract protected int inflateContentView();
    protected void launchFullScreen()
}

interface OnScreenViewCacheRefresh{
   public boolean outofdate(long interval);
    public void refreshCache();// 刷新缓存
}

interface OnScreenPopCallback {
        void onScreenExpand(); // 列表界面展开了
        void onScreenClosed(long duration); //列表界面关掉了
        void onScreenExandPrepare();//开始展开
        void onScreenClosePrepare(); // 开始关闭
}


enum RefreshMode {
        /**
         * 清空原有所有数据,然后重新拉取pagesize 重设数据
         */
        reset,
        /**
         * 上拉加载更多
         */
        update,
        /**
         *  下拉刷新
         */
        refresh
    }



interface IPaging<T extends Serializable, Ts extends Serializable>{

    public IPaging<T, Ts> newInstance(); //重设参数
    /**
     * 处理数据
     *
     * @param newDatas  新获取的数据集合
     * @param firstData adapter数据集中的第一条数据
     * @param lastData  adapter数据集中的最后一条数据
     */
    public void processData(Ts newDatas, T firstData, T lastData);

    public String getPreviousPage();

    public String getNextPage();
}

abstract class APagingView<T extends Serializable, Ts extends Serializable, V extends View> {
    private ABaseAdapter<T> mAdapter;
    protected RefreshConfig refreshConfig;
    IPaging mPaging;
    void _layoutInit(Context context, View contentView)
    abstract public void requestData(RefreshMode mode);
    abstract protected ABaseAdapter.AbstractItemView<T> newItemView();
    protected void configRefresh(RefreshConfig config)
    public void onPullDownToRefresh();
    public void onPullUpToRefresh();
    abstract public void onRefreshViewComplete(RefreshMode mode);
    abstract public AbsListView getRefreshView();
    protected void taskStateChanged(ABaseTaskState state, TaskException exception, RefreshMode mode)
}

abstract class AListView<T extends Serializable, Ts extends Serializable>{
   ListView mListView;
   private View btnToTop;
   protected View mFooterView;
    private ObjectAnimator mRefreshAnim;
    protected int inflateContentView(){} //Override
    void _layoutInit(Context context, View contentView)//Override
    final protected void setInitRefreshView(AbsListView refreshView)
    public void onScrollStateChanged(AbsListView view, int scrollState)  //Override 接口
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) //接口
    public synchronized void onViewClicked(View view)
}


abstract class ASwipeListView<T extends Serializable, Ts extends Serializable> {
   private SwipeRefreshLayout mSwipeRefreshLayout;
   public void onRefresh()
   public void onRefreshViewComplete(RefreshMode mode) //Override
   final protected void setInitRefresh(ListView listView)//Override
   void _layoutInit(Context context, View contentView)
}



class NewsView{
   protected ABaseView configBaseView(Context context, AbstractScreenView screenView)
}


class NewsListView{
   protected int inflateContentView();
}

class NewsBaseView{
   protected int inflateContentView()
   public void requestData()
   public void requestData(ABizLogic.CacheMode mode)
   protected void launchFullScreen()
}


LScreen <|--right LScreenContainer
LScreenContainer <|--right LScreenImpl
LScreenImpl <|-- LScreenManager
LScreenManager o-right- UIModule

legend top
  <b>LScreenManager</b> and <b>UIModule</b>
  是聚合关系
endlegend


UIModule <|-- AbstractScreenView

AbstractScreenView <|-- AScreenView
AScreenView *-right- ABaseView



ABaseView ..up|> OnScreenViewCacheRefresh
ABaseView ..up|> OnScreenPopCallback

ABaseView <|--APagingView
APagingView <|--AListView

APagingView *-left- RefreshMode
APagingView *-left- IPaging

AListView <|--ASwipeListView

AScreenView <|--left NewsView
ASwipeListView <|--right NewsListView
ABaseView <|--right  NewsBaseView

@enduml


        
       

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值