From 1d4581a78e0329398d3b109a26834f312a208e4f Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Sun, 22 Jun 2014 20:40:43 +0930 Subject: [PATCH] Reverted layout of app details to what it was before. --- res/layout-land/app_details.xml | 24 ++++- res/layout/apklistitem.xml | 148 +++++++++++++++----------- res/layout/app_details.xml | 22 +++- res/layout/app_details_header.xml | 98 +++++++++++++++++ res/layout/app_details_summary.xml | 80 ++------------ src/org/fdroid/fdroid/AppDetails.java | 115 ++++++++++++++------ 6 files changed, 310 insertions(+), 177 deletions(-) create mode 100644 res/layout/app_details_header.xml diff --git a/res/layout-land/app_details.xml b/res/layout-land/app_details.xml index d7ff9d84f..110f3bba5 100644 --- a/res/layout-land/app_details.xml +++ b/res/layout-land/app_details.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:padding="5dp" android:baselineAligned="false" android:orientation="horizontal"> @@ -14,12 +13,27 @@ android:layout_weight="0.5" android:layout_height="wrap_content"> - + android:orientation="vertical" + android:padding="5dp"> + + + + + + diff --git a/res/layout/apklistitem.xml b/res/layout/apklistitem.xml index 6208b3af2..bd9b65414 100644 --- a/res/layout/apklistitem.xml +++ b/res/layout/apklistitem.xml @@ -1,74 +1,96 @@ - + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingTop="5dp" + android:paddingBottom="5dp" + android:paddingLeft="10dp" + android:paddingRight="10dp" + > - + - + - + - + - + - + - + - + - + + + + diff --git a/res/layout/app_details.xml b/res/layout/app_details.xml index 3acfc0973..f272f599f 100644 --- a/res/layout/app_details.xml +++ b/res/layout/app_details.xml @@ -1,10 +1,26 @@ - + android:orientation="vertical"> + + + + + + - + diff --git a/res/layout/app_details_header.xml b/res/layout/app_details_header.xml new file mode 100644 index 000000000..fe8ff6c66 --- /dev/null +++ b/res/layout/app_details_header.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/app_details_summary.xml b/res/layout/app_details_summary.xml index 44c9afe11..9e7c001b4 100644 --- a/res/layout/app_details_summary.xml +++ b/res/layout/app_details_summary.xml @@ -1,85 +1,26 @@ - - - + android:paddingLeft="5dp" + android:paddingRight="5dp"> - - - - - - - - + tools:text="Application manager"/> @@ -87,14 +28,12 @@ android:id="@+id/signature" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@id/appid" android:textSize="12sp" /> - + - + * Full permission to all device features and storage * Test access to protected storage" /> - + diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java index 60a3851b6..a1cea8a64 100644 --- a/src/org/fdroid/fdroid/AppDetails.java +++ b/src/org/fdroid/fdroid/AppDetails.java @@ -1076,19 +1076,10 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A public static class AppDetailsSummaryFragment extends Fragment { protected final Preferences prefs; - protected final DisplayImageOptions displayImageOptions; private AppDetailsData data; public AppDetailsSummaryFragment() { prefs = Preferences.get(); - displayImageOptions = new DisplayImageOptions.Builder() - .cacheInMemory(true) - .cacheOnDisk(true) - .imageScaleType(ImageScaleType.NONE) - .showImageOnLoading(R.drawable.ic_repo_app_default) - .showImageForEmptyUri(R.drawable.ic_repo_app_default) - .bitmapConfig(Bitmap.Config.RGB_565) - .build(); } @Override @@ -1129,21 +1120,6 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A private void setupView(View view) { - // Set the icon... - ImageView iv = (ImageView) view.findViewById(R.id.icon); - ImageLoader.getInstance().displayImage(getApp().iconUrl, iv, displayImageOptions); - - // Set the title and other header details... - TextView tv = (TextView) view.findViewById(R.id.title); - tv.setText(getApp().name); - tv = (TextView) view.findViewById(R.id.license); - tv.setText(getApp().license); - - if (getApp().categories != null) { - tv = (TextView) view.findViewById(R.id.categories); - tv.setText(getApp().categories.toString().replaceAll(",", ", ")); - } - TextView description = (TextView) view.findViewById(R.id.description); Spanned desc = Html.fromHtml(getApp().description, null, new Utils.HtmlTagHandler()); description.setMovementMethod(LinkMovementMethod.getInstance()); @@ -1244,19 +1220,10 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A public void updateViews(View view) { if (view == null) { - Log.e(TAG, "AppDetailsSummaryFragment.refreshApkList - view == null. Oops."); + Log.e(TAG, "AppDetailsSummaryFragment.updateViews(): view == null. Oops."); return; } - TextView statusView = (TextView) view.findViewById(R.id.status); - if (getApp().isInstalled()) { - statusView.setText(getString(R.string.details_installed, getApp().installedVersionName)); - NfcBeamManager.setAndroidBeam(getActivity(), getApp().id); - } else { - statusView.setText(getString(R.string.details_notinstalled)); - NfcBeamManager.disableAndroidBeam(getActivity()); - } - TextView signatureView = (TextView) view.findViewById(R.id.signature); if (prefs.expertMode() && getInstalledSignature() != null) { signatureView.setVisibility(View.VISIBLE); @@ -1268,6 +1235,86 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A } } + public static class AppDetailsHeaderFragment extends Fragment { + + private AppDetailsData data; + protected final Preferences prefs; + protected final DisplayImageOptions displayImageOptions; + + public AppDetailsHeaderFragment() { + prefs = Preferences.get(); + displayImageOptions = new DisplayImageOptions.Builder() + .cacheInMemory(true) + .cacheOnDisk(true) + .imageScaleType(ImageScaleType.NONE) + .showImageOnLoading(R.drawable.ic_repo_app_default) + .showImageForEmptyUri(R.drawable.ic_repo_app_default) + .bitmapConfig(Bitmap.Config.RGB_565) + .build(); + } + + private App getApp() { + return data.getApp(); + } + + private ApkListAdapter getApks() { + return data.getApks(); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.app_details_header, container, false); + setupView(view); + return view; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + data = (AppDetailsData)activity; + } + + private void setupView(View view) { + + // Set the icon... + ImageView iv = (ImageView) view.findViewById(R.id.icon); + ImageLoader.getInstance().displayImage(getApp().iconUrl, iv, displayImageOptions); + + // Set the title and other header details... + TextView tv = (TextView) view.findViewById(R.id.title); + tv.setText(getApp().name); + tv = (TextView) view.findViewById(R.id.license); + tv.setText(getApp().license); + + if (getApp().categories != null) { + tv = (TextView) view.findViewById(R.id.categories); + tv.setText(getApp().categories.toString().replaceAll(",", ", ")); + } + + updateViews(view); + } + + @Override + public void onResume() { + super.onResume(); + updateViews(getView()); + } + + public void updateViews(View view) { + + TextView statusView = (TextView) view.findViewById(R.id.status); + if (getApp().isInstalled()) { + statusView.setText(getString(R.string.details_installed, getApp().installedVersionName)); + NfcBeamManager.setAndroidBeam(getActivity(), getApp().id); + } else { + statusView.setText(getString(R.string.details_notinstalled)); + NfcBeamManager.disableAndroidBeam(getActivity()); + } + + } + + } + public static class AppDetailsListFragment extends ListFragment { private final String SUMMARY_TAG = "summary";