From 93ee50735978d18a901bc3310b415c39c8778d05 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 9 Oct 2013 17:46:24 +0200 Subject: [PATCH] Correct look of the preview widget in the widget config screen. --- core/AndroidManifest.xml | 4 +- core/res/layout-v11/actionbar_donebutton.xml | 4 +- core/res/layout-v11/activity_widgetconfig.xml | 19 +++-- core/res/layout-v11/widget_torrents_dark.xml | 77 +++++++++++-------- core/res/layout-v11/widget_torrents_light.xml | 73 +++++++++++------- core/res/values-sw600dp/dimens.xml | 2 +- core/res/values/dimens.xml | 4 +- core/res/values/styles.xml | 22 ++++-- .../core/widget/WidgetConfigActivity.java | 36 ++++----- full/AndroidManifest.xml | 5 +- lite/AndroidManifest.xml | 5 +- 11 files changed, 148 insertions(+), 103 deletions(-) diff --git a/core/AndroidManifest.xml b/core/AndroidManifest.xml index 1bb75454..80c57969 100644 --- a/core/AndroidManifest.xml +++ b/core/AndroidManifest.xml @@ -17,8 +17,8 @@ --> + android:versionCode="6" + android:versionName="2.0" > + android:orientation="@integer/widget_config_orientation" > + android:paddingLeft="@dimen/margin_default" + android:paddingRight="@dimen/margin_default" > + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_half" /> + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_default" /> + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_default" /> diff --git a/core/res/layout-v11/widget_torrents_dark.xml b/core/res/layout-v11/widget_torrents_dark.xml index 8b606768..3959a922 100644 --- a/core/res/layout-v11/widget_torrents_dark.xml +++ b/core/res/layout-v11/widget_torrents_dark.xml @@ -2,68 +2,83 @@ + android:padding="4dp" + android:scaleType="fitXY" + android:src="@drawable/ic_launcher" /> - - - + android:background="@drawable/selectable_background_transdroid" + android:clickable="true" + android:orientation="vertical" + android:paddingTop="2dp" + android:paddingRight="@dimen/margin_half" > + + + + + - + - - - + - + \ No newline at end of file diff --git a/core/res/layout-v11/widget_torrents_light.xml b/core/res/layout-v11/widget_torrents_light.xml index 4194cfa9..b9ecdfd7 100644 --- a/core/res/layout-v11/widget_torrents_light.xml +++ b/core/res/layout-v11/widget_torrents_light.xml @@ -2,68 +2,83 @@ + android:padding="4dp" + android:scaleType="fitXY" + android:src="@drawable/ic_launcher" /> - - - + android:background="@drawable/selectable_background_transdroid2" + android:clickable="true" + android:orientation="vertical" + android:paddingTop="2dp" + android:paddingRight="@dimen/margin_half" > + + + + + - + - + - + - + \ No newline at end of file diff --git a/core/res/values-sw600dp/dimens.xml b/core/res/values-sw600dp/dimens.xml index 2a8dc8ce..4f9b8522 100644 --- a/core/res/values-sw600dp/dimens.xml +++ b/core/res/values-sw600dp/dimens.xml @@ -37,7 +37,7 @@ 0 - 15dp + 30dp -1dp 300dp diff --git a/core/res/values/dimens.xml b/core/res/values/dimens.xml index 3dec83c5..52c36924 100644 --- a/core/res/values/dimens.xml +++ b/core/res/values/dimens.xml @@ -43,8 +43,8 @@ 1 - 10dp - 150dp + 20dp + 200dp -1dp diff --git a/core/res/values/styles.xml b/core/res/values/styles.xml index 85579153..4e0cbf9a 100644 --- a/core/res/values/styles.xml +++ b/core/res/values/styles.xml @@ -17,10 +17,10 @@ - + + + + + - + - - + + \ No newline at end of file diff --git a/core/src/org/transdroid/core/widget/WidgetConfigActivity.java b/core/src/org/transdroid/core/widget/WidgetConfigActivity.java index 204250e2..2478623e 100644 --- a/core/src/org/transdroid/core/widget/WidgetConfigActivity.java +++ b/core/src/org/transdroid/core/widget/WidgetConfigActivity.java @@ -30,7 +30,6 @@ import org.androidannotations.annotations.ViewById; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.ServerSetting; -import org.transdroid.core.app.settings.SystemSettings_; import org.transdroid.core.gui.lists.SimpleListItem; import org.transdroid.core.gui.lists.SortByListItem; import org.transdroid.core.gui.lists.TorrentsAdapter; @@ -58,12 +57,12 @@ import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; +import android.widget.ListView; import android.widget.Spinner; import android.widget.TextView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.SherlockListView; @TargetApi(Build.VERSION_CODES.HONEYCOMB) @EActivity(resName = "activity_widgetconfig") @@ -77,7 +76,7 @@ public class WidgetConfigActivity extends SherlockActivity { @ViewById protected TextView filterText, serverText, errorText; @ViewById - protected SherlockListView torrentsList; + protected ListView torrentsList; @Bean protected TorrentsAdapter previewTorrentsAdapter; private List previewTorrents = null; @@ -92,25 +91,20 @@ public class WidgetConfigActivity extends SherlockActivity { @Override protected void onCreate(Bundle savedInstanceState) { - // Set the theme according to the user preference - if (SystemSettings_.getInstance_(this).useDarkTheme()) { - setTheme(R.style.TransdroidTheme_Dark); - getSupportActionBar().setIcon(R.drawable.ic_activity_torrents); - } super.onCreate(savedInstanceState); - - if (getIntent() != null && getIntent().getExtras() != null) { - // Get the appwidget ID we are configuring - appWidgetId = getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, - AppWidgetManager.INVALID_APPWIDGET_ID); - // Set preliminary canceled result and continue with the initialisation - setResult(RESULT_CANCELED, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)); + if (getIntent() == null || getIntent().getExtras() == null + || !getIntent().hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) { + // Invalid configuration; return canceled result + setResult(RESULT_CANCELED, + new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)); + finish(); } - // Invalid configuration; return canceled result - setResult(RESULT_CANCELED, - new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID)); - finish(); + // Get the appwidget ID we are configuring + appWidgetId = getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, + AppWidgetManager.INVALID_APPWIDGET_ID); + // Set preliminary canceled result and continue with the initialisation + setResult(RESULT_CANCELED, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)); } @@ -122,6 +116,7 @@ public class WidgetConfigActivity extends SherlockActivity { for (TorrentsSortBy order : TorrentsSortBy.values()) { sortOrders.add(new SortByListItem(order)); } + serverSpinner.setAdapter(new FilterListItemAdapter(this, applicationSettings.getServerSettings())); filterSpinner.setAdapter(new FilterListItemAdapter(this, StatusType.getAllStatusTypes(this))); sortSpinner.setAdapter(new FilterListItemAdapter(this, sortOrders)); @@ -254,7 +249,8 @@ public class WidgetConfigActivity extends SherlockActivity { // Return the widget configuration result AppWidgetManager manager = AppWidgetManager.getInstance(WidgetConfigActivity.this); - manager.updateAppWidget(appWidgetId, WidgetProvider.buildRemoteViews(getApplicationContext(), appWidgetId, config)); + manager.updateAppWidget(appWidgetId, + WidgetProvider.buildRemoteViews(getApplicationContext(), appWidgetId, config)); manager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.torrents_list); setResult(RESULT_OK, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)); finish(); diff --git a/full/AndroidManifest.xml b/full/AndroidManifest.xml index 2a400a74..83439e1e 100644 --- a/full/AndroidManifest.xml +++ b/full/AndroidManifest.xml @@ -17,8 +17,8 @@ --> + android:versionCode="6" + android:versionName="2.0" > diff --git a/lite/AndroidManifest.xml b/lite/AndroidManifest.xml index d86c892b..18fa9c1a 100644 --- a/lite/AndroidManifest.xml +++ b/lite/AndroidManifest.xml @@ -17,8 +17,8 @@ --> + android:versionCode="6" + android:versionName="2.0" >