checkstyle: enable OneTopLevelClass
The only remaining error was ClipboardCompat, which was unnecessarily exposing three top-level classes. Make the two implementation classes be nested, private and static.
This commit is contained in:
		
							parent
							
								
									6311ad5c6b
								
							
						
					
					
						commit
						78af79cd4f
					
				| @ -17,34 +17,33 @@ public abstract class ClipboardCompat { | ||||
|         return new OldClipboard(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|     @TargetApi(11) | ||||
|     private static class HoneycombClipboard extends ClipboardCompat { | ||||
| 
 | ||||
| @TargetApi(11) | ||||
| class HoneycombClipboard extends ClipboardCompat { | ||||
|         private final ClipboardManager manager; | ||||
| 
 | ||||
|     private final ClipboardManager manager; | ||||
| 
 | ||||
|     HoneycombClipboard(Context context) { | ||||
|         this.manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String getText() { | ||||
|         CharSequence text = null; | ||||
|         if (manager.hasPrimaryClip()) { | ||||
|             ClipData data = manager.getPrimaryClip(); | ||||
|             if (data.getItemCount() > 0) { | ||||
|                 text = data.getItemAt(0).getText(); | ||||
|             } | ||||
|         HoneycombClipboard(Context context) { | ||||
|             this.manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|         public String getText() { | ||||
|             CharSequence text = null; | ||||
|             if (manager.hasPrimaryClip()) { | ||||
|                 ClipData data = manager.getPrimaryClip(); | ||||
|                 if (data.getItemCount() > 0) { | ||||
|                     text = data.getItemAt(0).getText(); | ||||
|                 } | ||||
|             } | ||||
|             return text != null ? text.toString() : null; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private static class OldClipboard extends ClipboardCompat { | ||||
| 
 | ||||
|         @Override | ||||
|         public String getText() { | ||||
|             return null; | ||||
|         } | ||||
|         return text != null ? text.toString() : null; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| class OldClipboard extends ClipboardCompat { | ||||
| 
 | ||||
|     @Override | ||||
|     public String getText() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -62,7 +62,7 @@ | ||||
|         </module> | ||||
|         <module name="NoLineWrap"/> | ||||
| 
 | ||||
|         <!--<module name="OneTopLevelClass" />--> | ||||
|         <module name="OneTopLevelClass" /> | ||||
|         <module name="OneStatementPerLine" /> | ||||
| 
 | ||||
|         <module name="EmptyBlock"> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Daniel Martí
						Daniel Martí