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 Project: TelePlus-Android Author: TelePlusDev File: ChannelEditInfoActivity.java License: 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 #2
Source Project: TelePlus-Android Author: TelePlusDev File: PaymentFormActivity.java License: 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 #3
Source Project: Telegram Author: DrKLO File: AlertsCreator.java License: 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 #4
Source Project: Telegram Author: DrKLO File: VoIPHelper.java License: 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 #5
Source Project: TelePlus-Android Author: TelePlusDev File: ChangePhoneActivity.java License: 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 Project: TelePlus-Android Author: TelePlusDev File: ChatActivityEnterView.java License: 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 #7
Source Project: Telegram Author: DrKLO File: ChatAttachAlertDocumentLayout.java License: 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 #8
Source Project: Telegram Author: DrKLO File: SQLitePreparedStatement.java License: 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 #9
Source Project: Telegram-FOSS Author: Telegram-FOSS-Team File: ThemeActivity.java License: 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 #10
Source Project: Telegram-FOSS Author: Telegram-FOSS-Team File: ActionIntroActivity.java License: GNU General Public License v2.0 | 6 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 #11
Source Project: TelePlus-Android Author: TelePlusDev File: BaseFragment.java License: 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 #12
Source Project: TelePlus-Android Author: TelePlusDev File: SerializedData.java License: 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 #13
Source Project: TelePlus-Android Author: TelePlusDev File: LocationActivity.java License: 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 #14
Source Project: Telegram Author: DrKLO File: InstantCameraView.java License: 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 #15
Source Project: TelePlus-Android Author: TelePlusDev File: SecretMediaViewer.java License: 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 #16
Source Project: Telegram-FOSS Author: Telegram-FOSS-Team File: SQLitePreparedStatement.java License: 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 #17
Source Project: Telegram-FOSS Author: Telegram-FOSS-Team File: ConnectionsManager.java License: 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 #18
Source Project: Telegram-FOSS Author: Telegram-FOSS-Team File: VoIPBaseService.java License: 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 #19
Source Project: TelePlus-Android Author: TelePlusDev File: LocationActivity.java License: 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 #20
Source Project: TelePlus-Android Author: TelePlusDev File: ConnectionsManager.java License: 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 #21
Source Project: TelePlus-Android Author: TelePlusDev File: VoIPBaseService.java License: 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 Project: Telegram Author: DrKLO File: CancelAccountDeletionActivity.java License: 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 #23
Source Project: Telegram-FOSS Author: Telegram-FOSS-Team File: ChatEditActivity.java License: 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 #24
Source Project: Telegram Author: DrKLO File: IntroActivity.java License: 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 #25
Source Project: TelePlus-Android Author: TelePlusDev File: VoIPHelper.java License: 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 #26
Source Project: TelePlus-Android Author: TelePlusDev File: VoIPServerConfig.java License: 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 #27
Source Project: TelePlus-Android Author: TelePlusDev File: PhotoFilterView.java License: 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 #28
Source Project: TelePlus-Android Author: TelePlusDev File: BaseFragment.java License: 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 #29
Source Project: TelePlus-Android Author: TelePlusDev File: WebPlayerView.java License: 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 #30
Source Project: Telegram Author: DrKLO File: SearchAdapterHelper.java License: GNU General Public License v2.0 | 5 votes |
private void putRecentHashtags(final ArrayList<HashtagObject> arrayList) { MessagesStorage.getInstance(currentAccount).getStorageQueue().postRunnable(() -> { try { MessagesStorage.getInstance(currentAccount).getDatabase().beginTransaction(); SQLitePreparedStatement state = MessagesStorage.getInstance(currentAccount).getDatabase().executeFast("REPLACE INTO hashtag_recent_v2 VALUES(?, ?)"); for (int a = 0; a < arrayList.size(); a++) { if (a == 100) { break; } HashtagObject hashtagObject = arrayList.get(a); state.requery(); state.bindString(1, hashtagObject.hashtag); state.bindInteger(2, hashtagObject.date); state.step(); } state.dispose(); MessagesStorage.getInstance(currentAccount).getDatabase().commitTransaction(); if (arrayList.size() >= 100) { MessagesStorage.getInstance(currentAccount).getDatabase().beginTransaction(); for (int a = 100; a < arrayList.size(); a++) { MessagesStorage.getInstance(currentAccount).getDatabase().executeFast("DELETE FROM hashtag_recent_v2 WHERE id = '" + arrayList.get(a).hashtag + "'").stepThis().dispose(); } MessagesStorage.getInstance(currentAccount).getDatabase().commitTransaction(); } } catch (Exception e) { FileLog.e(e); } }); }