当前位置: 首页>>代码示例>>Java>>正文


Java R类代码示例

本文整理汇总了Java中keepass2android.plugin.qr.R的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


R类属于keepass2android.plugin.qr包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getView

import keepass2android.plugin.qr.R; //导入依赖的package包/类
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
  SearchBookContentsListItem listItem;

  if (view == null) {
    LayoutInflater factory = LayoutInflater.from(getContext());
    listItem = (SearchBookContentsListItem) factory.inflate(
        R.layout.search_book_contents_list_item, viewGroup, false);
  } else {
    if (view instanceof SearchBookContentsListItem) {
      listItem = (SearchBookContentsListItem) view;
    } else {
      return view;
    }
  }

  SearchBookContentsResult result = getItem(position);
  listItem.set(result);
  return listItem;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:21,代码来源:SearchBookContentsAdapter.java

示例2: handleSearchResults

import keepass2android.plugin.qr.R; //导入依赖的package包/类
private void handleSearchResults(JSONObject json) {
  try {
    int count = json.getInt("number_of_results");
    headerView.setText(getString(R.string.msg_sbc_results) + " : " + count);
    if (count > 0) {
      JSONArray results = json.getJSONArray("search_results");
      SearchBookContentsResult.setQuery(queryTextView.getText().toString());
      List<SearchBookContentsResult> items = new ArrayList<SearchBookContentsResult>(count);
      for (int x = 0; x < count; x++) {
        items.add(parseResult(results.getJSONObject(x)));
      }
      resultListView.setOnItemClickListener(new BrowseBookListener(SearchBookContentsActivity.this, items));
      resultListView.setAdapter(new SearchBookContentsAdapter(SearchBookContentsActivity.this, items));
    } else {
      String searchable = json.optString("searchable");
      if ("false".equals(searchable)) {
        headerView.setText(R.string.msg_sbc_book_not_searchable);
      }
      resultListView.setAdapter(null);
    }
  } catch (JSONException e) {
    Log.w(TAG, "Bad JSON from book search", e);
    resultListView.setAdapter(null);
    headerView.setText(R.string.msg_sbc_failed);
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:27,代码来源:SearchBookContentsActivity.java

示例3: quitSynchronously

import keepass2android.plugin.qr.R; //导入依赖的package包/类
public void quitSynchronously() {
  state = State.DONE;
  cameraManager.stopPreview();
  Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
  quit.sendToTarget();
  try {
    // Wait at most half a second; should be enough time, and onPause() will timeout quickly
    decodeThread.join(500L);
  } catch (InterruptedException e) {
    // continue
  }

  // Be absolutely sure we don't send any queued up messages
  removeMessages(R.id.decode_succeeded);
  removeMessages(R.id.decode_failed);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:17,代码来源:CaptureActivityHandler.java

示例4: onPause

import keepass2android.plugin.qr.R; //导入依赖的package包/类
@Override
protected void onPause() {
  if (handler != null) {
    handler.quitSynchronously();
    handler = null;
  }
  inactivityTimer.onPause();
  ambientLightManager.stop();
  cameraManager.closeDriver();
  if (!hasSurface) {
    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
    SurfaceHolder surfaceHolder = surfaceView.getHolder();
    surfaceHolder.removeCallback(this);
  }
  super.onPause();
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:17,代码来源:CaptureActivity.java

示例5: onOptionsItemSelected

import keepass2android.plugin.qr.R; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  switch (item.getItemId()) {
    case R.id.menu_settings:
      intent.setClassName(this, PreferencesActivity.class.getName());
      startActivity(intent);
      break;
    default:
      return super.onOptionsItemSelected(item);
  }
  return true;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:15,代码来源:CaptureActivity.java

示例6: drawResultPoints

import keepass2android.plugin.qr.R; //导入依赖的package包/类
/**
 * Superimpose a line for 1D or dots for 2D to highlight the key features of the barcode.
 *
 * @param barcode   A bitmap of the captured image.
 * @param scaleFactor amount by which thumbnail was scaled
 * @param rawResult The decoded results which contains the points to draw.
 */
private void drawResultPoints(Bitmap barcode, float scaleFactor, Result rawResult) {
  ResultPoint[] points = rawResult.getResultPoints();
  if (points != null && points.length > 0) {
    Canvas canvas = new Canvas(barcode);
    Paint paint = new Paint();
    paint.setColor(getResources().getColor(R.color.result_points));
    if (points.length == 2) {
      paint.setStrokeWidth(4.0f);
      drawLine(canvas, paint, points[0], points[1], scaleFactor);
    } else if (points.length == 4 &&
               (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A ||
                rawResult.getBarcodeFormat() == BarcodeFormat.EAN_13)) {
      // Hacky special case -- draw two lines, for the barcode and metadata
      drawLine(canvas, paint, points[0], points[1], scaleFactor);
      drawLine(canvas, paint, points[2], points[3], scaleFactor);
    } else {
      paint.setStrokeWidth(10.0f);
      for (ResultPoint point : points) {
        if (point != null) {
          canvas.drawPoint(scaleFactor * point.getX(), scaleFactor * point.getY(), paint);
        }
      }
    }
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:33,代码来源:CaptureActivity.java

示例7: onOptionsItemSelected

import keepass2android.plugin.qr.R; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case R.id.menu_share:
      share();
      return true;
    case R.id.menu_encode:
      Intent intent = getIntent();
      if (intent == null) {
        return false;
      }
      intent.putExtra(USE_VCARD_KEY, !qrCodeEncoder.isUseVCard());
      startActivity(intent);
      finish();
      return true;
    default:
      return false;
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:20,代码来源:EncodeActivity.java

示例8: encodeFromTextExtras

import keepass2android.plugin.qr.R; //导入依赖的package包/类
private void encodeFromTextExtras(Intent intent) throws WriterException {
  // Notice: Google Maps shares both URL and details in one text, bummer!
  String theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_TEXT));
  if (theContents == null) {
    theContents = ContactEncoder.trim(intent.getStringExtra("android.intent.extra.HTML_TEXT"));
    // Intent.EXTRA_HTML_TEXT
    if (theContents == null) {
      theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_SUBJECT));
      if (theContents == null) {
        String[] emails = intent.getStringArrayExtra(Intent.EXTRA_EMAIL);
        if (emails != null) {
          theContents = ContactEncoder.trim(emails[0]);
        } else {
          theContents = "?";
        }
      }
    }
  }

  // Trim text to avoid URL breaking.
  if (theContents == null || theContents.isEmpty()) {
    throw new WriterException("Empty EXTRA_TEXT");
  }
  contents = theContents;
  // We only do QR code.
  format = BarcodeFormat.QR_CODE;
  if (intent.hasExtra(Intent.EXTRA_SUBJECT)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_SUBJECT);
  } else if (intent.hasExtra(Intent.EXTRA_TITLE)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_TITLE);
  } else {
    displayContents = contents;
  }
  title = activity.getString(R.string.contents_text);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:36,代码来源:QRCodeEncoder.java

示例9: encodeQRCodeContents

import keepass2android.plugin.qr.R; //导入依赖的package包/类
private void encodeQRCodeContents(AddressBookParsedResult contact) {
  ContactEncoder encoder = useVCard ? new VCardContactEncoder() : new MECARDContactEncoder();
  String[] encoded = encoder.encode(toIterable(contact.getNames()),
                                    contact.getOrg(),
                                    toIterable(contact.getAddresses()),
                                    toIterable(contact.getPhoneNumbers()),
                                    toIterable(contact.getEmails()),
                                    toIterable(contact.getURLs()),
                                    null);
  // Make sure we've encoded at least one field.
  if (!encoded[1].isEmpty()) {
    contents = encoded[0];
    displayContents = encoded[1];
    title = activity.getString(R.string.contents_contact);
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:17,代码来源:QRCodeEncoder.java

示例10: handleButtonPress

import keepass2android.plugin.qr.R; //导入依赖的package包/类
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:21,代码来源:WifiResultHandler.java

示例11: onCreate

import keepass2android.plugin.qr.R; //导入依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
  super.onCreate(icicle);

  // Make sure that expired cookies are removed on launch.
  CookieSyncManager.createInstance(this);
  CookieManager.getInstance().removeExpiredCookie();

  Intent intent = getIntent();
  if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) {
    finish();
    return;
  }

  isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
  if (LocaleManager.isBookSearchUrl(isbn)) {
    setTitle(getString(R.string.sbc_name));
  } else {
    setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
  }

  setContentView(R.layout.search_book_contents);
  queryTextView = (EditText) findViewById(R.id.query_text_view);

  String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
  if (initialQuery != null && !initialQuery.isEmpty()) {
    // Populate the search box but don't trigger the search
    queryTextView.setText(initialQuery);
  }
  queryTextView.setOnKeyListener(keyListener);

  queryButton = findViewById(R.id.query_button);
  queryButton.setOnClickListener(buttonListener);

  resultListView = (ListView) findViewById(R.id.result_list_view);
  LayoutInflater factory = LayoutInflater.from(this);
  headerView = (TextView) factory.inflate(R.layout.search_book_contents_header,
      resultListView, false);
  resultListView.addHeaderView(headerView);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:41,代码来源:SearchBookContentsActivity.java

示例12: launchSearch

import keepass2android.plugin.qr.R; //导入依赖的package包/类
private void launchSearch() {
  String query = queryTextView.getText().toString();
  if (query != null && !query.isEmpty()) {
    AsyncTask<?,?,?> oldTask = networkTask;
    if (oldTask != null) {
      oldTask.cancel(true);
    }
    networkTask = new NetworkTask();
    networkTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, query, isbn);
    headerView.setText(R.string.msg_sbc_searching_book);
    resultListView.setAdapter(null);
    queryTextView.setEnabled(false);
    queryButton.setEnabled(false);
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:16,代码来源:SearchBookContentsActivity.java

示例13: onPostExecute

import keepass2android.plugin.qr.R; //导入依赖的package包/类
@Override
protected void onPostExecute(JSONObject result) {
  if (result == null) {
    headerView.setText(R.string.msg_sbc_failed);
  } else {
    handleSearchResults(result);
  }
  queryTextView.setEnabled(true);
  queryTextView.selectAll();
  queryButton.setEnabled(true);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:12,代码来源:SearchBookContentsActivity.java

示例14: parseResult

import keepass2android.plugin.qr.R; //导入依赖的package包/类
private SearchBookContentsResult parseResult(JSONObject json) {

      String pageId;
      String pageNumber;
      String snippet;
      try {
        pageId = json.getString("page_id");
        pageNumber = json.optString("page_number");
        snippet = json.optString("snippet_text");        
      } catch (JSONException e) {
        Log.w(TAG, e);
        // Never seen in the wild, just being complete.
        return new SearchBookContentsResult(getString(R.string.msg_sbc_no_page_returned), "", "", false);
      }
      
      if (pageNumber == null || pageNumber.isEmpty()) {
        // This can happen for text on the jacket, and possibly other reasons.
        pageNumber = "";
      } else {
        pageNumber = getString(R.string.msg_sbc_page) + ' ' + pageNumber;
      }
      
      boolean valid = snippet != null && !snippet.isEmpty();
      if (valid) {
        // Remove all HTML tags and encoded characters.          
        snippet = TAG_PATTERN.matcher(snippet).replaceAll("");
        snippet = LT_ENTITY_PATTERN.matcher(snippet).replaceAll("<");
        snippet = GT_ENTITY_PATTERN.matcher(snippet).replaceAll(">");
        snippet = QUOTE_ENTITY_PATTERN.matcher(snippet).replaceAll("'");
        snippet = QUOT_ENTITY_PATTERN.matcher(snippet).replaceAll("\"");
      } else {
        snippet = '(' + getString(R.string.msg_sbc_snippet_unavailable) + ')';        
      }

      return new SearchBookContentsResult(pageId, pageNumber, snippet, valid);
    }
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:37,代码来源:SearchBookContentsActivity.java

示例15: restartPreviewAndDecode

import keepass2android.plugin.qr.R; //导入依赖的package包/类
private void restartPreviewAndDecode() {
  if (state == State.SUCCESS) {
    state = State.PREVIEW;
    cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
    activity.drawViewfinder();
  }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:8,代码来源:CaptureActivityHandler.java


注:本文中的keepass2android.plugin.qr.R类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。