Skip to content

Commit f2f99f7

Browse files
committed
Put special signs in resource
1 parent 152fe90 commit f2f99f7

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

activitytaskview/src/main/java/cc/rome753/activitytask/model/STree.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@
1111
*/
1212
public class STree {
1313

14+
private String tab1, tab2, tab3;
15+
1416
private STNode root;
1517

1618
public STree() {
1719
root = new STNode("");
1820
}
1921

22+
public void setTabs(String tab1, String tab2, String tab3){
23+
this.tab1 = tab1;
24+
this.tab2 = tab2;
25+
this.tab3 = tab3;
26+
}
27+
2028
public void add(LinkedList<String> list) {
2129
STNode node = root;
2230
while (!list.isEmpty()) {
@@ -49,16 +57,15 @@ public List<String> convertToList(){
4957

5058
private void convert(List<String> res, STNode node, String pre, boolean end){
5159
if(node != root){
52-
StringBuilder sb = new StringBuilder(pre);
53-
sb.append(end ? "└─" : "├─");
54-
sb.append(node.name);
55-
res.add(sb.toString());
60+
String s = pre + (end ? tab2 : tab3) +
61+
node.name;
62+
res.add(s);
5663
}
5764
int i = 0;
5865
for(Map.Entry<String, STNode> entry : node.children.entrySet()){
5966
i++;
6067
boolean subEnd = i == node.children.size();
61-
String subPre = pre + (node == root ? "" : (end ? " " : "│ "));
68+
String subPre = pre + (node == root ? "" : (end ? " " : tab1 + " "));
6269
convert(res, entry.getValue(), subPre, subEnd);
6370
}
6471
}

activitytaskview/src/main/java/cc/rome753/activitytask/view/FragmentTreeView.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.List;
1010

1111
import cc.rome753.activitytask.AUtils;
12+
import cc.rome753.activitytask.R;
1213
import cc.rome753.activitytask.model.FragmentInfo;
1314
import cc.rome753.activitytask.model.STree;
1415

@@ -65,6 +66,10 @@ public void onActivityResume(String activityName){
6566
mTree = mAFMap.get(activityName);
6667
if(mTree == null){
6768
mTree = new STree();
69+
mTree.setTabs(
70+
getResources().getString(R.string.tab1),
71+
getResources().getString(R.string.tab2),
72+
getResources().getString(R.string.tab3));
6873
mAFMap.put(activityName, mTree);
6974
}
7075
notifyData();
@@ -83,6 +88,10 @@ public void onFragmentChange(FragmentInfo fragmentInfo){
8388
STree stree = mAFMap.get(parent);
8489
if(stree == null){
8590
stree = new STree();
91+
mTree.setTabs(
92+
getResources().getString(R.string.tab1),
93+
getResources().getString(R.string.tab2),
94+
getResources().getString(R.string.tab3));
8695
mAFMap.put(parent, stree);
8796
}
8897

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
<resources>
22
<string name="app_name">activityTaskView</string>
3+
<string name="tab1">│</string>
4+
<string name="tab2">└─</string>
5+
<string name="tab3">├─</string>
36
</resources>

0 commit comments

Comments
 (0)