chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

電子發(fā)燒友App

硬聲App

掃碼添加小助手

加入工程師交流群

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示
創(chuàng)作
電子發(fā)燒友網(wǎng)>電子資料下載>電子資料>ThinkMap Android簡易思維導(dǎo)圖控件

ThinkMap Android簡易思維導(dǎo)圖控件

2022-05-20 | zip | 0.59 MB | 次下載 | 2積分

資料介紹

授權(quán)協(xié)議 GPL
開發(fā)語言 Kotlin Java
軟件類型 開源軟件
所屬分類 手機/移動開發(fā)、 Android UI 組件

軟件簡介

實現(xiàn)Android端的簡易思維導(dǎo)圖。可以保存數(shù)據(jù)。編輯樹形圖。

poYBAGJ2P_mATIRPAAKrZeFgCtQ448.png

建立模型

主要模型結(jié)構(gòu)相對簡單:TreeModel,NoteModel,NoteView,TreeView。

核心實現(xiàn)分布如下:

  • TreeModel:樹形結(jié)構(gòu)的存儲,樹形結(jié)構(gòu)的遍歷,添加、刪除節(jié)點;

  • NoteModel:節(jié)點關(guān)聯(lián)的指向,和Parent的指向;

  • TreeView :繪制樹形結(jié)構(gòu),對樹形結(jié)構(gòu)位置的糾正,實現(xiàn)View層的添加,刪除,note關(guān)聯(lián)繪制;

  • NoteView:顯示text;

?

編寫位置計算核心代碼

在核心代碼中,我想和大家分享的是TreeView如何對多種Style(樹形形狀)進行適配的問題。因為我們的樹形結(jié)構(gòu)的表達多種的,有的是一個半樹形圖,有點是圓形展開的等。對于這個問題,作為程序員如何進行解耦能,采用Interface進行解構(gòu)適配,統(tǒng)一行為。所以在這里我寫了一個TreeLayoutManager進行管理樹形的位置表達。這里我實現(xiàn)了一個RightTreeLayoutManager。代碼概況如下:

接口

public?interface?TreeLayoutManager?{
????/**
?????*?進行樹形結(jié)構(gòu)的位置計算
?????*/
????void?onTreeLayout(TreeView?treeView);
????/**
?????*?位置分布好后的回調(diào),用于確認ViewGroup的大小
?????*/
????ViewBox?onTreeLayoutCallBack();
????/**
?????*?修正位置
?????*
?????*?@param?treeView
?????*?@param?next
?????*/
????void?correctLayout(TreeView?treeView,?NodeView?next);
}

?

實現(xiàn)

public?class?RightTreeLayoutManager?implements?TreeLayoutManager{
????final?int?msg_standard_layout?=?1;
????final?int?msg_correct_layout?=?2;
????final?int?msg_box_call_back?=?3;
????private?ViewBox?mViewBox;
????private?int?mDy;
????private?int?mDx;
????private?int?mHeight;
????public?RightTreeLayoutManager(int?dx,?int?dy,?int?height)?{
????????mViewBox?=?new?ViewBox();
????????this.mDx?=?dx;
????????this.mDy?=?dy;
????????this.mHeight?=?height;
????}
????@Override
????public?void?onTreeLayout(final?TreeView?treeView)?{
????????final?TreeModel?mTreeModel?=?treeView.getTreeModel();
????????if?(mTreeModel?!=?null)?{
????????????View?rootView?=?treeView.findNodeViewFromNodeModel(mTreeModel.getRootNode());
????????????if?(rootView?!=?null)?{
????????????????rootTreeViewLayout((NodeView)?rootView);
????????????}
????????????mTreeModel.addForTreeItem(new?ForTreeItem>()?{
????????????????@Override
????????????????public?void?next(int?msg,?NodeModel?next)?{
????????????????????doNext(msg,?next,?treeView);
????????????????}
????????????});
????????????//基本布局
????????????mTreeModel.ergodicTreeInWith(msg_standard_layout);
????????????//糾正
????????????mTreeModel.ergodicTreeInWith(msg_correct_layout);
????????????mViewBox.clear();
????????????mTreeModel.ergodicTreeInDeep(msg_box_call_back);
????????}
????}
????@Override
????public?ViewBox?onTreeLayoutCallBack()?{
????????if?(mViewBox?!=?null)?{
????????????return?mViewBox;
????????}?else?{
????????????return?null;
????????}
????}
????/**
?????*?布局糾正
?????*
?????*?@param?treeView
?????*?@param?next
?????*/
????public?void?correctLayout(TreeView?treeView,?NodeView?next)?{
??????????????//主要是糾正對于標準布局出現(xiàn)的錯誤,譬如,在圖片糾正中的那種情況
?????????????//糾正需要對同層的Note進行拉伸
????}
????/**
?????*?標準分布
?????*
?????*?@param?treeView
?????*?@param?rootView
?????*/
????private?void?standardLayout(TreeView?treeView,?NodeView?rootView)?{
????????????????//標準分布主要是在基于root節(jié)點進行排開
????????????????//對于奇數(shù)和偶數(shù)不同的情況進行排開
????????????????//中間向外計算位置
????}
????/**
?????*?移動
?????*
?????*?@param?rootView
?????*?@param?dy
?????*/
????private?void?moveNodeLayout(TreeView?superTreeView,?NodeView?rootView,?int?dy)?{
????????????????//如果一個note節(jié)點進行了移動,那么它
????????????????//會影響到它的子節(jié)點的位置。
????????????????//所以要進行重新計算,把它的所有的Note位置進行位移????????
????}
????/**
?????*?root節(jié)點的定位
?????*
?????*?@param?rootView
?????*/
????private?void?rootTreeViewLayout(NodeView?rootView)?{
????????int?lr?=?mDy;
????????int?tr?=?mHeight?/?2?-?rootView.getMeasuredHeight()?/?2;
????????int?rr?=?lr?+?rootView.getMeasuredWidth();
????????int?br?=?tr?+?rootView.getMeasuredHeight();
????????rootView.layout(lr,?tr,?rr,?br);
????}
}

?

View的連線

要實現(xiàn)對View和View的連線,只要在View的位置定了之后,就進行畫線即可。用Sketch畫個演示如下:

pYYBAGJ2P_2AIMyBAAAtGqmqqQ8437.png

其中線為一個貝塞爾曲線。代碼如下:

????@Override
????protected?void?dispatchDraw(Canvas?canvas)?{
????????if?(mTreeModel?!=?null)?{
????????????drawTreeLine(canvas,?mTreeModel.getRootNode());
????????}
????????super.dispatchDraw(canvas);
????}
????/**
?????*?繪制樹形的連線
?????*
?????*?@param?canvas
?????*?@param?root
?????*/
????private?void?drawTreeLine(Canvas?canvas,?NodeModel?root)?{
????????NodeView?fatherView?=?(NodeView)?findNodeViewFromNodeModel(root);
????????if?(fatherView?!=?null)?{
????????????LinkedList>?childNodes?=?root.getChildNodes();
????????????for?(NodeModel?node?:?childNodes)?{
????????????????//連線
????????????????drawLineToView(canvas,?fatherView,?findNodeViewFromNodeModel(node));
????????????????//遞歸
????????????????drawTreeLine(canvas,?node);
????????????}
????????}
????}
????/**
?????*?繪制兩個View直接的連線
?????*
?????*?@param?canvas
?????*?@param?from
?????*?@param?to
?????*/
????private?void?drawLineToView(Canvas?canvas,?View?from,?View?to)?{
????????if?(to.getVisibility()?==?GONE)?{
????????????return;
????????}
????????Paint?paint?=?new?Paint();
????????paint.setAntiAlias(true);
????????paint.setStyle(Paint.Style.STROKE);
????????float?width?=?2f;
????????paint.setStrokeWidth(dp2px(mContext,?width));
????????paint.setColor(mContext.getResources().getColor(R.color.chelsea_cucumber));
????????int?top?=?from.getTop();
????????int?formY?=?top?+?from.getMeasuredHeight()?/?2;
????????int?formX?=?from.getRight();
????????int?top1?=?to.getTop();
????????int?toY?=?top1?+?to.getMeasuredHeight()?/?2;
????????int?toX?=?to.getLeft();
????????Path?path?=?new?Path();
????????path.moveTo(formX,?formY);
????????path.quadTo(toX?-?dp2px(mContext,?15),?toY,?toX,?toY);
????????canvas.drawPath(path,?paint);
????}

?

位置的糾正流程

位置糾正的問題;在對于我之前的位置的算法探索流程如下圖,關(guān)鍵是寫好已知的代碼,之后糾正。

poYBAGJ2P_-AchqiAAHJTEkaJXg611.png

poYBAGJ2QAKAYAHnAACsa_zuYyI888.png

?

pYYBAGJ2QBqAMdldAADn2M6Fx_0549.png

?

Android 開源 控件
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評論

查看更多

下載排行

本周

  1. 1新一代網(wǎng)絡(luò)可視化(NPB 2.0)
  2. 3.40 MB  |  1次下載  |  免費
  3. 2冷柜-電氣控制系統(tǒng)講解
  4. 13.68 MB   |  1次下載  |  10 積分
  5. 3MDD品牌三極管MMBT3906數(shù)據(jù)手冊
  6. 2.33 MB  |  次下載  |  免費
  7. 4MDD品牌三極管S9012數(shù)據(jù)手冊
  8. 2.62 MB  |  次下載  |  免費
  9. 5LAT1218 如何選擇和設(shè)置外部晶體適配 BlueNRG-X
  10. 0.60 MB   |  次下載  |  3 積分
  11. 6LAT1216 Blue NRG-1/2 系列芯片 Flash 操作與 BLE 事件的互斥處理
  12. 0.89 MB   |  次下載  |  3 積分
  13. 7收音環(huán)繞擴音機 AVR-1507手冊
  14. 2.50 MB   |  次下載  |  免費
  15. 8MS1000TA 超聲波測量模擬前端芯片技術(shù)手冊
  16. 0.60 MB   |  次下載  |  免費

本月

  1. 1愛華AIWA HS-J202維修手冊
  2. 3.34 MB   |  37次下載  |  免費
  3. 2PC5502負載均流控制電路數(shù)據(jù)手冊
  4. 1.63 MB   |  23次下載  |  免費
  5. 3NB-IoT芯片廠商的資料說明
  6. 0.31 MB   |  22次下載  |  1 積分
  7. 4UWB653Pro USB口測距通信定位模塊規(guī)格書
  8. 838.47 KB  |  5次下載  |  免費
  9. 5蘇泊爾DCL6907(即CHK-S007)單芯片電磁爐原理圖資料
  10. 0.04 MB   |  4次下載  |  1 積分
  11. 6蘇泊爾DCL6909(即CHK-S009)單芯片電磁爐原理圖資料
  12. 0.08 MB   |  2次下載  |  1 積分
  13. 7100W準諧振反激式恒流電源電路圖資料
  14. 0.09 MB   |  2次下載  |  1 積分
  15. 8FS8025B USB的PD和OC快充協(xié)議電壓誘騙控制器IC技術(shù)手冊
  16. 1.81 MB   |  1次下載  |  免費

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935137次下載  |  10 積分
  3. 2開源硬件-PMP21529.1-4 開關(guān)降壓/升壓雙向直流/直流轉(zhuǎn)換器 PCB layout 設(shè)計
  4. 1.48MB  |  420064次下載  |  10 積分
  5. 3Altium DXP2002下載入口
  6. 未知  |  233089次下載  |  10 積分
  7. 4電路仿真軟件multisim 10.0免費下載
  8. 340992  |  191439次下載  |  10 積分
  9. 5十天學會AVR單片機與C語言視頻教程 下載
  10. 158M  |  183353次下載  |  10 積分
  11. 6labview8.5下載
  12. 未知  |  81602次下載  |  10 積分
  13. 7Keil工具MDK-Arm免費下載
  14. 0.02 MB  |  73822次下載  |  10 積分
  15. 8LabVIEW 8.6下載
  16. 未知  |  65991次下載  |  10 積分