Java Code Examples for android.widget.ScrollView#postDelayed()

The following examples show how to use android.widget.ScrollView#postDelayed() . 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: LiveChatActivity.java    From BotLibre with Eclipse Public License 1.0 6 votes vote down vote up
public void submitChat() {
	EditText v = (EditText) findViewById(R.id.messageText);
	String input = v.getText().toString().trim();
	if (input.equals("")) {
		return;
	}
	final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
	scroll.postDelayed(new Runnable() {
	    public void run() {
	    	scroll.fullScroll(View.FOCUS_DOWN);
	    }
	}, 200);
	scroll.postDelayed(new Runnable() {
	    public void run() {
	    	scroll.fullScroll(View.FOCUS_DOWN);
	    }
	}, 400);
	
	
	this.connection.sendMessage(input);
	
	v.setText("");
}
 
Example 2
Source File: LiveChatActivity.java    From BotLibre with Eclipse Public License 1.0 6 votes vote down vote up
public void submitChat() {
	EditText v = (EditText) findViewById(R.id.messageText);
	String input = v.getText().toString().trim();
	if (input.equals("")) {
		return;
	}
	final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
	scroll.postDelayed(new Runnable() {
	    public void run() {
	    	scroll.fullScroll(View.FOCUS_DOWN);
	    }
	}, 200);
	scroll.postDelayed(new Runnable() {
	    public void run() {
	    	scroll.fullScroll(View.FOCUS_DOWN);
	    }
	}, 400);
	
	
	this.connection.sendMessage(input);
	
	v.setText("");
}
 
Example 3
Source File: LiveChatActivity.java    From BotLibre with Eclipse Public License 1.0 6 votes vote down vote up
public void submitChat() {
	EditText v = (EditText) findViewById(R.id.messageText);
	String input = v.getText().toString().trim();
	if (input.equals("")) {
		return;
	}
	final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
	scroll.postDelayed(new Runnable() {
	    public void run() {
	    	scroll.fullScroll(View.FOCUS_DOWN);
	    }
	}, 200);
	scroll.postDelayed(new Runnable() {
	    public void run() {
	    	scroll.fullScroll(View.FOCUS_DOWN);
	    }
	}, 400);
	
	
	this.connection.sendMessage(input);
	
	v.setText("");
}
 
Example 4
Source File: LiveChatActivity.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
public void response(String text) {
  	if (this.closing) {
  		return;
  	}
  	String user = "";
  	String message = text;
  	int index = text.indexOf(':');
  	if (index != -1) {
  		user = text.substring(0, index);
  		message = text.substring(index + 2, text.length());
  	}
if (user.equals("Online")) {
	HttpAction action = new HttpGetLiveChatUsersAction(this, message);
	action.execute();
	return;
}
if (user.equals("Media")) {
	return;
}
if (user.equals("Channel")) {
	return;
}

WebView log = (WebView) findViewById(R.id.logText);
this.html = this.html + "<b>" + user + "</b> <span style='font-size:10px;color:grey'>"
			+ Utils.displayTime(new Date()) + "</span><br/>"
			+ Utils.linkHTML(message) + "<br/>";
log.loadDataWithBaseURL(null, this.html, "text/html", "utf-8", null);

final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 200);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 400);

if ((System.currentTimeMillis() - startTime) < (1000 * 5)) {
   	return;
}
		
boolean speak = this.speak;
boolean chime = this.chime;
if (user.equals("Error") || user.equals("Info")) {
	speak = false;
} else if (MainActivity.user == null) {
	if (user.startsWith("anonymous")) {
		speak = false;
		chime = false;
	}
} else {
	if (user.equals(MainActivity.user.user)) {
		speak = false;
		chime = false;
	}			
}
if (speak) {
	this.tts.speak(message, TextToSpeech.QUEUE_FLUSH, null);
} else if (chime) {
	if (this.chimePlayer != null && this.chimePlayer.isPlaying()) {
		return;
	}
	chime();
}
  }
 
Example 5
Source File: LiveChatActivity.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
public void response(String text) {
  	if (this.closing) {
  		return;
  	}
  	String user = "";
  	String message = text;
  	int index = text.indexOf(':');
  	if (index != -1) {
  		user = text.substring(0, index);
  		message = text.substring(index + 2, text.length());
  	}
if (user.equals("Online")) {
	HttpAction action = new HttpGetLiveChatUsersAction(this, message);
	action.execute();
	return;
}
if (user.equals("Media")) {
	return;
}
if (user.equals("Channel")) {
	return;
}

WebView log = (WebView) findViewById(R.id.logText);

message = Utils.linkHTML(message);
if (message.contains("<") && message.contains(">")) {
	message = linkPostbacks(message);
}
this.html = this.html + "<b>" + user + "</b> <span style='font-size:10px;color:grey'>"
			+ Utils.displayTime(new Date()) + "</span><br/>"
			+ Utils.linkHTML(message) + "<br/>";
log.loadDataWithBaseURL(null, this.html, "text/html", "utf-8", null);

final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 200);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 400);

if ((System.currentTimeMillis() - startTime) < (1000 * 5)) {
   	return;
}
		
boolean speak = this.speak;
boolean chime = this.chime;
if (user.equals("Error") || user.equals("Info")) {
	speak = false;
} else if (MainActivity.user == null) {
	if (user.startsWith("anonymous")) {
		speak = false;
		chime = false;
	}
} else {
	if (user.equals(MainActivity.user.user)) {
		speak = false;
		chime = false;
	}			
}
if (speak) {
	this.tts.speak(message, TextToSpeech.QUEUE_FLUSH, null);
} else if (chime) {
	if (this.chimePlayer != null && this.chimePlayer.isPlaying()) {
		return;
	}
	chime();
}
  }
 
Example 6
Source File: LiveChatActivity.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
public void response(String text) {
  	if (this.closing) {
  		return;
  	}
  	String user = "";
  	String message = text;
  	int index = text.indexOf(':');
  	if (index != -1) {
  		user = text.substring(0, index);
  		message = text.substring(index + 2, text.length());
  	}
if (user.equals("Online")) {
	HttpAction action = new HttpGetLiveChatUsersAction(this, message);
	action.execute();
	return;
}
if (user.equals("Media")) {
	return;
}
if (user.equals("Channel")) {
	return;
}

WebView log = (WebView) findViewById(R.id.logText);

message = Utils.linkHTML(message);
if (message.contains("<") && message.contains(">")) {
	message = linkPostbacks(message);
}
this.html = this.html + "<b>" + user + "</b> <span style='font-size:10px;color:grey'>"
			+ Utils.displayTime(new Date()) + "</span><br/>"
			+ Utils.linkHTML(message) + "<br/>";
log.loadDataWithBaseURL(null, this.html, "text/html", "utf-8", null);

final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 200);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 400);

if ((System.currentTimeMillis() - startTime) < (1000 * 5)) {
   	return;
}
		
boolean speak = this.speak;
boolean chime = this.chime;
if (user.equals("Error") || user.equals("Info")) {
	speak = false;
} else if (MainActivity.user == null) {
	if (user.startsWith("anonymous")) {
		speak = false;
		chime = false;
	}
} else {
	if (user.equals(MainActivity.user.user)) {
		speak = false;
		chime = false;
	}			
}
if (speak) {
	this.tts.speak(message, TextToSpeech.QUEUE_FLUSH, null);
} else if (chime) {
	if (this.chimePlayer != null && this.chimePlayer.isPlaying()) {
		return;
	}
	chime();
}
  }
 
Example 7
Source File: LiveChatActivity.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
public void response(String text) {
  	if (this.closing) {
  		return;
  	}
  	String user = "";
  	String message = text;
  	int index = text.indexOf(':');
  	if (index != -1) {
  		user = text.substring(0, index);
  		message = text.substring(index + 2, text.length());
  	}
if (user.equals("Online")) {
	HttpAction action = new HttpGetLiveChatUsersAction(this, message);
	action.execute();
	return;
}
if (user.equals("Media")) {
	return;
}
if (user.equals("Channel")) {
	return;
}

WebView log = (WebView) findViewById(R.id.logText);

message = Utils.linkHTML(message);
if (message.contains("<") && message.contains(">")) {
	message = linkPostbacks(message);
}
this.html = this.html + "<b>" + user + "</b> <span style='font-size:10px;color:grey'>"
			+ Utils.displayTime(new Date()) + "</span><br/>"
			+ Utils.linkHTML(message) + "<br/>";
log.loadDataWithBaseURL(null, this.html, "text/html", "utf-8", null);

final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 200);
scroll.postDelayed(new Runnable() {
    public void run() {
    	scroll.fullScroll(View.FOCUS_DOWN);
    }
}, 400);

if ((System.currentTimeMillis() - startTime) < (1000 * 5)) {
   	return;
}
		
boolean speak = this.speak;
boolean chime = this.chime;
if (user.equals("Error") || user.equals("Info")) {
	speak = false;
} else if (MainActivity.user == null) {
	if (user.startsWith("anonymous")) {
		speak = false;
		chime = false;
	}
} else {
	if (user.equals(MainActivity.user.user)) {
		speak = false;
		chime = false;
	}			
}
if (speak) {
	this.tts.speak(message, TextToSpeech.QUEUE_FLUSH, null);
} else if (chime) {
	if (this.chimePlayer != null && this.chimePlayer.isPlaying()) {
		return;
	}
	chime();
}
  }