Add: commonjs support, Fix: editor auto line break

This commit is contained in:
hyb1996
2017-03-25 15:49:23 +08:00
parent feff05e11c
commit 3f7dacad2a
38 changed files with 800 additions and 496 deletions

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:clipOrientation="vertical"
android:drawable="@drawable/toolbar_bg"
android:gravity="top"/>

View File

@@ -12,14 +12,22 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
<ImageView
android:id="@+id/app_bar_bg"
android:layout_width="match_parent"
android:layout_height="128.5dp"
android:background="@drawable/toolbar_bg"
android:scaleType="fitXY"
android:src="@drawable/toolbar_bg"/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:clipToPadding="false"
android:paddingTop="24dp"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
@@ -41,15 +49,21 @@
<android.support.design.widget.TabLayout
android:id="@+id/tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
app:tabGravity="fill"
app:tabIndicatorColor="#E91E63"
app:tabIndicatorColor="@android:color/white"
app:tabMode="fixed"
app:tabTextColor="@android:color/primary_text_dark"/>
app:tabSelectedTextColor="@android:color/primary_text_dark"
app:tabTextColor="@android:color/secondary_text_dark"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main"/>
<include
android:id="@+id/content_main"
layout="@layout/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<com.stardust.widget.SlidingUpPanel
android:id="@+id/bottom_menu"
@@ -117,59 +131,6 @@
</LinearLayout>
<LinearLayout
android:id="@+id/record"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:orientation="vertical">
<com.stardust.theme.widget.ThemeColorImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_video_record"/>
<com.stardust.theme.widget.ThemeColorTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_script_record"
android:textColor="@color/colorPrimary"
android:textSize="16sp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/root_record"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:orientation="vertical">
<com.stardust.theme.widget.ThemeColorImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_video_record"/>
<com.stardust.theme.widget.ThemeColorTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_root_script_record"
android:textColor="@color/colorPrimary"
android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
</com.stardust.widget.SlidingUpPanel>
@@ -182,6 +143,7 @@
android:layout_width="304dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="false"
/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<LinearLayout
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/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.stardust.scriptdroid.ui.main.MainActivity"
tools:showIn="@layout/activity_main">
@@ -13,8 +14,8 @@
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</RelativeLayout>
</LinearLayout>

View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context="com.stardust.scriptdroid.ui.main.MainActivity">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/app_bar_bg"
android:layout_width="match_parent"
android:layout_height="128.5dp"
android:scaleType="fitXY"
android:src="@drawable/toolbar_bg"/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:clipToPadding="false"
android:paddingTop="24dp"
android:theme="@style/AppTheme.AppBarOverlay"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:title="@string/_app_name"
app:popupTheme="@style/AppTheme.PopupOverlay">
<ImageView
android:id="@+id/add"
android:layout_width="?android:attr/actionBarSize"
android:layout_height="match_parent"
android:layout_gravity="right"
android:foreground="?selectableItemBackgroundBorderless"
android:padding="12dp"
android:src="@drawable/ic_add_white_48dp"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.ashokvarma.bottomnavigation.BottomNavigationBar
android:id="@+id/bottom_navigation_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<com.stardust.widget.SlidingUpPanel
android:id="@+id/bottom_menu"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="@android:color/white"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
<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:orientation="vertical">
<com.stardust.theme.widget.ThemeColorImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_add_file_green"/>
<com.stardust.theme.widget.ThemeColorTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_new_file"
android:textColor="@color/colorPrimary"
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">
<com.stardust.theme.widget.ThemeColorImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_folder_open_outline_green"/>
<com.stardust.theme.widget.ThemeColorTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_import_from_file"
android:textColor="@color/colorPrimary"
android:textSize="16sp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/record"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<com.stardust.theme.widget.ThemeColorImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_video_record"/>
<com.stardust.theme.widget.ThemeColorTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_script_record"
android:textColor="@color/colorPrimary"
android:textSize="16sp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/root_record"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<com.stardust.theme.widget.ThemeColorImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="10dp"
android:src="@drawable/ic_video_record"/>
<com.stardust.theme.widget.ThemeColorTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/text_root_script_record"
android:textColor="@color/colorPrimary"
android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
</com.stardust.widget.SlidingUpPanel>
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.DrawerLayout>

View File

@@ -0,0 +1,13 @@
<?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:orientation="vertical">
<view
android:id="@+id/console"
class="com.stardust.scriptdroid.ui.console.ConsoleActivity$ConsoleView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingBottom="10dp">
<android.support.design.widget.TabLayout
android:id="@+id/tab"
android:layout_width="match_parent"
android:layout_height="48dp"
android:elevation="10dp"
app:elevation="10dp"
android:outlineProvider="bounds"
app:tabGravity="fill"
app:tabIndicatorColor="@color/colorAccent"
app:tabMode="fixed"
app:tabSelectedTextColor="@android:color/primary_text_dark"
app:tabTextColor="#c4c4c4"
tools:background="@color/colorPrimary"/>
</FrameLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</LinearLayout>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ToolbarMenuItem">
<attr name="text" format="string|reference"/>
<attr name="icon" format="reference"/>

View File

@@ -177,6 +177,9 @@
<string name="key_single_thread">KEY_SINGLE_THREAD</string>
<string name="text_on">已开启</string>
<string name="text_off">已关闭</string>
<string name="text_script">脚本</string>
<string name="text_manage">管理</string>
<string name="text_task_manage">任务管理</string>
<string-array name="record_control_keys">
<item></item>