List of usage examples for android.os Bundle getLong
public long getLong(String key, long defaultValue)
From source file:com.dwdesign.tweetings.fragment.UserListMembersFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { if (savedInstanceState != null) { mCursor = savedInstanceState.getLong(INTENT_KEY_PAGE, -1); }/*from w ww . j av a 2 s . c o m*/ mService = getApplication().getServiceInterface(); super.onActivityCreated(savedInstanceState); }
From source file:de.vanita5.twittnuker.fragment.support.CursorStatusesListFragment.java
protected long getAccountId() { final Bundle args = getArguments(); return args != null ? args.getLong(EXTRA_ACCOUNT_ID, -1) : -1; }
From source file:com.vuw.project1.riverwatch.ui.History_IncidentActivity_Item.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_container); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); }/* w ww . ja v a2 s. c o m*/ Bundle extras = getIntent().getExtras(); id = 0; latitude = 0; longitude = 0; if (extras != null) { id = extras.getLong("id", 0); latitude = extras.getDouble("latitude", 0); longitude = extras.getDouble("longitude", 0); } final String[] titles = new String[] { "Info", "Map" }; ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { switch (position) { case 0: return History_IncidentActivityFragment_Info.newInstance(id); case 1: return History_ActivityFragment_Map.newInstance(latitude, longitude); default: return History_IncidentActivityFragment_Info.newInstance(-1); } } @Override public CharSequence getPageTitle(int position) { return titles[position]; } @Override public int getCount() { return titles.length; } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); }
From source file:com.vuw.project1.riverwatch.ui.History_WaterActivity_Samples.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_container); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); }/*from w w w . j av a2s. c om*/ Bundle extras = getIntent().getExtras(); id = 0; latitude = 0; longitude = 0; if (extras != null) { id = extras.getLong("id", 0); latitude = extras.getDouble("latitude", 0); longitude = extras.getDouble("longitude", 0); } final String[] titles = new String[] { "Samples", "Map", "Graphs" }; ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { switch (position) { case 0: return History_WaterActivityFragment_Samples.newInstance(id); case 1: return History_ActivityFragment_Map.newInstance(latitude, longitude); case 2: return History_WaterActivityFragment_Graph.newInstance(id); default: return History_WaterActivityFragment_Samples.newInstance(-1); } } @Override public CharSequence getPageTitle(int position) { return titles[position]; } @Override public int getCount() { return titles.length; } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); }
From source file:com.vuw.project1.riverwatch.ui.History_NitrateActivity_Item.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_container); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); }//from w w w . ja v a2 s. c o m Bundle extras = getIntent().getExtras(); id = 0; latitude = 0; longitude = 0; if (extras != null) { id = extras.getLong("id", 0); latitude = extras.getDouble("latitude", 0); longitude = extras.getDouble("longitude", 0); } final String[] titles = new String[] { "Info", "Map" }; ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { switch (position) { case 0: return History_NitrateActivityFragment_Info.newInstance(id); case 1: return History_ActivityFragment_Map.newInstance(latitude, longitude); default: return History_NitrateActivityFragment_Info.newInstance(-1); } } @Override public CharSequence getPageTitle(int position) { return titles[position]; } @Override public int getCount() { return titles.length; } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); }
From source file:com.groksolutions.grok.mobile.dialog.AutoDismissDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Bundle args = getArguments(); final CharSequence message = args.getCharSequence("message"); final CharSequence title = args.getCharSequence("title"); final long timeout = args.getLong("timeout", 0); final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(title).setMessage(message).setNegativeButton(android.R.string.ok, new OnClickListener() { @Override/*from w w w . j a va2s . co m*/ public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); final AlertDialog dialog = builder.create(); if (timeout > 0) { new Handler().postDelayed(new Runnable() { @Override public void run() { dialog.dismiss(); } }, timeout); } return dialog; }
From source file:com.dwdesign.tweetings.fragment.UserRetweetedStatusFragment.java
@Override public Loader<SynchronizedStateSavedList<ParcelableStatus, Long>> newLoaderInstance(final Bundle args) { long account_id = -1, max_id = -1, since_id = -1, status_id = -1; String screen_name = null;/*from www. jav a 2 s .c om*/ boolean is_home_tab = false; if (args != null) { account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1); max_id = args.getLong(INTENT_KEY_MAX_ID, -1); since_id = args.getLong(INTENT_KEY_SINCE_ID, -1); status_id = args.getLong(INTENT_KEY_STATUS_ID, -1); } return new UserRetweetedStatusLoader(getActivity(), account_id, status_id, max_id, since_id, getData(), getClass().getSimpleName(), is_home_tab); }
From source file:de.vanita5.twittnuker.fragment.support.SearchFragment.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case MENU_SAVE: { final AsyncTwitterWrapper twitter = getTwitterWrapper(); final Bundle args = getArguments(); if (twitter != null && args != null) { final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1); final String query = args.getString(EXTRA_QUERY); twitter.createSavedSearchAsync(accountId, query); }// w w w. j a v a 2s .c o m return true; } } return super.onOptionsItemSelected(item); }
From source file:com.dwdesign.tweetings.fragment.RetweetedToMeFragment.java
@Override public Loader<SynchronizedStateSavedList<ParcelableStatus, Long>> newLoaderInstance(final Bundle args) { long account_id = -1, max_id = -1, since_id = -1; boolean is_home_tab = false; if (args != null) { account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1); max_id = args.getLong(INTENT_KEY_MAX_ID, -1); since_id = args.getLong(INTENT_KEY_SINCE_ID, -1); is_home_tab = args.getBoolean(INTENT_KEY_IS_HOME_TAB); }/*w w w .j a v a 2 s . co m*/ return new RetweetedToMeLoader(getActivity(), account_id, max_id, since_id, getData(), getClass().getSimpleName(), is_home_tab); }
From source file:com.liato.bankdroid.WebViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webview);/*from w w w . j a v a 2 s. c o m*/ this.addTitleButton(R.drawable.title_icon_back, "back", this); this.addTitleButton(R.drawable.title_icon_forward, "forward", this); this.addTitleButton(R.drawable.title_icon_refresh, "refresh", this); this.setTitleButtonEnabled("forward", false); this.setTitleButtonEnabled("back", false); this.setTitleButtonEnabled("refresh", false); final CookieSyncManager csm = CookieSyncManager.createInstance(this); mWebView = (WebView) findViewById(R.id.wvBank); mWebView.setBackgroundColor(0); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setBuiltInZoomControls(true); mWebView.getSettings().setUserAgentString(Urllib.DEFAULT_USER_AGENT); mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); mWebView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { activity.setProgressBar(progress); if (progress == 100) { Handler handler = new Handler(); Runnable runnable = new Runnable() { public void run() { activity.hideProgressBar(); } }; // Let the progress bar hit 100% before we hide it. handler.postDelayed(runnable, 100); } else if (mFirstPageLoaded) { activity.showProgressBar(); } } }); mWebView.setWebViewClient(new BankWebViewClient()); String preloader = "Error..."; try { preloader = IOUtils.toString(getResources().openRawResource(R.raw.loading)); preloader = String.format(preloader, "", // Javascript function "" // HTML ); } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mWebView.loadDataWithBaseURL("what://is/this/i/dont/even", preloader, "text/html", "utf-8", null); Bundle extras = getIntent().getExtras(); final long bankId = extras.getLong("bankid", -1); //final long bankId = -1; if (bankId >= 0) { Runnable generateLoginPage = new Runnable() { public void run() { Bank bank = BankFactory.bankFromDb(bankId, WebViewActivity.this, false); SessionPackage loginPackage = bank.getSessionPackage(WebViewActivity.this); CookieStore cookieStore = loginPackage.getCookiestore(); if ((cookieStore != null) && !cookieStore.getCookies().isEmpty()) { CookieManager cookieManager = CookieManager.getInstance(); String cookieString; for (Cookie cookie : cookieStore.getCookies()) { cookieString = String.format("%s=%s;%spath=%s; domain=%s;", cookie.getName(), cookie.getValue(), cookie.getExpiryDate() == null ? "" : "expires=" + cookie.getExpiryDate() + "; ", cookie.getPath() == null ? "/" : cookie.getPath(), cookie.getDomain()); cookieManager.setCookie(cookie.getDomain(), cookieString); } csm.sync(); } mWebView.loadDataWithBaseURL("what://is/this/i/dont/even", loginPackage.getHtml(), "text/html", "utf-8", null); } }; new Thread(generateLoginPage).start(); } }