Remove final dependency on AppDetails (the old one).

In a future MR I will remove this class completely, but this just
ensures that touching a notification will not send the user to the old
AppDetails (instead sending them to AppDetails2).
This commit is contained in:
Peter Serwylo 2017-03-23 21:10:52 +11:00
parent bf8a61765d
commit b179aaecff
10 changed files with 19 additions and 22 deletions

View File

@ -107,7 +107,6 @@ public class AppDetails extends AppCompatActivity {
private static final int REQUEST_PERMISSION_DIALOG = 3;
private static final int REQUEST_UNINSTALL_DIALOG = 4;
public static final String EXTRA_APPID = "appid";
public static final String EXTRA_FROM = "from";
public static final String EXTRA_HINT_SEARCHING = "searching";
@ -351,12 +350,12 @@ public class AppDetails extends AppCompatActivity {
* and not externally.
*/
private String getPackageNameFromIntent(Intent intent) {
if (!intent.hasExtra(EXTRA_APPID)) {
if (!intent.hasExtra(AppDetails2.EXTRA_APPID)) {
Log.e(TAG, "No package name found in the intent!");
return null;
}
return intent.getStringExtra(EXTRA_APPID);
return intent.getStringExtra(AppDetails2.EXTRA_APPID);
}
@Override

View File

@ -53,6 +53,7 @@ import org.fdroid.fdroid.views.apps.FeatureImage;
public class AppDetails2 extends AppCompatActivity implements ShareChooserDialog.ShareChooserDialogListener, AppDetailsRecyclerViewAdapter.AppDetailsRecyclerViewAdapterCallbacks {
public static final String EXTRA_APPID = "appid";
private static final String TAG = "AppDetails2";
private static final int REQUEST_ENABLE_BLUETOOTH = 2;
@ -170,11 +171,11 @@ public class AppDetails2 extends AppCompatActivity implements ShareChooserDialog
}
private String getPackageNameFromIntent(Intent intent) {
if (!intent.hasExtra(AppDetails.EXTRA_APPID)) {
if (!intent.hasExtra(EXTRA_APPID)) {
Log.e(TAG, "No package name found in the intent!");
return null;
}
return intent.getStringExtra(AppDetails.EXTRA_APPID);
return intent.getStringExtra(EXTRA_APPID);
}
/**

View File

@ -392,16 +392,16 @@ public final class AppUpdateStatusManager {
/**
* Get a {@link PendingIntent} for a {@link Notification} to send when it
* is clicked. {@link AppDetails} handles {@code Intent}s that are missing
* or bad {@link AppDetails#EXTRA_APPID}, so it does not need to be checked
* is clicked. {@link AppDetails2} handles {@code Intent}s that are missing
* or bad {@link AppDetails2#EXTRA_APPID}, so it does not need to be checked
* here.
*/
private PendingIntent getAppDetailsIntent(Apk apk) {
Intent notifyIntent = new Intent(context, AppDetails.class)
.putExtra(AppDetails.EXTRA_APPID, apk.packageName);
Intent notifyIntent = new Intent(context, AppDetails2.class)
.putExtra(AppDetails2.EXTRA_APPID, apk.packageName);
return TaskStackBuilder.create(context)
.addParentStack(AppDetails.class)
.addParentStack(AppDetails2.class)
.addNextIntent(notifyIntent)
.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
}

View File

@ -243,7 +243,7 @@ public class FDroid extends AppCompatActivity implements SearchView.OnQueryTextL
if (!TextUtils.isEmpty(packageName)) {
Utils.debugLog(TAG, "FDroid launched via app link for '" + packageName + "'");
Intent intentToInvoke = new Intent(this, AppDetails2.class);
intentToInvoke.putExtra(AppDetails.EXTRA_APPID, packageName);
intentToInvoke.putExtra(AppDetails2.EXTRA_APPID, packageName);
startActivity(intentToInvoke);
finish();
} else if (!TextUtils.isEmpty(query)) {

View File

@ -185,7 +185,7 @@ class NotificationHelper {
if (entry.status == AppUpdateStatusManager.Status.Unknown) {
return true;
} else if ((entry.status == AppUpdateStatusManager.Status.Downloading || entry.status == AppUpdateStatusManager.Status.ReadyToInstall || entry.status == AppUpdateStatusManager.Status.InstallError) &&
(AppDetails.isAppVisible(entry.app.packageName) || AppDetails2.isAppVisible(entry.app.packageName))) {
AppDetails2.isAppVisible(entry.app.packageName)) {
// Ignore downloading, readyToInstall and installError if we are showing the details screen for this app
return true;
}

View File

@ -29,7 +29,6 @@ import android.widget.TextView;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import org.fdroid.fdroid.AppDetails;
import org.fdroid.fdroid.AppDetails2;
import org.fdroid.fdroid.AppUpdateStatusManager;
import org.fdroid.fdroid.R;
@ -396,7 +395,7 @@ public class AppListItemController extends RecyclerView.ViewHolder {
}
Intent intent = new Intent(activity, AppDetails2.class);
intent.putExtra(AppDetails.EXTRA_APPID, currentApp.packageName);
intent.putExtra(AppDetails2.EXTRA_APPID, currentApp.packageName);
if (Build.VERSION.SDK_INT >= 21) {
Pair<View, String> iconTransitionPair = Pair.create((View) icon, activity.getString(R.string.transition_app_item_icon));
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, iconTransitionPair).toBundle();

View File

@ -22,7 +22,6 @@ import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import org.fdroid.fdroid.AppDetails;
import org.fdroid.fdroid.AppDetails2;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.Utils;
@ -129,7 +128,7 @@ public class AppCardController extends RecyclerView.ViewHolder implements ImageL
}
Intent intent = new Intent(activity, AppDetails2.class);
intent.putExtra(AppDetails.EXTRA_APPID, currentApp.packageName);
intent.putExtra(AppDetails2.EXTRA_APPID, currentApp.packageName);
if (Build.VERSION.SDK_INT >= 21) {
Pair<View, String> iconTransitionPair = Pair.create((View) icon, activity.getString(R.string.transition_app_item_icon));

View File

@ -169,7 +169,7 @@ public abstract class AppListFragment extends ListFragment implements
if (cursor != null) {
final App app = new App(cursor);
Intent intent = getAppDetailsIntent(useNewDetailsActivity);
intent.putExtra(AppDetails.EXTRA_APPID, app.packageName);
intent.putExtra(AppDetails2.EXTRA_APPID, app.packageName);
intent.putExtra(AppDetails.EXTRA_FROM, getFromTitle());
if (Build.VERSION.SDK_INT >= 21) {
Pair<View, String> iconTransitionPair = Pair.create(view.findViewById(R.id.icon),

View File

@ -13,7 +13,7 @@ import android.preference.PreferenceCategory;
import android.support.v4.preference.PreferenceFragment;
import android.text.TextUtils;
import org.fdroid.fdroid.AppDetails;
import org.fdroid.fdroid.AppDetails2;
import org.fdroid.fdroid.CleanCacheService;
import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.Preferences;
@ -261,8 +261,8 @@ public class PreferencesFragment extends PreferenceFragment
@Override
public boolean onPreferenceClick(Preference preference) {
// Open details of F-Droid Privileged
Intent intent = new Intent(getActivity(), AppDetails.class);
intent.putExtra(AppDetails.EXTRA_APPID,
Intent intent = new Intent(getActivity(), AppDetails2.class);
intent.putExtra(AppDetails2.EXTRA_APPID,
PrivilegedInstaller.PRIVILEGED_EXTENSION_PACKAGE_NAME);
startActivity(intent);

View File

@ -23,7 +23,6 @@ import com.ashokvarma.bottomnavigation.BadgeItem;
import com.ashokvarma.bottomnavigation.BottomNavigationBar;
import com.ashokvarma.bottomnavigation.BottomNavigationItem;
import org.fdroid.fdroid.AppDetails;
import org.fdroid.fdroid.AppDetails2;
import org.fdroid.fdroid.AppUpdateStatusManager;
import org.fdroid.fdroid.FDroidApp;
@ -281,7 +280,7 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationB
if (!TextUtils.isEmpty(packageName)) {
Utils.debugLog(TAG, "FDroid launched via app link for '" + packageName + "'");
Intent intentToInvoke = new Intent(this, AppDetails2.class);
intentToInvoke.putExtra(AppDetails.EXTRA_APPID, packageName);
intentToInvoke.putExtra(AppDetails2.EXTRA_APPID, packageName);
startActivity(intentToInvoke);
finish();
} else if (!TextUtils.isEmpty(query)) {