@Override
  public void handleMessage(Message msg) {
    super.handleMessage(msg);

    OnNewMetadataListener listener = ref.get();
    if (listener == null) {
      return;
    }
    switch (msg.what) {
      case (ACTION_METADATA):
        {
          String streamTitle = (String) msg.obj;
          listener.onNewStreamTitle(mUrlString, streamTitle);
          break;
        }
      case (ACTION_HEADERS):
        {
          Bundle data = msg.getData();
          List<String> name = data.getStringArrayList(IcecastHeader.NAME);
          List<String> desc = data.getStringArrayList(IcecastHeader.DESC);
          List<String> br = data.getStringArrayList(IcecastHeader.BR);
          List<String> genre = data.getStringArrayList(IcecastHeader.GENRE);
          List<String> info = data.getStringArrayList(IcecastHeader.INFO);
          listener.onNewHeaders(mUrlString, name, desc, br, genre, info);
          break;
        }
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) return;
    onInflate(savedInstanceState);
    if (isFinishing()) return;
    Collection<String> groups;
    Collection<String> selected;
    if (savedInstanceState != null) {
      groups = savedInstanceState.getStringArrayList(SAVED_GROUPS);
      selected = savedInstanceState.getStringArrayList(SAVED_SELECTED);
    } else {
      groups = getInitialGroups();
      selected = getInitialSelected();
    }

    listView = getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    listView.setOnItemClickListener(this);
    arrayAdapter =
        new ArrayAdapter<>(
            this, android.R.layout.simple_list_item_multiple_choice, new ArrayList<String>());
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.add_item, listView, false);
    ((TextView) view.findViewById(android.R.id.message)).setText(R.string.group_add);
    listView.addFooterView(view, null, true);
    setListAdapter(arrayAdapter);
    setGroups(groups, selected);
  }
  int queryPurchases(Inventory inv, String itemType) throws JSONException, RemoteException {
    // Query purchases
    logDebug("Querying owned items, item type: " + itemType);
    logDebug("Package name: " + mContext.getPackageName());
    boolean verificationFailed = false;
    String continueToken = null;

    do {
      logDebug("Calling getPurchases with continuation token: " + continueToken);
      Bundle ownedItems =
          mService.getPurchases(3, mContext.getPackageName(), itemType, continueToken);

      int response = getResponseCodeFromBundle(ownedItems);
      logDebug("Owned items response: " + String.valueOf(response));
      if (response != BILLING_RESPONSE_RESULT_OK) {
        logDebug("getPurchases() failed: " + getResponseDesc(response));
        return response;
      }
      if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST)
          || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST)
          || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) {
        logError("Bundle returned from getPurchases() doesn't contain required fields.");
        return IABHELPER_BAD_RESPONSE;
      }

      ArrayList<String> ownedSkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST);
      ArrayList<String> purchaseDataList =
          ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
      ArrayList<String> signatureList =
          ownedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST);

      for (int i = 0; i < purchaseDataList.size(); ++i) {
        String purchaseData = purchaseDataList.get(i);
        String signature = signatureList.get(i);
        String sku = ownedSkus.get(i);
        if (Security.verifyPurchase(mSignatureBase64, purchaseData, signature)) {
          logDebug("Sku is owned: " + sku);
          Purchase purchase = new Purchase(itemType, purchaseData, signature);

          if (TextUtils.isEmpty(purchase.getToken())) {
            logWarn("BUG: empty/null token!");
            logDebug("Purchase data: " + purchaseData);
          }

          // Record ownership and token
          inv.addPurchase(purchase);
        } else {
          logWarn("Purchase signature verification **FAILED**. Not adding item.");
          logDebug("   Purchase data: " + purchaseData);
          logDebug("   Signature: " + signature);
          verificationFailed = true;
        }
      }

      continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
      logDebug("Continuation token: " + continueToken);
    } while (!TextUtils.isEmpty(continueToken));

    return verificationFailed ? IABHELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK;
  }
  @Override
  protected void onRestoreInstanceState(Bundle savedInstanceState) {
    // Retrieve saved strings
    ArrayList<String> savedSiteStrings = savedInstanceState.getStringArrayList("savedSiteText");
    ArrayList<String> savedAccountStrings =
        savedInstanceState.getStringArrayList("savedAccountText");

    boolean firstLaunch = savedInstanceState.getBoolean("firstLaunch");

    // Restore saved user search field input
    searchInputField.setText(savedInstanceState.getString("savedSearchInput"));

    // Add the help card back
    if (firstLaunch) {
      displayHelpCard();
    }

    // Add the cards back
    if (savedSiteStrings != null && savedAccountStrings != null) {
      for (int i = 0; i < Math.max(savedSiteStrings.size(), savedAccountStrings.size()); i++) {
        displayOutput(savedSiteStrings.get(i), savedAccountStrings.get(i));
      }
    }
    super.onRestoreInstanceState(savedInstanceState);
  }
  @Override
  public void restoreState(Parcelable state, ClassLoader loader) {
    if (state != null) {
      Bundle bundle = (Bundle) state;
      bundle.setClassLoader(loader);
      ArrayList<FragmentState> fs = bundle.getParcelableArrayList("states_fragment");
      ArrayList<Bundle> args = bundle.getParcelableArrayList("arg_fragment");
      ArrayList<String> tags = bundle.getStringArrayList("tag_fragment");
      ArrayList<String> classNames = bundle.getStringArrayList("classname_fragment");

      mFragments.clear();
      mFragmentStates.clear();
      mFragmentTags.clear();
      mFragmentClassNames.clear();
      mFragmentArgs.clear();
      if (fs != null) {
        for (int i = 0; i < fs.size(); i++) {
          FragmentState fragmentState = fs.get(i);
          mFragmentStates.add(fragmentState);
          if (fragmentState != null) {
            mFragmentArgs.add(fragmentState.mArguments);
            mFragmentTags.add(fragmentState.mTag);
            mFragmentClassNames.add(fragmentState.mClassName);
          } else {
            mFragmentArgs.add(args.get(i));
            mFragmentTags.add(tags.get(i));
            mFragmentClassNames.add(classNames.get(i));
          }
          mFragments.add(null);
        }
      }
      Iterable<String> keys = bundle.keySet();
      for (String key : keys) {
        if (key.startsWith("f")) {
          int index = Integer.parseInt(key.substring(1));
          Fragment f = null;
          try {
            f = mFragmentManager.getFragment(bundle, key);
          } catch (Throwable ex) {
            ex.printStackTrace();
          }
          if (f != null) {
            f.setMenuVisibility(false);
            mFragments.set(index, f);
            mFragmentArgs.set(index, f.mArguments);
            mFragmentTags.set(index, f.mTag);
            mFragmentClassNames.set(index, f.getClass().getName());
          } else {
            Log.w(TAG, "Bad fragment at key " + key);
          }
        }
      }
      // If restore will change
      notifyDataSetChanged();
    }
  }
 public void onCreate(Bundle paramBundle)
 {
   int i = 1;
   super.onCreate(paramBundle);
   setHasOptionsMenu(i);
   Bundle localBundle = getArguments();
   this.mUserId = localBundle.getLong("user_id", -1L);
   this.mFlurryEventSource = "Profile: Tab 1";
   this.mFlurryFollowEventSource = localBundle.getString("event_source");
   this.mTakeFocus = localBundle.getBoolean("take_focus", false);
   if (this.mTakeFocus)
     setFocused(i);
   this.mAppSessionListener = new ProfileListener();
   this.mPopupWindow = new PopupWindow(getActivity(), null, 2130772013);
   if (paramBundle != null)
   {
     this.mCurrentTab = paramBundle.getInt("state_tab");
     if (paramBundle.containsKey("stated_header_added"))
       this.mHeaderAdded = paramBundle.getBoolean("stated_header_added");
     this.mCursorQuerySizePosts = Util.getNextCursorSize(0);
     this.mCursorQuerySizeLikes = Util.getNextCursorSize(0);
     showSadface(false);
     this.mRepostsEnabled = i;
     if (this.mUser != null)
       this.mUser.repostsEnabled = i;
     if (localBundle.getStringArrayList("vanity_url") == null)
       break label212;
     this.mAppController.fetchUserId(localBundle.getStringArrayList("vanity_url"));
   }
   label212: 
   while (this.mUserId <= 0L)
   {
     return;
     this.mCurrentTab = i;
     this.mHeaderAdded = false;
     break;
   }
   if (this.mUserId == this.mAppController.getActiveId());
   while (true)
   {
     this.mIsMe = i;
     if (this.mIsMe)
       break;
     this.mAppController.getBlockedUsers();
     return;
     i = 0;
   }
 }
 protected void initParans() {
   Bundle extra = getArguments();
   if (extra != null) {
     position = extra.getInt(POSITION);
     convertData(extra.getStringArrayList(LIST_STRING));
   }
 }
        @Override
        public void onResults(Bundle results) {
          lawg.d("[RecognitionListener] onResults()");
          ArrayList<String> resultsArray =
              results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
          float[] confidenceScores = results.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES);
          StringBuilder sb = new StringBuilder();
          for (int i = 0; i < resultsArray.size(); i++) {
            String word = resultsArray.get(i);
            sb.append(word);
            if (i != resultsArray.size() - 1) sb.append(", ");
            if (TextUtils.equals(word.toLowerCase(), "cheese")) {
              captureStillPicture();
            }
          }
          lawg.d("Words detected: \n" + sb.toString());
          mDisplayText1.setText(sb.toString());

          for (int i = 0; i < resultsArray.size(); i++) {
            String word = resultsArray.get(i);
            addFloatingWord(word, confidenceScores[i]);
          }

          // repeat listen
          startListening();
        }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mRepository = (Repository) getArguments().getSerializable("repository");
    mSelectedRef = getArguments().getString("ref");

    if (savedInstanceState != null) {
      for (String entry : savedInstanceState.getStringArrayList(STATE_KEY_DIR_STACK)) {
        mDirStack.add(entry);
      }

      int prefixLen = STATE_KEY_CONTENT_CACHE_PREFIX.length();
      for (String key : savedInstanceState.keySet()) {
        if (key.startsWith(STATE_KEY_CONTENT_CACHE_PREFIX)) {
          String cacheKey = key.substring(prefixLen);
          if (cacheKey.equals("/")) {
            cacheKey = null;
          }
          mContentCache.put(
              cacheKey, (ArrayList<RepositoryContents>) savedInstanceState.getSerializable(key));
        }
      }
    } else {
      mDirStack.push("");
    }
  }
    @Override
    public void onResults(Bundle results) {

      ((ImageView) findViewById(R.id.mic)).setImageDrawable(getDrawable(R.drawable.mic_disabled));
      Log.i(LOG_TAG, "onResults");
      ArrayList<String> matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);

      Boolean hit = false;
      for (String r : matches) {
        hit =
            current
                .getCurrentScriptEntry()
                .getTextToCheck()
                .toLowerCase()
                .replaceAll("[^a-zA-Z0-9]", "")
                .equals(r.toLowerCase().replaceAll("[^a-zA-Z0-9]", ""));
        if (hit) {
          break;
        }
      }

      if (hit) {
        SharedPreferences sharedPreferences =
            PreferenceManager.getDefaultSharedPreferences(PracticeActivity.this);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putInt(
            "correct_sentence_count", sharedPreferences.getInt("correct_sentence_count", 0) + 1);
        editor.commit();
        if (current.hasMoreScripts()) {
          current.selectNextScript();
        }
      }
      current.setShouldRunScript(true);
      runScriptEntry(); // user should not stop in the middle of the lesson.
    }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_invite_contacts_confirm);
    // Get data from intent
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      inviteCodeText = extras.getString("inviteCodeText");
      arraySelectedUsersIds = extras.getStringArrayList("arraySelectedUsersIds");
    }

    String escapedUsername = TextUtils.htmlEncode(AppCAP.getLoggedInUserNickname());

    Resources res = getResources();
    String text =
        String.format(res.getString(R.string.activity_invite_confirm_header), escapedUsername);
    CharSequence styledText = Html.fromHtml(text);
    title = styledText.toString();
    ((CustomFontView) findViewById(R.id.confirm_header)).setText(styledText);
    text =
        String.format(
            res.getString(R.string.activity_invite_confirm_content),
            escapedUsername,
            inviteCodeText);
    styledText = Html.fromHtml(text);
    messageContent = styledText.toString();
    ((CustomFontView) findViewById(R.id.confirm_content)).setText(styledText);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);

    setContentView(R.layout.calculation_editor);
    setTitle(R.string.new_calculation);

    titleField = (EditText) findViewById(R.id.calculation_title);
    currencyField = (Spinner) findViewById(R.id.calculation_currency);
    personList = (LinearLayout) findViewById(R.id.person_list);

    CurrencySpinnerAdapter adapter = new CurrencySpinnerAdapter(this);
    int selected = adapter.findItem(getDefaultCurrency());
    currencyField.setAdapter(adapter);
    currencyField.setSelection(selected);

    if (savedInstanceState != null) {
      for (String personName : savedInstanceState.getStringArrayList("personNames")) {
        PersonView view = addPersonRow();
        view.nameField.setText(personName);
      }
    }
    createOrDeletePersonRows();
  }
Beispiel #13
0
  @Override
  public void queryPurchases(Preferences pref) {
    this.pref = pref;
    try {
      Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
      int response = ownedItems.getInt("RESPONSE_CODE");
      if (response == 0) {
        ArrayList<String> ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

        for (int i = 0; i < ownedSkus.size(); i++) {
          String name = null;

          if (ownedSkus.get(i).equals("ryan")) name = "Ryan";
          else if (ownedSkus.get(i).equals("ash")) name = "Ash";
          else if (ownedSkus.get(i).equals("rob")) name = "Rob";
          else if (ownedSkus.get(i).equals("battle_cat")) name = "BattleCat";
          else if (ownedSkus.get(i).equals("xorp")) name = "Xorp";
          else if (ownedSkus.get(i).equals("rootsworth")) name = "Rootsworth";
          else if (ownedSkus.get(i).equals("snap")) name = "Snap";
          else if (ownedSkus.get(i).equals("metatron")) name = "Metatron";
          else if (ownedSkus.get(i).equals("abaddon")) name = "Abaddon";

          pref.putBoolean(name, true);
          pref.flush();
        }
      }
    } catch (RemoteException e) {
      e.printStackTrace();
    }
  }
Beispiel #14
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    switch (getCurrentState(savedInstanceState)) {
      case FIRST_TIME_START:
        bean = ((IUserInfo) getActivity()).getUser();
        handler.postDelayed(
            new Runnable() {
              @Override
              public void run() {
                refresh();
              }
            },
            1000);
        break;
      case SCREEN_ROTATE:
        // nothing

        break;
      case ACTIVITY_DESTROY_AND_CREATE:
        topicList = savedInstanceState.getStringArrayList("topicList");
        bean = (UserBean) savedInstanceState.getParcelable("bean");
        break;
    }

    setValue();
  }
Beispiel #15
0
  @Click(R.id.get_purchases_button)
  public void getPurchases(View v) {
    try {
      Bundle ownedItems;
      ownedItems = billingService.getPurchases(apiLevel, getPackageName(), "inapp", null);

      if (ownedItems.getInt("RESPONSE_CODE") != 0) {
        logView.append("getPurchases Fail\n");
        return;
      }

      ArrayList<String> purchaseDataList =
          ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
      if (purchaseDataList.size() == 0) {
        logView.append("getPurchases empty\n");
      }

      for (String purchaseData : purchaseDataList) {
        logView.append("getPurchases: " + purchaseData + "\n");
      }
    } catch (RemoteException e) {
      String msg = "getPurchases: " + e.getMessage() + "\n";
      logView.append(msg);

      Log.e(TAG, msg);
      e.printStackTrace();
    }
  }
  @Override
  protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    if (null != savedInstanceState) {
      // 地理位置
      if (savedInstanceState.containsKey("location")) {
        locationString = savedInstanceState.getString("location");
        if (null == locationString || locationString.length() < 1) {
          choiceLocationTextView.setText("告诉我你在哪里....");
        } else {
          choiceLocationTextView.setText(locationString);
        }
      }
      // 内容
      if (savedInstanceState.containsKey("content")) {
        contentEditText.setText(savedInstanceState.getString("content"));
      }
      // 图片
      if (savedInstanceState.containsKey("images")) {
        ArrayList<String> imageList = savedInstanceState.getStringArrayList("images");
        for (String string : imageList) {
          addNewsImageView(string);
        }
      }

      // 最后拍的
      if (savedInstanceState.containsKey("tmpImageName")) {
        tmpImageName = savedInstanceState.getString("tmpImageName");
      }
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_map);
    /* ActionBar items */
    try {
      getActionBar().setHomeButtonEnabled(true);
      getActionBar().setDisplayHomeAsUpEnabled(true);
    } catch (NullPointerException e) {
      Toast.makeText(this, "Something went wrong. Try again.", Toast.LENGTH_SHORT).show();
    }
    ICON_HEIGHT = getResources().getDimensionPixelSize(R.dimen.mapIconHeight);

    // Toast.makeText(this, "onCreate", Toast.LENGTH_SHORT).show();
    FragmentManager fm = getFragmentManager();
    /* Obtain a reference to the UI element */
    MapFragment frag = (MapFragment) fm.findFragmentById(R.id.overworld);

    /* Obtain a reference to GoogleMap object associated with the fragment */
    worldMap = frag.getMap();
    mapClient = new LocationClient(this, this, this);
    mapClient = new LocationClient(this, this, this);
    ePrefs = PreferenceManager.getDefaultSharedPreferences(this);
    Boolean infoShown = ePrefs.getBoolean(infoDialoguePref, false);

    if (!infoShown) {
      String title = "Map Gallery";
      String text = getResources().getString(R.string.mapInfo);
      new AlertDialog.Builder(this)
          .setTitle(title)
          .setMessage(text)
          .setPositiveButton(
              android.R.string.ok,
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                  dialog.dismiss();
                }
              })
          .show();
      SharedPreferences.Editor editor = ePrefs.edit();
      editor.putBoolean(infoDialoguePref, true);
      editor.commit();
    }

    if (savedInstanceState != null) {
      zoomlevel = savedInstanceState.getFloat("zoom");
      loaded = savedInstanceState.getBoolean("loaded");
      currentLat = savedInstanceState.getDouble("lat");
      currentLng = savedInstanceState.getDouble("lng");
      fileToReload = savedInstanceState.getString("redo");

      dataRestorer =
          new DataRestorer(
              savedInstanceState.getStringArrayList("allFiles"),
              savedInstanceState.getParcelableArrayList("allBitmaps"),
              savedInstanceState.getFloatArray("allLat"),
              savedInstanceState.getFloatArray("allLng"));
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    ActionBarUtil.compatibleDeviceWithSB(this);
    requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    ActionBarUtil.setXiaomiFilterDisplayOptions(getSupportActionBar(), false);
    getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_trans));
    Bundle extras = getIntent().getExtras();
    title = extras.getString("title");
    getSupportActionBar().setTitle(title);
    aid = extras.getInt("aid");
    mList = extras.getStringArrayList(EXTRA_IMAGES);
    int index = extras.getInt(EXTRA_INDEX, 0);
    MobclickAgent.onEvent(this, "view_big_pic");
    setContentView(R.layout.activity_images);

    indexText = (TextView) findViewById(R.id.index);
    if (ActionBarUtil.hasSB()
        && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
      setInfoBottomMargin(
          getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height));
    }
    pager = (MyViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImageAdapter(getSupportFragmentManager(), mList));
    pager.setOffscreenPageLimit(1);
    pager.setOnPageChangeListener(this);
    pager.setCurrentItem(index);
    onPageSelected(index);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    savedInstanceState = getIntent().getExtras().getBundle("bundle");
    this.tab = savedInstanceState.getStringArrayList("list");
    this.pos = savedInstanceState.getInt("position");
    setContentView(R.layout.activity_town_details);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar2);
    setSupportActionBar(toolbar);

    ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);

    refresh();
    List<TownDetailsFragment> list = new ArrayList<TownDetailsFragment>();
    for (int i = 0; i < this.tab.size(); i++) {
      list.add(TownDetailsFragment.newInstance(this.tab.get(i)));
    }

    MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager(), list);
    this.receiverData = new RefreshAllReceiver(pagerAdapter, this.tab);
    this.receiverIcon = new RefreshIconReceiver(pagerAdapter);
    this.filtreData = new IntentFilter("com.intent.action.ALLRECEIVE");
    this.filtreIcon = new IntentFilter("com.intent.action.ICON_UPDATE");

    this.registerReceiver(receiverData, filtreData);
    this.registerReceiver(receiverIcon, filtreIcon);

    refresh();
    ViewPager view = (ViewPager) findViewById(R.id.viewpager);
    view.setAdapter(pagerAdapter);
    view.setCurrentItem(pos);
  }
Beispiel #20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mToolbar = (Toolbar) findViewById(R.id.tbToolbar_AM);
    setSupportActionBar(mToolbar);

    final RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.rvList_AM);
    setLayoutManager(mRecyclerView);

    if (savedInstanceState == null) {
      GetUriTask getUriTask =
          new GetUriTask() {
            @Override
            protected void onPostExecute(ArrayList<String> urls) {
              mData.addAll(urls);

              mAdapter = new ImageRecyclerAdapter(MainActivity.this, urls);
              mRecyclerView.setAdapter(mAdapter);
            }
          };
      getUriTask.execute(URL);
    } else {
      mData = savedInstanceState.getStringArrayList(KEY);
      mAdapter = new ImageRecyclerAdapter(this, mData);
      mRecyclerView.setAdapter(mAdapter);
    }
  }
Beispiel #21
0
  int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(ITEM_TYPE_INAPP));
    if (moreSkus != null) skuList.addAll(moreSkus);

    if (skuList.size() == 0) {
      return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = connection.getSkuDetails(querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
      int response = getResponseCodeFromBundle(skuDetails);
      if (response != BILLING_RESPONSE_RESULT_OK) {
        return response;
      } else {
        return HELPER_BAD_RESPONSE;
      }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
      SkuDetails d = new SkuDetails(thisResponse);
      inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
  }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   Bundle extras = intent.getExtras();
   switch (requestCode) {
     case ACTIVITY_FRIEND_LIST_SHOW:
       ArrayList<String> flist;
       Log.d("BuganizerParseEdit", "onActivityResult:ACTIVITY_FRIEND_LIST_SHOW");
       flist = extras.getStringArrayList(BuganizerParseConstants.friendslist);
       for (String f : flist) {
         Log.d("BuganizerParseEdit", "Adding user to ACL " + f);
         if (acl == null) {
           Log.d("BuganizerParseEdit", "Creating ACL");
           acl = new ParseACL();
         }
         acl.setWriteAccess(f, true);
         acl.setReadAccess(f, true);
       }
       if ((acl != null) && (flist.size() > 0)) {
         Log.d("BuganizerParseEdit", "Saving object with ACL in background");
         pObject.setACL(acl);
         pObject.saveInBackground();
       }
       break;
   }
 }
  /** {@inheritDoc}. */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "BEGIN onCreate.");

    setContentView(R.layout.privacy_list);
    registerForContextMenu(this.getListView());

    mHandler = new Handler();

    if (savedInstanceState != null && !savedInstanceState.isEmpty()) {
      mPrivacyListNames.addAll(
          savedInstanceState.getStringArrayList(SAVED_INSTANCE_KEY_PRIVACY_LISTS));
    }

    mAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mPrivacyListNames);
    setListAdapter(mAdapter);

    bindService(SERVICE_INTENT, mConn, BIND_AUTO_CREATE);

    mPrivacyListListener = new PrivacyListListener();
    this.registerReceiver(
        mBroadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));

    Log.d(TAG, "END onCreate.");
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 获取传递的特殊数据
    Bundle bundle = getIntent().getExtras();
    lists_note = bundle.getStringArrayList("lists_note");

    list_infos = bundle.getParcelableArrayList("list_infos");

    instructions_value = bundle.getString("instructions_value");
    instructions_date = bundle.getString("date");
    instructions_person = bundle.getString("maker");

    patient_info_id = bundle.getInt("patient_info_id");
    user_auth_id = bundle.getInt("user_auth_id");
    position = bundle.getInt("position");
    main_position = bundle.getInt("main_position");
    menu_lib_id = bundle.getString("menu_lib_id");

    indexTextName = bundle.getString("indexTextName");

    initData();
    initListener();

    // 网络返回数据后得到通知刷新View
    handler =
        new Handler() {
          @Override
          public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
              case 1:
                // progressBar.setVisibility(View.GONE);
                if (200 == create_code) {
                  // 发广播
                  Intent intent = new Intent(TableChildInfoActivity.ACTION_INTENT_TABLE_ADD);
                  intent.putExtra("spinner_value", spinner_value);
                  L.d("aa", "sos--create-----spinner_value-------------------" + spinner_value);
                  sendBroadcast(intent);
                  finish();
                  ShowToast.Short(getString(R.string.msg_save_success));
                } else if (200 == update_code) {
                  // 发广播
                  Intent intent1 = new Intent(TableChildInfoActivity.ACTION_INTENT_TABLE_EDIT);
                  intent1.putExtra("spinner_value", spinner_value);
                  sendBroadcast(intent1);
                  finish();
                  ShowToast.Short(getString(R.string.msg_update_success));
                } else if (100 == create_code || 500 == create_code) {
                  ShowToast.Short(getString(R.string.msg_save_fail));
                } else if (100 == update_code || 500 == create_code) {
                  ShowToast.Short(getString(R.string.msg_update_fail));
                }
                break;
            }
          }
        };
  }
 private void ensureControlCategories() {
   if (mControlCategories == null) {
     mControlCategories = mBundle.getStringArrayList(KEY_CONTROL_CATEGORIES);
     if (mControlCategories == null || mControlCategories.isEmpty()) {
       mControlCategories = Collections.<String>emptyList();
     }
   }
 }
Beispiel #26
0
 @Override
 public void onResults(Bundle results) {
   if (recognitionCallback != null)
     recognitionCallback.onRecognitionDone(
         results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION).get(0));
   recognitionCallback = null;
   exceptionCallback = null;
 }
  public void onPartialResults(Bundle partialResults) {
    ArrayList<String> nbest =
        partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    if (nbest.size() > 0) {
      // print("~临时识别结果:" + Arrays.toString(nbest.toArray(new
      // String[0])));

    }
  }
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.selectdistrict_fragment, container, false);

    district = (Spinner) v.findViewById(R.id.district);
    back = (Button) v.findViewById(R.id.back);
    next = (Button) v.findViewById(R.id.next);

    Bundle bundle = getArguments();
    list = bundle.getStringArrayList("district");
    pcode = bundle.getStringArrayList("pcode");

    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, list);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    district.setAdapter(adapter);

    activity = (ChoseLocationActivity) getActivity();

    back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.select_state.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
            activity.select_district.setAlpha((float) 0.25);
            activity.fragmentManager.popBackStack();
            activity.fragement_state = "state";
          }
        });

    next.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            int i = district.getSelectedItemPosition();
            activity.district_selected(
                district.getSelectedItem().toString(), pcode.get(i).toString());
          }
        });

    return v;
  }
  @Override
  public void onViewCreated(View v, @Nullable Bundle savedInstanceState) {
    mImojiIv = (ImageView) v.findViewById(R.id.iv_imoji);
    mTagEditor = v.findViewById(R.id.tag_editor);
    mTagEditor.setBackgroundDrawable(createTagDrawable());
    mTagGrid = (GridLayout) v.findViewById(R.id.gl_tagbox);
    mTaggerEt = (EditText) v.findViewById(R.id.et_tag);
    mTaggerEt.setOnEditorActionListener(mKeyActionListener);
    mUploadButton = (ImageButton) v.findViewById(R.id.ib_upload);
    mUploadButton.setOnClickListener(mOnDoneClickListener);
    mProgress = (ProgressBar) v.findViewById(R.id.imoji_progress);

    mToolbar = (Toolbar) v.findViewById(R.id.imoji_toolbar);
    mToolbar.setNavigationIcon(R.drawable.create_back);
    mToolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (isResumed()) {
              getFragmentManager().popBackStack();
              mInputMethodManager.hideSoftInputFromWindow(
                  mTaggerEt.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            }
          }
        });

    mClearInputBt = (ImageButton) v.findViewById(R.id.ib_cancel);
    mClearInputBt.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mTaggerEt != null) {
              mTaggerEt.getText().clear();
            }
          }
        });

    View toolbarScrim = v.findViewById(R.id.imoji_toolbar_scrim);
    if (Build.VERSION.SDK_INT >= 16) {
      toolbarScrim.setBackground(
          ScrimUtil.makeCubicGradientScrimDrawable(0x66000000, 8, Gravity.TOP));
    } else {
      toolbarScrim.setBackgroundDrawable(
          ScrimUtil.makeCubicGradientScrimDrawable(0x66000000, 8, Gravity.TOP));
    }

    if (savedInstanceState != null) {
      List<String> tags = savedInstanceState.getStringArrayList(TAGS_BUNDLE_ARG_KEY);
      for (String tag : tags) {
        addTagChip(tag);
      }

      mProgress.setVisibility(
          savedInstanceState.getBoolean(IS_PROCESSING_BUNDLE_ARG_KEY) ? View.VISIBLE : View.GONE);
    }
  }
Beispiel #30
0
 public void onResults(Bundle results) {
   String str = new String();
   Log.d(TAG, "onResults " + results);
   ArrayList<String> data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
   for (int i = 0; i < data.size(); i++) {
     Log.d(TAG, "result " + data.get(i));
     str += data.get(i);
   }
   mText.setText("results: " + String.valueOf(data.size()));
 }