Skip to content

Commit 71cdf0c

Browse files
committed
UI
1 parent e0b20a3 commit 71cdf0c

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed

activitytaskview/src/main/java/cc/rome753/activitytask/model/TextViewFractory.java renamed to activitytaskview/src/main/java/cc/rome753/activitytask/model/ViewPool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
import cc.rome753.activitytask.view.ObserverTextView;
1010

11-
public class TextViewFractory {
11+
public class ViewPool {
1212

1313
LinkedList<ObserverTextView> pool = new LinkedList<>();
14-
private static TextViewFractory factory = new TextViewFractory();
15-
public static TextViewFractory get() {
14+
private static ViewPool factory = new ViewPool();
15+
public static ViewPool get() {
1616
return factory;
1717
}
1818

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import android.view.View;
88
import android.view.ViewGroup;
99
import android.view.WindowManager;
10-
import android.widget.FrameLayout;
1110
import android.widget.LinearLayout;
1211

1312
import java.util.ArrayList;
@@ -18,7 +17,7 @@
1817
import cc.rome753.activitytask.R;
1918
import cc.rome753.activitytask.model.ATree;
2019
import cc.rome753.activitytask.model.LifecycleInfo;
21-
import cc.rome753.activitytask.model.TextViewFractory;
20+
import cc.rome753.activitytask.model.ViewPool;
2221

2322
/**
2423
* Created by rome753 on 2017/3/31.
@@ -130,7 +129,7 @@ public void add(LifecycleInfo info) {
130129

131130
public void remove(LifecycleInfo info) {
132131
FragmentTaskView view = findFragmentTaskView(info.activity);
133-
TextViewFractory.get().recycle(view);
132+
ViewPool.get().recycle(view);
134133
mContainer.removeView(view);
135134

136135
aTree.remove(info.task, info.activity);
@@ -143,14 +142,14 @@ public void update(LifecycleInfo info) {
143142
}
144143

145144
private void notifyData() {
146-
TextViewFractory.get().recycle(mLinearLayout);
145+
ViewPool.get().recycle(mLinearLayout);
147146
mLinearLayout.removeAllViews();
148147
Set<Map.Entry<String, ArrayList<String>>> set = aTree.entrySet();
149148
for(Map.Entry<String, ArrayList<String>> entry : set) {
150149
TaskLayout layout = new TaskLayout(getContext());
151150
layout.setTitle(entry.getKey());
152151
for (String value : entry.getValue()) {
153-
ObserverTextView textView = TextViewFractory.get().getOne(getContext());
152+
ObserverTextView textView = ViewPool.get().getOne(getContext());
154153
textView.setInfoText(value, aTree.getLifecycle(value));
155154
layout.addFirst(textView);
156155
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import cc.rome753.activitytask.model.FTree;
1111
import cc.rome753.activitytask.model.LifecycleInfo;
12-
import cc.rome753.activitytask.model.TextViewFractory;
12+
import cc.rome753.activitytask.model.ViewPool;
1313

1414

1515
/**
@@ -46,12 +46,12 @@ public void update(LifecycleInfo info) {
4646
}
4747

4848
private void notifyData(){
49-
TextViewFractory.get().recycle(this);
49+
ViewPool.get().recycle(this);
5050
removeAllViews();
5151
if(mTree != null){
5252
List<String> strings = mTree.convertToList();
5353
for(String s : strings){
54-
ObserverTextView textView = TextViewFractory.get().getOne(getContext());
54+
ObserverTextView textView = ViewPool.get().getOne(getContext());
5555
String[] arr = s.split(String.valueOf('\u2500')); // -
5656
String name = arr[arr.length - 1];
5757
textView.setInfoText(s, mTree.getLifecycle(name));

activitytaskview/src/main/res/layout/layout_task.xml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools">
55

6-
<androidx.constraintlayout.widget.ConstraintLayout
6+
<LinearLayout
77
android:paddingStart="2dp"
88
android:paddingEnd="2dp"
9+
android:orientation="vertical"
910
android:layout_marginBottom="5dp"
1011
android:layout_width="wrap_content"
1112
android:layout_height="wrap_content">
@@ -15,23 +16,18 @@
1516
android:text="Package@TaskId"
1617
android:textSize="8sp"
1718
android:textColor="#00FF00"
18-
app:layout_constraintTop_toTopOf="parent"
19-
app:layout_constraintStart_toStartOf="parent"
20-
app:layout_constraintEnd_toEndOf="parent"
2119
android:layout_width="wrap_content"
2220
android:layout_height="wrap_content" />
2321

2422
<LinearLayout
2523
android:id="@+id/ll"
2624
android:orientation="vertical"
27-
app:layout_constraintTop_toBottomOf="@id/tv_title"
28-
app:layout_constraintBottom_toBottomOf="parent"
29-
app:layout_constraintStart_toStartOf="parent"
30-
app:layout_constraintEnd_toEndOf="parent"
25+
android:layout_marginStart="5dp"
3126
android:layout_width="wrap_content"
32-
android:layout_height="wrap_content">
27+
android:layout_height="wrap_content"
28+
android:layout_marginLeft="5dp">
3329

3430
</LinearLayout>
3531

36-
</androidx.constraintlayout.widget.ConstraintLayout>
32+
</LinearLayout>
3733
</layout>

activitytaskview/src/main/res/layout/view_activity_task.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
android:id="@+id/view_empty"
2727
android:text="No Activity"
2828
android:textColor="#FFFFFF"
29+
android:padding="5dp"
2930
android:layout_width="wrap_content"
3031
android:layout_height="wrap_content" />
3132

0 commit comments

Comments
 (0)