/** {@inheritDoc} */
 @Override
 public Cursor query(
     final Uri uri,
     final String[] projection,
     final String selection,
     final String[] selectionArgs,
     final String sortOrder) {
   Log.d(TAG, "query(" + uri + ",..)");
   if (uri == null) {
     return null;
   }
   final String query = uri.getLastPathSegment();
   Log.d(TAG, "query: " + query);
   if (TextUtils.isEmpty(query) || query.equals(SearchManager.SUGGEST_URI_PATH_QUERY)) {
     return null;
   }
   final int limit = Utils.parseInt(uri.getQueryParameter("limit"), -1);
   Log.d(TAG, "limit: " + limit);
   final String[] proj =
       new String[] {
         "_id",
         "address as " + SearchManager.SUGGEST_COLUMN_TEXT_1,
         "body as " + SearchManager.SUGGEST_COLUMN_TEXT_2
       };
   final String where = "body like '%" + query + "%'";
   return new MergeCursor(
       new Cursor[] {
         this.getContext()
             .getContentResolver()
             .query(
                 SMS_URI, // .
                 proj, where, null, null)
       });
 }
  /** {@inheritDoc} */
  @Override
  public void onUpdate(
      final Context context, final AppWidgetManager appWidgetManager, final int[] appWidgetIds) {
    Log.d(TAG, "onUpdate()");
    Utils.setLocale(context);
    // Update logs and run rule matcher
    LogRunnerService.update(context, LogRunnerService.ACTION_RUN_MATCHER);

    final int count = appWidgetIds.length;

    // Perform this loop procedure for each App Widget that belongs to this
    // provider
    for (int i = 0; i < count; i++) {
      updateWidget(context, appWidgetManager, appWidgetIds[i]);
    }
  }
 /** {@inheritDoc} */
 @Override
 public boolean onOptionsItemSelected(final MenuItem item) {
   switch (item.getItemId()) {
     case R.id.item_compose:
       final Intent i = getComposeIntent(this, null);
       try {
         this.startActivity(i);
       } catch (ActivityNotFoundException e) {
         Log.e(TAG, "error launching intent: " + i.getAction() + ", " + i.getData());
         Toast.makeText(
                 this,
                 "error launching messaging app!\n" + "Please contact the developer.",
                 Toast.LENGTH_LONG)
             .show();
       }
       return true;
     case R.id.item_settings: // start settings activity
       if (Utils.isApi(Build.VERSION_CODES.HONEYCOMB)) {
         this.startActivity(
             new Intent(
                 this, // .
                 Preferences11Activity.class));
       } else {
         this.startActivity(new Intent(this, PreferencesActivity.class));
       }
       return true;
     case R.id.item_donate:
       DonationHelper.startDonationActivity(this, true);
       return true;
     case R.id.item_delete_all_threads:
       deleteMessages(
           this,
           Uri.parse("content://sms/"),
           R.string.delete_threads_,
           R.string.delete_threads_question,
           null);
       return true;
     case R.id.item_mark_all_read:
       markRead(this, Uri.parse("content://sms/"), 1);
       markRead(this, Uri.parse("content://mms/"), 1);
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
  /** {@inheritDoc} */
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    final Intent i = this.getIntent();
    Log.d(TAG, "got intent: " + i.getAction());
    Log.d(TAG, "got uri: " + i.getData());
    Log.d(TAG, "got extra: " + i.getExtras());

    this.setTheme(PreferencesActivity.getTheme(this));
    Utils.setLocale(this);
    this.setContentView(R.layout.conversationlist);

    ChangelogHelper.showChangelog(this, true);
    final List<ResolveInfo> ri =
        this.getPackageManager()
            .queryBroadcastReceivers(new Intent("de.ub0r.android.websms.connector.INFO"), 0);
    if (ri.size() == 0) {
      final Intent intent =
          Market.getInstallAppIntent(this, "de.ub0r.android.websms", Market.ALT_WEBSMS);
      ChangelogHelper.showNotes(this, true, "get WebSMS", null, intent);
    } else {
      ChangelogHelper.showNotes(this, true, null, null, null);
    }

    showRows(this);

    final ListView list = this.getListView();
    this.adapter = new ConversationAdapter(this);
    this.setListAdapter(this.adapter);
    list.setOnItemClickListener(this);
    list.setOnItemLongClickListener(this);
    this.longItemClickDialog = new String[WHICH_N];
    this.longItemClickDialog[WHICH_ANSWER] = this.getString(R.string.reply);
    this.longItemClickDialog[WHICH_CALL] = this.getString(R.string.call);
    this.longItemClickDialog[WHICH_VIEW_CONTACT] = this.getString(R.string.view_contact_);
    this.longItemClickDialog[WHICH_VIEW] = this.getString(R.string.view_thread_);
    this.longItemClickDialog[WHICH_DELETE] = this.getString(R.string.delete_thread_);
    this.longItemClickDialog[WHICH_MARK_SPAM] = this.getString(R.string.filter_spam_);
  }
  /** {@inheritDoc} */
  @Override
  public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Utils.setLocale(this);
    this.setTitle(
        this.getString(R.string.settings)
            + " > "
            + this.getString(R.string.rules)
            + " > "
            + this.getString(R.string.numbers)
            + " > "
            + this.getString(R.string.edit_));
    this.setContentView(R.layout.list_name_ok_help_add);

    final Intent i = this.getIntent();
    final Uri u = i.getData();
    if (u != null) {
      this.gid = ContentUris.parseId(u);
    }

    this.setListAdapter(new NumberAdapter(this, this.gid));
    this.getListView().setOnItemClickListener(this);

    this.findViewById(R.id.ok).setOnClickListener(this);
    this.findViewById(R.id.add).setOnClickListener(this);
    this.findViewById(R.id.name_help).setOnClickListener(this);
    this.findViewById(R.id.help).setOnClickListener(this);

    this.etName = (EditText) this.findViewById(R.id.name_et);
    this.etName.setText(DataProvider.NumbersGroup.getName(this.getContentResolver(), this.gid));

    final String a = i.getAction();
    if (a != null && a.equals(Intent.ACTION_VIEW)) {
      this.etName.setVisibility(View.GONE);
      this.findViewById(R.id.name).setVisibility(View.GONE);
      this.findViewById(R.id.name_help).setVisibility(View.GONE);
    }
  }
Exemple #6
0
 /** {@inheritDoc} */
 @Override
 public final void onCreate(final Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Utils.setLocale(this);
   this.setTitle(this.getString(R.string.settings) + " > " + this.getString(R.string.rules));
   this.setContentView(R.layout.list_ok_add_touch);
   this.adapter = new RuleAdapter(this);
   this.setListAdapter(this.adapter);
   this.setListAdapter(this.adapter);
   ((TouchListView) this.getListView())
       .setDropListener(
           new DropListener() {
             @Override
             public void drop(final int from, final int to) {
               Rules.this.move(from, to);
             }
           });
   this.getListView().setOnItemClickListener(this);
   this.getListView().setOnItemLongClickListener(this);
   this.findViewById(R.id.ok).setOnClickListener(this);
   this.findViewById(R.id.add).setOnClickListener(this);
   this.findViewById(R.id.import_default).setOnClickListener(this);
 }
 /** {@inheritDoc} */
 @Override
 protected final void onResume() {
   super.onResume();
   Utils.setLocale(this);
   this.showEmptyHint();
 }
 @Override
 public void onCreate(final Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setTitle(R.string.settings);
   Utils.setLocale(this);
 }