org.chromium.chrome.browser.physicalweb.PhysicalWebUma Java Examples

The following examples show how to use org.chromium.chrome.browser.physicalweb.PhysicalWebUma. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PhysicalWebPreferenceFragment.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
                                       int[] grantResults) {
    switch (requestCode) {
        case REQUEST_ID:
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                PhysicalWebUma.onPrefsLocationGranted(getActivity());
                Log.d(TAG, "Location permission granted");
                PhysicalWeb.startPhysicalWeb(
                        (ChromeApplication) getActivity().getApplicationContext());
            } else {
                PhysicalWebUma.onPrefsLocationDenied(getActivity());
                Log.d(TAG, "Location permission denied");
            }
            break;
        default:
    }
}
 
Example #2
Source File: PhysicalWebPreferenceFragment.java    From delion with Apache License 2.0 6 votes vote down vote up
private void initPhysicalWebSwitch() {
    ChromeSwitchPreference physicalWebSwitch =
            (ChromeSwitchPreference) findPreference(PREF_PHYSICAL_WEB_SWITCH);

    physicalWebSwitch.setChecked(
            PrivacyPreferencesManager.getInstance().isPhysicalWebEnabled());

    physicalWebSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            boolean enabled = (boolean) newValue;
            if (enabled) {
                PhysicalWebUma.onPrefsFeatureEnabled(getActivity());
                ensureLocationPermission();
            } else {
                PhysicalWebUma.onPrefsFeatureDisabled(getActivity());
            }
            PrivacyPreferencesManager.getInstance().setPhysicalWebEnabled(enabled);
            return true;
        }
    });
}
 
Example #3
Source File: PhysicalWebPreferenceFragment.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
                                       int[] grantResults) {
    switch (requestCode) {
        case REQUEST_ID:
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                PhysicalWebUma.onPrefsLocationGranted(getActivity());
                Log.d(TAG, "Location permission granted");
                PhysicalWeb.startPhysicalWeb();
            } else {
                PhysicalWebUma.onPrefsLocationDenied(getActivity());
                Log.d(TAG, "Location permission denied");
            }
            break;
        default:
    }
}
 
Example #4
Source File: PhysicalWebPreferenceFragment.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void initPhysicalWebSwitch() {
    ChromeSwitchPreference physicalWebSwitch =
            (ChromeSwitchPreference) findPreference(PREF_PHYSICAL_WEB_SWITCH);

    physicalWebSwitch.setChecked(
            PrivacyPreferencesManager.getInstance().isPhysicalWebEnabled());

    physicalWebSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            boolean enabled = (boolean) newValue;
            if (enabled) {
                PhysicalWebUma.onPrefsFeatureEnabled(getActivity());
                ensureLocationPermission();
            } else {
                PhysicalWebUma.onPrefsFeatureDisabled(getActivity());
            }
            PrivacyPreferencesManager.getInstance().setPhysicalWebEnabled(enabled);
            return true;
        }
    });
}
 
Example #5
Source File: PhysicalWebPreferenceFragment.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
                                       int[] grantResults) {
    switch (requestCode) {
        case REQUEST_ID:
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                PhysicalWebUma.onPrefsLocationGranted();
                Log.d(TAG, "Location permission granted");
            } else {
                PhysicalWebUma.onPrefsLocationDenied();
                Log.d(TAG, "Location permission denied");
            }
            break;
        default:
    }
    PhysicalWeb.updateScans();
}
 
Example #6
Source File: PhysicalWebPreferenceFragment.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void initPhysicalWebSwitch() {
    ChromeSwitchPreference physicalWebSwitch =
            (ChromeSwitchPreference) findPreference(PREF_PHYSICAL_WEB_SWITCH);

    physicalWebSwitch.setChecked(
            PrivacyPreferencesManager.getInstance().isPhysicalWebEnabled());

    physicalWebSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            boolean enabled = (boolean) newValue;
            if (enabled) {
                PhysicalWebUma.onPrefsFeatureEnabled();
                ensureLocationPermission();
            } else {
                PhysicalWebUma.onPrefsFeatureDisabled();
            }
            PrivacyPreferencesManager.getInstance().setPhysicalWebEnabled(enabled);
            return true;
        }
    });
}
 
Example #7
Source File: PhysicalWebPreferenceFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void initLaunchButton() {
    ButtonPreference physicalWebLaunch =
            (ButtonPreference) findPreference(PREF_PHYSICAL_WEB_LAUNCH);

    physicalWebLaunch.setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            PhysicalWebUma.onActivityReferral(PhysicalWebUma.PREFERENCE_REFERER);
            PhysicalWeb.showUrlList();
            return true;
        }
    });
}