コード例 #1
0
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (mViewFramework.onKeyDown(keyCode, event)) {
     return true;
   }
   return super.onKeyDown(keyCode, event);
 }
コード例 #2
0
  @Override
  protected void onCreate(Bundle bundle) {
    super.requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(bundle);
    startService(new Intent(this, RucksackService.class));
    mHandler = new Handler(new MessageProcessor());
    mWaitDialog = new WaitDialog(this);
    mDeviceDialog = new DeviceDialog(this, mHandler.obtainMessage(ACTION_DEVICE_SELECTED));
    mRootPasswordDialog =
        new RootPasswordDialog(this, mHandler.obtainMessage(ACTION_PASSWORD_INPUTED));
    mRootPasswordStorage = getSharedPreferences("password-storage", MODE_APPEND);

    mViewFramework = new ViewFramework(this);
    mViewFramework.addSettingGroup("网络");
    mViewFramework.addSettingItem(new ConfigureNetwork(this));
    mViewFramework.addSettingGroup("服务");
    mViewFramework.addSettingItem(new ConfigureWebService(this));
    mViewFramework.addSettingItem(new ConfigureFtpService(this));
    mViewFramework.addSettingItem(new ConfigureDlnaService(this));
    mViewFramework.addSettingItem(new ConfigureDdnsService(this));
    mViewFramework.addSettingItem(new ConfigureProxyService(this));
    mViewFramework.addSettingItem(new ConfigureSambaService(this));
    mViewFramework.addSettingGroup("密码");
    mViewFramework.addSettingItem(new ConfigurePassword(this, "root"));
    mViewFramework.addSettingItem(new ConfigurePassword(this, "share"));
    mViewFramework.addSettingItem(new ConfigurePassword(this, "guest"));
    mViewFramework.addSettingGroup("日期和时间");
    mViewFramework.addSettingItem(new ConfigureTime(this, ConfigureTime.Source.DEVICE));
    mViewFramework.addSettingItem(new ConfigureTime(this, ConfigureTime.Source.NETWORK));
    mViewFramework.addSettingGroup("系统");
    mViewFramework.addSettingItem(new ConfigureHostname(this));
    mViewFramework.addSettingItem(new ConfigureStorage(this));
    mViewFramework.addSettingItem(new ConfigureService(this));
    mViewFramework.addSettingItem(new ConfigureProcess(this));
    mViewFramework.addSettingItem(new ConfigureAbout(this));

    mViewFramework.addFunctionItem(new FunctionFilesystem(this));
    mViewFramework.addFunctionItem(new FunctionDownloader(this));
    mViewFramework.addFunctionItem(new FunctionPlayer(this));

    setContentView(mViewFramework);
  }