fix merge issues and tweak the header layouts a bit more

This commit is contained in:
dkanada 2018-12-09 16:37:18 +09:00
parent 85ed0d46ab
commit 568ef56247
7 changed files with 55 additions and 93 deletions

View File

@ -396,6 +396,16 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
return app; return app;
} }
/**
* In order to format all in coming descriptions before they are written
* out to the database and used elsewhere, this is needed to intercept
* the setting of {@link App#description} to insert the format method.
*/
@JsonProperty("description")
private void setDescription(String description) { // NOPMD
this.description = formatDescription(description);
}
/** /**
* Parses the {@code localized} block in the incoming index metadata, * Parses the {@code localized} block in the incoming index metadata,
* choosing the best match in terms of locale/language while filling as * choosing the best match in terms of locale/language while filling as

View File

@ -504,8 +504,8 @@ public class AppDetailsRecyclerViewAdapter
sbWhatsNew.append(whatsNewView.getContext().getString(R.string.details_new_in_version, sbWhatsNew.append(whatsNewView.getContext().getString(R.string.details_new_in_version,
suggestedApk.versionName).toUpperCase(locale)); suggestedApk.versionName).toUpperCase(locale));
sbWhatsNew.append("\n\n"); sbWhatsNew.append("\n\n");
sbWhatsNew.append(app.whatsNew); sbWhatsNew.append(trimTrailingNewlines(Html.fromHtml(app.whatsNew)));
whatsNewView.setText(trimTrailingNewlines(sbWhatsNew)); whatsNewView.setText(sbWhatsNew);
whatsNewView.setVisibility(View.VISIBLE); whatsNewView.setVisibility(View.VISIBLE);
// Set focus on the header section to prevent auto scrolling to // Set focus on the header section to prevent auto scrolling to
@ -1091,7 +1091,7 @@ public class AppDetailsRecyclerViewAdapter
Repo repo = RepoProvider.Helper.findById(context, apk.repoId); Repo repo = RepoProvider.Helper.findById(context, apk.repoId);
if (repo != null) { if (repo != null) {
repository.setVisibility(View.VISIBLE); repository.setVisibility(View.VISIBLE);
repository.setText(String.format(repo.getName(), context.getString(R.string.app_repository))); repository.setText(String.format(context.getString(R.string.app_repository), repo.getName()));
} else { } else {
repository.setVisibility(View.INVISIBLE); repository.setVisibility(View.INVISIBLE);
} }

View File

@ -138,7 +138,6 @@ public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
public void toggleAllUpdateableApps() { public void toggleAllUpdateableApps() {
showAllUpdateableApps = !showAllUpdateableApps; showAllUpdateableApps = !showAllUpdateableApps;
populateItems(); populateItems();
notifyDataSetChanged();
} }
/** /**

View File

@ -8,7 +8,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.hannesdorfmann.adapterdelegates3.AdapterDelegate; import com.hannesdorfmann.adapterdelegates3.AdapterDelegate;
import org.fdroid.fdroid.R; import org.fdroid.fdroid.R;

17
app/src/main/res/layout/app_details2_header.xml Executable file → Normal file
View File

@ -184,11 +184,11 @@
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:scrollbars="none" android:scrollbars="none"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textIsSelectable="true" android:textIsSelectable="true"
@ -215,11 +215,11 @@
android:id="@+id/label_anti_features" android:id="@+id/label_anti_features"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:scrollbars="none" android:scrollbars="none"
android:text="@string/antifeatures" android:text="@string/antifeatures"
android:textStyle="bold" android:textStyle="bold"
@ -230,23 +230,24 @@
android:id="@+id/text_anti_features" android:id="@+id/text_anti_features"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:scrollbars="none" android:scrollbars="none"
tools:text="\t• This app tracks and reports your activity." tools:text="This app tracks and reports your activity."
android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<android.support.v7.widget.AppCompatTextView <TextView
android:id="@+id/description_more" android:id="@+id/description_more"
style="@style/DetailsMoreButtonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:text="@string/more" android:text="@string/more"
android:textAllCaps="true" android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
style="@style/DetailsMoreButtonStyle" />
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Defines the layout of a single permission item.
-->
<view class="org.fdroid.fdroid.privileged.views.AppSecurityPermissions$PermissionItemView"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/perm_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:scaleType="fitCenter" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<TextView
android:id="@+id/perm_name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="16sp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|start" />
</view>

View File

@ -24,7 +24,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" /> app:layout_constraintBottom_toBottomOf="parent" />
<LinearLayout <android.support.constraint.ConstraintLayout
android:id="@+id/text_layout" android:id="@+id/text_layout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -35,8 +35,7 @@
app:layout_constraintStart_toEndOf="@+id/icon" app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintEnd_toStartOf="@+id/action_button" app:layout_constraintEnd_toStartOf="@+id/action_button"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/progress_bar" app:layout_constraintBottom_toBottomOf="parent">
android:orientation="vertical">
<TextView <TextView
android:id="@+id/app_name" android:id="@+id/app_name"
@ -46,7 +45,9 @@
android:textSize="16sp" android:textSize="16sp"
android:textColor="?attr/installedApps" android:textColor="?attr/installedApps"
android:maxLines="2" android:maxLines="2"
android:ellipsize="end" /> android:ellipsize="end"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/status" android:id="@+id/status"
@ -55,34 +56,37 @@
tools:text="@string/app_list_download_ready" tools:text="@string/app_list_download_ready"
style="@style/AppListItemStatusText" style="@style/AppListItemStatusText"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_name" />
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/cancel_button"
app:layout_constraintTop_toBottomOf="@id/status"
tools:visibility="visible" /> tools:visibility="visible" />
</LinearLayout> <ImageButton
android:id="@+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingStart="8dp"
android:src="@drawable/ic_cancel"
android:contentDescription="@string/cancel"
android:background="@android:color/transparent"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/progress_bar"
app:layout_constraintBottom_toBottomOf="@+id/progress_bar"
tools:visibility="visible" />
<ProgressBar </android.support.constraint.ConstraintLayout>
android:id="@+id/progress_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:visibility="gone"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintEnd_toStartOf="@+id/cancel_button"
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="visible" />
<ImageButton
android:id="@+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cancel"
android:contentDescription="@string/cancel"
android:background="@android:color/transparent"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/progress_bar"
app:layout_constraintBottom_toBottomOf="@+id/progress_bar"
tools:visibility="visible" />
<Button <Button
android:id="@+id/action_button" android:id="@+id/action_button"