add: manager tab
This commit is contained in:
@@ -39,33 +39,4 @@ public class LogActivity extends BaseActivity {
|
||||
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.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
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.ui.common.ScriptOperations;
|
||||
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.script_list.MyScriptListFragment_;
|
||||
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.DrawableSaver;
|
||||
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.settings.SettingsActivity_;
|
||||
import com.stardust.scriptdroid.ui.update.VersionGuard;
|
||||
@@ -72,8 +71,10 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
SlidingUpPanel mAddBottomMenuPanel;
|
||||
@ViewById(R.id.viewpager)
|
||||
ViewPager mViewPager;
|
||||
private FragmentPagerAdapterBuilder.StoredFragmentPagerAdapter mPagerAdapter;
|
||||
@ViewById(R.id.fab)
|
||||
FloatingActionButton mFab;
|
||||
|
||||
private FragmentPagerAdapterBuilder.StoredFragmentPagerAdapter mPagerAdapter;
|
||||
private OnActivityResultDelegate.Mediator mActivityResultMediator = new OnActivityResultDelegate.Mediator();
|
||||
private DrawableSaver mDrawerHeaderBackgroundSaver;
|
||||
private VersionGuard mVersionGuard;
|
||||
@@ -182,6 +183,15 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
.build();
|
||||
mViewPager.setAdapter(mPagerAdapter);
|
||||
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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
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.
|
||||
*/
|
||||
|
||||
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.content.Context;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.ui.main.ViewPagerFragment;
|
||||
import com.stardust.util.BackPressedHandler;
|
||||
import com.stardust.widget.EWebView;
|
||||
|
||||
@@ -17,7 +21,7 @@ import org.androidannotations.annotations.ViewById;
|
||||
* Created by Stardust on 2017/8/22.
|
||||
*/
|
||||
@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)
|
||||
EWebView mEWebView;
|
||||
@@ -53,4 +57,11 @@ public class OnlineDocsFragment extends Fragment implements BackPressedHandler {
|
||||
}
|
||||
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;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
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.afollestad.materialdialogs.DialogAction;
|
||||
@@ -14,6 +17,7 @@ import com.stardust.scriptdroid.script.Scripts;
|
||||
import com.stardust.scriptdroid.script.StorageFileProvider;
|
||||
import com.stardust.scriptdroid.ui.common.ScriptLoopDialog;
|
||||
import com.stardust.scriptdroid.ui.edit.ScriptEditView;
|
||||
import com.stardust.scriptdroid.ui.main.ViewPagerFragment;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
import org.androidannotations.annotations.EFragment;
|
||||
@@ -32,7 +36,7 @@ import io.reactivex.schedulers.Schedulers;
|
||||
* Created by Stardust on 2017/3/13.
|
||||
*/
|
||||
@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";
|
||||
|
||||
@@ -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.widget.TextView;
|
||||
|
||||
import com.stardust.autojs.script.AutoFileSource;
|
||||
import com.stardust.pio.PFile;
|
||||
import com.stardust.scriptdroid.R;
|
||||
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)
|
||||
@@ -203,17 +204,16 @@ public class ScriptListView extends SwipeRefreshLayout implements SwipeRefreshLa
|
||||
mDesc.setText(PFile.getHumanReadableSize(file.length()));
|
||||
if (file.getType() == ScriptFile.TYPE_JAVA_SCRIPT) {
|
||||
mFirstChar.setText("J");
|
||||
//什么?裸写颜色代码?!不影响代码可读性和重构成本的情况下,这样子修改起来方便多啦
|
||||
mFirstCharBackground.setColor(0xFF99CC99);
|
||||
mFirstCharBackground.setColor(getResources().getColor(R.color.color_j));
|
||||
} else {
|
||||
mFirstChar.setText("R");
|
||||
mFirstCharBackground.setColor(0xFFFD999A);
|
||||
mFirstCharBackground.setColor(getResources().getColor(R.color.color_r));
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.item)
|
||||
void onItemClick() {
|
||||
if(mOnScriptFileClickListener != null){
|
||||
if (mOnScriptFileClickListener != null) {
|
||||
mOnScriptFileClickListener.onScriptFileClick(itemView, mScriptFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.stardust.scriptdroid.ui.main.task;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.ThemeColorRecyclerView;
|
||||
@@ -8,28 +9,28 @@ import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.workground.WrapContentLinearLayoutManager;
|
||||
|
||||
import com.stardust.autojs.ScriptEngineService;
|
||||
import com.stardust.autojs.engine.JavaScriptEngine;
|
||||
import com.stardust.autojs.engine.ScriptEngineManager;
|
||||
import com.stardust.autojs.execution.ScriptExecution;
|
||||
import com.stardust.autojs.execution.ScriptExecutionListener;
|
||||
import com.stardust.autojs.execution.SimpleScriptExecutionListener;
|
||||
import com.stardust.autojs.engine.ScriptEngine;
|
||||
import com.stardust.autojs.script.AutoFileSource;
|
||||
import com.stardust.autojs.script.JavaScriptSource;
|
||||
import com.stardust.autojs.script.ScriptSource;
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.autojs.AutoJs;
|
||||
import com.stardust.scriptdroid.script.ScriptFile;
|
||||
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* 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 Adapter mAdapter;
|
||||
private final ScriptEngineService mScriptEngineService = AutoJs.getInstance().getScriptEngineService();
|
||||
@@ -106,7 +84,7 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView implements Scri
|
||||
private void init() {
|
||||
setLayoutManager(new WrapContentLinearLayoutManager(getContext()));
|
||||
addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext())
|
||||
.color(0xffd9d9d9)
|
||||
.color(0xffEDEEEF)
|
||||
.size(2)
|
||||
.marginResId(R.dimen.script_and_folder_list_divider_left_margin, R.dimen.script_and_folder_list_divider_right_margin)
|
||||
.showLastDivider()
|
||||
@@ -186,7 +164,9 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView implements Scri
|
||||
|
||||
@Override
|
||||
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
|
||||
@@ -195,30 +175,46 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView implements Scri
|
||||
}
|
||||
}
|
||||
|
||||
private class ViewHolder extends RecyclerView.ViewHolder {
|
||||
class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView icon;
|
||||
TextView name, detail;
|
||||
View stop;
|
||||
@BindView(R.id.first_char)
|
||||
TextView mFirstChar;
|
||||
@BindView(R.id.name)
|
||||
TextView mName;
|
||||
@BindView(R.id.desc)
|
||||
TextView mDesc;
|
||||
|
||||
private ScriptEngine mScriptEngine;
|
||||
private GradientDrawable mFirstCharBackground;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
itemView.setOnClickListener(mOnItemClickListenerProxy);
|
||||
name = (TextView) itemView.findViewById(R.id.name);
|
||||
detail = (TextView) itemView.findViewById(R.id.detail);
|
||||
icon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
stop = itemView.findViewById(R.id.stop);
|
||||
stop.setOnClickListener(mOnStopClickListener);
|
||||
ButterKnife.bind(this, itemView);
|
||||
mFirstCharBackground = (GradientDrawable) mFirstChar.getBackground();
|
||||
}
|
||||
|
||||
public void bind(ScriptSource source) {
|
||||
public void bind(ScriptSource source, ScriptEngine engine) {
|
||||
mScriptEngine = engine;
|
||||
if (source == null)
|
||||
return;
|
||||
name.setText(source.getName());
|
||||
detail.setText(source.toString());
|
||||
mName.setText(source.getName());
|
||||
mDesc.setText(source.toString());
|
||||
//ignore android studio warning: use equals to compare string
|
||||
icon.setImageResource(source.getEngineName() == AutoFileSource.ENGINE ? R.drawable.record_icon_18
|
||||
: R.drawable.ic_node_js_black);
|
||||
if (source.getEngineName() == AutoFileSource.ENGINE) {
|
||||
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;
|
||||
|
||||
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.view.ViewPager;
|
||||
import android.support.v4.view.animation.FastOutSlowInInterpolator;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.view.MenuItem;
|
||||
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.autojs.AutoJs;
|
||||
import com.stardust.scriptdroid.ui.console.LogView;
|
||||
import com.stardust.scriptdroid.ui.main.ViewPagerFragment;
|
||||
import com.stardust.widget.SimpleAdapterDataObserver;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
@@ -13,27 +27,54 @@ import org.androidannotations.annotations.Click;
|
||||
import org.androidannotations.annotations.EFragment;
|
||||
import org.androidannotations.annotations.ViewById;
|
||||
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/3/24.
|
||||
*/
|
||||
@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)
|
||||
TaskListRecyclerView mTaskListRecyclerView;
|
||||
@ViewById(R.id.close_all)
|
||||
View mCloseAllView;
|
||||
|
||||
@ViewById(R.id.notice_no_running_script)
|
||||
View mNoRunningScriptNotice;
|
||||
|
||||
@ViewById(R.id.swipe_refresh_layout)
|
||||
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
|
||||
void setUpViews() {
|
||||
init();
|
||||
final boolean noRunningScript = mTaskListRecyclerView.getAdapter().getItemCount() == 0;
|
||||
mNoRunningScriptNotice.setVisibility(noRunningScript ? View.VISIBLE : View.GONE);
|
||||
mCloseAllView.setVisibility(noRunningScript ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -48,7 +89,6 @@ public class TaskManagerFragment extends Fragment {
|
||||
if (mNoRunningScriptNotice == null)
|
||||
return;
|
||||
mNoRunningScriptNotice.setVisibility(noRunningScript ? View.VISIBLE : View.GONE);
|
||||
mCloseAllView.setVisibility(noRunningScript ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}, 150);
|
||||
}
|
||||
@@ -69,8 +109,66 @@ public class TaskManagerFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
@Click(R.id.close_all)
|
||||
void closeAllRunningScripts() {
|
||||
AutoJs.getInstance().getScriptEngineService().stopAll();
|
||||
@Click(R.id.spinner)
|
||||
void showPopupMenu() {
|
||||
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>
|
||||
|
||||
<view
|
||||
<com.stardust.scriptdroid.ui.console.LogView
|
||||
android:id="@+id/console"
|
||||
class="com.stardust.scriptdroid.ui.console.LogActivity$ConsoleView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.stardust.widget.AppWithStatusBarLayout
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#5cab7d"
|
||||
android:paddingTop="16dp"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
@@ -33,8 +34,7 @@
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
app:tabMode="scrollable"/>
|
||||
</com.stardust.widget.AppWithStatusBarLayout>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
@@ -43,6 +43,7 @@
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
@@ -58,7 +59,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="160dp"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
~ copies of the Software, and to permit persons to whom the Software is
|
||||
~ 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.
|
||||
~
|
||||
~ 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
|
||||
~ 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.
|
||||
~
|
||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
|
||||
@@ -1,63 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#f4f4f4">
|
||||
|
||||
<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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:padding="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/close_all"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@+id/spinner_current_item"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#d4d4d4"
|
||||
android:foreground="?selectableItemBackground"
|
||||
android:visibility="gone">
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="@string/text_task_manage"
|
||||
android:textColor="#484C4F"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginLeft="17dp"
|
||||
android:layout_marginRight="17dp"
|
||||
android:layout_marginTop="12dp"
|
||||
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>
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:src="@drawable/ic_arrow_drop_down_black"
|
||||
android:tint="#484C4F"/>
|
||||
|
||||
</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"?>
|
||||
<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
|
||||
android:id="@+id/icon"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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_height="40dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:contentDescription="@string/_app_name"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_node_js_black"/>
|
||||
android:background="@drawable/circle_green"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="24sp"
|
||||
tools:text="J"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
@@ -32,41 +36,38 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="@android:color/secondary_text_light"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#484C4F"
|
||||
android:textSize="14sp"
|
||||
tools:text="正在运行的服务"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="4dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="#777777"
|
||||
android:textSize="12sp"
|
||||
tools:text="/storage/emulated/0/脚本/正在运行的服务.txt"/>
|
||||
android:textColor="#9DA0A2"
|
||||
android:textSize="11sp"
|
||||
tools:text="18 KB"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
<ImageView
|
||||
android:id="@+id/stop"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="12dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:gravity="center">
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:padding="6dp"
|
||||
android:src="@drawable/ic_close_gray600_48dp"
|
||||
android:tint="#A9AAAB"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/_app_name"
|
||||
android:src="@drawable/ic_close"/>
|
||||
</LinearLayout>
|
||||
|
||||
</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"?>
|
||||
<notices>
|
||||
<notice>
|
||||
<toast>
|
||||
<name>Rhino: JavaScript in Java</name>
|
||||
<url>https://github.com/mozilla/rhino</url>
|
||||
<copyright/>
|
||||
<license>Mozilla Public License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>920 Text Editor</name>
|
||||
<url>https://github.com/jecelyin/920-text-editor-v2</url>
|
||||
<copyright/>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>LeakCanary</name>
|
||||
<copyright>Copyright 2015 Square, Inc.</copyright>
|
||||
<url>https://github.com/square/leakcanary</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>StorIO</name>
|
||||
<url>https://github.com/pushtorefresh/storio</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Material Dialogs</name>
|
||||
<url>https://github.com/afollestad/material-dialogs</url>
|
||||
<copyright>Copyright (c) 2014-2016 Aidan Michael Follestad</copyright>
|
||||
<license>MIT License</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Gson</name>
|
||||
<url>https://github.com/google/gson</url>
|
||||
<copyright>Copyright 2008 Google Inc.</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>commonmark-java</name>
|
||||
<url>https://github.com/atlassian/commonmark-java</url>
|
||||
<copyright>Copyright (c) 2015-2016 Atlassian and others.</copyright>
|
||||
<license>BSD 2-Clause License</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Alipay ZeroSdk</name>
|
||||
<copyright>Copyright 2016 Fung Go (fython)</copyright>
|
||||
<url>https://github.com/fython/AlipayZeroSdk</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Console</name>
|
||||
<copyright>Copyright 2015 Josef Raska</copyright>
|
||||
<url>https://github.com/jraska/Console</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>android-issue-reporter</name>
|
||||
<copyright/>
|
||||
<url>https://github.com/HeinrichReimer/android-issue-reporter</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>SortableTableView</name>
|
||||
<copyright>Copyright 2015 Ingo Schwarz</copyright>
|
||||
<url>https://github.com/ISchwarz23/SortableTableView</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>MultiLevelListView</name>
|
||||
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
||||
<url>https://github.com/open-rnd/android-multi-level-listview</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>hover</name>
|
||||
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
||||
<url>https://github.com/google/hover</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>event-bus</name>
|
||||
<copyright>2016 (C) Copyright Open-RnD Sp. z o.o.</copyright>
|
||||
<url>https://github.com/greenrobot/EventBus</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Expandable RecyclerView</name>
|
||||
<copyright>Copyright (c) 2015 Big Nerd Ranch</copyright>
|
||||
<url>https://github.com/bignerdranch/expandable-recycler-view</url>
|
||||
<license>MIT License</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Android Terminal Emulator</name>
|
||||
<copyright/>
|
||||
<url>https://github.com/jackpal/Android-Terminal-Emulator</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>RecyclerView-FlexibleDivider</name>
|
||||
<copyright>Copyright 2016 yqritc</copyright>
|
||||
<url>https://github.com/yqritc/RecyclerView-FlexibleDivider</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Volley</name>
|
||||
<copyright/>
|
||||
<url>https://github.com/google/volley</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Settings Compat</name>
|
||||
<copyright>Copyright 2016 czy1121</copyright>
|
||||
<url>https://github.com/czy1121/settingscompat</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
</toast>
|
||||
<toast>
|
||||
<name>Zip4j</name>
|
||||
<copyright/>
|
||||
<url>http://www.lingala.net/zip4j/</url>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
</toast>
|
||||
</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.
|
||||
|
||||
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”
|
||||
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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
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
|
||||
|
||||
@@ -127,7 +127,7 @@ If it is impossible for You to comply with any of the terms of this License with
|
||||
|
||||
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.
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -5,4 +5,6 @@
|
||||
<color name="colorAccent">#536DFE</color>
|
||||
<color name="sliding_up_panel_shadow_color">#99444444</color>
|
||||
<color name="bubble_bg">#eef2f3f9</color>
|
||||
<color name="color_r">#FD999A</color>
|
||||
<color name="color_j">#99CC99</color>
|
||||
</resources>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<dimen name="level_beam_view_line_width">6dp</dimen>
|
||||
<dimen name="level_beam_view_line_offset">2dp</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="floating_icon_size">56dp</dimen>
|
||||
<dimen name="floating_icon_margin">0dp</dimen>
|
||||
|
||||
@@ -4,8 +4,6 @@ import android.app.Activity;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
@@ -50,15 +48,15 @@ public interface BackPressedHandler {
|
||||
private final Activity mActivity;
|
||||
private long mLastPressedMillis;
|
||||
private long mDoublePressInterval = 1000;
|
||||
private String mNotice;
|
||||
private String mToast;
|
||||
|
||||
public DoublePressExit(Activity activity, int noticeResId) {
|
||||
this(activity, activity.getString(noticeResId));
|
||||
}
|
||||
|
||||
public DoublePressExit(Activity activity, String notice) {
|
||||
public DoublePressExit(Activity activity, String toast) {
|
||||
mActivity = activity;
|
||||
mNotice = notice;
|
||||
mToast = toast;
|
||||
}
|
||||
|
||||
public DoublePressExit doublePressInterval(long doublePressInterval) {
|
||||
@@ -72,7 +70,7 @@ public interface BackPressedHandler {
|
||||
mActivity.finish();
|
||||
} else {
|
||||
mLastPressedMillis = System.currentTimeMillis();
|
||||
Toast.makeText(mActivity, mNotice, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(mActivity, mToast, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user