org.telegram.messenger.FileLog Java Examples
The following examples show how to use
org.telegram.messenger.FileLog.
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: ActionIntroActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 7 votes |
@Override public void onResume() { super.onResume(); if (currentType == ACTION_TYPE_NEARBY_LOCATION_ENABLED) { boolean enabled = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { LocationManager lm = (LocationManager) ApplicationLoader.applicationContext.getSystemService(Context.LOCATION_SERVICE); enabled = lm.isLocationEnabled(); } else if (Build.VERSION.SDK_INT >= 19) { try { int mode = Settings.Secure.getInt(ApplicationLoader.applicationContext.getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); enabled = (mode != Settings.Secure.LOCATION_MODE_OFF); } catch (Throwable e) { FileLog.e(e); } } if (enabled) { presentFragment(new PeopleNearbyActivity(), true); } } }
Example #2
Source File: ConnectionsManager.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(final NativeByteBuffer result) { Utilities.stageQueue.postRunnable(() -> { currentTask = null; if (result != null) { native_applyDnsConfig(currentAccount, result.address, AccountInstance.getInstance(currentAccount).getUserConfig().getClientPhone(), responseDate); } else { if (BuildVars.LOGS_ENABLED) { FileLog.d("failed to get google result"); FileLog.d("start mozilla task"); } MozillaDnsLoadTask task = new MozillaDnsLoadTask(currentAccount); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); currentTask = task; } }); }
Example #3
Source File: ChatAttachAlertDocumentLayout.java From Telegram 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 #4
Source File: ChatActivityEnterView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void replaceWithText(int start, int len, CharSequence text, boolean parseEmoji) { try { SpannableStringBuilder builder = new SpannableStringBuilder(messageEditText.getText()); builder.replace(start, start + len, text); if (parseEmoji) { Emoji.replaceEmoji(builder, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); } messageEditText.setText(builder); messageEditText.setSelection(start + text.length()); } catch (Exception e) { FileLog.e(e); } }
Example #5
Source File: ChangePhoneActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onFragmentDestroy() { super.onFragmentDestroy(); for (int a = 0; a < views.length; a++) { if (views[a] != null) { views[a].onDestroyActivity(); } } if (progressDialog != null) { try { progressDialog.dismiss(); } catch (Exception e) { FileLog.e(e); } progressDialog = null; } AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid); }
Example #6
Source File: VoIPServerConfig.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public static void setConfig(String json){ try{ JSONObject obj=new JSONObject(json); config=obj; String[] keys=new String[obj.length()], values=new String[obj.length()]; Iterator<String> itrtr=obj.keys(); int i=0; while(itrtr.hasNext()){ keys[i]=itrtr.next(); values[i]=obj.getString(keys[i]); i++; } nativeSetConfig(keys, values); }catch(JSONException x){ if (BuildVars.LOGS_ENABLED) { FileLog.e("Error parsing VoIP config", x); } } }
Example #7
Source File: PhotoFilterView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public Bitmap getTexture() { if (!initied) { return null; } final CountDownLatch countDownLatch = new CountDownLatch(1); final Bitmap object[] = new Bitmap[1]; try { postRunnable(new Runnable() { @Override public void run() { GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, renderFrameBuffer[1]); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, renderTexture[blured ? 0 : 1], 0); GLES20.glClear(0); object[0] = getRenderBufferBitmap(); countDownLatch.countDown(); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); GLES20.glClear(0); } }); countDownLatch.await(); } catch (Exception e) { FileLog.e(e); } return object[0]; }
Example #8
Source File: VoIPHelper.java From Telegram with GNU General Public License v2.0 | 6 votes |
private static void doInitiateCall(TLRPC.User user, Activity activity) { if (activity == null || user == null) { return; } if (System.currentTimeMillis() - lastCallTime < 2000) return; lastCallTime = System.currentTimeMillis(); Intent intent = new Intent(activity, VoIPService.class); intent.putExtra("user_id", user.id); intent.putExtra("is_outgoing", true); intent.putExtra("start_incall_activity", true); intent.putExtra("account", UserConfig.selectedAccount); try { activity.startService(intent); } catch (Throwable e) { FileLog.e(e); } }
Example #9
Source File: AlertsCreator.java From Telegram with GNU General Public License v2.0 | 6 votes |
private static void processCreate(EditTextBoldCursor editText, AlertDialog alertDialog, BaseFragment fragment) { if (fragment == null || fragment.getParentActivity() == null) { return; } AndroidUtilities.hideKeyboard(editText); Theme.ThemeInfo themeInfo = Theme.createNewTheme(editText.getText().toString()); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.themeListUpdated); ThemeEditorView themeEditorView = new ThemeEditorView(); themeEditorView.show(fragment.getParentActivity(), themeInfo); alertDialog.dismiss(); SharedPreferences preferences = MessagesController.getGlobalMainSettings(); if (preferences.getBoolean("themehint", false)) { return; } preferences.edit().putBoolean("themehint", true).commit(); try { Toast.makeText(fragment.getParentActivity(), LocaleController.getString("CreateNewThemeHelp", R.string.CreateNewThemeHelp), Toast.LENGTH_LONG).show(); } catch (Exception e) { FileLog.e(e); } }
Example #10
Source File: BaseFragment.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void onBeginSlide() { try { if (visibleDialog != null && visibleDialog.isShowing()) { visibleDialog.dismiss(); visibleDialog = null; } } catch (Exception e) { FileLog.e(e); } if (actionBar != null) { actionBar.onPause(); } }
Example #11
Source File: PaymentFormActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onResume() { super.onResume(); AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid); if (Build.VERSION.SDK_INT >= 23) { try { if ((currentStep == 2 || currentStep == 6) && !paymentForm.invoice.test) { getParentActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); } else if (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture) { getParentActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); } } catch (Throwable e) { FileLog.e(e); } } if (googleApiClient != null) { googleApiClient.connect(); } }
Example #12
Source File: WebPlayerView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
protected String doInBackground(Void... voids) { String playerCode = downloadUrlContent(this, currentUrl, null, false); if (isCancelled()) { return null; } try { Matcher filelist = twitchClipFilePattern.matcher(playerCode); if (filelist.find()) { String jsonCode = filelist.group(1); JSONObject json = new JSONObject(jsonCode); JSONArray array = json.getJSONArray("quality_options"); JSONObject obj = array.getJSONObject(0); results[0] = obj.getString("source"); results[1] = "other"; } } catch (Exception e) { FileLog.e(e); } return isCancelled() ? null : results[0]; }
Example #13
Source File: VoIPHelper.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private static void doInitiateCall(TLRPC.User user, Activity activity) { if (activity == null || user==null) { return; } if(System.currentTimeMillis()-lastCallTime<2000) return; lastCallTime=System.currentTimeMillis(); Intent intent = new Intent(activity, VoIPService.class); intent.putExtra("user_id", user.id); intent.putExtra("is_outgoing", true); intent.putExtra("start_incall_activity", true); intent.putExtra("account", UserConfig.selectedAccount); try { activity.startService(intent); } catch (Throwable e) { FileLog.e(e); } }
Example #14
Source File: SQLitePreparedStatement.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void finalizeQuery() { if (isFinalized) { return; } if (BuildVars.DEBUG_VERSION) { long diff = SystemClock.elapsedRealtime() - startTime; if (diff > 500) { FileLog.d("sqlite query " + query + " took " + diff + "ms"); } } try { /*if (BuildVars.DEBUG_VERSION) { hashMap.remove(this); }*/ isFinalized = true; finalize(sqliteStatementHandle); } catch (SQLiteException e) { if (BuildVars.LOGS_ENABLED) { FileLog.e(e.getMessage(), e); } } }
Example #15
Source File: IntroActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void run() { if (!initied) { return; } if (!eglContext.equals(egl10.eglGetCurrentContext()) || !eglSurface.equals(egl10.eglGetCurrentSurface(EGL10.EGL_DRAW))) { if (!egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) { if (BuildVars.LOGS_ENABLED) { FileLog.e("eglMakeCurrent failed " + GLUtils.getEGLErrorString(egl10.eglGetError())); } return; } } float time = (System.currentTimeMillis() - currentDate) / 1000.0f; Intro.setPage(currentViewPagerPage); Intro.setDate(time); Intro.onDrawFrame(); egl10.eglSwapBuffers(eglDisplay, eglSurface); postRunnable(() -> drawRunnable.run(), 16); }
Example #16
Source File: ThemeActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void showPermissionAlert(boolean byButton) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); if (byButton) { builder.setMessage(LocaleController.getString("PermissionNoLocationPosition", R.string.PermissionNoLocationPosition)); } else { builder.setMessage(LocaleController.getString("PermissionNoLocation", R.string.PermissionNoLocation)); } builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), (dialog, which) -> { if (getParentActivity() == null) { return; } try { Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName())); getParentActivity().startActivity(intent); } catch (Exception e) { FileLog.e(e); } }); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); showDialog(builder.create()); }
Example #17
Source File: ChatEditActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void didUploadPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) { AndroidUtilities.runOnUIThread(() -> { if (file != null) { uploadedAvatar = file; if (createAfterUpload) { try { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } } catch (Exception e) { FileLog.e(e); } donePressed = false; doneButton.performClick(); } showAvatarProgress(false, true); } else { avatar = smallSize.location; avatarBig = bigSize.location; avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, currentChat); showAvatarProgress(true, false); } }); }
Example #18
Source File: CancelAccountDeletionActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onFragmentDestroy() { super.onFragmentDestroy(); for (int a = 0; a < views.length; a++) { if (views[a] != null) { views[a].onDestroyActivity(); } } if (progressDialog != null) { try { progressDialog.dismiss(); } catch (Exception e) { FileLog.e(e); } progressDialog = null; } AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid); }
Example #19
Source File: BaseFragment.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void onPause() { if (actionBar != null) { actionBar.onPause(); } try { if (visibleDialog != null && visibleDialog.isShowing() && dismissDialogOnPause(visibleDialog)) { visibleDialog.dismiss(); visibleDialog = null; } } catch (Exception e) { FileLog.e(e); } }
Example #20
Source File: SerializedData.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void writeInt64(long x, DataOutputStream out) { try { for (int i = 0; i < 8; i++) { out.write((int) (x >> (i * 8))); } } catch (Exception e) { if (BuildVars.LOGS_ENABLED) { FileLog.e("write int64 error"); } } }
Example #21
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@SuppressLint("NewApi") @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) { AudioManager am=(AudioManager) getSystemService(AUDIO_SERVICE); if (isHeadsetPlugged || am.isSpeakerphoneOn() || (isBluetoothHeadsetConnected() && am.isBluetoothScoOn())) { return; } boolean newIsNear = event.values[0] < Math.min(event.sensor.getMaximumRange(), 3); if (newIsNear != isProximityNear) { if (BuildVars.LOGS_ENABLED) { FileLog.d("proximity " + newIsNear); } isProximityNear = newIsNear; try{ if(isProximityNear){ proximityWakelock.acquire(); }else{ proximityWakelock.release(1); // this is non-public API before L } }catch(Exception x){ FileLog.e(x); } } } }
Example #22
Source File: LocationActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onFragmentDestroy() { super.onFragmentDestroy(); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionGranted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didReceivedNewMessages); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.replaceMessagesObjects); try { if (mapView != null) { mapView.onDestroy(); } } catch (Exception e) { FileLog.e(e); } if (adapter != null) { adapter.destroy(); } if (searchAdapter != null) { searchAdapter.destroy(); } if (updateRunnable != null) { AndroidUtilities.cancelRunOnUIThread(updateRunnable); updateRunnable = null; } }
Example #23
Source File: InstantCameraView.java From Telegram with GNU General Public License v2.0 | 6 votes |
private void createCamera(final SurfaceTexture surfaceTexture) { AndroidUtilities.runOnUIThread(() -> { if (cameraThread == null) { return; } if (BuildVars.LOGS_ENABLED) { FileLog.d("create camera session"); } surfaceTexture.setDefaultBufferSize(previewSize.getWidth(), previewSize.getHeight()); cameraSession = new CameraSession(selectedCamera, previewSize, pictureSize, ImageFormat.JPEG); cameraThread.setCurrentSession(cameraSession); CameraController.getInstance().openRound(cameraSession, surfaceTexture, () -> { if (cameraSession != null) { if (BuildVars.LOGS_ENABLED) { FileLog.d("camera initied"); } cameraSession.setInitied(); } }, () -> cameraThread.setCurrentSession(cameraSession)); }); }
Example #24
Source File: SecretMediaViewer.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void destroyPhotoViewer() { NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateMessageMedia); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didCreatedNewDeleteTask); isVisible = false; currentProvider = null; if (currentThumb != null) { currentThumb.release(); currentThumb = null; } releasePlayer(); if (parentActivity != null && windowView != null) { try { if (windowView.getParent() != null) { WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE); wm.removeViewImmediate(windowView); } windowView = null; } catch (Exception e) { FileLog.e(e); } } Instance = null; }
Example #25
Source File: ConnectionsManager.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(final NativeByteBuffer result) { Utilities.stageQueue.postRunnable(() -> { if (result != null) { native_applyDnsConfig(currentAccount, result.address, UserConfig.getInstance(currentAccount).getClientPhone()); } else { if (BuildVars.LOGS_ENABLED) FileLog.d("failed to get azure result"); } currentTask = null; }); }
Example #26
Source File: LocationActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onFragmentDestroy() { super.onFragmentDestroy(); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionGranted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.closeChats); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.didReceivedNewMessages); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.messagesDeleted); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.replaceMessagesObjects); try { if (mapView != null) { mapView.onDestroy(); } } catch (Exception e) { FileLog.e(e); } if (adapter != null) { adapter.destroy(); } if (searchAdapter != null) { searchAdapter.destroy(); } if (updateRunnable != null) { AndroidUtilities.cancelRunOnUIThread(updateRunnable); updateRunnable = null; } }
Example #27
Source File: VoIPBaseService.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@SuppressLint("NewApi") @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) { AudioManager am=(AudioManager) getSystemService(AUDIO_SERVICE); if (isHeadsetPlugged || am.isSpeakerphoneOn() || (isBluetoothHeadsetConnected() && am.isBluetoothScoOn())) { return; } boolean newIsNear = event.values[0] < Math.min(event.sensor.getMaximumRange(), 3); if (newIsNear != isProximityNear) { if (BuildVars.LOGS_ENABLED) { FileLog.d("proximity " + newIsNear); } isProximityNear = newIsNear; try{ if(isProximityNear){ proximityWakelock.acquire(); }else{ proximityWakelock.release(1); // this is non-public API before L } }catch(Exception x){ FileLog.e(x); } } } }
Example #28
Source File: SQLitePreparedStatement.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void finalizeQuery() { if (isFinalized) { return; } if (BuildVars.DEBUG_VERSION) { long diff = SystemClock.elapsedRealtime() - startTime; if (diff > 500) { FileLog.d("sqlite query " + query + " took " + diff + "ms"); } } try { /*if (BuildVars.DEBUG_VERSION) { hashMap.remove(this); }*/ isFinalized = true; finalize(sqliteStatementHandle); } catch (SQLiteException e) { if (BuildVars.LOGS_ENABLED) { FileLog.e(e.getMessage(), e); } } }
Example #29
Source File: ChannelEditInfoActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile) { AndroidUtilities.runOnUIThread(() -> { uploadedAvatar = file; avatar = small.location; avatarImage.setImage(avatar, "50_50", avatarDrawable); if (createAfterUpload) { try { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } } catch (Exception e) { FileLog.e(e); } donePressed = false; doneButton.performClick(); } }); }
Example #30
Source File: DialogsSearchAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void putRecentSearch(final long did, TLObject object) { RecentSearchObject recentSearchObject = recentSearchObjectsById.get(did); if (recentSearchObject == null) { recentSearchObject = new RecentSearchObject(); recentSearchObjectsById.put(did, recentSearchObject); } else { recentSearchObjects.remove(recentSearchObject); } recentSearchObjects.add(0, recentSearchObject); recentSearchObject.did = did; recentSearchObject.object = object; recentSearchObject.date = (int) (System.currentTimeMillis() / 1000); notifyDataSetChanged(); MessagesStorage.getInstance(currentAccount).getStorageQueue().postRunnable(() -> { try { SQLitePreparedStatement state = MessagesStorage.getInstance(currentAccount).getDatabase().executeFast("REPLACE INTO search_recent VALUES(?, ?)"); state.requery(); state.bindLong(1, did); state.bindInteger(2, (int) (System.currentTimeMillis() / 1000)); state.step(); state.dispose(); } catch (Exception e) { FileLog.e(e); } }); }