Port NFC + Tor bootstrap code from FDroid to MainActivity

This commit is contained in:
Peter Serwylo 2017-02-13 14:29:37 +11:00
parent 02dae30a1b
commit b8de545179
2 changed files with 8 additions and 1 deletions

View File

@ -38,7 +38,7 @@ public class NfcHelper {
}
@TargetApi(16)
static void setAndroidBeam(Activity activity, String packageName) {
public static void setAndroidBeam(Activity activity, String packageName) {
if (Build.VERSION.SDK_INT < 16) {
return;
}

View File

@ -10,6 +10,8 @@ import android.support.v7.widget.LinearLayoutManager;
import android.view.MenuItem;
import android.support.v7.widget.RecyclerView;
import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.NfcHelper;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.UpdateService;
import org.fdroid.fdroid.Utils;
@ -76,10 +78,15 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
protected void onResume() {
super.onResume();
FDroidApp.checkStartTor(this);
if (getIntent().hasExtra(EXTRA_VIEW_MY_APPS)) {
getIntent().removeExtra(EXTRA_VIEW_MY_APPS);
pager.scrollToPosition(adapter.adapterPositionFromItemId(R.id.my_apps));
}
// AppDetails and RepoDetailsActivity set different NFC actions, so reset here
NfcHelper.setAndroidBeam(this, getApplication().getPackageName());
}
@Override