com.alibaba.weex.R Java Examples
The following examples show how to use
com.alibaba.weex.R.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchBookContentsAdapter.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 6 votes |
@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; }
Example #2
Source File: WeexUiTestCaseTCAHrefUpdate.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG, "activity1=" + waTestPageActivity.toString()); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(2000); }
Example #3
Source File: BookmarkAdapter.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 6 votes |
@Override public View getView(int index, View view, ViewGroup viewGroup) { View layout; if (view instanceof LinearLayout) { layout = view; } else { LayoutInflater factory = LayoutInflater.from(context); layout = factory.inflate(R.layout.bookmark_picker_list_item, viewGroup, false); } if (!cursor.isClosed()) { cursor.moveToPosition(index); CharSequence title = cursor.getString(BookmarkPickerActivity.TITLE_COLUMN); ((TextView) layout.findViewById(R.id.bookmark_title)).setText(title); CharSequence url = cursor.getString(BookmarkPickerActivity.URL_COLUMN); ((TextView) layout.findViewById(R.id.bookmark_url)).setText(url); } // Otherwise... just don't update as the object is shutting down return layout; }
Example #4
Source File: WeexUiTestCaseTCAHrefStyle.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG, "activity1=" + waTestPageActivity.toString()); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #5
Source File: CaptureActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 6 votes |
@Override protected void onPause() { if (handler != null) { handler.quitSynchronously(); handler = null; } inactivityTimer.onPause(); ambientLightManager.stop(); beepManager.close(); cameraManager.closeDriver(); // historyManager = null; // Keep for onActivityResult if (!hasSurface) { SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view); SurfaceHolder surfaceHolder = surfaceView.getHolder(); surfaceHolder.removeCallback(this); } super.onPause(); }
Example #6
Source File: CaptureActivity.java From weex with Apache License 2.0 | 6 votes |
@Override protected void onPause() { if (handler != null) { handler.quitSynchronously(); handler = null; } inactivityTimer.onPause(); ambientLightManager.stop(); beepManager.close(); cameraManager.closeDriver(); // historyManager = null; // Keep for onActivityResult if (!hasSurface) { SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view); SurfaceHolder surfaceHolder = surfaceView.getHolder(); surfaceHolder.removeCallback(this); } super.onPause(); }
Example #7
Source File: SearchBookContentsActivity.java From weex with Apache License 2.0 | 6 votes |
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<>(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); } }
Example #8
Source File: CaptureActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 6 votes |
private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result) { // Bitmap isn't used yet -- will be used soon if (handler == null) { savedResultToShow = result; } else { if (result != null) { savedResultToShow = result; } if (savedResultToShow != null) { Message message = Message.obtain(handler, R.id.decode_succeeded, savedResultToShow); handler.sendMessage(message); } savedResultToShow = null; } }
Example #9
Source File: WeexUiTestCaseTcDowngradeAppVTrue.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp into!!"); setActivityInitialTouchMode(false); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); setActivity(WXPageActivity.wxPageActivityInstance); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); }
Example #10
Source File: EncodeActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { int i = item.getItemId(); if (i == R.id.menu_share) { share(); return true; } else if (i == R.id.menu_encode) { Intent intent = getIntent(); if (intent == null) { return false; } intent.putExtra(USE_VCARD_KEY, !qrCodeEncoder.isUseVCard()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); return true; } else { return false; } }
Example #11
Source File: TestFlow.java From WeexOne with MIT License | 6 votes |
/** * get tc list * @throws InterruptedException */ @Before public void setUp() throws InterruptedException { setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); if(mInstrumentation == null){ mInstrumentation = this.getInstrumentation(); } Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); Log.e(TAG, "activity1=" + waTestPageActivity.toString()); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); // 根据TC 获取TC 列表,默认“"TC_"” mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "AG_"); Thread.sleep(3000); }
Example #12
Source File: LoadPackagesAsyncTask.java From weex with Apache License 2.0 | 6 votes |
@Override protected void onPostExecute(final List<AppInfo> results) { ListAdapter listAdapter = new ArrayAdapter<AppInfo>(activity, R.layout.app_picker_list_item, R.id.app_picker_list_item_label, results) { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); Drawable icon = results.get(position).getIcon(); if (icon != null) { ((ImageView) view.findViewById(R.id.app_picker_list_item_icon)).setImageDrawable(icon); } return view; } }; activity.setListAdapter(listAdapter); }
Example #13
Source File: EncodeActivity.java From weex with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { int i = item.getItemId(); if (i == R.id.menu_share) { share(); return true; } else if (i == R.id.menu_encode) { Intent intent = getIntent(); if (intent == null) { return false; } intent.putExtra(USE_VCARD_KEY, !qrCodeEncoder.isUseVCard()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); return true; } else { return false; } }
Example #14
Source File: WeexUiTestCaseTcElementOpt.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #15
Source File: WeexUiTestCaseTcColorUpdate.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); }
Example #16
Source File: CaptureActivityHandler.java From weex with Apache License 2.0 | 6 votes |
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); }
Example #17
Source File: SearchBookContentsAdapter.java From weex with Apache License 2.0 | 6 votes |
@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; }
Example #18
Source File: QRCodeEncoder.java From weex with Apache License 2.0 | 6 votes |
private void encodeQRCodeContents(AddressBookParsedResult contact) { ContactEncoder encoder = useVCard ? new VCardContactEncoder() : new MECARDContactEncoder(); String[] encoded = encoder.encode(toList(contact.getNames()), contact.getOrg(), toList(contact.getAddresses()), toList(contact.getPhoneNumbers()), null, toList(contact.getEmails()), toList(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); } }
Example #19
Source File: CaptureActivity.java From weex with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); int i = item.getItemId(); if (i == R.id.menu_history) { intent.setClassName(this, HistoryActivity.class.getName()); startActivityForResult(intent, HISTORY_REQUEST_CODE); // case R.id.menu_settings: // intent.setClassName(this, PreferencesActivity.class.getName()); // startActivity(intent); // break; // case R.id.menu_help: // intent.setClassName(this, HelpActivity.class.getName()); // startActivity(intent); // break; } else { return super.onOptionsItemSelected(item); } return true; }
Example #20
Source File: WeexUiTestCaseTcInputEvent.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG, "activity1=" + waTestPageActivity.toString()); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); }
Example #21
Source File: WeexUiTestCaseTcInputType.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #22
Source File: SearchBookContentsActivity.java From weex with Apache License 2.0 | 5 votes |
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); }
Example #23
Source File: SearchBookContentsActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
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); } }
Example #24
Source File: HistoryItemAdapter.java From weex with Apache License 2.0 | 5 votes |
@Override public View getView(int position, View view, ViewGroup viewGroup) { View layout; if (view instanceof LinearLayout) { layout = view; } else { LayoutInflater factory = LayoutInflater.from(activity); layout = factory.inflate(R.layout.history_list_item, viewGroup, false); } HistoryItem item = getItem(position); Result result = item.getResult(); CharSequence title; CharSequence detail; if (result != null) { title = result.getText(); detail = item.getDisplayAndDetails(); } else { Resources resources = getContext().getResources(); title = resources.getString(R.string.history_empty); detail = resources.getString(R.string.history_empty_detail); } ((TextView) layout.findViewById(R.id.history_title)).setText(title); ((TextView) layout.findViewById(R.id.history_detail)).setText(detail); return layout; }
Example #25
Source File: SearchBookContentsActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
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); }
Example #26
Source File: CaptureActivityHandler.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
private void restartPreviewAndDecode() { if (state == State.SUCCESS) { state = State.PREVIEW; cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode); activity.drawViewfinder(); } }
Example #27
Source File: WXBaseNavActivity.java From weex with Apache License 2.0 | 5 votes |
private int getActionBarHeight() { TypedArray actionbarSizeTypedArray = obtainStyledAttributes(new int[]{ android.R.attr.actionBarSize }); return (int) actionbarSizeTypedArray.getDimension(0, 0); }
Example #28
Source File: CaptureActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
/** * 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); } } } } }
Example #29
Source File: CaptureActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
private void resetStatusView() { resultView.setVisibility(View.GONE); statusView.setText(R.string.msg_default_status); statusView.setVisibility(View.VISIBLE); viewfinderView.setVisibility(View.VISIBLE); lastResult = null; }
Example #30
Source File: EncodeActivity.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Intent intent = getIntent(); if (intent == null) { finish(); } else { String action = intent.getAction(); if (Intents.Encode.ACTION.equals(action) || Intent.ACTION_SEND.equals(action)) { setContentView(R.layout.encode); } else { finish(); } } }