List of usage examples for android.appwidget AppWidgetManager EXTRA_APPWIDGET_ID
String EXTRA_APPWIDGET_ID
To view the source code for android.appwidget AppWidgetManager EXTRA_APPWIDGET_ID.
Click Source Link
From source file:com.teinproductions.tein.papyrosprogress.MainActivity.java
private void restoreAppWidgetStuff() { if (Build.VERSION.SDK_INT < 16) return;// w w w .ja va 2s . co m Bundle extras = getIntent().getExtras(); if (extras != null) { appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); adapter.setTextSize(pref.getInt(Constants.TEXT_SIZE_PREFERENCE + appWidgetId, 24)); adapter.setWidgetMilestoneTitle( pref.getString(Constants.MILESTONE_WIDGET_PREFERENCE + appWidgetId, null)); } else { adapter.setTextSize(PapyrosRecyclerAdapter.DONT_SHOW_TEXT_SIZE_TILE); } }
From source file:eu.power_switch.widget.activity.ConfigureReceiverWidgetActivity.java
private void saveCurrentConfiguration() { try {/*from w w w .ja v a 2 s . c o m*/ // First, get the App Widget ID from the Intent that launched the Activity: Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); // Perform your App Widget configuration: Apartment selectedApartment = getSelectedApartment(); Room selectedRoom = selectedApartment.getRoom(spinnerRoom.getSelectedItem().toString()); Receiver selectedReceiver = selectedRoom.getReceiver(spinnerReceiver.getSelectedItem().toString()); // save new widget data to database ReceiverWidget receiverWidget = new ReceiverWidget(appWidgetId, selectedRoom.getId(), selectedReceiver.getId()); DatabaseHandler.addReceiverWidget(receiverWidget); // When the configuration is complete, get an instance of // the AppWidgetManager by calling getInstance(Context): AppWidgetManager appWidgetManager = AppWidgetManager .getInstance(ConfigureReceiverWidgetActivity.this); // Update the App Widget with a RemoteViews layout by // calling updateAppWidget(int, RemoteViews): RemoteViews remoteViews = new RemoteViews(getString(eu.power_switch.shared.R.string.PACKAGE_NAME), R.layout.widget_receiver); LinkedList<Button> buttons = selectedReceiver.getButtons(); remoteViews.setTextViewText(R.id.textView_receiver_widget_name, selectedApartment.getName() + ": " + selectedRoom.getName() + ": " + selectedReceiver.getName()); int buttonOffset = 0; for (Button button : buttons) { // set button action RemoteViews buttonView = new RemoteViews( getString(eu.power_switch.shared.R.string.PACKAGE_NAME), R.layout.widget_receiver_button_layout); SpannableString s = new SpannableString(button.getName()); s.setSpan(new StyleSpan(Typeface.BOLD), 0, button.getName().length(), 0); buttonView.setTextViewText(R.id.button_widget_universal, s); if (SmartphonePreferencesHandler.getHighlightLastActivatedButton() && selectedReceiver.getLastActivatedButtonId().equals(button.getId())) { buttonView.setTextColor(R.id.button_widget_universal, ContextCompat.getColor(getApplicationContext(), R.color.color_light_blue_a700)); } PendingIntent pendingIntent = WidgetIntentReceiver.buildReceiverWidgetActionPendingIntent( getApplicationContext(), selectedApartment, selectedRoom, selectedReceiver, button, appWidgetId * 15 + buttonOffset); buttonView.setOnClickPendingIntent(R.id.button_widget_universal, pendingIntent); remoteViews.addView(R.id.linearlayout_receiver_widget, buttonView); buttonOffset++; } appWidgetManager.updateAppWidget(appWidgetId, remoteViews); // Finally, create the return Intent, set it with the // Activity result, and finish the Activity: Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); setResult(RESULT_OK, resultValue); finish(); } } catch (Exception e) { StatusMessageHandler.showErrorMessage(this, e); } }
From source file:org.opensilk.fuzzyclock.FuzzyWidgetService.java
/** * Creates unique pending intent for given appwidget id * @param id/*from ww w.java 2 s . co m*/ * @return */ private PendingIntent createPendingIntent(int id) { Intent i = new Intent(String.format(Locale.US, "scheduled_update_%d", id), null, mContext, FuzzyWidgetService.class); i.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, id); return PendingIntent.getService(mContext, 0, i, PendingIntent.FLAG_UPDATE_CURRENT); }
From source file:com.farmerbb.taskbar.activity.DashboardActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_PICK_APPWIDGET) { configureWidget(data);//from ww w . ja v a 2 s .c om } else if (requestCode == REQUEST_CREATE_APPWIDGET) { createWidget(data); } } else if (resultCode == RESULT_CANCELED) { if (data != null) { int appWidgetId = data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1); if (appWidgetId != -1) { mAppWidgetHost.deleteAppWidgetId(appWidgetId); } } LocalBroadcastManager.getInstance(this) .sendBroadcast(new Intent("com.farmerbb.taskbar.ADD_WIDGET_COMPLETED")); shouldFinish = true; } }
From source file:ch.fixme.status.Main.java
private void showHsInfo(Intent intent, Bundle savedInstanceState) { // Get hackerspace api url if (intent != null && intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) { mApiUrl = mPrefs.getString(PREF_API_URL_WIDGET + intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID), ParseGeneric.API_DEFAULT); } else if (intent != null && intent.hasExtra(STATE_HS)) { mApiUrl = intent.getStringExtra(STATE_HS); } else {/*from w ww .j av a2 s . com*/ mApiUrl = mPrefs.getString(PREF_API_URL, ParseGeneric.API_DEFAULT); } // Get Data final Bundle data = (Bundle) getLastNonConfigurationInstance(); if (data == null || (savedInstanceState == null && !savedInstanceState.containsKey(STATE_HS))) { getApiTask = new GetApiTask(); getApiTask.execute(mApiUrl); } else { finishApi = true; mResultHs = data.getString(STATE_HS); populateDataHs(); } // Update widget Widget.UpdateAllWidgets(getApplicationContext()); }
From source file:com.farmerbb.taskbar.activity.DashboardActivity.java
private void configureWidget(Intent data) { Bundle extras = data.getExtras();//from w ww. j a v a 2 s. c o m int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1); AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId); if (appWidgetInfo.configure != null) { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE); intent.setComponent(appWidgetInfo.configure); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); startActivityForResult(intent, REQUEST_CREATE_APPWIDGET); shouldFinish = false; } else { createWidget(data); } }
From source file:au.com.wallaceit.reddinator.SubredditSelectActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.subredditselect); // load personal list from saved prefereces, if null use default and save mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(SubredditSelectActivity.this); global = ((GlobalObjects) SubredditSelectActivity.this.getApplicationContext()); // get subreddit list and set adapter subredditList = global.getSubredditManager().getSubredditNames(); subsAdapter = new MySubredditsAdapter(this, subredditList); ListView subListView = (ListView) findViewById(R.id.sublist); subListView.setAdapter(subsAdapter); subListView.setTextFilterEnabled(true); subListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String subreddit = ((TextView) view.findViewById(R.id.subreddit_name)).getText().toString(); global.getSubredditManager().setFeedSubreddit(mAppWidgetId, subreddit); updateFeedAndFinish();//from w w w . j a v a 2 s. c o m //System.out.println(sreddit+" selected"); } }); subsAdapter.sort(new Comparator<String>() { @Override public int compare(String s, String t1) { return s.compareToIgnoreCase(t1); } }); // get multi list and set adapter mMultiAdapter = new MyMultisAdapter(this); ListView multiListView = (ListView) findViewById(R.id.multilist); multiListView.setAdapter(mMultiAdapter); multiListView.setTextFilterEnabled(true); multiListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position == mMultiAdapter.getCount() - 1) { LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.dialog_multi_add, parent, false); final EditText name = (EditText) layout.findViewById(R.id.new_multi_name); AlertDialog.Builder builder = new AlertDialog.Builder(SubredditSelectActivity.this); builder.setTitle("Create A Multi").setView(layout) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (name.getText().toString().equals("")) { Toast.makeText(SubredditSelectActivity.this, "Please enter a name for the multi", Toast.LENGTH_LONG).show(); return; } new SubscriptionEditTask(SubscriptionEditTask.ACTION_MULTI_CREATE) .execute(name.getText().toString()); dialogInterface.dismiss(); } }).show(); } else { JSONObject multiObj = mMultiAdapter.getItem(position); try { String name = multiObj.getString("display_name"); String path = multiObj.getString("path"); global.getSubredditManager().setFeed(mAppWidgetId, name, path, true); updateFeedAndFinish(); } catch (JSONException e) { e.printStackTrace(); Toast.makeText(SubredditSelectActivity.this, "Error setting multi.", Toast.LENGTH_LONG) .show(); } } } }); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { mAppWidgetId = 0; // Id of 4 zeros indicates its the app view, not a widget, that is being updated } else { String action = getIntent().getAction(); widgetFirstTimeSetup = action != null && action.equals("android.appwidget.action.APPWIDGET_CONFIGURE"); } } else { mAppWidgetId = 0; } final ViewPager pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(new SimpleTabsAdapter(new String[] { "My Subreddits", "My Multis" }, new int[] { R.id.sublist, R.id.multilist }, SubredditSelectActivity.this, null)); LinearLayout tabsLayout = (LinearLayout) findViewById(R.id.tab_widget); tabs = new SimpleTabsWidget(SubredditSelectActivity.this, tabsLayout); tabs.setViewPager(pager); addButton = (Button) findViewById(R.id.addsrbutton); addButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(SubredditSelectActivity.this, ViewAllSubredditsActivity.class); startActivityForResult(intent, 1); } }); refreshButton = (Button) findViewById(R.id.refreshloginbutton); refreshButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (global.mRedditData.isLoggedIn()) { if (pager.getCurrentItem() == 1) { refreshMultireddits(); } else { refreshSubreddits(); } } else { global.mRedditData.initiateLogin(SubredditSelectActivity.this); } } }); // sort button sortBtn = (Button) findViewById(R.id.sortselect); String sortTxt = "Sort: " + mSharedPreferences.getString("sort-" + (mAppWidgetId == 0 ? "app" : mAppWidgetId), "hot"); sortBtn.setText(sortTxt); sortBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { showSortDialog(); } }); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } // set theme colors setThemeColors(); GlobalObjects.doShowWelcomeDialog(SubredditSelectActivity.this); }
From source file:de.eidottermihi.rpicheck.widget.OverclockingWidget.java
@Override public void onReceive(Context context, Intent intent) { LoggingHelper.initLogging(context);//ww w .j a v a 2 s . c o m String action = intent.getAction(); LOGGER.debug("Receiving Intent: action={}", action); if (action.equals(ACTION_WIDGET_UPDATE_ONE_MANUAL)) { int widgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (widgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { super.onReceive(context, intent); } else { if (this.deviceDb == null) { this.deviceDb = new DeviceDbHelper(context); } updateAppWidget(context, widgetId, this.deviceDb, false); } } else { super.onReceive(context, intent); } }
From source file:com.shafiq.myfeedle.core.OAuthLogin.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_CANCELED);/*from w ww .j a v a 2s . co m*/ mHttpClient = MyfeedleHttpClient.getThreadSafeClient(getApplicationContext()); mLoadingDialog = new ProgressDialog(this); mLoadingDialog.setMessage(getString(R.string.loading)); mLoadingDialog.setCancelable(true); mLoadingDialog.setOnCancelListener(this); mLoadingDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, getString(android.R.string.cancel), this); Intent intent = getIntent(); if (intent != null) { Bundle extras = intent.getExtras(); if (extras != null) { int service = extras.getInt(Myfeedle.Accounts.SERVICE, Myfeedle.INVALID_SERVICE); mServiceName = Myfeedle.getServiceName(getResources(), service); mWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); mAccountId = extras.getLong(Myfeedle.EXTRA_ACCOUNT_ID, Myfeedle.INVALID_ACCOUNT_ID); mMyfeedleWebView = new MyfeedleWebView(); final ProgressDialog loadingDialog = new ProgressDialog(this); final AsyncTask<String, Void, String> asyncTask = new AsyncTask<String, Void, String>() { @Override protected String doInBackground(String... args) { try { return mMyfeedleOAuth.getAuthUrl(args[0], args[1], args[2], args[3], Boolean.parseBoolean(args[4]), mHttpClient); } catch (OAuthMessageSignerException e) { e.printStackTrace(); } catch (OAuthNotAuthorizedException e) { e.printStackTrace(); } catch (OAuthExpectationFailedException e) { e.printStackTrace(); } catch (OAuthCommunicationException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String url) { if (loadingDialog.isShowing()) loadingDialog.dismiss(); // load the webview if (url != null) { mMyfeedleWebView.open(url); } else { (Toast.makeText(OAuthLogin.this, String.format(getString(R.string.oauth_error), mServiceName), Toast.LENGTH_LONG)).show(); OAuthLogin.this.finish(); } } }; loadingDialog.setMessage(getString(R.string.loading)); loadingDialog.setCancelable(true); loadingDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (!asyncTask.isCancelled()) asyncTask.cancel(true); dialog.cancel(); OAuthLogin.this.finish(); } }); loadingDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (!asyncTask.isCancelled()) asyncTask.cancel(true); dialog.cancel(); OAuthLogin.this.finish(); } }); switch (service) { case TWITTER: mMyfeedleOAuth = new MyfeedleOAuth(TWITTER_KEY, TWITTER_SECRET); asyncTask.execute(String.format(TWITTER_URL_REQUEST, TWITTER_BASE_URL), String.format(TWITTER_URL_ACCESS, TWITTER_BASE_URL), String.format(TWITTER_URL_AUTHORIZE, TWITTER_BASE_URL), TWITTER_CALLBACK.toString(), Boolean.toString(true)); loadingDialog.show(); break; case FACEBOOK: mMyfeedleWebView.open(String.format(FACEBOOK_URL_AUTHORIZE, FACEBOOK_BASE_URL, FACEBOOK_ID, FACEBOOK_CALLBACK.toString())); break; // case MYSPACE: // mMyfeedleOAuth = new MyfeedleOAuth(MYSPACE_KEY, MYSPACE_SECRET); // asyncTask.execute(MYSPACE_URL_REQUEST, MYSPACE_URL_ACCESS, MYSPACE_URL_AUTHORIZE, MYSPACE_CALLBACK.toString(), Boolean.toString(true)); // loadingDialog.show(); // break; case FOURSQUARE: mMyfeedleWebView.open(String.format(FOURSQUARE_URL_AUTHORIZE, FOURSQUARE_KEY, FOURSQUARE_CALLBACK.toString())); break; case LINKEDIN: mMyfeedleOAuth = new MyfeedleOAuth(LINKEDIN_KEY, LINKEDIN_SECRET); asyncTask.execute(LINKEDIN_URL_REQUEST, LINKEDIN_URL_ACCESS, LINKEDIN_URL_AUTHORIZE, LINKEDIN_CALLBACK.toString(), Boolean.toString(true)); loadingDialog.show(); break; case SMS: Cursor c = getContentResolver().query(Accounts.getContentUri(this), new String[] { Accounts._ID }, Accounts.SERVICE + "=?", new String[] { Integer.toString(SMS) }, null); if (c.moveToFirst()) { (Toast.makeText(OAuthLogin.this, "SMS has already been added.", Toast.LENGTH_LONG)).show(); } else { addAccount(getResources().getStringArray(R.array.service_entries)[SMS], null, null, 0, SMS, null); } c.close(); finish(); break; case RSS: // prompt for RSS url final EditText rss_url = new EditText(this); rss_url.setSingleLine(); new AlertDialog.Builder(OAuthLogin.this).setTitle(R.string.rss_url).setView(rss_url) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int which) { // test the url and add if valid, else Toast error mLoadingDialog.show(); (new AsyncTask<String, Void, String>() { String url; @Override protected String doInBackground(String... params) { url = rss_url.getText().toString(); return MyfeedleHttpClient.httpResponse(mHttpClient, new HttpGet(url)); } @Override protected void onPostExecute(String response) { mLoadingDialog.dismiss(); if (response != null) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; try { db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(response)); Document doc = db.parse(is); // test parsing... NodeList nodes = doc.getElementsByTagName(Sitem); if (nodes.getLength() > 0) { // check for an image NodeList images = doc.getElementsByTagName(Simage); if (images.getLength() > 0) { NodeList imageChildren = images.item(0).getChildNodes(); Node n = imageChildren.item(0); if (n.getNodeName().toLowerCase().equals(Surl)) { if (n.hasChildNodes()) { n.getChildNodes().item(0).getNodeValue(); } } } NodeList children = nodes.item(0).getChildNodes(); String date = null; String title = null; String description = null; String link = null; int values_count = 0; for (int child = 0, c2 = children.getLength(); (child < c2) && (values_count < 4); child++) { Node n = children.item(child); if (n.getNodeName().toLowerCase().equals(Spubdate)) { values_count++; if (n.hasChildNodes()) { date = n.getChildNodes().item(0).getNodeValue(); } } else if (n.getNodeName().toLowerCase() .equals(Stitle)) { values_count++; if (n.hasChildNodes()) { title = n.getChildNodes().item(0) .getNodeValue(); } } else if (n.getNodeName().toLowerCase() .equals(Sdescription)) { values_count++; if (n.hasChildNodes()) { StringBuilder sb = new StringBuilder(); NodeList descNodes = n.getChildNodes(); for (int dn = 0, dn2 = descNodes .getLength(); dn < dn2; dn++) { Node descNode = descNodes.item(dn); if (descNode .getNodeType() == Node.TEXT_NODE) { sb.append(descNode.getNodeValue()); } } // strip out the html tags description = sb.toString() .replaceAll("\\<(.|\n)*?>", ""); } } else if (n.getNodeName().toLowerCase() .equals(Slink)) { values_count++; if (n.hasChildNodes()) { link = n.getChildNodes().item(0).getNodeValue(); } } } if (Myfeedle.HasValues( new String[] { title, description, link, date })) { final EditText url_name = new EditText(OAuthLogin.this); url_name.setSingleLine(); new AlertDialog.Builder(OAuthLogin.this) .setTitle(R.string.rss_channel) .setView(url_name) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface dialog1, int which) { addAccount( url_name.getText() .toString(), null, null, 0, RSS, url); dialog1.dismiss(); dialog.dismiss(); finish(); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface dialog1, int which) { dialog1.dismiss(); dialog.dismiss(); finish(); } }) .show(); } else { (Toast.makeText(OAuthLogin.this, "Feed is missing standard fields", Toast.LENGTH_LONG)).show(); } } else { (Toast.makeText(OAuthLogin.this, "Invalid feed", Toast.LENGTH_LONG)).show(); dialog.dismiss(); finish(); } } catch (ParserConfigurationException e) { Log.e(TAG, e.toString()); (Toast.makeText(OAuthLogin.this, "Invalid feed", Toast.LENGTH_LONG)).show(); dialog.dismiss(); finish(); } catch (SAXException e) { Log.e(TAG, e.toString()); (Toast.makeText(OAuthLogin.this, "Invalid feed", Toast.LENGTH_LONG)).show(); dialog.dismiss(); finish(); } catch (IOException e) { Log.e(TAG, e.toString()); (Toast.makeText(OAuthLogin.this, "Invalid feed", Toast.LENGTH_LONG)).show(); dialog.dismiss(); finish(); } } else { (Toast.makeText(OAuthLogin.this, "Invalid URL", Toast.LENGTH_LONG)) .show(); dialog.dismiss(); finish(); } } }).execute(rss_url.getText().toString()); } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); } }).show(); break; // case IDENTICA: // mMyfeedleOAuth = new MyfeedleOAuth(IDENTICA_KEY, IDENTICA_SECRET); // asyncTask.execute(String.format(IDENTICA_URL_REQUEST, IDENTICA_BASE_URL), String.format(IDENTICA_URL_ACCESS, IDENTICA_BASE_URL), String.format(IDENTICA_URL_AUTHORIZE, IDENTICA_BASE_URL), IDENTICA_CALLBACK.toString(), Boolean.toString(true)); // loadingDialog.show(); // break; case GOOGLEPLUS: mMyfeedleWebView.open( String.format(GOOGLEPLUS_AUTHORIZE, GOOGLE_CLIENTID, "urn:ietf:wg:oauth:2.0:oob")); break; // case CHATTER: // mMyfeedleWebView.open(String.format(CHATTER_URL_AUTHORIZE, CHATTER_KEY, CHATTER_CALLBACK.toString())); // break; case PINTEREST: Cursor pinterestAccount = getContentResolver().query(Accounts.getContentUri(this), new String[] { Accounts._ID }, Accounts.SERVICE + "=?", new String[] { Integer.toString(PINTEREST) }, null); if (pinterestAccount.moveToFirst()) { (Toast.makeText(OAuthLogin.this, "Pinterest has already been added.", Toast.LENGTH_LONG)) .show(); } else { (Toast.makeText(OAuthLogin.this, "Pinterest currently allows only public, non-authenticated viewing.", Toast.LENGTH_LONG)).show(); String[] values = getResources().getStringArray(R.array.service_values); String[] entries = getResources().getStringArray(R.array.service_entries); for (int i = 0, l = values.length; i < l; i++) { if (Integer.toString(PINTEREST).equals(values[i])) { addAccount(entries[i], null, null, 0, PINTEREST, null); break; } } } pinterestAccount.close(); finish(); break; default: this.finish(); } } } }
From source file:com.farmerbb.taskbar.activity.DashboardActivity.java
private void createWidget(Intent data) { Intent intent = new Intent("com.farmerbb.taskbar.ADD_WIDGET_COMPLETED"); intent.putExtra("appWidgetId", data.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1)); intent.putExtra("cellId", cellId); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); shouldFinish = true;/*from w w w. j ava 2s. c om*/ }