Skip to content

Commit 25e1792

Browse files
committed
add diagnostic panel
1 parent 0883814 commit 25e1792

File tree

5 files changed

+128
-16
lines changed

5 files changed

+128
-16
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dependencies {
4040
implementation 'org.apmem.tools:layouts:1.10@aar'
4141
implementation 'com.makeramen:roundedimageview:2.2.1'
4242
implementation 'com.yqritc:recyclerview-flexibledivider:1.2.9'
43+
implementation 'com.sothree.slidinguppanel:library:3.4.0'
4344

4445
api project(':editor-view')
4546
api project(':terminal-emulator')

app/src/main/java/com/jecelyin/editor/v2/ui/widget/SymbolBarLayout.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ private void init() {
6060
symbol = Preferences.getInstance(getContext()).getSymbol();
6161
}
6262
charList = TextUtils.split(symbol, "\n");
63+
64+
}
65+
66+
@Override
67+
protected void onFinishInflate() {
68+
super.onFinishInflate();
6369
makeItemViews(getContext());
6470
}
6571

app/src/main/res/layout/activity_main.xml

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,65 @@
2323
app:popupTheme="?actionBarPopupTheme" />
2424
</android.support.design.widget.AppBarLayout>
2525

26-
<LinearLayout
26+
<com.sothree.slidinguppanel.SlidingUpPanelLayout
2727
android:layout_width="match_parent"
2828
android:layout_height="match_parent"
29+
android:gravity="bottom"
2930
android:orientation="vertical"
30-
app:layout_behavior="@string/appbar_scrolling_view_behavior">
31+
app:layout_behavior="@string/appbar_scrolling_view_behavior"
32+
app:umanoDragView="@+id/drag_view"
33+
app:umanoFadeColor="@android:color/transparent"
34+
app:umanoInitialState="collapsed"
35+
app:umanoPanelHeight="@dimen/symbol_bar_height">
3136

3237
<android.support.v4.view.ViewPager
3338
android:id="@+id/view_pager"
3439
android:layout_width="match_parent"
35-
android:layout_height="0dp"
36-
android:layout_weight="1" />
40+
android:layout_height="match_parent" />
3741

38-
<HorizontalScrollView
42+
<LinearLayout
3943
android:layout_width="match_parent"
4044
android:layout_height="wrap_content"
41-
android:layout_gravity="bottom"
42-
android:fillViewport="true">
43-
44-
<com.jecelyin.editor.v2.ui.widget.SymbolBarLayout
45-
android:id="@+id/symbolBarLayout"
46-
android:layout_width="wrap_content"
47-
android:layout_height="wrap_content"
48-
android:background="?android:attr/windowBackground"
49-
android:visibility="gone" />
50-
</HorizontalScrollView>
51-
</LinearLayout>
45+
android:orientation="vertical">
46+
47+
<LinearLayout
48+
android:id="@+id/drag_view"
49+
android:layout_width="match_parent"
50+
android:layout_height="@dimen/symbol_bar_height"
51+
android:fillViewport="true"
52+
android:orientation="horizontal">
53+
54+
<com.duy.view.TintImageView
55+
android:id="@+id/btn_toggle_panel"
56+
android:layout_width="@dimen/symbol_bar_height"
57+
android:layout_height="@dimen/symbol_bar_height"
58+
android:scaleType="centerInside"
59+
android:textColor="?android:textColorPrimary"
60+
app:srcCompat="@drawable/ic_keyboard_arrow_up_white_24dp" />
61+
62+
<HorizontalScrollView
63+
android:layout_width="match_parent"
64+
android:layout_height="match_parent">
65+
66+
<com.jecelyin.editor.v2.ui.widget.SymbolBarLayout
67+
android:id="@+id/symbolBarLayout"
68+
android:layout_width="wrap_content"
69+
android:layout_height="match_parent"
70+
android:background="?android:attr/windowBackground"
71+
android:visibility="visible" />
72+
</HorizontalScrollView>
73+
74+
</LinearLayout>
75+
76+
<android.support.v7.widget.RecyclerView
77+
android:id="@+id/diagnostic_view"
78+
android:layout_width="match_parent"
79+
android:layout_height="200dp">
80+
81+
</android.support.v7.widget.RecyclerView>
82+
</LinearLayout>
83+
84+
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
5285

5386
</android.support.design.widget.CoordinatorLayout>
5487

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright 2018 Mr Duy
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.duy.view;
18+
19+
import android.content.Context;
20+
import android.content.res.ColorStateList;
21+
import android.content.res.TypedArray;
22+
import android.support.v7.widget.AppCompatImageView;
23+
import android.util.AttributeSet;
24+
25+
/**
26+
* Created by Duy on 28-Apr-18.
27+
*/
28+
29+
public class TintImageView extends AppCompatImageView {
30+
private ColorStateList colorList;
31+
32+
public TintImageView(Context context) {
33+
super(context);
34+
init(context, null);
35+
}
36+
37+
public TintImageView(Context context, AttributeSet attrs) {
38+
super(context, attrs);
39+
init(context, attrs);
40+
}
41+
42+
public TintImageView(Context context, AttributeSet attrs, int defStyleAttr) {
43+
super(context, attrs, defStyleAttr);
44+
init(context, attrs);
45+
}
46+
47+
private void init(Context context, AttributeSet attrs) {
48+
if (attrs != null) {
49+
TypedArray arr =
50+
context.obtainStyledAttributes(attrs, new int[]{android.R.attr.textColor});
51+
colorList = arr.getColorStateList(0);
52+
if (colorList != null) {
53+
setColorFilter(colorList.getDefaultColor());
54+
}
55+
arr.recycle();
56+
}
57+
}
58+
59+
@Override
60+
public void dispatchDrawableHotspotChanged(float x, float y) {
61+
super.dispatchDrawableHotspotChanged(x, y);
62+
clearColorFilter();
63+
setColorFilter(colorList.getColorForState(getDrawableState(), colorList.getDefaultColor()));
64+
}
65+
66+
@Override
67+
public void refreshDrawableState() {
68+
super.refreshDrawableState();
69+
}
70+
}

editor-view/src/main/res/values/dimens.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
<dimen name="activity_vertical_margin">16dp</dimen>
55
<dimen name="divider_height">0.5dp</dimen>
66
<dimen name="cab_find_text_width">110dp</dimen>
7+
8+
<dimen name="symbol_bar_height">48dp</dimen>
79
</resources>

0 commit comments

Comments
 (0)