diff src/com/five_ten_sg/connectbot/monitor/MonitorActivity.java @ 2:f6a1aabf384f

add copyright
author Carl Byington <carl@five-ten-sg.com>
date Mon, 23 Jun 2014 16:57:39 -0700
parents 5564580fe160
children 2be5bca648ab
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/monitor/MonitorActivity.java	Mon May 05 14:37:11 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/monitor/MonitorActivity.java	Mon Jun 23 16:57:39 2014 -0700
@@ -36,13 +36,7 @@
         @Override
         public void handleMessage (Message msg) {
             if (msg.what == MESSAGE_CODE_PRINT) {
-                String s = (String)msg.obj;
-                if (count < LINES) count++;
-                else               start = (start+1) % LINES;
-                texts[(start+count-1) % LINES] = s + "\n";
-                String c = "";
-                for (int i=0; i<count; i++) c = c.concat(texts[(start+i) % LINES]);
-                text.setText(c);
+                printer((String)msg.obj);
             } else {
                 super.handleMessage(msg);
             }
@@ -65,19 +59,24 @@
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
         text = (TextView) findViewById(R.id.text2);
+        printer(getString(R.string.copyright));
         Log.i(TAG, "binding to monitor service");
         Intent intent = new Intent ("com.five_ten_sg.connectbot.monitor.MonitorService");
         bindService(intent, connection, Context.BIND_AUTO_CREATE);
     }
 
-    public void printer(String msg) {
-        handler.sendMessage(handler.obtainMessage(MonitorActivity.MESSAGE_CODE_PRINT, msg));
+    private void printer(String msg) {
+        if (count < LINES) count++;
+        else               start = (start+1) % LINES;
+        texts[(start+count-1) % LINES] = s + "\n";
+        String c = "";
+        for (int i=0; i<count; i++) c = c.concat(texts[(start+i) % LINES]);
+        text.setText(c);
     }
 
     @Override
     protected void onStart() {
         super.onStart();
-        printer("activity onStart()");
         Log.i(TAG, "activity onStart()");
     }