Merge branch 'fix-ellipsize' into 'master'
Fix ellipsizing on 2.X, other minor updates See merge request !276
This commit is contained in:
		
						commit
						ee696b4737
					
				| @ -33,6 +33,7 @@ import android.content.pm.PackageManager; | ||||
| import android.database.ContentObserver; | ||||
| import android.graphics.Bitmap; | ||||
| import android.net.Uri; | ||||
| import android.os.Build; | ||||
| import android.os.Bundle; | ||||
| import android.os.Handler; | ||||
| import android.support.annotation.NonNull; | ||||
| @ -1112,7 +1113,10 @@ public class AppDetails extends AppCompatActivity { | ||||
|                     viewMorePermissions.setText(getString(R.string.less)); | ||||
|                 } else { | ||||
|                     description.setMaxLines(MAX_LINES); | ||||
|                     description.setEllipsize(TextUtils.TruncateAt.MARQUEE); | ||||
|                     if (Build.VERSION.SDK_INT > 10) { | ||||
|                         // ellipsizing doesn't work properly here on 2.X | ||||
|                         description.setEllipsize(TextUtils.TruncateAt.MARQUEE); | ||||
|                     } | ||||
|                     viewMorePermissions.setText(R.string.more); | ||||
|                 } | ||||
|                 viewAllDescription ^= true; | ||||
| @ -1133,7 +1137,10 @@ public class AppDetails extends AppCompatActivity { | ||||
|                     // If description has more than five lines | ||||
|                     if (description.getLineCount() > MAX_LINES) { | ||||
|                         description.setMaxLines(MAX_LINES); | ||||
|                         description.setEllipsize(TextUtils.TruncateAt.MARQUEE); | ||||
|                         if (Build.VERSION.SDK_INT > 10) { | ||||
|                             // ellipsizing doesn't work properly here on 2.X | ||||
|                             description.setEllipsize(TextUtils.TruncateAt.MARQUEE); | ||||
|                         } | ||||
|                         description.setOnClickListener(expanderDescription); | ||||
|                         viewAllDescription = true; | ||||
| 
 | ||||
|  | ||||
| @ -71,7 +71,6 @@ import java.util.zip.Adler32; | ||||
| 
 | ||||
| public final class Utils { | ||||
| 
 | ||||
|     @SuppressWarnings("UnusedDeclaration") | ||||
|     private static final String TAG = "Utils"; | ||||
| 
 | ||||
|     private static final int BUFFER_SIZE = 4096; | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -181,15 +181,14 @@ public class DownloaderService extends Service { | ||||
|      * message. | ||||
|      */ | ||||
|     private String getNotificationTitle(@Nullable String packageName) { | ||||
|         String title; | ||||
|         if (packageName != null) { | ||||
|             App app = AppProvider.Helper.findByPackageName( | ||||
|             final App app = AppProvider.Helper.findByPackageName( | ||||
|                     getContentResolver(), packageName, new String[]{AppProvider.DataColumns.NAME}); | ||||
|             title = getString(R.string.downloading_apk, app.name); | ||||
|         } else { | ||||
|             title = getString(R.string.downloading); | ||||
|             if (app != null) { | ||||
|                 return getString(R.string.downloading_apk, app.name); | ||||
|             } | ||||
|         } | ||||
|         return title; | ||||
|         return getString(R.string.downloading); | ||||
|     } | ||||
| 
 | ||||
|     public static PendingIntent createAppDetailsIntent(@NonNull Context context, int requestCode, @Nullable String packageName) { | ||||
|  | ||||
| @ -227,9 +227,6 @@ public class SwapAppsView extends ListView implements | ||||
| 
 | ||||
|     private class AppListAdapter extends CursorAdapter { | ||||
| 
 | ||||
|         @SuppressWarnings("UnusedDeclaration") | ||||
|         private static final String TAG = "AppListAdapter"; | ||||
| 
 | ||||
|         private class ViewHolder { | ||||
| 
 | ||||
|             private final LocalBroadcastManager localBroadcastManager; | ||||
|  | ||||
| @ -656,9 +656,6 @@ public class SwapWorkflowActivity extends AppCompatActivity { | ||||
|         public static final int TYPE_COMPLETE = 1; | ||||
|         public static final int TYPE_ERROR = 2; | ||||
| 
 | ||||
|         @SuppressWarnings("UnusedDeclaration") | ||||
|         private static final String TAG = "UpdateAsyncTask"; | ||||
| 
 | ||||
|         @NonNull | ||||
|         protected final Set<String> selectedApps; | ||||
| 
 | ||||
|  | ||||
| @ -3,7 +3,7 @@ buildscript { | ||||
|         jcenter() | ||||
|     } | ||||
|     dependencies { | ||||
|         classpath 'com.android.tools.build:gradle:2.0.0' | ||||
|         classpath 'com.android.tools.build:gradle:2.1.0' | ||||
|         classpath files('libs/gradle-witness.jar') | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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í