Fix F-Droid support on report fragment (link to google) and fix creator when empty

This commit is contained in:
Schoumi 2020-07-01 19:19:50 +02:00
parent edbce7aab8
commit a1e241c294
6 changed files with 17 additions and 6 deletions

View File

@ -93,7 +93,7 @@ public class ReportViewModel extends BaseObservable {
@Bindable
public boolean getCreatorVisibility() {
return reportDisplay.creator != null;
return reportDisplay.creator != null && !reportDisplay.creator.isEmpty();
}
@Bindable
@ -170,6 +170,10 @@ public class ReportViewModel extends BaseObservable {
return reportDisplay.source;
}
public String getViewOnStore() {
return reportDisplay.viewOnStore;
}
}

View File

@ -130,9 +130,12 @@ public class ReportFragment extends Fragment implements Updatable {
reportBinding.permissionExplanation.setMovementMethod(LinkMovementMethod.getInstance());
reportBinding.permissionExplanation.setClickable(true);
reportBinding.viewPlay.setOnClickListener(v -> {
reportBinding.viewStore.setOnClickListener(v -> {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id="+reportDisplay.packageName));
if(reportDisplay.source.contains("google"))
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id="+reportDisplay.packageName));
else
intent.setData(Uri.parse("https://f-droid.org/packages/"+reportDisplay.packageName));
startActivity(intent);
});

View File

@ -28,6 +28,7 @@ public class ReportDisplay {
public List<Permission> permissions;
public Set<Tracker> trackers;
public String source;
public String viewOnStore;
private ReportDisplay(){
@ -43,6 +44,7 @@ public class ReportDisplay {
reportDisplay.report = model.report;
reportDisplay.source = context.getString(R.string.source,model.source);
reportDisplay.viewOnStore = context.getString(model.source.equals("google")? R.string.view_on_google_play : R.string.view_on_fdroid);
reportDisplay.trackers = model.trackers;

View File

@ -241,11 +241,11 @@
android:textColor="@color/colorPurple"/>
<TextView
android:id="@+id/view_play"
android:id="@+id/view_store"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="@string/view_on_google_play"
android:text="@{reportInfo.viewOnStore}"
android:textAlignment="textEnd"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/report_url"
@ -431,7 +431,7 @@
android:visibility="@{reportInfo.trackerVisibility ? View.GONE : View.VISIBLE}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_play"
app:layout_constraintTop_toBottomOf="@id/view_store"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="5dp"

View File

@ -29,6 +29,7 @@
<string name="and_updated">et mis à jour le</string>
<string name="view_on_exodus">Voir sur εxodus ➤</string>
<string name="view_on_google_play">Voir sur Google Play ➤</string>
<string name="view_on_fdroid">Voir sur F-Droid ➤</string>
<string name="downloads">téléchargements</string>
<string name="code_signature_found">Nous avons trouvé la signature des pisteurs suivants dans cette application : </string>
<string name="code_signature_not_found">Nous navons pas trouvé la signature de pisteurs que nous connaissons dans lapplication. </string>

View File

@ -29,6 +29,7 @@
<string name="and_updated">and updated on</string>
<string name="view_on_exodus">See on εxodus ➤</string>
<string name="view_on_google_play">See on Google Play ➤</string>
<string name="view_on_fdroid">See on F-Droid ➤</string>
<string name="downloads">downloads</string>
<string name="code_signature_found">We have found code signature of the following trackers in the application:</string>
<string name="code_signature_not_found">We have not found code signature of any tracker we know in the application.</string>