Port NFC + Tor bootstrap code from FDroid to MainActivity
This commit is contained in:
parent
02dae30a1b
commit
b8de545179
@ -38,7 +38,7 @@ public class NfcHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(16)
|
@TargetApi(16)
|
||||||
static void setAndroidBeam(Activity activity, String packageName) {
|
public static void setAndroidBeam(Activity activity, String packageName) {
|
||||||
if (Build.VERSION.SDK_INT < 16) {
|
if (Build.VERSION.SDK_INT < 16) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ import android.support.v7.widget.LinearLayoutManager;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.support.v7.widget.RecyclerView;
|
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.R;
|
||||||
import org.fdroid.fdroid.UpdateService;
|
import org.fdroid.fdroid.UpdateService;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
@ -76,10 +78,15 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
FDroidApp.checkStartTor(this);
|
||||||
|
|
||||||
if (getIntent().hasExtra(EXTRA_VIEW_MY_APPS)) {
|
if (getIntent().hasExtra(EXTRA_VIEW_MY_APPS)) {
|
||||||
getIntent().removeExtra(EXTRA_VIEW_MY_APPS);
|
getIntent().removeExtra(EXTRA_VIEW_MY_APPS);
|
||||||
pager.scrollToPosition(adapter.adapterPositionFromItemId(R.id.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
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user