add log max size feature

This commit is contained in:
Nathan Freitas 2014-05-02 00:39:59 -04:00
parent b9f14b318b
commit 0dc50cc492
2 changed files with 7 additions and 0 deletions

View File

@ -178,6 +178,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
private void appendLogTextAndScroll(String text) private void appendLogTextAndScroll(String text)
{ {
if(mTxtOrbotLog != null){ if(mTxtOrbotLog != null){
if (mTxtOrbotLog.getText().length() > MAX_LOG_LENGTH)
mTxtOrbotLog.setText("");
mTxtOrbotLog.append(text + "\n"); mTxtOrbotLog.append(text + "\n");
final Layout layout = mTxtOrbotLog.getLayout(); final Layout layout = mTxtOrbotLog.getLayout();
if(layout != null){ if(layout != null){

View File

@ -53,4 +53,7 @@ public interface TorConstants {
public final static String PREF_DISABLE_NETWORK = "pref_disable_network"; public final static String PREF_DISABLE_NETWORK = "pref_disable_network";
public final static String PREF_TOR_SHARED_PREFS = "org.torproject.android_preferences"; public final static String PREF_TOR_SHARED_PREFS = "org.torproject.android_preferences";
public final static int MAX_LOG_LENGTH = 10000;
} }