add editor (modified by 920 text editor)

This commit is contained in:
hyb1996
2017-01-30 11:13:30 +08:00
parent 5c8307afaa
commit b47eaf9d5e
33 changed files with 841 additions and 176 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".EditActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:title="@string/app_name"
app:popupTheme="@style/AppTheme.PopupOverlay">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:orientation="horizontal">
<com.stardust.scriptdroid.widget.ToolbarMenuItem
android:id="@+id/run"
android:layout_width="40dp"
android:layout_height="match_parent"
app:icon="@drawable/ic_play_arrow_white_48dp"
app:icon_color="@android:color/white"
app:text="@string/text_run"/>
<com.stardust.scriptdroid.widget.ToolbarMenuItem
android:id="@+id/undo"
android:layout_width="40dp"
android:layout_height="match_parent"
app:icon="@drawable/ic_undo_white_48dp"
app:text="@string/text_undo"/>
<com.stardust.scriptdroid.widget.ToolbarMenuItem
android:id="@+id/redo"
android:layout_width="40dp"
android:layout_height="match_parent"
app:icon="@drawable/ic_redo_white_48dp"
app:text="@string/text_redo"/>
<com.stardust.scriptdroid.widget.ToolbarMenuItem
android:id="@+id/save"
android:layout_width="40dp"
android:layout_height="match_parent"
app:icon="@drawable/ic_save_white_48dp"
app:text="@string/text_save"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_edit"/>
</android.support.design.widget.CoordinatorLayout>

View File

@@ -1,97 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.stardust.scriptdroid.MainActivity">
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.stardust.scriptdroid.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:title="@string/app_name"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main"/>
<com.stardust.scriptdroid.ui.SlidingUpPanel
android:id="@+id/bottom_menu"
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="@android:color/white"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:title="@string/app_name"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main"/>
<com.stardust.scriptdroid.ui.SlidingUpPanel
android:id="@+id/bottom_menu"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/create_new_file"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="@android:color/white"
android:baselineAligned="false"
android:gravity="center"
android:orientation="vertical">
android:orientation="horizontal">
<ImageView
android:layout_width="600dp"
android:layout_height="60dp"
android:src="@drawable/ic_create_new_folder_black_48dp"/>
<TextView
android:layout_width="match_parent"
<LinearLayout
android:id="@+id/create_new_file"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:text="@string/text_new_file"
android:textColor="@android:color/secondary_text_light"
android:textSize="16sp"/>
android:orientation="vertical">
<ImageView
android:layout_width="600dp"
android:layout_height="60dp"
android:src="@drawable/ic_create_new_folder_black_48dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_new_file"
android:textColor="@android:color/secondary_text_light"
android:textSize="16sp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/import_from_file"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_sdcard_black"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_import_from_file"
android:textColor="@android:color/secondary_text_light"
android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
</com.stardust.scriptdroid.ui.SlidingUpPanel>
<LinearLayout
android:id="@+id/import_from_file"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:orientation="vertical">
</android.support.design.widget.CoordinatorLayout>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_sdcard_black"/>
<include
layout="@layout/slide_menu"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"/>
</android.support.v4.widget.DrawerLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_import_from_file"
android:textColor="@android:color/secondary_text_light"
android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
</com.stardust.scriptdroid.ui.SlidingUpPanel>
</android.support.design.widget.CoordinatorLayout>

View File

@@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffffff"
android:orientation="vertical">
android:orientation="vertical"
tools:showIn="@layout/activity_edit">
<com.jecelyin.editor.v2.view.EditorView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/editor"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:paddingTop="?android:attr/actionBarSize">
<com.jecelyin.editor.v2.core.widget.JecEditText
android:id="@+id/edit_text"
@@ -19,7 +23,6 @@
android:gravity="start|top"
android:inputType="textMultiLine"
android:padding="5dp"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:scrollbarThumbVertical="@android:color/transparent"
android:scrollbarTrackVertical="@null"
android:scrollbars="vertical"/>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="156dp"
android:scaleType="fitXY"
android:src="@drawable/slide_menu_img"/>
</LinearLayout>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?selectableItemBackgroundBorderless"
android:orientation="vertical">
<ImageView
android:id="@+id/icon"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:paddingBottom="20dp"
android:paddingTop="10dp"/>
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-20dp"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="12sp"/>
</LinearLayout>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_redo"
android:icon="@drawable/ic_undo_white_48dp"
android:orderInCategory="100"
android:title="@string/text_undo"
app:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/action_undo"
android:icon="@drawable/ic_redo_white_48dp"
android:orderInCategory="200"
android:title="@string/text_redo"
app:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/action_save"
android:icon="@drawable/ic_save_white_48dp"
android:orderInCategory="300"
android:title="@string/text_save"
app:showAsAction="ifRoom|withText"/>
</menu>

View File

@@ -1,6 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MaterialEditText"><attr format="color" name="met_baseColor"/><attr format="color" name="met_primaryColor"/><attr name="met_floatingLabel"><enum name="none" value="0"/><enum name="normal" value="1"/><enum name="highlight" value="2"/></attr><attr format="color" name="met_errorColor"/><attr format="integer" name="met_minCharacters"/><attr format="integer" name="met_maxCharacters"/><attr format="boolean" name="met_singleLineEllipsis"/><attr format="integer" name="met_minBottomTextLines"/><attr format="string" name="met_helperText"/><attr format="color" name="met_helperTextColor"/><attr format="string" name="met_accentTypeface"/><attr format="string" name="met_typeface"/><attr format="string" name="met_floatingLabelText"/><attr format="dimension" name="met_floatingLabelPadding"/><attr format="boolean" name="met_hideUnderline"/><attr format="color" name="met_underlineColor"/><attr format="boolean" name="met_autoValidate"/><attr format="reference" name="met_iconLeft"/><attr format="reference" name="met_iconRight"/><attr format="dimension" name="met_iconPadding"/><attr format="boolean" name="met_clearButton"/><attr format="dimension" name="met_floatingLabelTextSize"/><attr format="color" name="met_floatingLabelTextColor"/><attr format="dimension" name="met_bottomTextSize"/><attr format="boolean" name="met_floatingLabelAlwaysShown"/><attr format="boolean" name="met_helperTextAlwaysShown"/><attr format="boolean" name="met_floatingLabelAnimating"/><attr format="color" name="met_textColor"/><attr format="color" name="met_textColorHint"/></declare-styleable>
<declare-styleable name="ToolbarMenuItem">
<attr name="text" format="string|reference"/>
<attr name="icon" format="reference"/>
<attr name="icon_color" format="color|reference"/>
</declare-styleable>
<declare-styleable name="MaterialEditText">
<attr name="met_baseColor" format="color"/>
<attr name="met_primaryColor" format="color"/>
<attr name="met_floatingLabel">
<enum name="none" value="0"/>
<enum name="normal" value="1"/>
<enum name="highlight" value="2"/>
</attr>
<attr name="met_errorColor" format="color"/>
<attr name="met_minCharacters" format="integer"/>
<attr name="met_maxCharacters" format="integer"/>
<attr name="met_singleLineEllipsis" format="boolean"/>
<attr name="met_minBottomTextLines" format="integer"/>
<attr name="met_helperText" format="string"/>
<attr name="met_helperTextColor" format="color"/>
<attr name="met_accentTypeface" format="string"/>
<attr name="met_typeface" format="string"/>
<attr name="met_floatingLabelText" format="string"/>
<attr name="met_floatingLabelPadding" format="dimension"/>
<attr name="met_hideUnderline" format="boolean"/>
<attr name="met_underlineColor" format="color"/>
<attr name="met_autoValidate" format="boolean"/>
<attr name="met_iconLeft" format="reference"/>
<attr name="met_iconRight" format="reference"/>
<attr name="met_iconPadding" format="dimension"/>
<attr name="met_clearButton" format="boolean"/>
<attr name="met_floatingLabelTextSize" format="dimension"/>
<attr name="met_floatingLabelTextColor" format="color"/>
<attr name="met_bottomTextSize" format="dimension"/>
<attr name="met_floatingLabelAlwaysShown" format="boolean"/>
<attr name="met_helperTextAlwaysShown" format="boolean"/>
<attr name="met_floatingLabelAnimating" format="boolean"/>
<attr name="met_textColor" format="color"/>
<attr name="met_textColorHint" format="color"/>
</declare-styleable>
<!-- From: file:/Users/rengwuxian/projects/MaterialEditText/library/src/main/res/values/dimens.xml -->
<eat-comment/>
<dimen name="bottom_ellipsis_height">4dp</dimen>
@@ -12,7 +53,33 @@
<dimen name="inner_padding_left">0dp</dimen>
<dimen name="inner_padding_right">0dp</dimen>
<declare-styleable name="RoundedImageView"><attr format="dimension" name="riv_corner_radius"/><attr format="dimension" name="riv_corner_radius_top_left"/><attr format="dimension" name="riv_corner_radius_top_right"/><attr format="dimension" name="riv_corner_radius_bottom_left"/><attr format="dimension" name="riv_corner_radius_bottom_right"/><attr format="dimension" name="riv_border_width"/><attr format="color" name="riv_border_color"/><attr format="boolean" name="riv_mutate_background"/><attr format="boolean" name="riv_oval"/><attr name="android:scaleType"/><attr name="riv_tile_mode"><enum name="clamp" value="0"/><enum name="repeat" value="1"/><enum name="mirror" value="2"/></attr><attr name="riv_tile_mode_x"><enum name="clamp" value="0"/><enum name="repeat" value="1"/><enum name="mirror" value="2"/></attr><attr name="riv_tile_mode_y"><enum name="clamp" value="0"/><enum name="repeat" value="1"/><enum name="mirror" value="2"/></attr></declare-styleable>
<declare-styleable name="RoundedImageView">
<attr name="riv_corner_radius" format="dimension"/>
<attr name="riv_corner_radius_top_left" format="dimension"/>
<attr name="riv_corner_radius_top_right" format="dimension"/>
<attr name="riv_corner_radius_bottom_left" format="dimension"/>
<attr name="riv_corner_radius_bottom_right" format="dimension"/>
<attr name="riv_border_width" format="dimension"/>
<attr name="riv_border_color" format="color"/>
<attr name="riv_mutate_background" format="boolean"/>
<attr name="riv_oval" format="boolean"/>
<attr name="android:scaleType"/>
<attr name="riv_tile_mode">
<enum name="clamp" value="0"/>
<enum name="repeat" value="1"/>
<enum name="mirror" value="2"/>
</attr>
<attr name="riv_tile_mode_x">
<enum name="clamp" value="0"/>
<enum name="repeat" value="1"/>
<enum name="mirror" value="2"/>
</attr>
<attr name="riv_tile_mode_y">
<enum name="clamp" value="0"/>
<enum name="repeat" value="1"/>
<enum name="mirror" value="2"/>
</attr>
</declare-styleable>
<!-- From: file:/Users/vince/Documents/vinc3m1/RoundedImageView/roundedimageview/src/main/res/values/about_libraries_def.xml -->
<eat-comment/>
<string name="define_roundedimageview"/>

View File

@@ -18,4 +18,15 @@
<string name="text_file_not_exists">文件不存在</string>
<string name="text_no_file_rw_permission">无文件读写权限</string>
<string name="action_test">内嵌920测试</string>
<string name="text_no_accessibility_permission">辅助性服务未启动</string>
<string name="text_drawer_close">关闭侧拉菜单</string>
<string name="text_drawer_open">打开侧拉菜单</string>
<string name="text_undo">撤销</string>
<string name="text_redo">重做</string>
<string name="text_save">保存</string>
<string name="text_run">运行</string>
<string name="text_alert">提示</string>
<string name="edit_exit_without_save_warn">内容尚未保存,您确定要退出吗?</string>
<string name="text_save_and_exit">保存并退出</string>
<string name="text_exit_directly">直接退出</string>
</resources>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="defaultColorControlNormal">#009688</color>
<style name="EditorTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- 工具栏背景 -->
<item name="colorPrimary">@color/colorPrimary</item>
<!--状态栏背景-->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!--按钮类默认颜色-->
<item name="colorControlNormal">@color/defaultColorControlNormal</item>
<!--按钮类选中颜色-->
<item name="colorAccent">@color/colorAccent</item>
<!--导航栏背景-->
<!--<item name="android:navigationBarColor">@color/navigationBarColor</item>-->
<!-- 浮在toolbar上面 -->
<item name="windowActionModeOverlay">true</item>
<!--<item name="android:actionBarStyle">@style/Toolbar</item>-->
<item name="actionBarStyle">@style/Toolbar</item>
<!--使用方式 app:theme="?attr/actionBarTheme"-->
<item name="actionBarTheme">@style/ToolbarTheme</item>
<item name="actionBarPopupTheme">@style/DefaultToolbarPopupTheme</item>
<!--菜单字体颜色-->
<item name="actionMenuTextColor">@android:color/white</item>
<!--<item name="actionMenuTextAppearance">@style/Toolbar.Item</item>-->
<item name="actionModeStyle">@style/ActionMode</item>
<item name="actionModeFindDrawable">@drawable/find_white</item>
<item name="actionModeCloseDrawable">@drawable/back_btn</item>
<item name="dividerColor">#10000000</item>
<item name="android:listDivider">@drawable/divider</item>
<item name="android:textViewStyle">@style/TextViewStyle</item>
<item name="android:editTextStyle">@style/EditTextStyle</item>
<!--App自定义-->
<item name="netLoadingDrawable">@drawable/loading_icon</item>
<item name="tabBackground">@drawable/drawer_tab_item_background</item>
<item name="listItemBackground">@drawable/white_selectable_item_background</item>
<item name="toolbarIconNormalColor">#ffffff</item>
<item name="toolbarIconDisabledColor">#50ffffff</item>
<item name="menuIconNormalColor">#23c5dd</item>
<!--编辑器样式-->
<item name="textForeground">#000000</item>
<item name="textBackground">#FFFFFF</item>
<item name="caret">#000000</item>
<item name="selection">#4D97FF54</item>
<item name="invisibles">#dddddd</item>
<item name="gutterForeground">#000000</item>
<item name="gutterBackground">#dfdfdf</item>
<item name="gutterDivider">#000000</item>
<!--高亮-->
<item name="hlComment1">#cc0000</item>
<item name="hlComment2">#ff8400</item>
<item name="hlComment3">#cc6600</item>
<item name="hlComment4">#cc6600</item>
<item name="hlDigit">#ff0000</item>
<item name="hlFoldLine0">#000000</item>
<item name="hlFoldLine1">#000000</item>
<item name="hlFoldLine2">#000000</item>
<item name="hlFoldLine3">#000000</item>
<item name="hlFunction">#9966ff</item>
<item name="hlInvalid">#ff0066</item>
<item name="hlKeyword1">#006699</item>
<item name="hlKeyword2">#009966</item>
<item name="hlKeyword3">#0099ff</item>
<item name="hlKeyword4">#66ccff</item>
<item name="hlLabel">#02b902</item>
<item name="hlLiteral1">#ff00cc</item>
<item name="hlLiteral2">#cc00cc</item>
<item name="hlLiteral3">#9900cc</item>
<item name="hlLiteral4">#9900cc</item>
<item name="hlMarkup">#0000ff</item>
<item name="hlOperator">#000000</item>
</style>
<style name="DefaultToolbarPopupTheme" parent="@style/ThemeOverlay.AppCompat.Light">
<item name="colorControlNormal">@color/defaultColorControlNormal</item>
</style>
</resources>