Java Code Examples for org.telegram.messenger.BuildVars#DEBUG_VERSION

The following examples show how to use org.telegram.messenger.BuildVars#DEBUG_VERSION . 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: VoIPHelper.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public static String getLogFilePath(long callId) {
	final File logsDir = getLogsDir();
	if (!BuildVars.DEBUG_VERSION) {
		final File[] _logs = logsDir.listFiles();
		if (_logs != null) {
			final ArrayList<File> logs = new ArrayList<>(Arrays.asList(_logs));
			while (logs.size() > 20) {
				File oldest = logs.get(0);
				for (File file : logs) {
					if (file.getName().endsWith(".log") && file.lastModified() < oldest.lastModified()) {
						oldest = file;
					}
				}
				oldest.delete();
				logs.remove(oldest);
			}
		}
	}
	return new File(logsDir, callId + ".log").getAbsolutePath();
}
 
Example 2
Source File: SQLitePreparedStatement.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
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 3
Source File: VoIPController.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private String getLogFilePath(long callID){
	File dir=VoIPHelper.getLogsDir();
	if(!BuildVars.DEBUG_VERSION){
		File[] _logs=dir.listFiles();
		ArrayList<File> logs=new ArrayList<>();
		logs.addAll(Arrays.asList(_logs));
		while(logs.size()>20){
			File oldest=logs.get(0);
			for(File file : logs){
				if(file.getName().endsWith(".log") && file.lastModified()<oldest.lastModified())
					oldest=file;
			}
			oldest.delete();
			logs.remove(oldest);
		}
	}
	return new File(dir, callID+".log").getAbsolutePath();
}
 
Example 4
Source File: VoIPController.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private String getLogFilePath(long callID){
	File dir=VoIPHelper.getLogsDir();
	if(!BuildVars.DEBUG_VERSION){
		File[] _logs=dir.listFiles();
		ArrayList<File> logs=new ArrayList<>();
		logs.addAll(Arrays.asList(_logs));
		while(logs.size()>20){
			File oldest=logs.get(0);
			for(File file : logs){
				if(file.getName().endsWith(".log") && file.lastModified()<oldest.lastModified())
					oldest=file;
			}
			oldest.delete();
			logs.remove(oldest);
		}
	}
	return new File(dir, callID+".log").getAbsolutePath();
}
 
Example 5
Source File: SQLitePreparedStatement.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
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 6
Source File: VoIPHelper.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public static String getLogFilePath(long callId) {
	final File logsDir = getLogsDir();
	if (!BuildVars.DEBUG_VERSION) {
		final File[] _logs = logsDir.listFiles();
		if (_logs != null) {
			final ArrayList<File> logs = new ArrayList<>(Arrays.asList(_logs));
			while (logs.size() > 20) {
				File oldest = logs.get(0);
				for (File file : logs) {
					if (file.getName().endsWith(".log") && file.lastModified() < oldest.lastModified()) {
						oldest = file;
					}
				}
				oldest.delete();
				logs.remove(oldest);
			}
		}
	}
	return new File(logsDir, callId + ".log").getAbsolutePath();
}
 
Example 7
Source File: DrawerLayoutContainer.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    inLayout = true;
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);

        if (child.getVisibility() == GONE) {
            continue;
        }

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (BuildVars.DEBUG_VERSION) {
            if (drawerLayout != child) {
                child.layout(lp.leftMargin, lp.topMargin + getPaddingTop(), lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight() + getPaddingTop());
            } else {
                child.layout(-child.getMeasuredWidth(), lp.topMargin + getPaddingTop(), 0, lp.topMargin + child.getMeasuredHeight() + +getPaddingTop());
            }
        } else {
            try {
                if (drawerLayout != child) {
                    child.layout(lp.leftMargin, lp.topMargin + getPaddingTop(), lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight() + getPaddingTop());
                } else {
                    child.layout(-child.getMeasuredWidth(), lp.topMargin + getPaddingTop(), 0, lp.topMargin + child.getMeasuredHeight() + +getPaddingTop());
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    }
    inLayout = false;
}
 
Example 8
Source File: VoIPHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static File getLogFile(long callID){
	if(BuildVars.DEBUG_VERSION){
		File debugLogsDir=new File(ApplicationLoader.applicationContext.getExternalFilesDir(null), "logs");
		String[] logs=debugLogsDir.list();
		for(String log:logs){
			if(log.endsWith("voip"+callID+".txt")){
				return new File(debugLogsDir, log);
			}
		}
	}
	return new File(getLogsDir(), callID+".log");
}
 
Example 9
Source File: SQLitePreparedStatement.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public SQLitePreparedStatement(SQLiteDatabase db, String sql) throws SQLiteException {
    sqliteStatementHandle = prepare(db.getSQLiteHandle(), sql);
    if (BuildVars.DEBUG_VERSION) {
        query = sql;
        startTime = SystemClock.elapsedRealtime();
        /*if (hashMap == null) {
            hashMap = new HashMap<>();
        }
        hashMap.put(this, sql);*/
    }
}
 
Example 10
Source File: VoIPHelper.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private static File getLogFile(long callID) {
	if (BuildVars.DEBUG_VERSION) {
		File debugLogsDir = new File(ApplicationLoader.applicationContext.getExternalFilesDir(null), "logs");
		String[] logs = debugLogsDir.list();
		if (logs != null) {
			for (String log : logs) {
				if (log.endsWith("voip" + callID + ".txt")) {
					return new File(debugLogsDir, log);
				}
			}
		}
	}
	return new File(getLogsDir(), callID + ".log");
}
 
Example 11
Source File: VoIPHelper.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static File getLogFile(long callID) {
	if (BuildVars.DEBUG_VERSION) {
		File debugLogsDir = new File(ApplicationLoader.applicationContext.getExternalFilesDir(null), "logs");
		String[] logs = debugLogsDir.list();
		if (logs != null) {
			for (String log : logs) {
				if (log.endsWith("voip" + callID + ".txt")) {
					return new File(debugLogsDir, log);
				}
			}
		}
	}
	return new File(getLogsDir(), callID + ".log");
}
 
Example 12
Source File: SQLitePreparedStatement.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public SQLitePreparedStatement(SQLiteDatabase db, String sql) throws SQLiteException {
    sqliteStatementHandle = prepare(db.getSQLiteHandle(), sql);
    if (BuildVars.DEBUG_VERSION) {
        query = sql;
        startTime = SystemClock.elapsedRealtime();
        /*if (hashMap == null) {
            hashMap = new HashMap<>();
        }
        hashMap.put(this, sql);*/
    }
}
 
Example 13
Source File: DataSettingsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onFragmentCreate() {
    super.onFragmentCreate();

    DownloadController.getInstance(currentAccount).loadAutoDownloadConfig(true);

    rowCount = 0;
    usageSectionRow = rowCount++;
    storageUsageRow = rowCount++;
    dataUsageRow = rowCount++;
    usageSection2Row = rowCount++;
    mediaDownloadSectionRow = rowCount++;
    mobileRow = rowCount++;
    wifiRow = rowCount++;
    roamingRow = rowCount++;
    resetDownloadRow = rowCount++;
    mediaDownloadSection2Row = rowCount++;
    autoplayHeaderRow = rowCount++;
    autoplayGifsRow = rowCount++;
    autoplayVideoRow = rowCount++;
    autoplaySectionRow = rowCount++;
    streamSectionRow = rowCount++;
    enableStreamRow = rowCount++;
    if (BuildVars.DEBUG_VERSION) {
        enableMkvRow = rowCount++;
        enableAllStreamRow = rowCount++;
    } else {
        enableAllStreamRow = -1;
        enableMkvRow = -1;
    }
    enableAllStreamInfoRow = rowCount++;
    enableCacheStreamRow = -1;//rowCount++;
    callsSectionRow = rowCount++;
    useLessDataForCallsRow = rowCount++;
    quickRepliesRow = rowCount++;
    callsSection2Row = rowCount++;
    proxySectionRow = rowCount++;
    proxyRow = rowCount++;
    proxySection2Row = rowCount++;

    return true;
}
 
Example 14
Source File: DataSettingsActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onFragmentCreate() {
    super.onFragmentCreate();

    DownloadController.getInstance(currentAccount).loadAutoDownloadConfig(true);

    rowCount = 0;
    usageSectionRow = rowCount++;
    storageUsageRow = rowCount++;
    dataUsageRow = rowCount++;
    usageSection2Row = rowCount++;
    mediaDownloadSectionRow = rowCount++;
    mobileRow = rowCount++;
    wifiRow = rowCount++;
    roamingRow = rowCount++;
    resetDownloadRow = rowCount++;
    mediaDownloadSection2Row = rowCount++;
    autoplayHeaderRow = rowCount++;
    autoplayGifsRow = rowCount++;
    autoplayVideoRow = rowCount++;
    autoplaySectionRow = rowCount++;
    streamSectionRow = rowCount++;
    enableStreamRow = rowCount++;
    if (BuildVars.DEBUG_VERSION) {
        enableMkvRow = rowCount++;
        enableAllStreamRow = rowCount++;
    } else {
        enableAllStreamRow = -1;
        enableMkvRow = -1;
    }
    enableAllStreamInfoRow = rowCount++;
    enableCacheStreamRow = -1;//rowCount++;
    callsSectionRow = rowCount++;
    useLessDataForCallsRow = rowCount++;
    quickRepliesRow = rowCount++;
    callsSection2Row = rowCount++;
    proxySectionRow = rowCount++;
    proxyRow = rowCount++;
    proxySection2Row = rowCount++;

    return true;
}
 
Example 15
Source File: SettingsActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void updateRows() {
    rowCount = 0;
    emptyRow = rowCount++;
    numberSectionRow = rowCount++;
    numberRow = rowCount++;
    usernameRow = rowCount++;
    bioRow = rowCount++;
    settingsSectionRow = rowCount++;
    settingsSectionRow2 = rowCount++;
    notificationRow = rowCount++;
    privacyRow = rowCount++;
    dataRow = rowCount++;
    chatRow = rowCount++;
    if (getMessagesController().filtersEnabled || !getMessagesController().dialogFilters.isEmpty()) {
        filtersRow = rowCount++;
    } else {
        filtersRow = -1;
    }
    devicesRow = rowCount++;
    languageRow = rowCount++;
    devicesSectionRow = rowCount++;
    helpHeaderRow = rowCount++;
    questionRow = rowCount++;
    faqRow = rowCount++;
    policyRow = rowCount++;
    if (BuildVars.LOGS_ENABLED || BuildVars.DEBUG_VERSION) {
        helpSectionCell = rowCount++;
        debugHeaderRow = rowCount++;
    } else {
        helpSectionCell = -1;
        debugHeaderRow = -1;
    }
    if (BuildVars.LOGS_ENABLED) {
        sendLogsRow = rowCount++;
        clearLogsRow = rowCount++;
    } else {
        sendLogsRow = -1;
        clearLogsRow = -1;
    }
    if (BuildVars.DEBUG_VERSION) {
        switchBackendRow = rowCount++;
    } else {
        switchBackendRow = -1;
    }
    versionRow = rowCount++;
    if (listAdapter != null) {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example 16
Source File: DataSettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onFragmentCreate()
{
    super.onFragmentCreate();

    rowCount = 0;
    usageSectionRow = rowCount++;
    storageUsageRow = rowCount++;
    mobileUsageRow = rowCount++;
    wifiUsageRow = rowCount++;
    roamingUsageRow = rowCount++;
    usageSection2Row = rowCount++;
    mediaDownloadSectionRow = rowCount++;
    autoDownloadMediaRow = rowCount++;
    photosRow = rowCount++;
    voiceMessagesRow = rowCount++;
    videoMessagesRow = rowCount++;
    videosRow = rowCount++;
    filesRow = rowCount++;
    musicRow = rowCount++;
    gifsRow = rowCount++;
    resetDownloadRow = rowCount++;
    mediaDownloadSection2Row = rowCount++;
    streamSectionRow = rowCount++;
    enableStreamRow = rowCount++;
    if (BuildVars.DEBUG_VERSION)
    {
        enableAllStreamRow = rowCount++;
    }
    else
    {
        enableAllStreamRow = -1;
    }
    enableAllStreamInfoRow = rowCount++;
    enableCacheStreamRow = -1;//rowCount++;
    callsSectionRow = rowCount++;
    useLessDataForCallsRow = rowCount++;
    quickRepliesRow = rowCount++;
    callsSection2Row = rowCount++;
    proxySectionRow = rowCount++;
    proxyRow = rowCount++;
    proxySection2Row = rowCount++;

    return true;
}
 
Example 17
Source File: SettingsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void updateRows() {
    rowCount = 0;
    emptyRow = rowCount++;
    numberSectionRow = rowCount++;
    numberRow = rowCount++;
    usernameRow = rowCount++;
    bioRow = rowCount++;
    settingsSectionRow = rowCount++;
    settingsSectionRow2 = rowCount++;
    notificationRow = rowCount++;
    privacyRow = rowCount++;
    dataRow = rowCount++;
    chatRow = rowCount++;
    if (getMessagesController().filtersEnabled || !getMessagesController().dialogFilters.isEmpty()) {
        filtersRow = rowCount++;
    } else {
        filtersRow = -1;
    }
    devicesRow = rowCount++;
    languageRow = rowCount++;
    devicesSectionRow = rowCount++;
    helpHeaderRow = rowCount++;
    questionRow = rowCount++;
    faqRow = rowCount++;
    policyRow = rowCount++;
    if (BuildVars.LOGS_ENABLED || BuildVars.DEBUG_VERSION) {
        helpSectionCell = rowCount++;
        debugHeaderRow = rowCount++;
    } else {
        helpSectionCell = -1;
        debugHeaderRow = -1;
    }
    if (BuildVars.LOGS_ENABLED) {
        sendLogsRow = rowCount++;
        clearLogsRow = rowCount++;
    } else {
        sendLogsRow = -1;
        clearLogsRow = -1;
    }
    if (BuildVars.DEBUG_VERSION) {
        switchBackendRow = rowCount++;
    } else {
        switchBackendRow = -1;
    }
    versionRow = rowCount++;
    if (listAdapter != null) {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example 18
Source File: DrawerLayoutContainer.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
    inLayout = true;
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++)
    {
        final View child = getChildAt(i);

        if (child.getVisibility() == GONE)
        {
            continue;
        }

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (BuildVars.DEBUG_VERSION)
        {
            if (drawerLayout != child)
            {
                child.layout(lp.leftMargin, lp.topMargin + getPaddingTop(), lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight() + getPaddingTop());
            }
            else
            {
                child.layout(-child.getMeasuredWidth(), lp.topMargin + getPaddingTop(), 0, lp.topMargin + child.getMeasuredHeight() + +getPaddingTop());
            }
        }
        else
        {
            try
            {
                if (drawerLayout != child)
                {
                    child.layout(lp.leftMargin, lp.topMargin + getPaddingTop(), lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight() + getPaddingTop());
                }
                else
                {
                    child.layout(-child.getMeasuredWidth(), lp.topMargin + getPaddingTop(), 0, lp.topMargin + child.getMeasuredHeight() + +getPaddingTop());
                }
            }
            catch (Exception e)
            {
                FileLog.e(e);
            }
        }
    }
    inLayout = false;
}
 
Example 19
Source File: DataSettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onFragmentCreate()
{
    super.onFragmentCreate();

    rowCount = 0;
    usageSectionRow = rowCount++;
    storageUsageRow = rowCount++;
    mobileUsageRow = rowCount++;
    wifiUsageRow = rowCount++;
    roamingUsageRow = rowCount++;
    usageSection2Row = rowCount++;
    mediaDownloadSectionRow = rowCount++;
    autoDownloadMediaRow = rowCount++;
    photosRow = rowCount++;
    voiceMessagesRow = rowCount++;
    videoMessagesRow = rowCount++;
    videosRow = rowCount++;
    filesRow = rowCount++;
    musicRow = rowCount++;
    gifsRow = rowCount++;
    resetDownloadRow = rowCount++;
    mediaDownloadSection2Row = rowCount++;
    streamSectionRow = rowCount++;
    enableStreamRow = rowCount++;
    if (BuildVars.DEBUG_VERSION)
    {
        enableAllStreamRow = rowCount++;
    }
    else
    {
        enableAllStreamRow = -1;
    }
    enableAllStreamInfoRow = rowCount++;
    enableCacheStreamRow = -1;//rowCount++;
    callsSectionRow = rowCount++;
    useLessDataForCallsRow = rowCount++;
    quickRepliesRow = rowCount++;
    callsSection2Row = rowCount++;
    proxySectionRow = rowCount++;
    proxyRow = rowCount++;
    proxySection2Row = rowCount++;

    return true;
}
 
Example 20
Source File: DrawerLayoutContainer.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
    inLayout = true;
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++)
    {
        final View child = getChildAt(i);

        if (child.getVisibility() == GONE)
        {
            continue;
        }

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (BuildVars.DEBUG_VERSION)
        {
            if (drawerLayout != child)
            {
                child.layout(lp.leftMargin, lp.topMargin + getPaddingTop(), lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight() + getPaddingTop());
            }
            else
            {
                child.layout(-child.getMeasuredWidth(), lp.topMargin + getPaddingTop(), 0, lp.topMargin + child.getMeasuredHeight() + +getPaddingTop());
            }
        }
        else
        {
            try
            {
                if (drawerLayout != child)
                {
                    child.layout(lp.leftMargin, lp.topMargin + getPaddingTop(), lp.leftMargin + child.getMeasuredWidth(), lp.topMargin + child.getMeasuredHeight() + getPaddingTop());
                }
                else
                {
                    child.layout(-child.getMeasuredWidth(), lp.topMargin + getPaddingTop(), 0, lp.topMargin + child.getMeasuredHeight() + +getPaddingTop());
                }
            }
            catch (Exception e)
            {
                FileLog.e(e);
            }
        }
    }
    inLayout = false;
}