+Icon/menu to GitLab/appName in AppDetailsActivity +LongClick to forum/appName in AppCardController

This commit is contained in:
ioTY
2019-08-26 17:49:22 +02:00
parent 839909089e
commit 17e6e30ab7
5 changed files with 28 additions and 2 deletions

View File

@@ -257,7 +257,12 @@ public class AppDetailsActivity extends AppCompatActivity
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_share) {
if (item.getItemId() == R.id.action_forum) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://gitlab.com/fdroid/fdroiddata/commits/master/metadata?search="
+app.name.replaceAll(" ","%20")));
startActivity(browserIntent);
return true;
} else if (item.getItemId() == R.id.action_share) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, app.name);

View File

@@ -3,6 +3,7 @@ package org.fdroid.fdroid.views.categories;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.IdRes;
@@ -30,7 +31,7 @@ import java.util.Locale;
* + {@link R.id#new_tag} ({@link TextView}, optional)
*/
public class AppCardController extends RecyclerView.ViewHolder
implements View.OnClickListener {
implements View.OnClickListener, View.OnLongClickListener {
/**
* After this many days, don't consider showing the "New" tag next to an app.
@@ -68,6 +69,7 @@ public class AppCardController extends RecyclerView.ViewHolder
newTag = (TextView) itemView.findViewById(R.id.new_tag);
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
/**
@@ -140,4 +142,18 @@ public class AppCardController extends RecyclerView.ViewHolder
activity.startActivity(intent);
}
}
/**
* When the user clicks/long https://forum.f-droid.org/search?q=
*/
@Override
public boolean onLongClick(View v) {
if (currentApp == null) {
return true;
}
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://forum.f-droid.org/search?q="
+currentApp.name.replaceAll(" ","%20")));
activity.startActivity(browserIntent);
return true;
}
}

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -2,6 +2,11 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/action_forum"
android:icon="@drawable/gitlabi"
android:title="@string/menu_search"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_share"
android:icon="@drawable/ic_share_white"