Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeView纵向排列 #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
.idea/gradle.xml
.idea/misc.xml
.idea/runConfigurations.xml
local.properties
/.idea
2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
### Draw a tree in android,ThinkMap

<image src="./info2.png"/>

<image src="./info3.png"/>
<image src="./info4.png"/>
### The Simple code

following the simple code, you can build a tree.
Expand Down Expand Up @@ -47,10 +48,16 @@ following the simple code, you can build a tree.
int dx = DensityUtils.dp2px(this, 20);
int dy = DensityUtils.dp2px(this, 20);
int mHeight = DensityUtils.dp2px(this, 720);


//横向排列(从左到右)
testTreeView.setMode(OrntModel.RIGHT)
testTreeView.setTreeLayoutManager(new RightTreeLayoutManager(dx, dy, mHeight));
testTreeView.setTreeModel(tree);

//纵向排列(从上到下)
testTreeView.setMode(OrntModel.BOTTOM);
testTreeView.setTreeLayoutManager(new BottomTreeLayoutManager(dx, dy, screenHeight));

testTreeView.setTreeModel(tree);
```


Expand Down
2 changes: 1 addition & 1 deletion ThinkMap.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="JDK" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
36 changes: 18 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ android {
storePassword 'owant123456'
}
}
compileSdkVersion 26
buildToolsVersion "26.0.1"
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.owant.thinkmap"
minSdkVersion 15
targetSdkVersion 26
minSdkVersion 16
targetSdkVersion 28
versionCode 10
versionName "1.0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -26,7 +26,7 @@ android {
applicationIdSuffix ".debug"
manifestPlaceholders = [app_name: "ThinkMap_Debug"]
//示例版本,用于判断是否需要更新示例
resValue("string", "examplesVersion", "v1.0.5")
resValue("string", "examplesVersion", "v1.0.6")
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Expand All @@ -37,7 +37,7 @@ android {
applicationIdSuffix ".debug"
manifestPlaceholders = [app_name: "ThinkMap_Debug"]
//示例版本,用于判断是否需要更新示例
resValue("string", "examplesVersion", "v1.0.5")
resValue("string", "examplesVersion", "v1.0.6")
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand All @@ -46,22 +46,22 @@ android {


ext {
support_version = "25.3.1"
support_version = "28.0.0"
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.nineoldandroids:library:2.4.0'
compile 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
compile "com.android.support:appcompat-v7:${support_version}"
compile "com.android.support:cardview-v7:${support_version}"
compile "com.android.support:recyclerview-v7:${support_version}"
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
implementation "com.android.support:appcompat-v7:${support_version}"
implementation "com.android.support:cardview-v7:${support_version}"
implementation "com.android.support:recyclerview-v7:${support_version}"
//leak检测
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/owant/thinkmap/model/OrntModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.owant.thinkmap.model;

/**
* Created by zm on 2019-12-18.
*/
public enum OrntModel {
/**
*
*/
RIGHT,
/**
*
*/
BOTTOM
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
import com.owant.thinkmap.R;
import com.owant.thinkmap.base.BaseActivity;
import com.owant.thinkmap.model.NodeModel;
import com.owant.thinkmap.model.OrntModel;
import com.owant.thinkmap.model.TreeModel;
import com.owant.thinkmap.ui.EditAlertDialog;
import com.owant.thinkmap.util.AndroidUtil;
import com.owant.thinkmap.util.DensityUtils;
import com.owant.thinkmap.util.LOG;
import com.owant.thinkmap.view.BottomTreeLayoutManager;
import com.owant.thinkmap.view.RightTreeLayoutManager;
import com.owant.thinkmap.view.TreeView;
import com.owant.thinkmap.view.TreeViewItemClick;
Expand Down Expand Up @@ -116,7 +118,14 @@ public void onClick(View v) {
int dx = DensityUtils.dp2px(getApplicationContext(), 20);
int dy = DensityUtils.dp2px(getApplicationContext(), 20);
int screenHeight = DensityUtils.dp2px(getApplicationContext(), 720);
editMapTreeView.setTreeLayoutManager(new RightTreeLayoutManager(dx, dy, screenHeight));

//TODO 设置横向排列(从左到右)
// editMapTreeView.setMode(OrntModel.RIGHT);
// editMapTreeView.setTreeLayoutManager(new RightTreeLayoutManager(dx, dy, screenHeight));
//TODO 设置纵向排列(从上到下)
editMapTreeView.setMode(OrntModel.BOTTOM);
editMapTreeView.setTreeLayoutManager(new BottomTreeLayoutManager(dx, dy, screenHeight));


editMapTreeView.setTreeViewItemLongClick(new TreeViewItemLongClick() {
@Override
Expand Down
Loading