Java Code Examples for org.telegram.messenger.FileLog#e()
The following examples show how to use
org.telegram.messenger.FileLog#e() .
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: ChatAttachAlertDocumentLayout.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onReceive(Context arg0, Intent intent) { Runnable r = () -> { try { if (currentDir == null) { listRoots(); } else { listFiles(currentDir); } updateSearchButton(); } catch (Exception e) { FileLog.e(e); } }; if (Intent.ACTION_MEDIA_UNMOUNTED.equals(intent.getAction())) { listView.postDelayed(r, 1000); } else { r.run(); } }
Example 2
Source File: EmbedBottomSheet.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void exitFromPip() { if (webView == null || pipVideoView == null) { return; } if (ApplicationLoader.mainInterfacePaused) { try { parentActivity.startService(new Intent(ApplicationLoader.applicationContext, BringAppForegroundService.class)); } catch (Throwable e) { FileLog.e(e); } } if (isYouTube) { runJsCode("showControls();"); } ViewGroup parent = (ViewGroup) webView.getParent(); if (parent != null) { parent.removeView(webView); } containerLayout.addView(webView, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 48 + 36 + (hasDescription ? 22 : 0))); setShowWithoutAnimation(true); show(); pipVideoView.close(); pipVideoView = null; }
Example 3
Source File: SerializedData.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void writeByte(byte b) { try { if (!justCalc) { out.writeByte(b); } else { len += 1; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write byte error"); } } }
Example 4
Source File: SpannableStringLight.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public SpannableStringLight(CharSequence source) { super(source); try { mSpansOverride = (Object[]) mSpansField.get(this); mSpanDataOverride = (int[]) mSpanDataField.get(this); mSpanCountOverride = (int) mSpanCountField.get(this); } catch (Throwable e) { FileLog.e(e); } }
Example 5
Source File: ChannelAdminLogActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void notifyDataSetChanged() { updateRows(); try { super.notifyDataSetChanged(); } catch (Exception e) { FileLog.e(e); } }
Example 6
Source File: SerializedData.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void writeBytes(byte[] b) { try { if (!justCalc) { out.write(b); } else { len += b.length; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write raw error"); FileLog.e(e); } } }
Example 7
Source File: ChangeUsernameActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { try { boolean result = super.onTouchEvent(widget, buffer, event); if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { Selection.removeSelection(buffer); } return result; } catch (Exception e) { FileLog.e(e); } return false; }
Example 8
Source File: DrawerActionCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setTextAndIcon(String text, int resId) { try { textView.setText(text); Drawable drawable = getResources().getDrawable(resId).mutate(); if (drawable != null) { drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_menuItemIcon), PorterDuff.Mode.MULTIPLY)); } textView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); } catch (Throwable e) { FileLog.e(e); } }
Example 9
Source File: DatabaseHandler.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private ArrayList<Long> getChatsList(String table) { ArrayList<Long> list = new ArrayList<>(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = null; try { cursor = db.query(table, new String[] { KEY_CHAT_ID }, null, null, null, null, null, null); if (cursor.moveToFirst()) { do { list.add(cursor.getLong(0)); } while (cursor.moveToNext()); } db.close(); } catch (Exception e) { if (cursor != null) cursor.close(); FileLog.e(e); } if (cursor != null) cursor.close(); return list; }
Example 10
Source File: SerializedData.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void readBytes(byte[] b, boolean exception) { try { in.read(b); len += b.length; } catch (Exception e) { if (exception) { throw new RuntimeException("read bytes error", e); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("read bytes error"); FileLog.e(e); } } } }
Example 11
Source File: ChatActivityEnterView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void setFieldFocused() { if (messageEditText != null) { try { messageEditText.requestFocus(); } catch (Exception e) { FileLog.e(e); } } }
Example 12
Source File: NativeByteBuffer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void writeInt64(long x) { try { if (!justCalc) { buffer.putLong(x); } else { len += 8; } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write int64 error"); } } }
Example 13
Source File: ThemePreviewActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void saveAccentWallpaper() { if (accent == null || TextUtils.isEmpty(accent.patternSlug)) { return; } try { File toFile = accent.getPathToWallpaper(); Drawable background = backgroundImage.getBackground(); Bitmap bitmap = backgroundImage.getImageReceiver().getBitmap(); Bitmap dst = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(dst); background.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight()); background.draw(canvas); Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); paint.setColorFilter(new PorterDuffColorFilter(patternColor, blendMode)); paint.setAlpha((int) (255 * currentIntensity)); canvas.drawBitmap(bitmap, 0, 0, paint); FileOutputStream stream = new FileOutputStream(toFile); dst.compress(Bitmap.CompressFormat.JPEG, 87, stream); stream.close(); } catch (Throwable e) { FileLog.e(e); } }
Example 14
Source File: NativeByteBuffer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public NativeByteBuffer readByteBuffer(boolean exception) { try { int sl = 1; int l = getIntFromByte(buffer.get()); if (l >= 254) { l = getIntFromByte(buffer.get()) | (getIntFromByte(buffer.get()) << 8) | (getIntFromByte(buffer.get()) << 16); sl = 4; } NativeByteBuffer b = new NativeByteBuffer(l); int old = buffer.limit(); buffer.limit(buffer.position() + l); b.buffer.put(buffer); buffer.limit(old); b.buffer.position(0); int i = sl; while ((l + i) % 4 != 0) { buffer.get(); i++; } return b; } catch (Exception e) { if (exception) { throw new RuntimeException("read byte array error", e); } else { if (BuildVars.LOGS_ENABLED) { FileLog.e("read byte array error"); } } } return null; }
Example 15
Source File: ThemeEditorView.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private void searchDialogsInternal(final String query, final int searchId) { try { String search1 = query.trim().toLowerCase(); if (search1.length() == 0) { lastSearchId = -1; updateSearchResults(new ArrayList<>(), new ArrayList<>(), lastSearchId); return; } String search2 = LocaleController.getInstance().getTranslitString(search1); if (search1.equals(search2) || search2.length() == 0) { search2 = null; } String[] search = new String[1 + (search2 != null ? 1 : 0)]; search[0] = search1; if (search2 != null) { search[1] = search2; } ArrayList<ArrayList<ThemeDescription>> searchResults = new ArrayList<>(); ArrayList<CharSequence> names = new ArrayList<>(); for (int a = 0, N = listAdapter.items.size(); a < N; a++) { ArrayList<ThemeDescription> themeDescriptions = listAdapter.items.get(a); String key = themeDescriptions.get(0).getCurrentKey(); String name = key.toLowerCase(); int found = 0; for (String q : search) { if (name.contains(q)) { searchResults.add(themeDescriptions); names.add(generateSearchName(key, q)); break; } } } updateSearchResults(searchResults, names, searchId); } catch (Exception e) { FileLog.e(e); } }
Example 16
Source File: ChangeUsernameActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onClick(View widget) { try { android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("label", url); clipboard.setPrimaryClip(clip); Toast.makeText(getParentActivity(), LocaleController.getString("LinkCopied", R.string.LinkCopied), Toast.LENGTH_SHORT).show(); } catch (Exception e) { FileLog.e(e); } }
Example 17
Source File: PhotoFilterView.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void drawEnhancePass() { if (!hsvGenerated) { GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, renderFrameBuffer[0]); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, renderTexture[0], 0); GLES20.glClear(0); GLES20.glUseProgram(rgbToHsvShaderProgram); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, renderTexture[1]); GLES20.glUniform1i(rgbToHsvSourceImageHandle, 0); GLES20.glEnableVertexAttribArray(rgbToHsvInputTexCoordHandle); GLES20.glVertexAttribPointer(rgbToHsvInputTexCoordHandle, 2, GLES20.GL_FLOAT, false, 8, textureBuffer); GLES20.glEnableVertexAttribArray(rgbToHsvPositionHandle); GLES20.glVertexAttribPointer(rgbToHsvPositionHandle, 2, GLES20.GL_FLOAT, false, 8, vertexBuffer); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); ByteBuffer hsvBuffer = ByteBuffer.allocateDirect(renderBufferWidth * renderBufferHeight * 4); GLES20.glReadPixels(0, 0, renderBufferWidth, renderBufferHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, hsvBuffer); GLES20.glBindTexture(GL10.GL_TEXTURE_2D, enhanceTextures[0]); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, renderBufferWidth, renderBufferHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, hsvBuffer); ByteBuffer buffer = null; try { buffer = ByteBuffer.allocateDirect(PGPhotoEnhanceSegments * PGPhotoEnhanceSegments * PGPhotoEnhanceHistogramBins * 4); Utilities.calcCDT(hsvBuffer, renderBufferWidth, renderBufferHeight, buffer); } catch (Exception e) { FileLog.e(e); } GLES20.glBindTexture(GL10.GL_TEXTURE_2D, enhanceTextures[1]); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 16, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buffer); hsvGenerated = true; } GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, renderFrameBuffer[1]); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, renderTexture[1], 0); GLES20.glClear(0); GLES20.glUseProgram(enhanceShaderProgram); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, enhanceTextures[0]); GLES20.glUniform1i(enhanceSourceImageHandle, 0); GLES20.glActiveTexture(GLES20.GL_TEXTURE1); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, enhanceTextures[1]); GLES20.glUniform1i(enhanceInputImageTexture2Handle, 1); if (showOriginal) { GLES20.glUniform1f(enhanceIntensityHandle, 0); } else { GLES20.glUniform1f(enhanceIntensityHandle, getEnhanceValue()); } GLES20.glEnableVertexAttribArray(enhanceInputTexCoordHandle); GLES20.glVertexAttribPointer(enhanceInputTexCoordHandle, 2, GLES20.GL_FLOAT, false, 8, textureBuffer); GLES20.glEnableVertexAttribArray(enhancePositionHandle); GLES20.glVertexAttribPointer(enhancePositionHandle, 2, GLES20.GL_FLOAT, false, 8, vertexBuffer); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); }
Example 18
Source File: PaymentFormActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private boolean sendCardData() { Integer month; Integer year; String date = inputFields[FIELD_EXPIRE_DATE].getText().toString(); String args[] = date.split("/"); if (args.length == 2) { month = Utilities.parseInt(args[0]); year = Utilities.parseInt(args[1]); } else { month = null; year = null; } Card card = new Card( inputFields[FIELD_CARD].getText().toString(), month, year, inputFields[FIELD_CVV].getText().toString(), inputFields[FIELD_CARDNAME].getText().toString(), null, null, null, null, inputFields[FIELD_CARD_POSTCODE].getText().toString(), inputFields[FIELD_CARD_COUNTRY].getText().toString(), null); cardName = card.getType() + " *" + card.getLast4(); if (!card.validateNumber()) { shakeField(FIELD_CARD); return false; } else if (!card.validateExpMonth() || !card.validateExpYear() || !card.validateExpiryDate()) { shakeField(FIELD_EXPIRE_DATE); return false; } else if (need_card_name && inputFields[FIELD_CARDNAME].length() == 0) { shakeField(FIELD_CARDNAME); return false; } else if (!card.validateCVC()) { shakeField(FIELD_CVV); return false; } else if (need_card_country && inputFields[FIELD_CARD_COUNTRY].length() == 0) { shakeField(FIELD_CARD_COUNTRY); return false; } else if (need_card_postcode && inputFields[FIELD_CARD_POSTCODE].length() == 0) { shakeField(FIELD_CARD_POSTCODE); return false; } showEditDoneProgress(true, true); try { Stripe stripe = new Stripe(stripeApiKey); stripe.createToken(card, new TokenCallback() { public void onSuccess(Token token) { if (canceled) { return; } paymentJson = String.format(Locale.US, "{\"type\":\"%1$s\", \"id\":\"%2$s\"}", token.getType(), token.getId()); AndroidUtilities.runOnUIThread(() -> { goToNextStep(); showEditDoneProgress(true, false); setDonePressed(false); }); } public void onError(Exception error) { if (canceled) { return; } showEditDoneProgress(true, false); setDonePressed(false); if (error instanceof APIConnectionException || error instanceof APIException) { AlertsCreator.showSimpleToast(PaymentFormActivity.this, LocaleController.getString("PaymentConnectionFailed", R.string.PaymentConnectionFailed)); } else { AlertsCreator.showSimpleToast(PaymentFormActivity.this, error.getMessage()); } } } ); } catch (Exception e) { FileLog.e(e); } return true; }
Example 19
Source File: VoIPBaseService.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public void onCreate() { super.onCreate(); if (BuildVars.LOGS_ENABLED) { FileLog.d("=============== VoIPService STARTING ==============="); } try { AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && am.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER)!=null) { int outFramesPerBuffer = Integer.parseInt(am.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER)); TgVoip.setBufferSize(outFramesPerBuffer); } else { TgVoip.setBufferSize(AudioTrack.getMinBufferSize(48000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT) / 2); } cpuWakelock = ((PowerManager) getSystemService(POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "telegram-voip"); cpuWakelock.acquire(); btAdapter=am.isBluetoothScoAvailableOffCall() ? BluetoothAdapter.getDefaultAdapter() : null; IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); if(!USE_CONNECTION_SERVICE){ filter.addAction(ACTION_HEADSET_PLUG); if(btAdapter!=null){ filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); filter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED); } filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); } registerReceiver(receiver, filter); soundPool = new SoundPool(1, AudioManager.STREAM_VOICE_CALL, 0); spConnectingId = soundPool.load(this, R.raw.voip_connecting, 1); spRingbackID = soundPool.load(this, R.raw.voip_ringback, 1); spFailedID = soundPool.load(this, R.raw.voip_failed, 1); spEndId = soundPool.load(this, R.raw.voip_end, 1); spBusyId = soundPool.load(this, R.raw.voip_busy, 1); am.registerMediaButtonEventReceiver(new ComponentName(this, VoIPMediaButtonReceiver.class)); if(!USE_CONNECTION_SERVICE && btAdapter!=null && btAdapter.isEnabled()){ int headsetState=btAdapter.getProfileConnectionState(BluetoothProfile.HEADSET); updateBluetoothHeadsetState(headsetState==BluetoothProfile.STATE_CONNECTED); //if(headsetState==BluetoothProfile.STATE_CONNECTED) // am.setBluetoothScoOn(true); for (StateListener l : stateListeners) l.onAudioSettingsChanged(); } } catch (Exception x) { if (BuildVars.LOGS_ENABLED) { FileLog.e("error initializing voip controller", x); } callFailed(); } }
Example 20
Source File: CancelAccountDeletionActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onNextPressed() { if (getParentActivity() == null || nextPressed) { return; } TelephonyManager tm = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService(Context.TELEPHONY_SERVICE); boolean simcardAvailable = tm.getSimState() != TelephonyManager.SIM_STATE_ABSENT && tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE; boolean allowCall = true; if (Build.VERSION.SDK_INT >= 23 && simcardAvailable) { //allowCall = getParentActivity().checkSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED; //boolean allowSms = getParentActivity().checkSelfPermission(Manifest.permission.RECEIVE_SMS) == PackageManager.PERMISSION_GRANTED; /*if (checkPermissions) { permissionsItems.clear(); if (!allowCall) { permissionsItems.add(Manifest.permission.READ_PHONE_STATE); } if (!allowSms) { permissionsItems.add(Manifest.permission.RECEIVE_SMS); } if (!permissionsItems.isEmpty()) { SharedPreferences preferences = MessagesController.getGlobalMainSettings(); if (preferences.getBoolean("firstlogin", true) || getParentActivity().shouldShowRequestPermissionRationale(Manifest.permission.READ_PHONE_STATE) || getParentActivity().shouldShowRequestPermissionRationale(Manifest.permission.RECEIVE_SMS)) { preferences.edit().putBoolean("firstlogin", false).commit(); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); if (permissionsItems.size() == 2) { builder.setMessage(LocaleController.getString("AllowReadCallAndSms", R.string.AllowReadCallAndSms)); } else if (!allowSms) { builder.setMessage(LocaleController.getString("AllowReadSms", R.string.AllowReadSms)); } else { builder.setMessage(LocaleController.getString("AllowReadCall", R.string.AllowReadCall)); } permissionsDialog = showDialog(builder.create()); } else { getParentActivity().requestPermissions(permissionsItems.toArray(new String[permissionsItems.size()]), 6); } return; } }*/ } final TLRPC.TL_account_sendConfirmPhoneCode req = new TLRPC.TL_account_sendConfirmPhoneCode(); req.allow_flashcall = false;//simcardAvailable && allowCall; req.hash = hash; if (req.allow_flashcall) { try { @SuppressLint("HardwareIds") String number = tm.getLine1Number(); if (!TextUtils.isEmpty(number)) { req.current_number = phone.contains(number) || number.contains(phone); if (!req.current_number) { req.allow_flashcall = false; } } else { req.current_number = false; } } catch (Exception e) { req.allow_flashcall = false; FileLog.e(e); } } final Bundle params = new Bundle(); params.putString("phone", phone); nextPressed = true; ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() { @Override public void run(final TLObject response, final TLRPC.TL_error error) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { nextPressed = false; if (error == null) { fillNextCodeParams(params, (TLRPC.TL_auth_sentCode) response); } else { errorDialog = AlertsCreator.processError(currentAccount, error, CancelAccountDeletionActivity.this, req); } } }); } }, ConnectionsManager.RequestFlagFailOnServerErrors); }