Hide the very last task row in the widget if screen density <= 0.75

pull/14/head
Tim Su 14 years ago
parent 3d8bcf4c95
commit 5f7ffb7406

@ -10,8 +10,11 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.IBinder;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.RemoteViews;
import com.timsu.astrid.R;
@ -197,6 +200,8 @@ public class TasksWidget extends AppWidgetProvider {
cursor.close();
}
updateForScreenSize(views);
Intent listIntent = new Intent(context, TaskListActivity.class);
listIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
if(filter != null) {
@ -221,6 +226,19 @@ public class TasksWidget extends AppWidgetProvider {
return views;
}
private void updateForScreenSize(RemoteViews views) {
Display display = ((WindowManager) this.getSystemService(
Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
if(metrics.density <= 0.75) {
views.setViewVisibility(SEPARATOR_IDS[3], View.INVISIBLE);
views.setViewVisibility(TEXT_IDS[4], View.INVISIBLE);
}
}
private Filter getFilter(int widgetId) {
// base our filter off the inbox filter, replace stuff if we have it
Filter filter = CoreFilterExposer.buildInboxFilter(getResources());

Loading…
Cancel
Save