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"> - <fragment - android:id="@+id/fragment_app_summary" + <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" - android:name="org.fdroid.fdroid.AppDetails$AppDetailsSummaryFragment" - tools:layout="@layout/app_details_summary"/> + android:orientation="vertical" + android:padding="5dp"> + + <fragment + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:id="@+id/landscape_header" + android:name="org.fdroid.fdroid.AppDetails$AppDetailsHeaderFragment" + tools:layout="@layout/app_details_header"/> + + <fragment + android:id="@+id/fragment_app_summary" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:name="org.fdroid.fdroid.AppDetails$AppDetailsSummaryFragment" + tools:layout="@layout/app_details_summary"/> + + </LinearLayout> </ScrollView> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:baselineAligned="false" - android:padding="5dp" > + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingTop="5dp" + android:paddingBottom="5dp" + android:paddingLeft="10dp" + android:paddingRight="10dp" + > - <TextView android:id="@+id/version" - android:textStyle="bold" - android:maxLines="2" - android:ellipsize="end" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="18sp" /> + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:baselineAligned="false" > - <TextView android:id="@+id/status" - android:textSize="13sp" - android:maxLines="2" - android:ellipsize="end" - android:layout_below="@id/version" - android:layout_height="wrap_content" - android:layout_width="wrap_content" /> + <TextView android:id="@+id/version" + android:textStyle="bold" + android:maxLines="2" + android:ellipsize="end" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="18sp" + tools:text="Version 1.0 (as if!)"/> - <TextView android:id="@+id/added" - android:textSize="13sp" - android:layout_below="@id/status" - android:layout_height="wrap_content" - android:layout_width="wrap_content" /> + <TextView android:id="@+id/status" + android:textSize="13sp" + android:maxLines="2" + android:ellipsize="end" + android:layout_below="@id/version" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + tools:text="Installed" /> - <TextView android:id="@+id/buildtype" - android:textSize="13sp" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_marginBottom="4sp" /> + <TextView android:id="@+id/added" + android:textSize="13sp" + android:layout_below="@id/status" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + tools:text="Added on 1/1/2050" /> - <TextView android:id="@+id/size" - android:textSize="13sp" - android:layout_below="@id/buildtype" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_marginBottom="4sp" /> + <TextView android:id="@+id/buildtype" + android:textSize="13sp" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_marginBottom="4sp" + tools:text="source" /> - <TextView android:id="@+id/api" - android:textSize="13sp" - android:layout_below="@id/buildtype" - android:layout_toLeftOf="@id/size" - android:layout_toStartOf="@id/size" - android:layout_marginRight="16sp" - android:layout_marginEnd="16sp" - android:layout_height="wrap_content" - android:layout_width="wrap_content" /> + <TextView android:id="@+id/size" + android:textSize="13sp" + android:layout_below="@id/buildtype" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_marginBottom="4sp" + tools:text="12mb" /> - <TextView android:id="@+id/nativecode" - android:textSize="13sp" - android:layout_below="@id/size" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_height="wrap_content" - android:layout_width="wrap_content" /> + <TextView android:id="@+id/api" + android:textSize="13sp" + android:layout_below="@id/buildtype" + android:layout_toLeftOf="@id/size" + android:layout_toStartOf="@id/size" + android:layout_marginRight="16sp" + android:layout_marginEnd="16sp" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + tools:text="" + tools:visible="gone" /> - <TextView android:id="@+id/incompatible_reasons" - android:textSize="13sp" - android:layout_below="@id/added" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_height="wrap_content" - android:layout_width="wrap_content" /> + <TextView android:id="@+id/nativecode" + android:textSize="13sp" + android:layout_below="@id/size" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + tools:text="" + tools:visible="gone" /> -</RelativeLayout> + <TextView android:id="@+id/incompatible_reasons" + android:textSize="13sp" + android:layout_below="@id/added" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + tools:text="" + tools:visible="gone" /> + + </RelativeLayout> +</LinearLayout> 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 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:padding="5dp"> + android:orientation="vertical"> + + <FrameLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingLeft="6dp" + android:paddingRight="6dp"> + + <fragment + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:id="@+id/header" + android:name="org.fdroid.fdroid.AppDetails$AppDetailsHeaderFragment" + tools:layout="@layout/app_details_header" /> + + </FrameLayout> <fragment android:id="@+id/fragment_app_list" @@ -13,4 +29,4 @@ android:name="org.fdroid.fdroid.AppDetails$AppDetailsListFragment" tools:layout="@android:layout/list_content"/> -</RelativeLayout> +</LinearLayout> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/icon_and_title" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:baselineAligned="false" + android:paddingTop="2dp"> + + <ImageView + android:id="@+id/icon" + android:contentDescription="@string/app_icon" + android:layout_width="56dp" + android:layout_height="56dp" + android:layout_centerVertical="true" + android:padding="4dp" + android:scaleType="fitCenter" + tools:src="@drawable/ic_launcher" + /> + + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_toRightOf="@id/icon" + android:layout_toEndOf="@id/icon" + android:baselineAligned="false" + android:paddingLeft="5dp" + android:paddingRight="5dp" + android:orientation="vertical" + > + + <TextView + android:id="@+id/license" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:singleLine="true" + android:ellipsize="end" + android:layout_marginLeft="6sp" + android:layout_marginStart="6sp" + android:textSize="12sp" + tools:text="GPLv3+" + /> + + <TextView + android:id="@+id/title" + android:textSize="17sp" + android:textStyle="bold" + android:singleLine="true" + android:ellipsize="end" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:gravity="start" + android:textAlignment="viewStart" + android:layout_toLeftOf="@id/license" + android:layout_toStartOf="@id/license" + tools:text="F-Droid"/> + + <TextView + android:id="@+id/categories" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="end" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:layout_marginLeft="6sp" + android:layout_marginStart="6sp" + android:layout_below="@id/title" + android:textSize="12sp" + tools:text="System"/> + + <TextView + android:id="@+id/status" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="end" + android:textSize="12sp" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:gravity="start" + android:textAlignment="viewStart" + android:layout_toLeftOf="@id/categories" + android:layout_toStartOf="@id/categories" + android:layout_below="@id/title" + tools:text="Installed"/> + + </RelativeLayout> +</RelativeLayout> + + \ 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 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" + android:orientation="vertical" android:paddingTop="4dp" android:paddingBottom="8dp" - android:baselineAligned="false" - android:orientation="vertical" > - - <ImageView - android:id="@+id/icon" - android:contentDescription="@string/app_icon" - android:layout_width="56dp" - android:layout_height="56dp" - android:padding="4dp" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_alignParentTop="true" - tools:src="@drawable/ic_launcher" - android:scaleType="fitCenter" - /> + android:paddingLeft="5dp" + android:paddingRight="5dp"> <TextView - android:id="@+id/status" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/icon" - android:layout_toEndOf="@id/icon" - android:layout_alignBottom="@id/icon" - android:paddingLeft="4dp" - tools:text="Installed" - android:textSize="13sp" android:layout_marginBottom="4dp"/> - - <TextView - android:id="@+id/title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:singleLine="false" - tools:text="F-Droid" - android:textSize="18sp" - android:textStyle="bold" - android:paddingLeft="4dp" - android:layout_toRightOf="@id/icon" - android:layout_above="@id/status" /> - - <TextView - android:id="@+id/categories" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_alignBottom="@id/icon" - android:paddingLeft="4dp" - tools:text="System, Internet" - android:textSize="13sp" android:layout_marginBottom="4dp"/> - - <TextView - android:id="@+id/license" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_above="@id/categories" - android:paddingRight="4dp" - tools:text="GPLv3+" - android:textSize="13sp" /> - - <TextView android:id="@+id/summary" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@id/icon" android:textStyle="bold" - tools:text="Application manager" /> + tools:text="Application manager"/> <TextView android:id="@+id/appid" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@id/summary" android:textSize="12sp" tools:text="org.fdroid.fdroid" /> @@ -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" /> <TextView android:id="@+id/antifeatures" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@id/signature" android:layout_marginTop="6sp" android:textStyle="bold" android:textColor="#ff0000" @@ -104,7 +43,6 @@ android:id="@+id/description" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@id/antifeatures" android:layout_marginTop="8sp" android:textSize="13sp" android:singleLine="false" @@ -120,22 +58,20 @@ Android is open in the sense that you are free to install apks from anywhere you * Stay safe by checking repo index signatures and apk hashes Changelog" /> - + <TextView android:id="@+id/permissions" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@id/description" android:layout_marginTop="8sp" android:singleLine="true" android:textStyle="bold" tools:text="Permissions for version 1.0" /> - + <TextView android:id="@+id/permissions_list" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@id/permissions" android:textSize="13sp" android:singleLine="false" tools:text=" * Full network access @@ -151,4 +87,4 @@ Changelog" /> * Full permission to all device features and storage * Test access to protected storage" /> -</RelativeLayout> +</LinearLayout> 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";