Remove unnecessary extra getter calls
These are especially to be avoided since they require casting, which means really long lines everywhere.
This commit is contained in:
parent
07f528352a
commit
12386570ff
@ -1569,10 +1569,10 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
// Check count > 0 due to incompatible apps resulting in an empty list.
|
// Check count > 0 due to incompatible apps resulting in an empty list.
|
||||||
// If App isn't installed
|
// If App isn't installed
|
||||||
} else if (!getApp().isInstalled() && getApp().suggestedVercode > 0 &&
|
} else if (!getApp().isInstalled() && getApp().suggestedVercode > 0 &&
|
||||||
((AppDetails)getActivity()).adapter.getCount() > 0) {
|
activity.adapter.getCount() > 0) {
|
||||||
installed = false;
|
installed = false;
|
||||||
statusView.setText(R.string.details_notinstalled);
|
statusView.setText(R.string.details_notinstalled);
|
||||||
NfcHelper.disableAndroidBeam(getActivity());
|
NfcHelper.disableAndroidBeam(activity);
|
||||||
// Set Install button and hide second button
|
// Set Install button and hide second button
|
||||||
btMain.setText(R.string.menu_install);
|
btMain.setText(R.string.menu_install);
|
||||||
btMain.setOnClickListener(mOnClickListener);
|
btMain.setOnClickListener(mOnClickListener);
|
||||||
@ -1581,13 +1581,13 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
} else if (getApp().isInstalled()) {
|
} else if (getApp().isInstalled()) {
|
||||||
installed = true;
|
installed = true;
|
||||||
statusView.setText(getString(R.string.details_installed, getApp().installedVersionName));
|
statusView.setText(getString(R.string.details_installed, getApp().installedVersionName));
|
||||||
NfcHelper.setAndroidBeam(getActivity(), getApp().id);
|
NfcHelper.setAndroidBeam(activity, getApp().id);
|
||||||
if (getApp().canAndWantToUpdate()) {
|
if (getApp().canAndWantToUpdate()) {
|
||||||
updateWanted = true;
|
updateWanted = true;
|
||||||
btMain.setText(R.string.menu_upgrade);
|
btMain.setText(R.string.menu_upgrade);
|
||||||
} else {
|
} else {
|
||||||
updateWanted = false;
|
updateWanted = false;
|
||||||
if (((AppDetails)getActivity()).mPm.getLaunchIntentForPackage(getApp().id) != null){
|
if (activity.mPm.getLaunchIntentForPackage(getApp().id) != null){
|
||||||
btMain.setText(R.string.menu_launch);
|
btMain.setText(R.string.menu_launch);
|
||||||
} else {
|
} else {
|
||||||
btMain.setText(R.string.menu_uninstall);
|
btMain.setText(R.string.menu_uninstall);
|
||||||
@ -1611,27 +1611,28 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
|
|
||||||
private final View.OnClickListener mOnClickListener = new View.OnClickListener() {
|
private final View.OnClickListener mOnClickListener = new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
AppDetails activity = (AppDetails) getActivity();
|
||||||
if (updateWanted) {
|
if (updateWanted) {
|
||||||
if (getApp().suggestedVercode > 0) {
|
if (getApp().suggestedVercode > 0) {
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(getActivity(), getApp().id, getApp().suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(activity, getApp().id, getApp().suggestedVercode);
|
||||||
((AppDetails)getActivity()).install(apkToInstall);
|
(activity).install(apkToInstall);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If installed
|
// If installed
|
||||||
if (installed) {
|
if (installed) {
|
||||||
// If "launchable", launch
|
// If "launchable", launch
|
||||||
if (((AppDetails)getActivity()).mPm.getLaunchIntentForPackage(getApp().id) != null) {
|
if (activity.mPm.getLaunchIntentForPackage(getApp().id) != null) {
|
||||||
((AppDetails)getActivity()).launchApk(getApp().id);
|
activity.launchApk(getApp().id);
|
||||||
} else {
|
} else {
|
||||||
((AppDetails)getActivity()).removeApk(getApp().id);
|
activity.removeApk(getApp().id);
|
||||||
}
|
}
|
||||||
// If not installed, install
|
// If not installed, install
|
||||||
} else if (getApp().suggestedVercode > 0) {
|
} else if (getApp().suggestedVercode > 0) {
|
||||||
btMain.setEnabled(false);
|
btMain.setEnabled(false);
|
||||||
btMain.setText(R.string.system_install_installing);
|
btMain.setText(R.string.system_install_installing);
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(getActivity(), getApp().id, getApp().suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(activity, getApp().id, getApp().suggestedVercode);
|
||||||
((AppDetails)getActivity()).install(apkToInstall);
|
activity.install(apkToInstall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user