add: manager tab
This commit is contained in:
@@ -39,33 +39,4 @@ public class LogActivity extends BaseActivity {
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ConsoleView extends Console {
|
|
||||||
|
|
||||||
public ConsoleView(Context context) {
|
|
||||||
super(context);
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConsoleView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConsoleView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConsoleView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init() {
|
|
||||||
findViewById(R.id.console_scroll_view).setBackgroundColor(Color.WHITE);
|
|
||||||
((TextView) findViewById(R.id.console_text)).setTextIsSelectable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.stardust.scriptdroid.ui.console;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.jraska.console.Console;
|
||||||
|
import com.stardust.scriptdroid.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Stardust on 2017/8/22.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LogView extends Console {
|
||||||
|
|
||||||
|
public LogView(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
findViewById(R.id.console_scroll_view).setBackgroundColor(Color.WHITE);
|
||||||
|
((TextView) findViewById(R.id.console_text)).setTextIsSelectable(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,9 @@ import android.app.Activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
@@ -33,7 +35,6 @@ import com.stardust.scriptdroid.script.ScriptFile;
|
|||||||
import com.stardust.scriptdroid.script.StorageFileProvider;
|
import com.stardust.scriptdroid.script.StorageFileProvider;
|
||||||
import com.stardust.scriptdroid.ui.common.ScriptOperations;
|
import com.stardust.scriptdroid.ui.common.ScriptOperations;
|
||||||
import com.stardust.scriptdroid.ui.main.community.CommunityFragment;
|
import com.stardust.scriptdroid.ui.main.community.CommunityFragment;
|
||||||
import com.stardust.scriptdroid.ui.main.doc.OnlineDocsFragment;
|
|
||||||
import com.stardust.scriptdroid.ui.main.doc.OnlineDocsFragment_;
|
import com.stardust.scriptdroid.ui.main.doc.OnlineDocsFragment_;
|
||||||
import com.stardust.scriptdroid.ui.main.script_list.MyScriptListFragment_;
|
import com.stardust.scriptdroid.ui.main.script_list.MyScriptListFragment_;
|
||||||
import com.stardust.scriptdroid.ui.main.task.TaskManagerFragment_;
|
import com.stardust.scriptdroid.ui.main.task.TaskManagerFragment_;
|
||||||
@@ -41,8 +42,6 @@ import com.stardust.util.DeveloperUtils;
|
|||||||
import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
||||||
import com.stardust.scriptdroid.tool.DrawableSaver;
|
import com.stardust.scriptdroid.tool.DrawableSaver;
|
||||||
import com.stardust.scriptdroid.ui.BaseActivity;
|
import com.stardust.scriptdroid.ui.BaseActivity;
|
||||||
import com.stardust.scriptdroid.ui.main.sample_list.SampleScriptListFragment;
|
|
||||||
import com.stardust.scriptdroid.ui.main.script_list.MyScriptListFragment;
|
|
||||||
import com.stardust.scriptdroid.ui.main.script_list.ScriptFileChooserDialogBuilder;
|
import com.stardust.scriptdroid.ui.main.script_list.ScriptFileChooserDialogBuilder;
|
||||||
import com.stardust.scriptdroid.ui.settings.SettingsActivity_;
|
import com.stardust.scriptdroid.ui.settings.SettingsActivity_;
|
||||||
import com.stardust.scriptdroid.ui.update.VersionGuard;
|
import com.stardust.scriptdroid.ui.update.VersionGuard;
|
||||||
@@ -72,8 +71,10 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
SlidingUpPanel mAddBottomMenuPanel;
|
SlidingUpPanel mAddBottomMenuPanel;
|
||||||
@ViewById(R.id.viewpager)
|
@ViewById(R.id.viewpager)
|
||||||
ViewPager mViewPager;
|
ViewPager mViewPager;
|
||||||
private FragmentPagerAdapterBuilder.StoredFragmentPagerAdapter mPagerAdapter;
|
@ViewById(R.id.fab)
|
||||||
|
FloatingActionButton mFab;
|
||||||
|
|
||||||
|
private FragmentPagerAdapterBuilder.StoredFragmentPagerAdapter mPagerAdapter;
|
||||||
private OnActivityResultDelegate.Mediator mActivityResultMediator = new OnActivityResultDelegate.Mediator();
|
private OnActivityResultDelegate.Mediator mActivityResultMediator = new OnActivityResultDelegate.Mediator();
|
||||||
private DrawableSaver mDrawerHeaderBackgroundSaver;
|
private DrawableSaver mDrawerHeaderBackgroundSaver;
|
||||||
private VersionGuard mVersionGuard;
|
private VersionGuard mVersionGuard;
|
||||||
@@ -182,6 +183,15 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
.build();
|
.build();
|
||||||
mViewPager.setAdapter(mPagerAdapter);
|
mViewPager.setAdapter(mPagerAdapter);
|
||||||
tabLayout.setupWithViewPager(mViewPager);
|
tabLayout.setupWithViewPager(mViewPager);
|
||||||
|
mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
Fragment fragment = mPagerAdapter.getStoredFragment(position);
|
||||||
|
if (fragment == null)
|
||||||
|
return;
|
||||||
|
((ViewPagerFragment) fragment).setUpWithFab(mViewPager, mFab);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Click(R.id.create_new_file)
|
@Click(R.id.create_new_file)
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.stardust.scriptdroid.ui.main;
|
||||||
|
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Stardust on 2017/8/22.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ViewPagerFragment {
|
||||||
|
|
||||||
|
void setUpWithFab(ViewPager pager, FloatingActionButton fab);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,29 @@
|
|||||||
package com.stardust.scriptdroid.ui.main.community;
|
package com.stardust.scriptdroid.ui.main.community;
|
||||||
|
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v4.view.animation.FastOutSlowInInterpolator;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.stardust.scriptdroid.R;
|
||||||
|
import com.stardust.scriptdroid.ui.main.ViewPagerFragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on 2017/8/22.
|
* Created by Stardust on 2017/8/22.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CommunityFragment extends Fragment {
|
public class CommunityFragment extends Fragment implements ViewPagerFragment {
|
||||||
|
@Override
|
||||||
|
public void setUpWithFab(ViewPager pager, FloatingActionButton fab) {
|
||||||
|
if (fab.getVisibility() != View.VISIBLE) {
|
||||||
|
fab.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fab.animate()
|
||||||
|
.rotation(0)
|
||||||
|
.setDuration(300)
|
||||||
|
.setInterpolator(new FastOutSlowInInterpolator())
|
||||||
|
.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,14 @@ package com.stardust.scriptdroid.ui.main.doc;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.view.View;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import com.stardust.scriptdroid.R;
|
import com.stardust.scriptdroid.R;
|
||||||
|
import com.stardust.scriptdroid.ui.main.ViewPagerFragment;
|
||||||
import com.stardust.util.BackPressedHandler;
|
import com.stardust.util.BackPressedHandler;
|
||||||
import com.stardust.widget.EWebView;
|
import com.stardust.widget.EWebView;
|
||||||
|
|
||||||
@@ -17,7 +21,7 @@ import org.androidannotations.annotations.ViewById;
|
|||||||
* Created by Stardust on 2017/8/22.
|
* Created by Stardust on 2017/8/22.
|
||||||
*/
|
*/
|
||||||
@EFragment(R.layout.fragment_online_docs)
|
@EFragment(R.layout.fragment_online_docs)
|
||||||
public class OnlineDocsFragment extends Fragment implements BackPressedHandler {
|
public class OnlineDocsFragment extends Fragment implements BackPressedHandler, ViewPagerFragment {
|
||||||
|
|
||||||
@ViewById(R.id.eweb_view)
|
@ViewById(R.id.eweb_view)
|
||||||
EWebView mEWebView;
|
EWebView mEWebView;
|
||||||
@@ -53,4 +57,11 @@ public class OnlineDocsFragment extends Fragment implements BackPressedHandler {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUpWithFab(ViewPager pager, FloatingActionButton fab) {
|
||||||
|
if (fab.getVisibility() == View.VISIBLE) {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.stardust.scriptdroid.ui.main.script_list;
|
package com.stardust.scriptdroid.ui.main.script_list;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v4.view.animation.FastOutSlowInInterpolator;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.afollestad.materialdialogs.DialogAction;
|
import com.afollestad.materialdialogs.DialogAction;
|
||||||
@@ -14,6 +17,7 @@ import com.stardust.scriptdroid.script.Scripts;
|
|||||||
import com.stardust.scriptdroid.script.StorageFileProvider;
|
import com.stardust.scriptdroid.script.StorageFileProvider;
|
||||||
import com.stardust.scriptdroid.ui.common.ScriptLoopDialog;
|
import com.stardust.scriptdroid.ui.common.ScriptLoopDialog;
|
||||||
import com.stardust.scriptdroid.ui.edit.ScriptEditView;
|
import com.stardust.scriptdroid.ui.edit.ScriptEditView;
|
||||||
|
import com.stardust.scriptdroid.ui.main.ViewPagerFragment;
|
||||||
|
|
||||||
import org.androidannotations.annotations.AfterViews;
|
import org.androidannotations.annotations.AfterViews;
|
||||||
import org.androidannotations.annotations.EFragment;
|
import org.androidannotations.annotations.EFragment;
|
||||||
@@ -32,7 +36,7 @@ import io.reactivex.schedulers.Schedulers;
|
|||||||
* Created by Stardust on 2017/3/13.
|
* Created by Stardust on 2017/3/13.
|
||||||
*/
|
*/
|
||||||
@EFragment(R.layout.fragment_my_script_list)
|
@EFragment(R.layout.fragment_my_script_list)
|
||||||
public class MyScriptListFragment extends Fragment {
|
public class MyScriptListFragment extends Fragment implements ViewPagerFragment {
|
||||||
|
|
||||||
private static final String TAG = "MyScriptListFragment";
|
private static final String TAG = "MyScriptListFragment";
|
||||||
|
|
||||||
@@ -140,4 +144,16 @@ public class MyScriptListFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUpWithFab(ViewPager pager, FloatingActionButton fab) {
|
||||||
|
if (fab.getVisibility() != View.VISIBLE) {
|
||||||
|
fab.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fab.animate()
|
||||||
|
.rotation(0)
|
||||||
|
.setDuration(300)
|
||||||
|
.setInterpolator(new FastOutSlowInInterpolator())
|
||||||
|
.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.stardust.autojs.script.AutoFileSource;
|
||||||
import com.stardust.pio.PFile;
|
import com.stardust.pio.PFile;
|
||||||
import com.stardust.scriptdroid.R;
|
import com.stardust.scriptdroid.R;
|
||||||
import com.stardust.scriptdroid.script.ScriptFile;
|
import com.stardust.scriptdroid.script.ScriptFile;
|
||||||
@@ -178,7 +179,7 @@ public class ScriptListView extends SwipeRefreshLayout implements SwipeRefreshLa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ScriptFileViewHolder extends BindableViewHolder<ScriptFile> {
|
class ScriptFileViewHolder extends BindableViewHolder<ScriptFile> {
|
||||||
|
|
||||||
|
|
||||||
@BindView(R.id.name)
|
@BindView(R.id.name)
|
||||||
@@ -203,17 +204,16 @@ public class ScriptListView extends SwipeRefreshLayout implements SwipeRefreshLa
|
|||||||
mDesc.setText(PFile.getHumanReadableSize(file.length()));
|
mDesc.setText(PFile.getHumanReadableSize(file.length()));
|
||||||
if (file.getType() == ScriptFile.TYPE_JAVA_SCRIPT) {
|
if (file.getType() == ScriptFile.TYPE_JAVA_SCRIPT) {
|
||||||
mFirstChar.setText("J");
|
mFirstChar.setText("J");
|
||||||
//什么?裸写颜色代码?!不影响代码可读性和重构成本的情况下,这样子修改起来方便多啦
|
mFirstCharBackground.setColor(getResources().getColor(R.color.color_j));
|
||||||
mFirstCharBackground.setColor(0xFF99CC99);
|
|
||||||
} else {
|
} else {
|
||||||
mFirstChar.setText("R");
|
mFirstChar.setText("R");
|
||||||
mFirstCharBackground.setColor(0xFFFD999A);
|
mFirstCharBackground.setColor(getResources().getColor(R.color.color_r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.item)
|
@OnClick(R.id.item)
|
||||||
void onItemClick() {
|
void onItemClick() {
|
||||||
if(mOnScriptFileClickListener != null){
|
if (mOnScriptFileClickListener != null) {
|
||||||
mOnScriptFileClickListener.onScriptFileClick(itemView, mScriptFile);
|
mOnScriptFileClickListener.onScriptFileClick(itemView, mScriptFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.stardust.scriptdroid.ui.main.task;
|
package com.stardust.scriptdroid.ui.main.task;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.ThemeColorRecyclerView;
|
import android.support.v7.widget.ThemeColorRecyclerView;
|
||||||
@@ -8,28 +9,28 @@ import android.util.AttributeSet;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.workground.WrapContentLinearLayoutManager;
|
import android.workground.WrapContentLinearLayoutManager;
|
||||||
|
|
||||||
import com.stardust.autojs.ScriptEngineService;
|
import com.stardust.autojs.ScriptEngineService;
|
||||||
import com.stardust.autojs.engine.JavaScriptEngine;
|
|
||||||
import com.stardust.autojs.engine.ScriptEngineManager;
|
import com.stardust.autojs.engine.ScriptEngineManager;
|
||||||
import com.stardust.autojs.execution.ScriptExecution;
|
import com.stardust.autojs.execution.ScriptExecution;
|
||||||
import com.stardust.autojs.execution.ScriptExecutionListener;
|
import com.stardust.autojs.execution.ScriptExecutionListener;
|
||||||
import com.stardust.autojs.execution.SimpleScriptExecutionListener;
|
import com.stardust.autojs.execution.SimpleScriptExecutionListener;
|
||||||
import com.stardust.autojs.engine.ScriptEngine;
|
import com.stardust.autojs.engine.ScriptEngine;
|
||||||
import com.stardust.autojs.script.AutoFileSource;
|
import com.stardust.autojs.script.AutoFileSource;
|
||||||
import com.stardust.autojs.script.JavaScriptSource;
|
|
||||||
import com.stardust.autojs.script.ScriptSource;
|
import com.stardust.autojs.script.ScriptSource;
|
||||||
import com.stardust.scriptdroid.R;
|
import com.stardust.scriptdroid.R;
|
||||||
import com.stardust.scriptdroid.autojs.AutoJs;
|
import com.stardust.scriptdroid.autojs.AutoJs;
|
||||||
import com.stardust.scriptdroid.script.ScriptFile;
|
|
||||||
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
|
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on 2017/3/24.
|
* Created by Stardust on 2017/3/24.
|
||||||
*/
|
*/
|
||||||
@@ -44,29 +45,6 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView implements Scri
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final OnClickListener mOnStopClickListener = new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
int position = getChildViewHolder((View) v.getParent()).getAdapterPosition();
|
|
||||||
if (position >= 0) {
|
|
||||||
final ScriptEngine engine = mScriptEngines.get(position);
|
|
||||||
engine.forceStop();
|
|
||||||
|
|
||||||
postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!engine.isDestroyed()) {
|
|
||||||
onScriptANR(engine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
} else {
|
|
||||||
updateEngineList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
private final List<ScriptEngine> mScriptEngines = new ArrayList<>();
|
private final List<ScriptEngine> mScriptEngines = new ArrayList<>();
|
||||||
private Adapter mAdapter;
|
private Adapter mAdapter;
|
||||||
private final ScriptEngineService mScriptEngineService = AutoJs.getInstance().getScriptEngineService();
|
private final ScriptEngineService mScriptEngineService = AutoJs.getInstance().getScriptEngineService();
|
||||||
@@ -106,7 +84,7 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView implements Scri
|
|||||||
private void init() {
|
private void init() {
|
||||||
setLayoutManager(new WrapContentLinearLayoutManager(getContext()));
|
setLayoutManager(new WrapContentLinearLayoutManager(getContext()));
|
||||||
addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext())
|
addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext())
|
||||||
.color(0xffd9d9d9)
|
.color(0xffEDEEEF)
|
||||||
.size(2)
|
.size(2)
|
||||||
.marginResId(R.dimen.script_and_folder_list_divider_left_margin, R.dimen.script_and_folder_list_divider_right_margin)
|
.marginResId(R.dimen.script_and_folder_list_divider_left_margin, R.dimen.script_and_folder_list_divider_right_margin)
|
||||||
.showLastDivider()
|
.showLastDivider()
|
||||||
@@ -186,7 +164,9 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView implements Scri
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||||
holder.bind((ScriptSource) mScriptEngines.get(position).getTag(ScriptEngine.TAG_SOURCE));
|
ScriptEngine engine = mScriptEngines.get(position);
|
||||||
|
ScriptSource source = (ScriptSource) mScriptEngines.get(position).getTag(ScriptEngine.TAG_SOURCE);
|
||||||
|
holder.bind(source, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -195,30 +175,46 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView implements Scri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ViewHolder extends RecyclerView.ViewHolder {
|
class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
ImageView icon;
|
@BindView(R.id.first_char)
|
||||||
TextView name, detail;
|
TextView mFirstChar;
|
||||||
View stop;
|
@BindView(R.id.name)
|
||||||
|
TextView mName;
|
||||||
|
@BindView(R.id.desc)
|
||||||
|
TextView mDesc;
|
||||||
|
|
||||||
|
private ScriptEngine mScriptEngine;
|
||||||
|
private GradientDrawable mFirstCharBackground;
|
||||||
|
|
||||||
ViewHolder(View itemView) {
|
ViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
itemView.setOnClickListener(mOnItemClickListenerProxy);
|
itemView.setOnClickListener(mOnItemClickListenerProxy);
|
||||||
name = (TextView) itemView.findViewById(R.id.name);
|
ButterKnife.bind(this, itemView);
|
||||||
detail = (TextView) itemView.findViewById(R.id.detail);
|
mFirstCharBackground = (GradientDrawable) mFirstChar.getBackground();
|
||||||
icon = (ImageView) itemView.findViewById(R.id.icon);
|
|
||||||
stop = itemView.findViewById(R.id.stop);
|
|
||||||
stop.setOnClickListener(mOnStopClickListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bind(ScriptSource source) {
|
public void bind(ScriptSource source, ScriptEngine engine) {
|
||||||
|
mScriptEngine = engine;
|
||||||
if (source == null)
|
if (source == null)
|
||||||
return;
|
return;
|
||||||
name.setText(source.getName());
|
mName.setText(source.getName());
|
||||||
detail.setText(source.toString());
|
mDesc.setText(source.toString());
|
||||||
//ignore android studio warning: use equals to compare string
|
//ignore android studio warning: use equals to compare string
|
||||||
icon.setImageResource(source.getEngineName() == AutoFileSource.ENGINE ? R.drawable.record_icon_18
|
if (source.getEngineName() == AutoFileSource.ENGINE) {
|
||||||
: R.drawable.ic_node_js_black);
|
mFirstChar.setText("R");
|
||||||
|
mFirstCharBackground.setColor(getResources().getColor(R.color.color_r));
|
||||||
|
} else {
|
||||||
|
mFirstChar.setText("J");
|
||||||
|
mFirstCharBackground.setColor(getResources().getColor(R.color.color_j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.stop)
|
||||||
|
void stop() {
|
||||||
|
if (mScriptEngine != null) {
|
||||||
|
mScriptEngine.forceStop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
package com.stardust.scriptdroid.ui.main.task;
|
package com.stardust.scriptdroid.ui.main.task;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v4.view.animation.FastOutSlowInInterpolator;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.PopupMenu;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.ViewAnimator;
|
||||||
|
|
||||||
|
import com.jraska.console.Console;
|
||||||
import com.stardust.scriptdroid.R;
|
import com.stardust.scriptdroid.R;
|
||||||
import com.stardust.scriptdroid.autojs.AutoJs;
|
import com.stardust.scriptdroid.autojs.AutoJs;
|
||||||
|
import com.stardust.scriptdroid.ui.console.LogView;
|
||||||
|
import com.stardust.scriptdroid.ui.main.ViewPagerFragment;
|
||||||
import com.stardust.widget.SimpleAdapterDataObserver;
|
import com.stardust.widget.SimpleAdapterDataObserver;
|
||||||
|
|
||||||
import org.androidannotations.annotations.AfterViews;
|
import org.androidannotations.annotations.AfterViews;
|
||||||
@@ -13,27 +27,54 @@ import org.androidannotations.annotations.Click;
|
|||||||
import org.androidannotations.annotations.EFragment;
|
import org.androidannotations.annotations.EFragment;
|
||||||
import org.androidannotations.annotations.ViewById;
|
import org.androidannotations.annotations.ViewById;
|
||||||
|
|
||||||
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on 2017/3/24.
|
* Created by Stardust on 2017/3/24.
|
||||||
*/
|
*/
|
||||||
@EFragment(R.layout.fragment_task_manager)
|
@EFragment(R.layout.fragment_task_manager)
|
||||||
public class TaskManagerFragment extends Fragment {
|
public class TaskManagerFragment extends Fragment implements PopupMenu.OnMenuItemClickListener, ViewPagerFragment {
|
||||||
|
|
||||||
@ViewById(R.id.task_list)
|
@ViewById(R.id.task_list)
|
||||||
TaskListRecyclerView mTaskListRecyclerView;
|
TaskListRecyclerView mTaskListRecyclerView;
|
||||||
@ViewById(R.id.close_all)
|
|
||||||
View mCloseAllView;
|
|
||||||
@ViewById(R.id.notice_no_running_script)
|
@ViewById(R.id.notice_no_running_script)
|
||||||
View mNoRunningScriptNotice;
|
View mNoRunningScriptNotice;
|
||||||
|
|
||||||
@ViewById(R.id.swipe_refresh_layout)
|
@ViewById(R.id.swipe_refresh_layout)
|
||||||
SwipeRefreshLayout mSwipeRefreshLayout;
|
SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
|
|
||||||
|
@ViewById(R.id.task_manager_view)
|
||||||
|
View mTaskManagerView;
|
||||||
|
|
||||||
|
@ViewById(R.id.log)
|
||||||
|
View mLogView;
|
||||||
|
|
||||||
|
@ViewById(R.id.spinner)
|
||||||
|
View mSpinner;
|
||||||
|
|
||||||
|
@ViewById(R.id.spinner_current_item)
|
||||||
|
TextView mSpinnerCurrentItem;
|
||||||
|
|
||||||
|
private FloatingActionButton mFab;
|
||||||
|
|
||||||
|
private View.OnClickListener mOnFabClickListener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (mLogView.getVisibility() == View.VISIBLE) {
|
||||||
|
Console.clear();
|
||||||
|
} else {
|
||||||
|
AutoJs.getInstance().getScriptEngineService().stopAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@AfterViews
|
@AfterViews
|
||||||
void setUpViews() {
|
void setUpViews() {
|
||||||
init();
|
init();
|
||||||
final boolean noRunningScript = mTaskListRecyclerView.getAdapter().getItemCount() == 0;
|
final boolean noRunningScript = mTaskListRecyclerView.getAdapter().getItemCount() == 0;
|
||||||
mNoRunningScriptNotice.setVisibility(noRunningScript ? View.VISIBLE : View.GONE);
|
mNoRunningScriptNotice.setVisibility(noRunningScript ? View.VISIBLE : View.GONE);
|
||||||
mCloseAllView.setVisibility(noRunningScript ? View.GONE : View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
@@ -48,7 +89,6 @@ public class TaskManagerFragment extends Fragment {
|
|||||||
if (mNoRunningScriptNotice == null)
|
if (mNoRunningScriptNotice == null)
|
||||||
return;
|
return;
|
||||||
mNoRunningScriptNotice.setVisibility(noRunningScript ? View.VISIBLE : View.GONE);
|
mNoRunningScriptNotice.setVisibility(noRunningScript ? View.VISIBLE : View.GONE);
|
||||||
mCloseAllView.setVisibility(noRunningScript ? View.GONE : View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
}, 150);
|
}, 150);
|
||||||
}
|
}
|
||||||
@@ -69,8 +109,66 @@ public class TaskManagerFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Click(R.id.close_all)
|
@Click(R.id.spinner)
|
||||||
void closeAllRunningScripts() {
|
void showPopupMenu() {
|
||||||
AutoJs.getInstance().getScriptEngineService().stopAll();
|
PopupMenu popupMenu = new PopupMenu(getContext(), mSpinner);
|
||||||
|
popupMenu.inflate(R.menu.menu_manager);
|
||||||
|
popupMenu.show();
|
||||||
|
popupMenu.setOnMenuItemClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == R.id.task_manage) {
|
||||||
|
showTaskManager();
|
||||||
|
} else {
|
||||||
|
showLog();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showLog() {
|
||||||
|
mTaskManagerView.setVisibility(View.GONE);
|
||||||
|
mLogView.setVisibility(View.VISIBLE);
|
||||||
|
mSpinnerCurrentItem.setText(R.string.text_log);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showTaskManager() {
|
||||||
|
mLogView.setVisibility(View.GONE);
|
||||||
|
mTaskManagerView.setVisibility(View.VISIBLE);
|
||||||
|
mSpinnerCurrentItem.setText(R.string.text_task_manage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUpWithFab(ViewPager pager, final FloatingActionButton fab) {
|
||||||
|
mFab = fab;
|
||||||
|
fab.setOnClickListener(mOnFabClickListener);
|
||||||
|
if (fab.getVisibility() != View.VISIBLE) {
|
||||||
|
fab.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fab.animate()
|
||||||
|
.rotation(45)
|
||||||
|
.setDuration(300)
|
||||||
|
.setInterpolator(new FastOutSlowInInterpolator())
|
||||||
|
.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
if (mFab != null) {
|
||||||
|
mFab.setOnClickListener(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (mFab != null) {
|
||||||
|
mFab.setOnClickListener(mOnFabClickListener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,8 @@
|
|||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<view
|
<com.stardust.scriptdroid.ui.console.LogView
|
||||||
android:id="@+id/console"
|
android:id="@+id/console"
|
||||||
class="com.stardust.scriptdroid.ui.console.LogActivity$ConsoleView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.stardust.widget.AppWithStatusBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#5cab7d"
|
android:background="#5cab7d"
|
||||||
|
android:paddingTop="16dp"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
@@ -33,8 +34,7 @@
|
|||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabIndicatorColor="@android:color/white"
|
app:tabIndicatorColor="@android:color/white"
|
||||||
app:tabMode="scrollable"/>
|
app:tabMode="scrollable"/>
|
||||||
</com.stardust.widget.AppWithStatusBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
|
||||||
<android.support.v4.view.ViewPager
|
<android.support.v4.view.ViewPager
|
||||||
android:id="@+id/viewpager"
|
android:id="@+id/viewpager"
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
@@ -58,7 +59,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="160dp"
|
android:layout_height="160dp"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
~ copies of the Software, and to permit persons to whom the Software is
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
~ furnished to do so, subject to the following conditions:
|
~ furnished to do so, subject to the following conditions:
|
||||||
~
|
~
|
||||||
~ The above copyright notice and this permission notice shall be included in all
|
~ The above copyright toast and this permission toast shall be included in all
|
||||||
~ copies or substantial portions of the Software.
|
~ copies or substantial portions of the Software.
|
||||||
~
|
~
|
||||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
~ copies of the Software, and to permit persons to whom the Software is
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
~ furnished to do so, subject to the following conditions:
|
~ furnished to do so, subject to the following conditions:
|
||||||
~
|
~
|
||||||
~ The above copyright notice and this permission notice shall be included in all
|
~ The above copyright toast and this permission toast shall be included in all
|
||||||
~ copies or substantial portions of the Software.
|
~ copies or substantial portions of the Software.
|
||||||
~
|
~
|
||||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
|||||||
@@ -1,63 +1,88 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#f4f4f4">
|
android:background="@android:color/white"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/spinner"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:orientation="vertical">
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/close_all"
|
android:id="@+id/spinner_current_item"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="70dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#d4d4d4"
|
android:layout_gravity="center_vertical"
|
||||||
android:foreground="?selectableItemBackground"
|
android:layout_marginLeft="8dp"
|
||||||
android:visibility="gone">
|
android:text="@string/text_task_manage"
|
||||||
|
android:textColor="#484C4F"
|
||||||
|
android:textSize="16sp"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="22dp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="22dp"
|
android:layout_height="16dp"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="17dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="17dp"
|
android:src="@drawable/ic_arrow_drop_down_black"
|
||||||
android:layout_marginTop="12dp"
|
android:tint="#484C4F"/>
|
||||||
android:src="@drawable/ic_close_gray600_48dp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:text="@string/text_close_all_running_scripts"
|
|
||||||
android:textColor="@android:color/primary_text_light"
|
|
||||||
android:textSize="16sp"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<android.support.v4.widget.SwipeRefreshLayout
|
|
||||||
android:id="@+id/swipe_refresh_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.stardust.scriptdroid.ui.main.task.TaskListRecyclerView
|
|
||||||
android:id="@+id/task_list"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/notice_no_running_script"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/notice_no_running_script"
|
|
||||||
android:textColor="#adadad"
|
|
||||||
android:textSize="16sp"/>
|
|
||||||
|
|
||||||
</FrameLayout>
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/white">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/task_manager_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/swipe_refresh_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.stardust.scriptdroid.ui.main.task.TaskListRecyclerView
|
||||||
|
android:id="@+id/task_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/notice_no_running_script"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/notice_no_running_script"
|
||||||
|
android:textColor="#adadad"
|
||||||
|
android:textSize="16sp"/>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<android.support.v4.widget.NestedScrollView
|
||||||
|
android:id="@+id/log"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:paddingLeft="6dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<com.stardust.scriptdroid.ui.console.LogView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/white"/>
|
||||||
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,30 +1,34 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:foreground="?android:selectableItemBackground">
|
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/icon"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/item"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:clickable="true"
|
||||||
|
android:foreground="?selectableItemBackground"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/first_char"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginBottom="6dp"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginTop="6dp"
|
android:background="@drawable/circle_green"
|
||||||
android:contentDescription="@string/_app_name"
|
android:gravity="center"
|
||||||
android:scaleType="fitCenter"
|
android:textColor="@android:color/white"
|
||||||
android:src="@drawable/ic_node_js_black"/>
|
android:textSize="24sp"
|
||||||
|
tools:text="J"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="80dp"
|
android:layout_weight="1"
|
||||||
android:layout_toRightOf="@id/icon"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -32,41 +36,38 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="@android:color/secondary_text_light"
|
android:textColor="#484C4F"
|
||||||
android:textSize="16sp"
|
android:textSize="14sp"
|
||||||
tools:text="正在运行的服务"/>
|
tools:text="正在运行的服务"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/detail"
|
android:id="@+id/desc"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="#777777"
|
android:textColor="#9DA0A2"
|
||||||
android:textSize="12sp"
|
android:textSize="11sp"
|
||||||
tools:text="/storage/emulated/0/脚本/正在运行的服务.txt"/>
|
tools:text="18 KB"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
<ImageView
|
||||||
android:id="@+id/stop"
|
android:id="@+id/stop"
|
||||||
android:layout_width="42dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="42dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentRight="true"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
android:layout_centerVertical="true"
|
android:clickable="true"
|
||||||
android:layout_marginRight="12dp"
|
android:padding="6dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:src="@drawable/ic_close_gray600_48dp"
|
||||||
android:gravity="center">
|
android:tint="#A9AAAB"/>
|
||||||
|
|
||||||
<ImageView
|
</LinearLayout>
|
||||||
android:layout_width="25dp"
|
|
||||||
android:layout_height="25dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:contentDescription="@string/_app_name"
|
|
||||||
android:src="@drawable/ic_close"/>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
14
app/src/main/res/menu/menu_manager.xml
Normal file
14
app/src/main/res/menu/menu_manager.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/task_manage"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/text_task_manage"/>
|
||||||
|
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/log"
|
||||||
|
android:orderInCategory="200"
|
||||||
|
android:title="@string/text_log"/>
|
||||||
|
</menu>
|
||||||
@@ -1,122 +1,122 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<notices>
|
<notices>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Rhino: JavaScript in Java</name>
|
<name>Rhino: JavaScript in Java</name>
|
||||||
<url>https://github.com/mozilla/rhino</url>
|
<url>https://github.com/mozilla/rhino</url>
|
||||||
<copyright/>
|
<copyright/>
|
||||||
<license>Mozilla Public License 2.0</license>
|
<license>Mozilla Public License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>920 Text Editor</name>
|
<name>920 Text Editor</name>
|
||||||
<url>https://github.com/jecelyin/920-text-editor-v2</url>
|
<url>https://github.com/jecelyin/920-text-editor-v2</url>
|
||||||
<copyright/>
|
<copyright/>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>LeakCanary</name>
|
<name>LeakCanary</name>
|
||||||
<copyright>Copyright 2015 Square, Inc.</copyright>
|
<copyright>Copyright 2015 Square, Inc.</copyright>
|
||||||
<url>https://github.com/square/leakcanary</url>
|
<url>https://github.com/square/leakcanary</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>StorIO</name>
|
<name>StorIO</name>
|
||||||
<url>https://github.com/pushtorefresh/storio</url>
|
<url>https://github.com/pushtorefresh/storio</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Material Dialogs</name>
|
<name>Material Dialogs</name>
|
||||||
<url>https://github.com/afollestad/material-dialogs</url>
|
<url>https://github.com/afollestad/material-dialogs</url>
|
||||||
<copyright>Copyright (c) 2014-2016 Aidan Michael Follestad</copyright>
|
<copyright>Copyright (c) 2014-2016 Aidan Michael Follestad</copyright>
|
||||||
<license>MIT License</license>
|
<license>MIT License</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Gson</name>
|
<name>Gson</name>
|
||||||
<url>https://github.com/google/gson</url>
|
<url>https://github.com/google/gson</url>
|
||||||
<copyright>Copyright 2008 Google Inc.</copyright>
|
<copyright>Copyright 2008 Google Inc.</copyright>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>commonmark-java</name>
|
<name>commonmark-java</name>
|
||||||
<url>https://github.com/atlassian/commonmark-java</url>
|
<url>https://github.com/atlassian/commonmark-java</url>
|
||||||
<copyright>Copyright (c) 2015-2016 Atlassian and others.</copyright>
|
<copyright>Copyright (c) 2015-2016 Atlassian and others.</copyright>
|
||||||
<license>BSD 2-Clause License</license>
|
<license>BSD 2-Clause License</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Alipay ZeroSdk</name>
|
<name>Alipay ZeroSdk</name>
|
||||||
<copyright>Copyright 2016 Fung Go (fython)</copyright>
|
<copyright>Copyright 2016 Fung Go (fython)</copyright>
|
||||||
<url>https://github.com/fython/AlipayZeroSdk</url>
|
<url>https://github.com/fython/AlipayZeroSdk</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Console</name>
|
<name>Console</name>
|
||||||
<copyright>Copyright 2015 Josef Raska</copyright>
|
<copyright>Copyright 2015 Josef Raska</copyright>
|
||||||
<url>https://github.com/jraska/Console</url>
|
<url>https://github.com/jraska/Console</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>android-issue-reporter</name>
|
<name>android-issue-reporter</name>
|
||||||
<copyright/>
|
<copyright/>
|
||||||
<url>https://github.com/HeinrichReimer/android-issue-reporter</url>
|
<url>https://github.com/HeinrichReimer/android-issue-reporter</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>SortableTableView</name>
|
<name>SortableTableView</name>
|
||||||
<copyright>Copyright 2015 Ingo Schwarz</copyright>
|
<copyright>Copyright 2015 Ingo Schwarz</copyright>
|
||||||
<url>https://github.com/ISchwarz23/SortableTableView</url>
|
<url>https://github.com/ISchwarz23/SortableTableView</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>MultiLevelListView</name>
|
<name>MultiLevelListView</name>
|
||||||
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
||||||
<url>https://github.com/open-rnd/android-multi-level-listview</url>
|
<url>https://github.com/open-rnd/android-multi-level-listview</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>hover</name>
|
<name>hover</name>
|
||||||
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
||||||
<url>https://github.com/google/hover</url>
|
<url>https://github.com/google/hover</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>event-bus</name>
|
<name>event-bus</name>
|
||||||
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
||||||
<url>https://github.com/greenrobot/EventBus</url>
|
<url>https://github.com/greenrobot/EventBus</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Expandable RecyclerView</name>
|
<name>Expandable RecyclerView</name>
|
||||||
<copyright>Copyright (c) 2015 Big Nerd Ranch</copyright>
|
<copyright>Copyright (c) 2015 Big Nerd Ranch</copyright>
|
||||||
<url>https://github.com/bignerdranch/expandable-recycler-view</url>
|
<url>https://github.com/bignerdranch/expandable-recycler-view</url>
|
||||||
<license>MIT License</license>
|
<license>MIT License</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Android Terminal Emulator</name>
|
<name>Android Terminal Emulator</name>
|
||||||
<copyright/>
|
<copyright/>
|
||||||
<url>https://github.com/jackpal/Android-Terminal-Emulator</url>
|
<url>https://github.com/jackpal/Android-Terminal-Emulator</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>RecyclerView-FlexibleDivider</name>
|
<name>RecyclerView-FlexibleDivider</name>
|
||||||
<copyright>Copyright 2016 yqritc</copyright>
|
<copyright>Copyright 2016 yqritc</copyright>
|
||||||
<url>https://github.com/yqritc/RecyclerView-FlexibleDivider</url>
|
<url>https://github.com/yqritc/RecyclerView-FlexibleDivider</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Volley</name>
|
<name>Volley</name>
|
||||||
<copyright/>
|
<copyright/>
|
||||||
<url>https://github.com/google/volley</url>
|
<url>https://github.com/google/volley</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Settings Compat</name>
|
<name>Settings Compat</name>
|
||||||
<copyright>Copyright 2016 czy1121</copyright>
|
<copyright>Copyright 2016 czy1121</copyright>
|
||||||
<url>https://github.com/czy1121/settingscompat</url>
|
<url>https://github.com/czy1121/settingscompat</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
<notice>
|
<toast>
|
||||||
<name>Zip4j</name>
|
<name>Zip4j</name>
|
||||||
<copyright/>
|
<copyright/>
|
||||||
<url>http://www.lingala.net/zip4j/</url>
|
<url>http://www.lingala.net/zip4j/</url>
|
||||||
<license>Apache Software License 2.0</license>
|
<license>Apache Software License 2.0</license>
|
||||||
</notice>
|
</toast>
|
||||||
</notices>
|
</notices>
|
||||||
@@ -13,12 +13,12 @@ means the combination of the Contributions of others (if any) used by a Contribu
|
|||||||
means Covered Software of a particular Contributor.
|
means Covered Software of a particular Contributor.
|
||||||
|
|
||||||
1.4. “Covered Software”
|
1.4. “Covered Software”
|
||||||
means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof.
|
means Source Code Form to which the initial Contributor has attached the toast in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof.
|
||||||
|
|
||||||
1.5. “Incompatible With Secondary Licenses”
|
1.5. “Incompatible With Secondary Licenses”
|
||||||
means
|
means
|
||||||
|
|
||||||
that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or
|
that the initial Contributor has attached the toast described in Exhibit B to the Covered Software; or
|
||||||
|
|
||||||
that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License.
|
that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License.
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ for infringements caused by: (i) Your and any other third party’s modification
|
|||||||
|
|
||||||
under Patent Claims infringed by Covered Software in the absence of its Contributions.
|
under Patent Claims infringed by Covered Software in the absence of its Contributions.
|
||||||
|
|
||||||
This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4).
|
This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the toast requirements in Section 3.4).
|
||||||
|
|
||||||
2.4. Subsequent Licenses
|
2.4. Subsequent Licenses
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ If it is impossible for You to comply with any of the terms of this License with
|
|||||||
|
|
||||||
5. Termination
|
5. Termination
|
||||||
|
|
||||||
5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice.
|
5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received toast of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the toast.
|
||||||
|
|
||||||
5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate.
|
5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate.
|
||||||
|
|
||||||
@@ -165,13 +165,13 @@ If you create software not governed by this License, and you want to create a ne
|
|||||||
|
|
||||||
10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
|
10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
|
||||||
|
|
||||||
If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached.
|
If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the toast described in Exhibit B of this License must be attached.
|
||||||
|
|
||||||
Exhibit A - Source Code Form License Notice
|
Exhibit A - Source Code Form License Notice
|
||||||
|
|
||||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
|
If it is not possible or desirable to put the toast in a particular file, then You may include the toast in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a toast.
|
||||||
|
|
||||||
You may add additional accurate notices of copyright ownership.
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,6 @@
|
|||||||
<color name="colorAccent">#536DFE</color>
|
<color name="colorAccent">#536DFE</color>
|
||||||
<color name="sliding_up_panel_shadow_color">#99444444</color>
|
<color name="sliding_up_panel_shadow_color">#99444444</color>
|
||||||
<color name="bubble_bg">#eef2f3f9</color>
|
<color name="bubble_bg">#eef2f3f9</color>
|
||||||
|
<color name="color_r">#FD999A</color>
|
||||||
|
<color name="color_j">#99CC99</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<dimen name="level_beam_view_line_width">6dp</dimen>
|
<dimen name="level_beam_view_line_width">6dp</dimen>
|
||||||
<dimen name="level_beam_view_line_offset">2dp</dimen>
|
<dimen name="level_beam_view_line_offset">2dp</dimen>
|
||||||
<dimen name="level_beam_view_padding_right">-4dp</dimen>
|
<dimen name="level_beam_view_padding_right">-4dp</dimen>
|
||||||
<dimen name="script_and_folder_list_divider_left_margin">56dp</dimen>
|
<dimen name="script_and_folder_list_divider_left_margin">0dp</dimen>
|
||||||
<dimen name="script_and_folder_list_divider_right_margin">0dp</dimen>
|
<dimen name="script_and_folder_list_divider_right_margin">0dp</dimen>
|
||||||
<dimen name="floating_icon_size">56dp</dimen>
|
<dimen name="floating_icon_size">56dp</dimen>
|
||||||
<dimen name="floating_icon_margin">0dp</dimen>
|
<dimen name="floating_icon_margin">0dp</dimen>
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import android.app.Activity;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,15 +48,15 @@ public interface BackPressedHandler {
|
|||||||
private final Activity mActivity;
|
private final Activity mActivity;
|
||||||
private long mLastPressedMillis;
|
private long mLastPressedMillis;
|
||||||
private long mDoublePressInterval = 1000;
|
private long mDoublePressInterval = 1000;
|
||||||
private String mNotice;
|
private String mToast;
|
||||||
|
|
||||||
public DoublePressExit(Activity activity, int noticeResId) {
|
public DoublePressExit(Activity activity, int noticeResId) {
|
||||||
this(activity, activity.getString(noticeResId));
|
this(activity, activity.getString(noticeResId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public DoublePressExit(Activity activity, String notice) {
|
public DoublePressExit(Activity activity, String toast) {
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
mNotice = notice;
|
mToast = toast;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DoublePressExit doublePressInterval(long doublePressInterval) {
|
public DoublePressExit doublePressInterval(long doublePressInterval) {
|
||||||
@@ -72,7 +70,7 @@ public interface BackPressedHandler {
|
|||||||
mActivity.finish();
|
mActivity.finish();
|
||||||
} else {
|
} else {
|
||||||
mLastPressedMillis = System.currentTimeMillis();
|
mLastPressedMillis = System.currentTimeMillis();
|
||||||
Toast.makeText(mActivity, mNotice, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, mToast, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user