Exemplo n.º 1
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
   if (scanResult != null) {
     ((FormEditText) builder.getDialog().findViewById(R.id.device_code_input))
         .setText(scanResult.getContents());
   }
 }
Exemplo n.º 2
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo;
    Cursor cursor = (Cursor) getListAdapter().getItem(mi.position);
    menu.setHeaderTitle(cursor.getString(2));
    menu.add(0, MENU_ID_DELETE, 0, R.string.devices_delete);
  }
  @Override
  public void onResume() {
    super.onResume();

    lv = getListView();
    lv.setOnScrollListener(this);
    lv.setOnItemClickListener(this);
    lv.setOnItemLongClickListener(this); // Directly got to reply

    String msg = setupFilter();
    if (msg != null) Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Activity theParent = getParent();
    if ((!(theParent instanceof TabWidget)) && (android.os.Build.VERSION.SDK_INT < 11)) {
      // We have no enclosing TabWidget, so we need to request the custom title
      requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    }

    // Set the layout of the list activity
    if (Build.VERSION.SDK_INT < 11) setContentView(R.layout.tweet_list_layout);
    else setContentView(R.layout.tweet_list_layout_honeycomb);

    // Get the windows progress bar from the enclosing TabWidget
    if ((!(theParent instanceof TabWidget)) && (android.os.Build.VERSION.SDK_INT < 11)) {
      // We have no enclosing TabWidget, so we need our window here
      getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
      progressBar = (ProgressBar) findViewById(R.id.title_progress_bar);
      titleTextBox = (TextView) findViewById(R.id.title_msg_box);

      ImageButton imageButton = (ImageButton) findViewById(R.id.back_button);
      imageButton.setVisibility(View.VISIBLE);
    }
    lv = getListView();
    lv.setOnScrollListener(this);
    lv.setOnItemClickListener(this);
    lv.setOnItemLongClickListener(this); // Directly got to reply

    Bundle intentInfo = getIntent().getExtras();
    if (intentInfo == null) {
      list_id = 0;
    } else {
      userListId = intentInfo.getInt("userListid");
      list_id = intentInfo.getInt(TabWidget.LIST_ID);
      if (intentInfo.containsKey("userId")) {
        // Display tweets of a single user
        userId = intentInfo.getLong("userId");
        // This is a one off list. So don't offer the reload button
        ImageButton tweet_list_reload_button =
            (ImageButton) findViewById(R.id.tweet_list_reload_button);
        if (tweet_list_reload_button != null)
          tweet_list_reload_button.setVisibility(View.INVISIBLE);
      }
      if (intentInfo.containsKey("unreadCount")) {
        unreadCount = intentInfo.getInt("unreadCount");
      }
    }

    boolean fromDbOnly = tdb.getLastRead(account.getId(), list_id) != -1;
    fillListViewFromTimeline(fromDbOnly); // Only get tweets from db to speed things up at start
  }
Exemplo n.º 5
0
 @Override
 @SuppressWarnings("deprecation")
 protected void onPrepareDialog(final int id, final Dialog dialog) {
   super.onPrepareDialog(id, dialog);
   switch (id) {
     case ModifyDeviceDialogBuilder.DIALOG_ID:
       ((AlertDialog) dialog).setTitle(getIntent().getStringExtra("deviceName"));
       break;
     case DeleteDeviceDialogBuilder.DIALOG_ID:
       ((AlertDialog) dialog).setTitle(getIntent().getStringExtra("deviceName"));
       break;
   }
 }
Exemplo n.º 6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.devices);

    if (Preferences.blackOnWhite && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
      getListView().setBackgroundColor(Color.WHITE);

    mDevices = Devices.getInstance();
    if (!mDevices.hasPlugins()) {
      Button b = (Button) findViewById(R.id.devices_add_device);
      b.setVisibility(View.GONE);
    }

    show();
  }
Exemplo n.º 7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    registerForContextMenu(getListView());
    doInitListViewTask("/user/" + getIntent().getStringExtra("userId") + "/devices");
    getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    getListView()
        .setOnItemClickListener(
            new OnItemClickListener() {

              @Override
              public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // TODO Auto-generated method stub
                Intent intent = new Intent(VariableActivity.ACTIVITY_ACTION);
                intent.putExtra("deviceId", String.valueOf(view.getTag()));
                startActivity(intent);
              }
            });
  }
Exemplo n.º 8
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, view, menuInfo);
   getMenuInflater().inflate(R.menu.context_menu, menu);
 }
Exemplo n.º 9
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   mDevices.initDevices();
 }
Exemplo n.º 10
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   mDevices.dbClose();
 }