Java Code Examples for android.os.Bundle#get()

The following examples show how to use android.os.Bundle#get() . 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: BundleUtil.java    From android-testdpc with Apache License 2.0 6 votes vote down vote up
@TargetApi(VERSION_CODES.LOLLIPOP_MR1)
public static PersistableBundle bundleToPersistableBundle(Bundle bundle) {
    Set<String> keySet = bundle.keySet();
    PersistableBundle persistableBundle = new PersistableBundle();
    for (String key : keySet) {
        Object value = bundle.get(key);
        if (value instanceof Boolean) {
            persistableBundle.putBoolean(key, (boolean) value);
        } else if (value instanceof Integer) {
            persistableBundle.putInt(key, (int) value);
        } else if (value instanceof String) {
            persistableBundle.putString(key, (String) value);
        } else if (value instanceof String[]) {
            persistableBundle.putStringArray(key, (String[]) value);
        } else if (value instanceof Bundle) {
            PersistableBundle innerBundle = bundleToPersistableBundle((Bundle) value);
            persistableBundle.putPersistableBundle(key, innerBundle);
        }
    }
    return persistableBundle;
}
 
Example 2
Source File: AccessToken.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
private static Date getBundleLongAsDate(Bundle bundle, String key, Date dateBase) {
    if (bundle == null) {
        return null;
    }

    long secondsFromBase = Long.MIN_VALUE;

    Object secondsObject = bundle.get(key);
    if (secondsObject instanceof Long) {
        secondsFromBase = (Long) secondsObject;
    } else if (secondsObject instanceof String) {
        try {
            secondsFromBase = Long.parseLong((String) secondsObject);
        } catch (NumberFormatException e) {
            return null;
        }
    } else {
        return null;
    }

    if (secondsFromBase == 0) {
        return new Date(Long.MAX_VALUE);
    } else {
        return new Date(dateBase.getTime() + (secondsFromBase * 1000L));
    }
}
 
Example 3
Source File: ALog.java    From ALog with Apache License 2.0 6 votes vote down vote up
private static String bundle2String(Bundle bundle) {
    Iterator<String> iterator = bundle.keySet().iterator();
    if (!iterator.hasNext()) {
        return "Bundle {}";
    }
    StringBuilder sb = new StringBuilder(128);
    sb.append("Bundle { ");
    for (; ; ) {
        String key = iterator.next();
        Object value = bundle.get(key);
        sb.append(key).append('=');
        if (value != null && value instanceof Bundle) {
            sb.append(value == bundle ? "(this Bundle)" : bundle2String((Bundle) value));
        } else {
            sb.append(formatObject(value));
        }
        if (!iterator.hasNext()) return sb.append(" }").toString();
        sb.append(',').append(' ');
    }
}
 
Example 4
Source File: MidiPrinter.java    From android-midisuite with Apache License 2.0 6 votes vote down vote up
public static String formatDeviceInfo(MidiDeviceInfo info) {
    StringBuilder sb = new StringBuilder();
    if (info != null) {
        Bundle properties = info.getProperties();
        for (String key : properties.keySet()) {
            Object value = properties.get(key);
            sb.append(key).append(" = ").append(value).append('\n');
        }
        for (PortInfo port : info.getPorts()) {
            sb.append((port.getType() == PortInfo.TYPE_INPUT) ? "input"
                    : "output");
            sb.append("[").append(port.getPortNumber()).append("] = \"").append(port.getName()
                    + "\"\n");
        }
    }
    return sb.toString();
}
 
Example 5
Source File: AccessToken.java    From HypFacebook with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static Date getBundleLongAsDate(Bundle bundle, String key, Date dateBase) {
    if (bundle == null) {
        return null;
    }

    long secondsFromBase = Long.MIN_VALUE;

    Object secondsObject = bundle.get(key);
    if (secondsObject instanceof Long) {
        secondsFromBase = (Long) secondsObject;
    } else if (secondsObject instanceof String) {
        try {
            secondsFromBase = Long.parseLong((String) secondsObject);
        } catch (NumberFormatException e) {
            return null;
        }
    } else {
        return null;
    }

    if (secondsFromBase == 0) {
        return new Date(Long.MAX_VALUE);
    } else {
        return new Date(dateBase.getTime() + (secondsFromBase * 1000L));
    }
}
 
Example 6
Source File: RuntimeUtil.java    From quickhybrid-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * 获取manifest中配置的metaData信息
 * <meta-data
 * android:name="key"
 * android:value="value" />
 *
 * @param ctx
 * @param key
 * @return
 */
public static String getMetaData(Context ctx, String key) {
    String packageName = ctx.getPackageName();
    PackageManager packageManager = ctx.getPackageManager();
    Bundle bd;
    String value = "";
    try {
        ApplicationInfo info = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        bd = info.metaData;//获取metaData标签内容
        if (bd != null) {
            Object keyO = bd.get(key);
            if (keyO != null) {
                value = keyO.toString();//这里获取的就是value值
            }
        }
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
    return value;
}
 
Example 7
Source File: EyepetizerDetailActivity.java    From Ency with Apache License 2.0 6 votes vote down vote up
@SuppressLint("SetTextI18n")
private void initData() {
    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();
    videoBean = (VideoBean.ItemListBean.DataBeanX) bundle.get("data");
    txtVideoTitle.setText(videoBean.getContent().getData().getTitle());
    txtVideoSubtitle.setText(videoBean.getHeader().getDescription());
    txtVideoContent.setText(videoBean.getContent().getData().getDescription());
    txtVideoShare.setText(videoBean.getContent().getData().getConsumption().getShareCount() + "");
    txtVideoReply.setText(videoBean.getContent().getData().getConsumption().getReplyCount() + "");
    ImageLoader.loadAllNoPlaceHolder(mContext, videoBean.getContent().getData().getAuthor().getIcon(),imgVideoAuthor);
    txtVideoAuthorName.setText(videoBean.getContent().getData().getAuthor().getName());
    txtVideoAuthorDescription.setText(videoBean.getContent().getData().getAuthor().getDescription());
    tagAdapter = new EyepetizerTagAdapter();
    tagAdapter.setNewData(videoBean.getContent().getData().getTags().size() > 3
            ? videoBean.getContent().getData().getTags().subList(0, 3) : videoBean.getContent().getData().getTags());
    recyclerviewTag.setLayoutManager(new GridLayoutManager(mContext, 3));
    recyclerviewTag.setAdapter(tagAdapter);
    daoManager = EncyApplication.getAppComponent().getGreenDaoManager();
    setLikeState(daoManager.queryByGuid(videoBean.getHeader().getId() + ""));
}
 
Example 8
Source File: SmsReceiver.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    if (intent == null) {
        return;
    }
    try {
        String message = "";
        SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
        String hash = preferences.getString("sms_hash", null);
        if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
            if (!AndroidUtilities.isWaitingForSms()) {
                return;
            }
            Bundle bundle = intent.getExtras();
            message = (String) bundle.get(SmsRetriever.EXTRA_SMS_MESSAGE);
        }
        if (TextUtils.isEmpty(message)) {
            return;
        }
        Pattern pattern = Pattern.compile("[0-9\\-]+");
        final Matcher matcher = pattern.matcher(message);
        if (matcher.find()) {
            String code = matcher.group(0).replace("-", "");
            if (code.length() >= 3) {
                if (preferences != null && hash != null) {
                    preferences.edit().putString("sms_hash_code", hash + "|" + code).commit();
                }
                AndroidUtilities.runOnUIThread(() -> NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didReceiveSmsCode, code));
            }
        }
    } catch (Throwable e) {
        FileLog.e(e);
    }
}
 
Example 9
Source File: Utility.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
public static Uri buildUri(String authority, String path, Bundle parameters) {
    Uri.Builder builder = new Uri.Builder();
    builder.scheme(URL_SCHEME);
    builder.authority(authority);
    builder.path(path);
    if (parameters != null) {
        for (String key : parameters.keySet()) {
            Object parameter = parameters.get(key);
            if (parameter instanceof String) {
                builder.appendQueryParameter(key, (String) parameter);
            }
        }
    }
    return builder.build();
}
 
Example 10
Source File: BundleJSONConverter.java    From react-native-fcm with MIT License 5 votes vote down vote up
public static JSONObject convertToJSON(Bundle bundle) throws JSONException {
    JSONObject json = new JSONObject();

    for(String key : bundle.keySet()) {
        Object value = bundle.get(key);
        if (value == null) {
            // Null is not supported.
            continue;
        }

        // Special case List<String> as getClass would not work, since List is an interface
        if (value instanceof List<?>) {
            JSONArray jsonArray = new JSONArray();
            @SuppressWarnings("unchecked")
            List<String> listValue = (List<String>)value;
            for (String stringValue : listValue) {
                jsonArray.put(stringValue);
            }
            json.put(key, jsonArray);
            continue;
        }

        // Special case Bundle as it's one way, on the return it will be JSONObject
        if (value instanceof Bundle) {
            json.put(key, convertToJSON((Bundle)value));
            continue;
        }

        Setter setter = SETTERS.get(value.getClass());
        if (setter == null) {
            throw new IllegalArgumentException("Unsupported type: " + value.getClass());
        }
        setter.setOnJSON(json, key, value);
    }

    return json;
}
 
Example 11
Source File: LoginActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void putBundleToEditor(Bundle bundle, SharedPreferences.Editor editor, String prefix)
{
    Set<String> keys = bundle.keySet();
    for (String key : keys)
    {
        Object obj = bundle.get(key);
        if (obj instanceof String)
        {
            if (prefix != null)
            {
                editor.putString(prefix + "_|_" + key, (String) obj);
            }
            else
            {
                editor.putString(key, (String) obj);
            }
        }
        else if (obj instanceof Integer)
        {
            if (prefix != null)
            {
                editor.putInt(prefix + "_|_" + key, (Integer) obj);
            }
            else
            {
                editor.putInt(key, (Integer) obj);
            }
        }
        else if (obj instanceof Bundle)
        {
            putBundleToEditor((Bundle) obj, editor, key);
        }
    }
}
 
Example 12
Source File: QRCodeEncoder.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
private static List<String> getAllBundleValues(Bundle bundle, String[] keys) {
  List<String> values = new ArrayList<>(keys.length);
  for (String key : keys) {
    Object value = bundle.get(key);
    values.add(value == null ? null : value.toString());
  }
  return values;
}
 
Example 13
Source File: PingSmsReceiver.java    From android-silent-ping-sms with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    if (!Telephony.Sms.Intents.DATA_SMS_RECEIVED_ACTION.equals(intent.getAction())) {
        Log.d(TAG, "Received intent, not DATA_SMS_RECEIVED_ACTION, but " + intent.getAction());
        return;
    }
    SharedPreferences preferences = context.getSharedPreferences(PREF_DATA_SMS_STORE, Context.MODE_PRIVATE);
    if (!context.getSharedPreferences("MainActivity", Context.MODE_PRIVATE).getBoolean(MainActivity.PREF_RECEIVE_DATA_SMS, false)) {
        return;
    }
    Bundle bundle = intent.getExtras();
    if (bundle == null) {
        return;
    }
    Object[] PDUs = (Object[]) bundle.get("pdus");
    Log.d(TAG, "Received " + (PDUs != null ? PDUs.length : 0) + " messages");

    int counter = 0;
    for (Object pdu : PDUs != null ? PDUs : new Object[0]) {
        StringBuilder sb = new StringBuilder();
        for (byte b : (byte[]) pdu) {
            sb.append(String.format("%02x", b));
        }
        Log.d(TAG, "HEX[" + (counter + 1) + "]: " + sb.toString());
        String storeString = preferences.getString(PREF_DATA_SMS_STORE, "");
        storeString += sb.toString() + ",";
        preferences.edit().putString(PREF_DATA_SMS_STORE, storeString).apply();
        Notification(context, sb.toString());
    }
}
 
Example 14
Source File: CompatUtils.java    From DroidService with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static IBinder getBinerAPI10(Bundle data, String key) {
    Object o = data.get(key);
    if (o == null) {
        return null;
    }
    try {
        return (IBinder) o;
    } catch (ClassCastException e) {
        typeWarning(key, o, "IBinder", e);
        return null;
    }
}
 
Example 15
Source File: Utils.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public static String bundle2string(Bundle bundle) {
    if (null == bundle) return "[Bundle null]";
    String string = "[Bundle: ";
    for (String key : bundle.keySet()) {
        string += key + "=" + bundle.get(key) + " ";
    }
    string += "]";
    return string;
}
 
Example 16
Source File: InsightsLogger.java    From FacebookNewsfeedSample-Android with Apache License 2.0 4 votes vote down vote up
private static String buildJSONForEvent(String eventName, double valueToSum, Bundle parameters) {
    String result;
    try {

        // Build custom event payload
        JSONObject eventObject = new JSONObject();
        eventObject.put("_eventName", eventName);
        if (valueToSum != 1.0) {
            eventObject.put("_valueToSum", valueToSum);
        }

        if (parameters != null) {

            Set<String> keys = parameters.keySet();
            for (String key : keys) {
                Object value = parameters.get(key);

                if (!(value instanceof String) &&
                    !(value instanceof Number)) {

                    notifyDeveloperError(
                            String.format("Parameter '%s' must be a string or a numeric type.", key));
                }

                eventObject.put(key, value);
            }
        }

        JSONArray eventArray = new JSONArray();
        eventArray.put(eventObject);

        result = eventArray.toString();

    } catch (JSONException exception) {

        notifyDeveloperError(exception.toString());
        result = null;

    }

    return result;
}
 
Example 17
Source File: AppEventsLogger.java    From Abelana-Android with Apache License 2.0 4 votes vote down vote up
public AppEvent(
        Context context,
        String eventName,
        Double valueToSum,
        Bundle parameters,
        boolean isImplicitlyLogged
) {

    validateIdentifier(eventName);

    this.name = eventName;

    isImplicit = isImplicitlyLogged;
    jsonObject = new JSONObject();

    try {
        jsonObject.put("_eventName", eventName);
        jsonObject.put("_logTime", System.currentTimeMillis() / 1000);
        jsonObject.put("_ui", Utility.getActivityName(context));

        if (valueToSum != null) {
            jsonObject.put("_valueToSum", valueToSum.doubleValue());
        }

        if (isImplicit) {
            jsonObject.put("_implicitlyLogged", "1");
        }

        String appVersion = Settings.getAppVersion();
        if (appVersion != null) {
            jsonObject.put("_appVersion", appVersion);
        }

        if (parameters != null) {
            for (String key : parameters.keySet()) {

                validateIdentifier(key);

                Object value = parameters.get(key);
                if (!(value instanceof String) && !(value instanceof Number)) {
                    throw new FacebookException(
                            String.format(
                                    "Parameter value '%s' for key '%s' should be a string or a numeric type.",
                                    value,
                                    key)
                    );
                }

                jsonObject.put(key, value.toString());
            }
        }

        if (!isImplicit) {
            Logger.log(LoggingBehavior.APP_EVENTS, "AppEvents",
                    "Created app event '%s'", jsonObject.toString());
        }
    } catch (JSONException jsonException) {

        // If any of the above failed, just consider this an illegal event.
        Logger.log(LoggingBehavior.APP_EVENTS, "AppEvents",
                "JSON encoding for app event failed: '%s'", jsonException.toString());
        jsonObject = null;

    }
}
 
Example 18
Source File: WifiGeneratorActivity.java    From SecScanQR with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneralHandler generalHandler = new GeneralHandler(this);
    generalHandler.loadTheme();
    setContentView(R.layout.activity_wifi_generator);

    tfSSID = (EditText) findViewById(R.id.tfSSID);
    tfPassword = (EditText) findViewById(R.id.tfPassword);
    cbHidden = (CheckBox) findViewById(R.id.cbHidden);
    btnGenerate = (Button) findViewById(R.id.btnGenerateWifi);

    btnGenerate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ssid = tfSSID.getText().toString().trim();
            password = tfPassword.getText().toString().trim();
            if(ssid.equals("") || (encrypt.equals("WEP") && password.equals("")) || (encrypt.equals("WPA") && password.equals(""))){
                Toast.makeText(getApplicationContext(), getResources().getText(R.string.error_geo_first), Toast.LENGTH_SHORT).show();
            } else {
                multiFormatWriter = new MultiFormatWriter();
                try{
                    if(hidden.equals("true") && encrypt.equals("nopass")) {
                        result = "WIFI:S:" + ssid + ";T:" + encrypt + ";P:;H:true;";
                    } else if (hidden.equals("false") && encrypt.equals("nopass")){
                        result = "WIFI:S:" + ssid + ";T:" + encrypt + ";P:;;";
                    } else if (hidden.matches("false")){
                        result = "WIFI:S:" + ssid + ";T:" + encrypt + ";P:" + password + ";;";
                    } else {
                        result = "WIFI:S:" + ssid + ";T:" + encrypt + ";P:" + password + ";H:true;";
                    }
                    openResultActivity();
                } catch (Exception e){
                    Toast.makeText(activity.getApplicationContext(), getResources().getText(R.string.error_generate), Toast.LENGTH_LONG).show();
                }
            }
        }
    });

    //Setup the Spinner Menu for the different formats
    Spinner formatSpinner = (Spinner) findViewById(R.id.spinner);
    Spinner encrypSpinner = (Spinner) findViewById(R.id.spinnerWifi);
    formatSpinner.setOnItemSelectedListener(this);
    encrypSpinner.setOnItemSelectedListener(this);

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.text_formats_array, R.layout.spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    formatSpinner.setAdapter(adapter);

    adapter = ArrayAdapter.createFromResource(this, R.array.text_formats_encryption, R.layout.spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    encrypSpinner.setAdapter(adapter);

    //If the device were rotated then restore information
    if(savedInstanceState != null){
        ssid = (String) savedInstanceState.get(STATE_SSID);
        tfSSID.setText(ssid);
        password = (String) savedInstanceState.get(STATE_PASSWORD);
        tfPassword.setText(password);
        encrypt = (String) savedInstanceState.get(STATE_ENCRYPT);
        if(encrypt.equals("nopass")){
            tfPassword.setVisibility(View.GONE);
        }
        hidden = (String) savedInstanceState.get(STATE_HIDDEN);
        if(hidden.equals("false")) {
            cbHidden.setChecked(false);
        }
    }


}
 
Example 19
Source File: RunActivity.java    From javainstaller with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	try{
		System.getProperties().setProperty("java.library.path", System.getProperty("java.library.path")+":/data/data/jackpal.androidterm/lib");
		
		String apkfile = getPackageManager().getApplicationInfo("jackpal.androidterm", 0).sourceDir;
		classloader = new dalvik.system.PathClassLoader(apkfile, ClassLoader.getSystemClassLoader());
		
		Bundle b = getIntent().getExtras();
		//create a new terminal session
		session = Class.forName("jackpal.androidterm.emulatorview.TermSession", true, classloader).getConstructor().newInstance(new Object[]{});
		SharedPreferences settings = getSharedPreferences("julianwi.javainstaller_preferences", 1);
		String[] arguments;
		//android terminal emulator version 1.0.66 and later wants the first argument twice
		if(b != null && (Boolean)b.get("install")==true){
			if(settings.getString("rootmode", "off").equals("on")){
				arguments = new String[]{"/system/bin/su", "/system/bin/su", "-c", "sh /data/data/julianwi.javainstaller/install.sh"};
			}
			else{
				arguments = new String[]{"/system/bin/sh", "/system/bin/sh", "/data/data/julianwi.javainstaller/install.sh"};
			}
		}
		else{
			String javapath = getSharedPreferences("settings", 1).getString("path3", "");
			if(settings.getString("rootmode2", "off").equals("on")){
				arguments = new String[]{"/system/bin/su", "/system/bin/su", "-c", "/data/data/julianwi.javainstaller/java -jar "+getIntent().getDataString()};
			}
			else{
				arguments = new String[]{"/data/data/julianwi.javainstaller/java", "/data/data/julianwi.javainstaller/java", "-jar", getIntent().getDataString()};
			}
		}
		//create a pty
		if(termexec == null){
			termexec = Class.forName("jackpal.androidterm.TermExec", true, classloader);
		}
		pseudoterm = ParcelFileDescriptor.open(new File("/dev/ptmx"), ParcelFileDescriptor.MODE_READ_WRITE);
		exec = termexec.getConstructor(new Class[]{String[].class}).newInstance(new Object[]{arguments});
		handler = new Handler();
		new Thread(this).start();

        //connect the pty's I/O streams to the TermSession.
        session.getClass().getMethod("setTermOut", OutputStream.class).invoke(session, new Object[]{new ParcelFileDescriptor.AutoCloseOutputStream(pseudoterm)});
        session.getClass().getMethod("setTermIn", InputStream.class).invoke(session, new Object[]{new ParcelFileDescriptor.AutoCloseInputStream(pseudoterm)});
        //create the EmulatorView
		DisplayMetrics metrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(metrics);
		emulatorview = (View) Class.forName("jackpal.androidterm.emulatorview.EmulatorView", true, classloader).getConstructor(Context.class, session.getClass(), DisplayMetrics.class).newInstance(new Object[]{this, session, metrics});
		setContentView(emulatorview);
	}catch(Exception e){
		e.printStackTrace();
		new Error("error", e.toString(), this);
	}
}
 
Example 20
Source File: Reminders.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
private void processIncomingBundle(Bundle bundle) {
    final PowerManager.WakeLock wl = JoH.getWakeLock("reminder-bundler", 10000);
    if (bundle != null) {

        if ((bundle != null) && (d)) {
            for (String key : bundle.keySet()) {
                Object value = bundle.get(key);
                if (value != null) {
                    Log.d(TAG, String.format("Bundle: %s %s (%s)", key,
                            value.toString(), value.getClass().getName()));
                }
            }
        }

        if (bundle.getString("snooze") != null) {
            long id = bundle.getLong("snooze_id");
            Log.d(TAG, "Reminder id for snooze: " + id);
            final Reminder reminder = Reminder.byid(id);
            if (reminder != null) {
                final long snooze_time = reminder.last_snoozed_for > 0 ? reminder.last_snoozed_for : default_snooze;
                snoozeReminder(reminder, snooze_time);
                JoH.static_toast_long(xdrip.getAppContext().getString(R.string.snoozed_reminder_for) + " " + JoH.niceTimeScalar(snooze_time));
                reloadList();
                hideSnoozeFloater();
                hideKeyboard(recyclerView);
            }
        } else {
            Log.d(TAG, "Processing non null default bundle");
            reloadList();
            hideSnoozeFloater();
            hideKeyboard(recyclerView);
            JoH.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    wakeUpScreen(false);
                }
            });
            if (bundle.getString(REMINDER_WAKEUP) != null) {
                try {
                    recyclerView.smoothScrollToPosition(getPositionFromReminderId(Integer.parseInt(bundle.getString(REMINDER_WAKEUP))));
                } catch (IllegalArgumentException e) {
                    Log.e(TAG, "Couldn't scroll to position");
                }
                JoH.runOnUiThreadDelayed(new Runnable() {
                    @Override
                    public void run() {
                        Log.d(TAG, "Checking for sensor: " + proximity);
                        if (!proximity) {
                            wakeUpScreen(true);
                        }
                    }
                }, 2000);
            }
        }
    }
    // intentionally don't release wakelock for proximity detection etc
}