1717
1818import android .app .Activity ;
1919import android .content .Context ;
20- import android .util .*;
21- import android .widget .TextView ;
20+ import android .util .AttributeSet ;
2221
23- /** Simple TextView which is used to output log data received through the LogNode interface.
24- */
25- public class LogView extends TextView implements LogNode {
22+ import androidx .appcompat .widget .AppCompatTextView ;
23+
24+ /**
25+ * Simple TextView which is used to output log data received through the LogNode interface.
26+ */
27+ public class LogView extends AppCompatTextView implements LogNode {
2628
2729 public LogView (Context context ) {
2830 super (context );
@@ -38,20 +40,21 @@ public LogView(Context context, AttributeSet attrs, int defStyle) {
3840
3941 /**
4042 * Formats the log data and prints it out to the LogView.
43+ *
4144 * @param priority Log level of the data being logged. Verbose, Error, etc.
42- * @param tag Tag for for the log data. Can be used to organize log statements.
43- * @param msg The actual message to be logged. The actual message to be logged.
44- * @param tr If an exception was thrown, this can be sent along for the logging facilities
45- * to extract and print useful information.
45+ * @param tag Tag for for the log data. Can be used to organize log statements.
46+ * @param msg The actual message to be logged. The actual message to be logged.
47+ * @param tr If an exception was thrown, this can be sent along for the logging facilities
48+ * to extract and print useful information.
4649 */
4750 @ Override
4851 public void println (int priority , String tag , String msg , Throwable tr ) {
4952
50-
53+
5154 String priorityStr = null ;
5255
5356 // For the purposes of this View, we want to print the priority as readable text.
54- switch (priority ) {
57+ switch (priority ) {
5558 case android .util .Log .VERBOSE :
5659 priorityStr = "VERBOSE" ;
5760 break ;
@@ -92,7 +95,7 @@ public void println(int priority, String tag, String msg, Throwable tr) {
9295
9396 // In case this was originally called from an AsyncTask or some other off-UI thread,
9497 // make sure the update occurs within the UI thread.
95- ((Activity ) getContext ()).runOnUiThread ( (new Thread (new Runnable () {
98+ ((Activity ) getContext ()).runOnUiThread ((new Thread (new Runnable () {
9699 @ Override
97100 public void run () {
98101 // Display the text we just generated within the LogView.
@@ -113,11 +116,13 @@ public void setNext(LogNode node) {
113116 mNext = node ;
114117 }
115118
116- /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since
119+ /**
120+ * Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since
117121 * the logger takes so many arguments that might be null, this method helps cut out some of the
118122 * agonizing tedium of writing the same 3 lines over and over.
119- * @param source StringBuilder containing the text to append to.
120- * @param addStr The String to append
123+ *
124+ * @param source StringBuilder containing the text to append to.
125+ * @param addStr The String to append
121126 * @param delimiter The String to separate the source and appended strings. A tab or comma,
122127 * for instance.
123128 * @return The fully concatenated String as a StringBuilder
@@ -136,7 +141,9 @@ private StringBuilder appendIfNotNull(StringBuilder source, String addStr, Strin
136141 // The next LogNode in the chain.
137142 LogNode mNext ;
138143
139- /** Outputs the string as a new line of log data in the LogView. */
144+ /**
145+ * Outputs the string as a new line of log data in the LogView.
146+ */
140147 public void appendToLog (String s ) {
141148 append ("\n " + s );
142149 }
0 commit comments