Esempio n. 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.script_manager);
    setTitle("sl4a");
    File sl4a = null;
    mBaseDir = new File(new GetPath().path(this) + "/sl4a/scripts/");
    Log.i("mBaseDir: " + mBaseDir.getAbsolutePath());
    sl4a = mBaseDir.getParentFile();
    if (!sl4a.exists()) {
      sl4a.mkdirs();
      try {
        FileUtils.chmod(sl4a, 0755);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    File tfile = new File(mBaseDir.getAbsolutePath() + "/template/");
    if (!tfile.exists()) {
      tfile.mkdirs(); // 创建模版路径
    }
    if (!FileUtils.makeDirectories(mBaseDir, 0755)) {
      new AlertDialog.Builder(this)
          .setTitle("Error")
          .setMessage(
              getString(R.string.s_Failedtocreate)
                  + "\n"
                  + mBaseDir
                  + "\n"
                  + getString(R.string.s_PleaseCheck))
          .setIcon(android.R.drawable.ic_dialog_alert)
          .setPositiveButton("Ok", null)
          .show();
    }

    mCurrentDir = mBaseDir;
    mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    mAdapter = new ScriptManagerAdapter(this);
    mObserver = new ScriptListObserver();
    mAdapter.registerDataSetObserver(mObserver);
    mConfiguration = ((BaseApplication) getApplication()).getInterpreterConfiguration();
    // mManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    mList = (JazzyListView) findViewById(android.R.id.list);
    registerForContextMenu(mList);
    updateAndFilterScriptList(mQuery);
    mList.setAdapter(mAdapter);
    ActivityFlinger.attachView(mList, this);
    ActivityFlinger.attachView(getWindow().getDecorView(), this);
    startService(IntentBuilders.buildTriggerServiceIntent());
    UsageTrackingConfirmation.show(this);
    Analytics.trackActivity(this);
    setupJazziness(JazzyHelper.HELIX);
    mList.setOnItemClickListener(listItemClick);
    mList.setOnScrollListener(scrollListener);
    new CrashEmail(this, "*****@*****.**");
  }
Esempio n. 2
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   CustomizeWindow.requestCustomTitle(this, "Triggers", R.layout.trigger_manager);
   ScriptTriggerListObserver observer = new ScriptTriggerListObserver();
   mAdapter = new ScriptTriggerAdapter();
   setListAdapter(mAdapter);
   registerForContextMenu(getListView());
   mTriggerRepository = ((BaseApplication) getApplication()).getTriggerRepository();
   mTriggerRepository.bootstrapObserver(observer);
   ActivityFlinger.attachView(getListView(), this);
   ActivityFlinger.attachView(getWindow().getDecorView(), this);
   Analytics.trackActivity(this);
 }