Example usage for android.os Bundle EMPTY

List of usage examples for android.os Bundle EMPTY

Introduction

In this page you can find the example usage for android.os Bundle EMPTY.

Prototype

Bundle EMPTY

To view the source code for android.os Bundle EMPTY.

Click Source Link

Usage

From source file:dev.drsoran.moloko.activities.AbstractTasksListActivity.java

private void startLoadingRtmLists() {
    getSupportLoaderManager().initLoader(RtmListWithTaskCountLoader.ID, Bundle.EMPTY, this);
}

From source file:se.leap.bitmaskclient.ProviderAPI.java

@Override
protected void onHandleIntent(Intent command) {
    final ResultReceiver receiver = command.getParcelableExtra(RECEIVER_KEY);
    String action = command.getAction();
    Bundle parameters = command.getBundleExtra(PARAMETERS);

    if (provider_api_url == null && preferences.contains(Provider.KEY)) {
        try {// ww  w .j  a v a 2s .c  om
            JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, ""));
            provider_api_url = provider_json.getString(Provider.API_URL) + "/"
                    + provider_json.getString(Provider.API_VERSION);
            go_ahead = true;
        } catch (JSONException e) {
            go_ahead = false;
        }
    }

    if (action.equalsIgnoreCase(SET_UP_PROVIDER)) {
        Bundle result = setUpProvider(parameters);
        if (go_ahead) {
            if (result.getBoolean(RESULT_KEY)) {
                receiver.send(PROVIDER_OK, result);
            } else {
                receiver.send(PROVIDER_NOK, result);
            }
        }
    } else if (action.equalsIgnoreCase(SIGN_UP)) {
        UserStatus.updateStatus(UserStatus.SessionStatus.SIGNING_UP, resources);
        Bundle result = tryToRegister(parameters);
        if (result.getBoolean(RESULT_KEY)) {
            receiver.send(SUCCESSFUL_SIGNUP, result);
        } else {
            receiver.send(FAILED_SIGNUP, result);
        }
    } else if (action.equalsIgnoreCase(LOG_IN)) {
        UserStatus.updateStatus(UserStatus.SessionStatus.LOGGING_IN, resources);
        Bundle result = tryToAuthenticate(parameters);
        if (result.getBoolean(RESULT_KEY)) {
            receiver.send(SUCCESSFUL_LOGIN, result);
            UserStatus.updateStatus(UserStatus.SessionStatus.LOGGED_IN, resources);
        } else {
            receiver.send(FAILED_LOGIN, result);
            UserStatus.updateStatus(UserStatus.SessionStatus.NOT_LOGGED_IN, resources);
        }
    } else if (action.equalsIgnoreCase(LOG_OUT)) {
        UserStatus.updateStatus(UserStatus.SessionStatus.LOGGING_OUT, resources);
        if (logOut()) {
            receiver.send(SUCCESSFUL_LOGOUT, Bundle.EMPTY);
            UserStatus.updateStatus(UserStatus.SessionStatus.LOGGED_OUT, resources);
        } else {
            receiver.send(LOGOUT_FAILED, Bundle.EMPTY);
            UserStatus.updateStatus(UserStatus.SessionStatus.DIDNT_LOG_OUT, resources);
        }
    } else if (action.equalsIgnoreCase(DOWNLOAD_CERTIFICATE)) {
        if (updateVpnCertificate()) {
            receiver.send(CORRECTLY_DOWNLOADED_CERTIFICATE, Bundle.EMPTY);
        } else {
            receiver.send(INCORRECTLY_DOWNLOADED_CERTIFICATE, Bundle.EMPTY);
        }
    } else if (action.equalsIgnoreCase(DOWNLOAD_EIP_SERVICE)) {
        Bundle result = getAndSetEipServiceJson();
        if (result.getBoolean(RESULT_KEY)) {
            receiver.send(CORRECTLY_DOWNLOADED_EIP_SERVICE, result);
        } else {
            receiver.send(INCORRECTLY_DOWNLOADED_EIP_SERVICE, result);
        }
    }
}

From source file:tv.loilo.promise.samples.http.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mProgressBar = (ProgressBar) findViewById(R.id.main_progress_bar);
    mRecyclerView = (RecyclerView) findViewById(R.id.main_recycler_view);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    mRecyclerView.setAdapter(mAdapter);/*  w w  w.  ja  v  a2  s .  co  m*/

    getSupportLoaderManager().initLoader(0, Bundle.EMPTY, mLoaderCallbacks);
}

From source file:com.deliciousdroid.activity.BrowseBookmarks.java

@Override
public boolean onSearchRequested() {
    if (isMyself()) {
        Bundle contextData = new Bundle();
        contextData.putString("tagname", tagname);
        contextData.putString("username", username);
        contextData.putBoolean("unread", unread);
        startSearch(null, false, contextData, false);
    } else {//from  w  w  w  . j av  a  2 s.  co m
        startSearch(null, false, Bundle.EMPTY, false);
    }
    return true;
}

From source file:org.smssecure.smssecure.ConversationFragment.java

public void onNewIntent() {
    if (actionMode != null) {
        actionMode.finish();/*from  w  w  w . j  ava 2 s . co m*/
    }

    initializeResources();
    initializeListAdapter();

    if (threadId == -1) {
        getLoaderManager().restartLoader(0, Bundle.EMPTY, this);
    }
}

From source file:org.smssecure.smssecure.ConversationFragment.java

public void reloadList() {
    getLoaderManager().restartLoader(0, Bundle.EMPTY, this);
}

From source file:com.pindroid.activity.BrowseBookmarks.java

@Override
public boolean onSearchRequested() {
    if (isMyself()) {
        Bundle contextData = new Bundle();
        contextData.putString("tagname", tagname);
        contextData.putString("username", app.getUsername());
        contextData.putBoolean("unread", unread);
        startSearch(null, false, contextData, false);
    } else {//from   www.j a v a  2s.  c om
        startSearch(null, false, Bundle.EMPTY, false);
    }
    return true;
}

From source file:com.pindroid.authenticator.AuthenticatorActivity.java

/**
 * /*from   w  w w .  j  a  va2  s  .  com*/
 * Called when response is received from the server for authentication
 * request. See onAuthenticationResult(). Sets the
 * AccountAuthenticatorResult which is sent back to the caller. Also sets
 * the authToken in AccountManager for this account.
 * 
 * @param the confirmCredentials result.
 */
protected void finishLogin(String authToken) {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    final int synctime = Integer.parseInt(settings.getString("pref_synctime", "0"));

    final Account account = new Account(mUsername, Constants.ACCOUNT_TYPE);

    if (mRequestNewAccount) {
        mAccountManager.addAccountExplicitly(account, null, null);

        ContentResolver.setSyncAutomatically(account, BookmarkContentProvider.AUTHORITY, true);
        if (synctime != 0) {
            SyncUtils.addPeriodicSync(BookmarkContentProvider.AUTHORITY, Bundle.EMPTY, synctime, this);
        }
    }

    mAccountManager.setAuthToken(account, Constants.AUTHTOKEN_TYPE, authToken);

    final Intent intent = new Intent();

    intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, mUsername);
    intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, Constants.ACCOUNT_TYPE);
    intent.putExtra(AccountManager.KEY_AUTHTOKEN, authToken);
    setAccountAuthenticatorResult(intent.getExtras());
    setResult(RESULT_OK, intent);
    finish();
}

From source file:com.collabora.xwperf.notxw_contacts.fragments.MainFragment.java

private TabHost.TabSpec newTab(String tabId, String tabCaption, int imgResId) {
    TabHost.TabSpec tabSpec = tabHost.newTabSpec(tabId);
    ViewGroup tab = (ViewGroup) getLayoutInflater(Bundle.EMPTY).inflate(R.layout.view_tabwidget_tab, null);
    TextView tabTextView = ((TextView) tab.findViewById(R.id.tab_text));
    tabTextView.setText(tabCaption);//  w  w  w  . ja  va2 s .com
    tabTextView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(imgResId), null, null, null);
    tabSpec.setIndicator(tab);
    tabSpec.setContent(getContainerViewId(tabId));
    return tabSpec;
}

From source file:com.busticket.amedora.busticketsrl.TicketingHomeActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.layout_ticket_home);
    myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);/* w  ww  . j  av a  2 s  . co m*/
    //synchTrips();
    assert getSupportActionBar() != null;
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    spBoard = (Spinner) findViewById(R.id.spBoard);
    spBuses = (Spinner) findViewById(R.id.spBusNo);
    spTrips = (Spinner) findViewById(R.id.spTripType);
    spHighlight = (Spinner) findViewById(R.id.spHighlight);
    mAccount = CreateSyncAccount(this);
    mQueue = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicket = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicketSynch = Volley.newRequestQueue(getApplicationContext());
    rQSyncBalance = Volley.newRequestQueue(getApplicationContext());
    rqTrip = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicketing = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicketingSynch = Volley.newRequestQueue(getApplicationContext());
    //Key methods needed to be sent to server on activity created
    syncTicketing();
    syncTickets();

    apps = db.getApp(Installation.appId(getApplicationContext()));
    EMAIL = apps.getRoute_name();
    NAME = "CODE: " + apps.getAgent_code().toUpperCase() + " Trip: " + apps.getTripCount();
    // Get the content resolver for your app
    mResolver = getContentResolver();
    /*
     * Turn on periodic syncing
     */

    mTitle = mDrawerTitle = getTitle();
    ContentResolver.addPeriodicSync(CreateSyncAccount(this), AUTHORITY, Bundle.EMPTY, SYNC_INTERVAL);

    String[] tdata = populateTerminals();
    String[] bdata = populateBuses();
    ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, tdata);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spBoard.setAdapter(adapter);/**/

    ArrayAdapter Hadapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, tdata);
    Hadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spHighlight.setAdapter(Hadapter);

    ArrayAdapter gadapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, bdata);
    gadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spBuses.setAdapter(gadapter);

    ArrayAdapter<CharSequence> tadapter = ArrayAdapter.createFromResource(this, R.array.tripTypes,
            android.R.layout.simple_spinner_item);
    tadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    /*ArrayAdapter badapter =new ArrayAdapter(this,android.R.layout.simple_spinner_item,bdata);
    badapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);*/
    spTrips.setAdapter(tadapter);

    spBuses.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            bus = parent.getItemAtPosition(position).toString();
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    spBoard.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            board = parent.getItemAtPosition(position).toString();
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    spHighlight.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            highlight = parent.getItemAtPosition(position).toString();
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    spTrips.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            trip = parent.getItemAtPosition(position).toString();

        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    btnGenerate = (Button) findViewById(R.id.btnGenerate);

    btnGenerate.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // get a new activity to show invoice preview
            sendData();
        }
    });
    mRecyclerView = (RecyclerView) findViewById(R.id.RecyclerView); // Assigning the RecyclerView Object to the xml View

    mRecyclerView.setHasFixedSize(true); // Letting the system know that the list objects are of fixed size

    mAdapter = new DrawerAdapter(TITLES, ICONS, NAME, EMAIL, PROFILE); // Creating the Adapter of MyAdapter class(which we are going to see in a bit)
    // And passing the titles,icons,header view name, header view email,
    // and header view profile picture

    // Setting the adapter to RecyclerView
    //mRecyclerView.setLayoutManager(mLayoutManager);                 // Setting the layout Manager
    LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setAdapter(mAdapter);
    Drawer = (DrawerLayout) findViewById(R.id.DrawerLayout);
    // Drawer object Assigned to the view

    mDrawerToggle = new ActionBarDrawerToggle(this, Drawer, toolbar, R.string.openDrawer,
            R.string.closeDrawer) {
        @Override
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            // code here will execute once the drawer is opened( As I dont want anything happened whe drawer is
            // open I am not going to put anything here)
            invalidateOptionsMenu();
        }

        @Override
        public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            // Code here will execute once drawer is closed
            invalidateOptionsMenu();
        }
    }; // Drawer Toggle Object Made
    Drawer.setDrawerListener(mDrawerToggle); // Drawer Listener set to the Drawer toggle
    mDrawerToggle.syncState(); // Finally we set the drawer toggle sync State

    final GestureDetector mGestureDetector = new GestureDetector(TicketingHomeActivity.this,
            new GestureDetector.SimpleOnGestureListener() {

                @Override
                public boolean onSingleTapUp(MotionEvent e) {
                    return true;
                }

            });

    mRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
        @Override
        public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
            View child = recyclerView.findChildViewUnder(motionEvent.getX(), motionEvent.getY());
            if (child != null && mGestureDetector.onTouchEvent(motionEvent)) {
                Drawer.closeDrawers();
                if (recyclerView.getChildPosition(child) == 1) {

                } else if (recyclerView.getChildPosition(child) == 2) {
                    Intent intent = new Intent(TicketingHomeActivity.this, AccountActivity.class);
                    startActivity(intent);
                } else if (recyclerView.getChildPosition(child) == 3) {
                    Intent intent = new Intent(TicketingHomeActivity.this, TicketListActivity.class);
                    startActivity(intent);
                } else if (recyclerView.getChildPosition(child) == 4) {

                    syncTicketingSynchronize();
                    syncTicketsSynchronize();
                    synchAccount();
                    insertBuses();
                    //insertTerminals();

                    //syncTickets();

                    //dialog = ProgressDialog.show(TicketingHomeActivity.this, "", "Synchronizing App Data. Please wait...", true);
                    /*new Thread(new Runnable() {
                    @Override
                    public void run() {
                            
                        Looper.prepare();
                            
                        final Handler handler = new Handler();
                        handler.postDelayed(new Runnable() {
                            @Override
                            public void run() {*/

                    // insertTerminals();

                    // insertBuses();
                    //getTickets();

                    //Toast.makeText(TicketingHomeActivity.this, "Looper startes ", Toast.LENGTH_SHORT).show();
                    /*handler.removeCallbacks(this);
                            
                    Looper.myLooper().quit();
                    }
                    }, 30000);
                            
                    Looper.loop();
                    }
                    }).start();*/

                } else if (recyclerView.getChildPosition(child) == 5) {
                    if (apps.getLicenceNo() != null) {
                        Intent intent = new Intent(TicketingHomeActivity.this, TripHomeActivity.class);
                        startActivity(intent);

                    } else {
                        //Intent intent = new Intent(TicketingHomeActivity.this,TestPrintActivity.class);
                        //startActivity(intent);
                        Toast.makeText(TicketingHomeActivity.this,
                                "Application is in default mode you cannot use this menu", Toast.LENGTH_SHORT)
                                .show();
                    }

                } else if (recyclerView.getChildPosition(child) == 6) {
                    Intent intent = new Intent(TicketingHomeActivity.this, LogoutActivity.class);
                    startActivity(intent);
                    // Toast.makeText(TicketingHomeActivity.this, "The Item Clicked is: " + recyclerView.getChildPosition(child), Toast.LENGTH_SHORT).show();
                }
                return true;
            }
            return false;
        }

        @Override
        public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {

        }
    });
    List<Ticket> issuedTickets = db.getIssuedTickets();
    Log.e("SYNC LOG", issuedTickets.toString());
}