Actually use the compat class in ClipboardCompat and SwitchCompat
This commit is contained in:
		
							parent
							
								
									f1c7846605
								
							
						
					
					
						commit
						c274752477
					
				| @ -1,21 +1,21 @@ | ||||
| package org.fdroid.fdroid.compat; | ||||
| 
 | ||||
| import android.annotation.TargetApi; | ||||
| import android.content.ClipData; | ||||
| import android.content.ClipboardManager; | ||||
| import android.content.Context; | ||||
| import android.os.Build; | ||||
| import android.widget.CompoundButton; | ||||
| import android.widget.Switch; | ||||
| import android.widget.ToggleButton; | ||||
| import org.fdroid.fdroid.ManageRepo; | ||||
| 
 | ||||
| public abstract class ClipboardCompat { | ||||
| public abstract class ClipboardCompat extends Compatibility { | ||||
| 
 | ||||
|     public abstract String getText(); | ||||
| 
 | ||||
|     public static ClipboardCompat create(Context context) { | ||||
|         if (Build.VERSION.SDK_INT >= 11) { | ||||
|                 return new HoneycombClipboard(context); | ||||
|         if (hasApi(11)) { | ||||
|             return new HoneycombClipboard(context); | ||||
|         } else { | ||||
|             return new OldClipboard(); | ||||
|         } | ||||
| @ -23,6 +23,7 @@ public abstract class ClipboardCompat { | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| @TargetApi(11) | ||||
| class HoneycombClipboard extends ClipboardCompat { | ||||
| 
 | ||||
|     private final ClipboardManager manager; | ||||
| @ -51,4 +52,4 @@ class OldClipboard extends ClipboardCompat { | ||||
|     public String getText() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -1,12 +1,12 @@ | ||||
| package org.fdroid.fdroid.compat; | ||||
| 
 | ||||
| import android.os.Build; | ||||
| import android.annotation.TargetApi; | ||||
| import android.widget.CompoundButton; | ||||
| import android.widget.Switch; | ||||
| import android.widget.ToggleButton; | ||||
| import org.fdroid.fdroid.ManageRepo; | ||||
| 
 | ||||
| public abstract class SwitchCompat { | ||||
| public abstract class SwitchCompat extends Compatibility { | ||||
| 
 | ||||
|     protected final ManageRepo activity; | ||||
| 
 | ||||
| @ -17,7 +17,7 @@ public abstract class SwitchCompat { | ||||
|     public abstract CompoundButton createSwitch(); | ||||
| 
 | ||||
|     public static SwitchCompat create(ManageRepo activity) { | ||||
|         if (Build.VERSION.SDK_INT >= 11) { | ||||
|         if (hasApi(11)) { | ||||
|                 return new HoneycombSwitch(activity); | ||||
|         } else { | ||||
|             return new OldSwitch(activity); | ||||
| @ -26,6 +26,7 @@ public abstract class SwitchCompat { | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| @TargetApi(11) | ||||
| class HoneycombSwitch extends SwitchCompat { | ||||
| 
 | ||||
|     protected HoneycombSwitch(ManageRepo activity) { | ||||
| @ -48,4 +49,4 @@ class OldSwitch extends SwitchCompat { | ||||
|     public CompoundButton createSwitch() { | ||||
|         return new ToggleButton(activity); | ||||
|     } | ||||
| } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Daniel Martí
						Daniel Martí