// NOTE: Implement any IChildProcessService methods here.
 @Override
 public int setupConnection(Bundle args, IChildProcessCallback callback) {
   mCallback = callback;
   // Required to unparcel FileDescriptorInfo.
   args.setClassLoader(getClassLoader());
   synchronized (mMainThread) {
     // Allow the command line to be set via bind() intent or setupConnection, but
     // the FD can only be transferred here.
     if (mCommandLineParams == null) {
       mCommandLineParams = args.getStringArray(ChildProcessConnection.EXTRA_COMMAND_LINE);
     }
     // We must have received the command line by now
     assert mCommandLineParams != null;
     mCpuCount = args.getInt(ChildProcessConnection.EXTRA_CPU_COUNT);
     mCpuFeatures = args.getLong(ChildProcessConnection.EXTRA_CPU_FEATURES);
     assert mCpuCount > 0;
     Parcelable[] fdInfosAsParcelable =
         args.getParcelableArray(ChildProcessConnection.EXTRA_FILES);
     // For why this arraycopy is necessary:
     // http://stackoverflow.com/questions/8745893/i-dont-get-why-this-classcastexception-occurs
     mFdInfos = new FileDescriptorInfo[fdInfosAsParcelable.length];
     System.arraycopy(fdInfosAsParcelable, 0, mFdInfos, 0, fdInfosAsParcelable.length);
     Bundle sharedRelros = args.getBundle(Linker.EXTRA_LINKER_SHARED_RELROS);
     if (sharedRelros != null) {
       Linker.getInstance().useSharedRelros(sharedRelros);
       sharedRelros = null;
     }
     mMainThread.notifyAll();
   }
   return Process.myPid();
 }
Exemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.theater);

    gridview = (GridView) findViewById(R.id.gridview);

    Bundle b = this.getIntent().getExtras();

    th_name = b.getStringArray("th_name");
    lat = b.getDoubleArray("lat");
    lng = b.getDoubleArray("lng");
    address = b.getStringArray("address");
    mv_time = b.getStringArray("mv_time");
    wh = b.getString("wh");
    setTitle(wh);
    th_distance = new String[address.length];
    Wm = th_name.length;
    for (int a = 0; a < Wm; a++) {
      Pois.add(new Poi(th_name[a], lat[a], lng[a], address[a], mv_time[a]));
    }
    // 取得定位權限
    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mLocationManager.requestLocationUpdates(
        LocationManager.NETWORK_PROVIDER, 0, 10000.0f, LocationChange);

    // Mv_find fl = new Mv_find();
    // fl.start();

    // 按下按鈕後讀取我的位置,定位抓取方式為網路讀取(若欲以GPS為定位抓取方式則更改成LocationManager.GPS_PROVIDER),最後則帶入定位更新Listener。

    // 建立物件,並放入List裡 (建立物件需帶入名稱、緯度、經度)
    /*
    Pois.add(new Poi("台北車站" , 25.04661 , 121.5168 ));
     	Pois.add(new Poi("台中車站" , 24.13682 , 120.6850 ));
     	Pois.add(new Poi("台北101" , 25.03362 , 121.56500 ));
     	Pois.add(new Poi("高雄85大樓" , 22.61177 , 120.30031 ));
     	Pois.add(new Poi("九份老街" , 25.10988 , 121.84519 ));*/

    gridview.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

            Intent intent = new Intent();

            Bundle b = new Bundle();
            b.putString("address1", String.valueOf(Pois.get(arg2).getLatitude()));
            b.putString("address2", String.valueOf(Pois.get(arg2).getLongitude()));
            b.putString("theater_name", Pois.get(arg2).getName());
            b.putString("theater", Pois.get(arg2).getaddress());
            intent.putExtras(b);
            intent.setClass(Movie_th2.this, find_theater.class);
            startActivity(intent);
          }
        });
    // 將字串 list 回傳的 JSON 透過解析後存到 values 陣列並傳給 listView 作清單的顯示
    gridview.setAdapter(adapter);
  }
Exemplo n.º 3
0
  @Override
  public boolean handleMessage(Message msg) {
    Bundle date;
    date = msg.getData();
    String chargerValu;
    String chargerEle;
    chargerEle = date.getStringArray("chargerinfo")[0];
    chargerValu = date.getStringArray("chargerinfo")[1];

    String s1 = "";
    s1 += getString(R.string.charger_ma) + chargerEle;
    s1 += "\n";
    s1 += getString(R.string.charger_v) + chargerValu;
    s1 += "\n";
    Log.e("leihai", " ___ > " + chargerEle);
    if (!chargerEle.equals("ERROR")) {

      if (Integer.parseInt(chargerEle) < 100) {
        s1 += "(" + getString(R.string.abnormal_value) + ")";
        s1 += "\n";
        mChargerTest = false;

      } else {
        mChargerTest = true;
      }
    }
    if (mChargerTest && mBatteryTest) {
      result = getString(R.string.success);
      btn_success.setEnabled(true);
    } else result = getString(R.string.fail);
    s1 += "\n";
    s1 += result;
    tv_chargerinfo.setText(s1);
    return false;
  }
  @Override
  public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle args = getArguments();
    if (args != null) {
      mPlace = args.getStringArray(ARG_PLACE);
      mPlayers = args.getStringArray(ARG_PLAYERS);
      mDurations = args.getStringArray(ARG_DURATION);
      mWins = args.getStringArray(ARG_WINS);
    }

    setCancelable(false);

    mAlarm =
        new AlarmHandler(
            new AlarmHandler.AlarmListener() {
              @Override
              public void alarm(int id) {
                mCloseTextView.setEnabled(true);
                setCancelable(true);
              }
            });
    mAlarm.setAlarm(CLOSE_DELAY, 0);
  }
Exemplo n.º 5
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    that = this;

    final ActionBar actionBar = getActionBar();
    actionBar.setCustomView(R.layout.actionbar_profiler_audio);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.color.black));

    if (savedInstanceState == null) {
      Bundle extras = getIntent().getExtras();
      imageUrl = extras.getString("image_url");
      profileName = extras.getString("profile_name");
      identityProfileId = extras.getString("identity_profile_id");
      firstName = extras.getString("first_name");
      lastName = extras.getString("last_name");
      userIdentityProfileId = extras.getString("user_identity_profile_id");
      useDefault = extras.getBoolean("use_default");
    }

    Bundle extras = getIntent().getExtras();
    audioFileName = extras.getStringArray("audio_file_name");
    fileName = extras.getStringArray("file_name");
    fileLocation = extras.getStringArray("file_location");
    audioDescription = extras.getStringArray("audio_description");

    setListAdapter(new ProfilerAudioAdapter(this, audioFileName, fileName, audioDescription));
  }
Exemplo n.º 6
0
  @Override
  public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMyLocationEnabled(true);

    Bundle extras = getIntent().getExtras();
    float[] lats = {}, lngs = {};
    String[] titles = {}, snippets = {};
    int[] beers = {};

    if (null != extras) {
      lats = extras.getFloatArray("Latitudes");
      lngs = extras.getFloatArray("Longitudes");
      titles = extras.getStringArray("Titles");
      snippets = extras.getStringArray("Snippets");
      beers = extras.getIntArray("Beers");
    }
    googleMap.setInfoWindowAdapter(new CustomInfoWindowAdapter());

    LatLng ll = null;
    for (int i = 0; i < titles.length; i++) {
      ll = new LatLng(lats[i], lngs[i]);

      MarkerOptions mark = new MarkerOptions().position(ll).title(titles[i]).snippet(snippets[i]);

      // Other color if beer has been drunk.
      // The argument to defaultMarker() takes a float between 0-360.0,
      // check BitmapDescriptorFactory.HUE_*.
      // It is possible to create a BitmapDescriptor from drawables etc.
      BitmapDescriptor icon;
      if (i < beers.length && 0 < beers[i]) {
        icon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN);
      } else {
        icon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED);
      }
      mark.icon(icon);

      // Add a marker and set the number of beers drunk
      Marker marker = mMap.addMarker(mark);
      beerMap.put(marker, (beers.length > i ? beers[i] : 0));
    }

    /* Add propellern */
    BitmapDrawable bd = (BitmapDrawable) getResources().getDrawable(R.drawable.proppeller);
    Bitmap b = bd.getBitmap();
    Bitmap bhalfsize = Bitmap.createScaledBitmap(b, b.getWidth() / 2, b.getHeight() / 2, false);
    MarkerOptions propellern =
        new MarkerOptions()
            .position(PROPELLERN)
            .icon(BitmapDescriptorFactory.fromBitmap(bhalfsize));
    mMap.addMarker(propellern);

    /* See zoom */
    if (null == ll || 1 < titles.length) {
      // Zoom from far 2.0 (zoomed out) to close 21.0 (zoomed in)
      mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(PROPELLERN, 12.2f));
    } else {
      mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 12.2f));
    }
  }
Exemplo n.º 7
0
    @Override
    protected void onPostExecute(Bundle result) {
      if (!handleRequestResult(
          result, REQUEST_GET_FRIENDS, result.getStringArray(RESULT_GET_FRIENDS_ID))) return;

      ((OnRequestGetFriendsCompleteListener) mLocalListeners.get(REQUEST_GET_FRIENDS))
          .onGetFriendsIdComplete(getID(), result.getStringArray(RESULT_GET_FRIENDS_ID));
      ArrayList<SocialPerson> socialPersons = result.getParcelableArrayList(RESULT_GET_FRIENDS);
      ((OnRequestGetFriendsCompleteListener) mLocalListeners.get(REQUEST_GET_FRIENDS))
          .onGetFriendsComplete(getID(), socialPersons);
    }
Exemplo n.º 8
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.appDeck = this.loader.appDeck;
    // currentPageUrl = getArguments().getString("absoluteURL");
    // this.screenConfiguration = this.appDeck.config.getConfiguration(currentPageUrl);

    Bundle args = getArguments();

    bgcolor = args.getString("bgcolor");
    startIndex = args.getInt("startIndex");
    // nbPhoto = args.getInt("nbPhoto");
    url = args.getStringArray("url");
    thumbnail = args.getStringArray("thumbnail");
    caption = args.getStringArray("caption");

    currentPageUrl = args.getString("parentUrl", null);

    // setHasOptionsMenu(true);
    self = this;
    // shouldRenderActionBar = true;

    menuItemPrevious =
        new PageMenuItem(
            loader.getResources().getString(R.string.previous),
            "!previous",
            "button",
            "photobrowser:previous",
            null,
            null,
            this);
    menuItemNext =
        new PageMenuItem(
            loader.getResources().getString(R.string.next),
            "!next",
            "button",
            "photobrowser:next",
            null,
            null,
            this);
    menuItemShare =
        new PageMenuItem(
            loader.getResources().getString(R.string.action),
            "!action",
            "button",
            "photobrowser:share",
            null,
            null,
            this);

    menuItems = new PageMenuItem[] {menuItemPrevious, menuItemNext, menuItemShare};
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_pesel);

    Bundle extras = getIntent().getExtras();
    elements = null;
    if (extras != null) {
      elements = extras.getStringArray("pesels");
    } else {
      Log.d("error", "Problem with delievered argument between activities");
      return;
    }

    ListView listPesels = (ListView) findViewById(R.id.listView1);
    ArrayAdapter<String> adapter_listy =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, elements);
    listPesels.setAdapter(adapter_listy);
    listPesels.setOnItemClickListener(
        new OnItemClickListener() {

          public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) {
            copyToClipboard4("" + elements[pos]);

            Toast toast =
                Toast.makeText(
                    getApplicationContext(),
                    "Skopiowano do schowka: " + elements[pos],
                    Toast.LENGTH_LONG);
            toast.show();
          }
        });
  }
Exemplo n.º 10
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_grid);

    Bundle bundle = getIntent().getExtras();
    imageUrls = bundle.getStringArray(Extra.IMAGES);

    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_stub)
            .showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    listView = (GridView) findViewById(R.id.gridview);
    ((GridView) listView).setAdapter(new ImageAdapter());
    listView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
          }
        });
  }
  /**
   * doDbUpgrade is triggered by someone calling the static method "processPackageReplacedBroadcast"
   *
   * @param cps - a String array containing all the ContentProvider authorities to upgrade
   * @return
   */
  protected boolean doDbUpgrade(final Intent intent) {
    boolean success = false;
    try {
      // First set the global lock on the Base ContentProvider
      LogUtils.i(LogUtils.TAG, "Package has been replaced, perform database upgrades...");
      // PIMContentProviderBase.setMaintenanceLock(cpLock, true);

      // Get the list of content authorities from the Intent extras
      Bundle extras = intent.getExtras();
      String[] cps = extras.getStringArray(CP_LIST);
      if (cps == null) {
        // Nothing to upgrade?
        return success;
      }
      // Write out our current task information to a preference file
      writeActionState(DB_UPGRADE_ACTION, cps);

      // Lock all providers, then upgrade, then unlock
      lockProviders(cps);
      success = upgradeProviders(cps);
      unlockProviders(cps);

    } catch (Exception e) {
      LogUtils.e(LogUtils.TAG, "Database upgrade exception: %s", e.getMessage());
    } finally {
      // Unlock the Base Content Provider
      // PIMContentProviderBase.setMaintenanceLock(cpLock, false);
    }
    LogUtils.i(LogUtils.TAG, "Package has been replaced, perform database upgrades...done");
    return success;
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   bundle = getIntent().getExtras();
   route = bundle.getStringArray("route");
   setListAdapter(new ArrayAdapter<String>(this, R.layout.list_view, route));
 }
Exemplo n.º 13
0
 @Override
 public Loader<Cursor> onCreateLoader(int id, Bundle args) {
   CursorLoader cl;
   switch (id) {
       // 2. Suche Location
     case Katalog.LOCATION:
       cl =
           new CursorLoader(
               getActivity(),
               Katalog.LOCATION_URI,
               null,
               null,
               new String[] {args.getString("url"), args.getString("search")},
               null);
       return cl;
       // 4. hole EINEN Term Curser für alle Locations
     case Katalog.TERMINOLOGY_SEARCH:
       cl =
           new CursorLoader(
               getActivity(),
               Katalog.TERMINOLOGY_URI,
               null,
               null,
               args.getStringArray("data"),
               null);
       return cl;
     case Katalog.ONTOLOGY:
   }
   return null;
 }
Exemplo n.º 14
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.staffmessage);
    capspin = (Spinner) this.findViewById(R.id.capspin);
    emailedit = (EditText) this.findViewById(R.id.emailedit);
    seekRate = (SeekBar) this.findViewById(R.id.seekRate);
    sendproposal = (ImageButton) this.findViewById(R.id.sendProposalButton);
    seekRateValue = (TextView) this.findViewById(R.id.seekRateValue);
    messagebox = (EditText) this.findViewById(R.id.proposalEdit);
    proposalSubject = (EditText) this.findViewById(R.id.proposalSubject);
    seekRate.setMax(100);
    seekRate.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            int real_value = (seekRate.getProgress() + 8);
            value = Integer.toString(real_value);
            seekRateValue.setText("     $" + value);
          }

          public void onStartTrackingTouch(SeekBar seekBar) {}

          public void onStopTrackingTouch(SeekBar seekBar) {}
        });

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Proposal.this);
    name = prefs.getString("name", null);
    staffkey = prefs.getString("staffkey", null);

    sendproposal.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            email = emailedit.getText().toString();
            message = messagebox.getText().toString();
            subject = proposalSubject.getText().toString();
            rate = value;
            // sendEmail(email,"You've received a proposal from "+name+" on Staffittome!","You've
            // recieved a proposal from"+name+" from Staffittome! "+name+"'s additional message:
            // "+message);
            sendProposal("Java Developing", rate, email, subject, message);
          }
        });

    Bundle extras = getIntent().getExtras();
    String[] profinfo = extras.getStringArray("profinfo");
    String[] caparray = new String[profinfo.length];
    for (int i = 0; i < profinfo.length; i++) {
      if (profinfo[i] != null) {
        caparray[i] = profinfo[i];
      } else {
        caparray[i] = "";
      }
    }

    ArrayAdapter<String> spinnerArrayAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, caparray);
    capspin.setAdapter(spinnerArrayAdapter);
    capspin.setBackgroundColor(Color.TRANSPARENT);
  }
Exemplo n.º 15
0
  @Override
  public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    int size = savedInstanceState.getInt(Constants.MAIN_BACK_STACK_SIZE);
    String[] ids = savedInstanceState.getStringArray(Constants.MAIN_BACK_STACK);
    FragmentManager fm = getSupportFragmentManager();
    currentFragment = (SubsonicFragment) fm.findFragmentByTag(ids[0]);
    currentFragment.setPrimaryFragment(true);
    currentFragment.setSupportTag(ids[0]);
    supportInvalidateOptionsMenu();
    FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
    for (int i = 1; i < size; i++) {
      SubsonicFragment frag = (SubsonicFragment) fm.findFragmentByTag(ids[i]);
      frag.setSupportTag(ids[i]);
      if (secondaryContainer != null) {
        frag.setPrimaryFragment(false, true);
      }
      trans.hide(frag);
      backStack.add(frag);
    }
    trans.commit();

    // Current fragment is hidden in secondaryContainer
    if (secondaryContainer == null && !currentFragment.isVisible()) {
      trans = getSupportFragmentManager().beginTransaction();
      trans.remove(currentFragment);
      trans.commit();
      getSupportFragmentManager().executePendingTransactions();

      trans = getSupportFragmentManager().beginTransaction();
      trans.add(R.id.fragment_container, currentFragment, ids[0]);
      trans.commit();
    }
    // Current fragment needs to be moved over to secondaryContainer
    else if (secondaryContainer != null
        && secondaryContainer.findViewById(currentFragment.getRootId()) == null
        && backStack.size() > 0) {
      trans = getSupportFragmentManager().beginTransaction();
      trans.remove(currentFragment);
      trans.show(backStack.get(backStack.size() - 1));
      trans.commit();
      getSupportFragmentManager().executePendingTransactions();

      trans = getSupportFragmentManager().beginTransaction();
      trans.add(R.id.fragment_second_container, currentFragment, ids[0]);
      trans.commit();

      secondaryContainer.setVisibility(View.VISIBLE);
    }

    lastSelectedPosition = savedInstanceState.getInt(Constants.FRAGMENT_POSITION);
    if (lastSelectedPosition != 0) {
      MenuItem item = drawerList.getMenu().findItem(lastSelectedPosition);
      if (item != null) {
        item.setChecked(true);
      }
    }
    recreateSpinner();
  }
Exemplo n.º 16
0
 public void restoreState(Bundle state) {
   String[] stackTags = state.getStringArray(STATE_STACK);
   for (String tag : stackTags) {
     Fragment f = fragmentManager.findFragmentByTag(tag);
     stack.add(f);
   }
   dispatchOnStackChangedEvent();
 }
 protected void setupColors(Bundle extras) {
   if (mColors != null) {
     return;
   }
   if (extras == null || !extras.containsKey(KEY_COLORS)) {
     return;
   }
   mColors = extras.getStringArray(KEY_COLORS);
 }
Exemplo n.º 18
0
  @Override
  protected void onCreate(Bundle state) {
    super.onCreate(state);

    setContentView(R.layout.tile_picker);

    ListView list = (ListView) findViewById(R.id.tile_picker_tile_list);

    if (state != null && state.containsKey(TILE_ARRAY_BUNDLE_KEY)) {
      _tile_array = state.getStringArray(TILE_ARRAY_BUNDLE_KEY);

      if (_tile_array.length == 0) {
        _tile_array = Assets.apkListTiles(this);
      }
    } else {
      _tile_array = Assets.apkListTiles(this);
    }

    list.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = getIntent();
            i.putExtra(
                StyleEditorActivity.TILE_EXTRA,
                StyleData.DEFAULT_TILE_LOCATION_PREFIX + view.getTag().toString());
            setResult(Activity.RESULT_OK, i);
            finish();
          }
        });

    Button open_gallery = new Button(this);
    open_gallery.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(
                Intent.createChooser(intent, getString(R.string.tile_picker_open_gallery)),
                TILE_GALLERY_RESULT);
          }
        });

    open_gallery.setText(R.string.tile_picker_open_gallery);

    list.addFooterView(open_gallery);

    _adapter =
        new TilePickerAdapter(this); // Don't use array in the constructor to avoid caching problems
    list.setAdapter(_adapter);

    for (String tile : _tile_array) {
      _adapter.add(tile);
    }
  }
Exemplo n.º 19
0
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case AppConstants.OK:
              Bundle bundle = msg.getData();

              ProCodeArr = bundle.getStringArray(columns[0]);
              ProNameArr = bundle.getStringArray(columns[1]);
              projectsMap = new HashMap<String, String>();

              rgProInfo = (RadioGroup) findViewById(R.id.rgProjects);

              RadioButton rb = null;

              for (int i = 0; i < ProNameArr.length; i++) {
                rb = new RadioButton(rgProInfo.getContext());

                rb.setText(ProNameArr[i]);
                rb.setTextSize(20);
                // 选中其次选中的数据
                if (ProCodeArr[i].equals(selectedProCode)) {
                  rb.setChecked(true);
                  // 直接点击返回按钮后,将其次选择的数据返回
                  selectedProName = ProNameArr[i];
                }

                rgProInfo.addView(rb);

                projectsMap.put(ProNameArr[i], ProCodeArr[i]);
              }

              dataListLayout.setVisibility(View.VISIBLE);
              break;
            case AppConstants.NG:
              Toast.makeText(
                      appContext,
                      appContext.getString(R.string.error_select_result_zero),
                      Toast.LENGTH_LONG)
                  .show();
              break;
            case AppConstants.ERROR1:
              Toast.makeText(
                      appContext,
                      appContext.getString(R.string.error_network_connected),
                      Toast.LENGTH_LONG)
                  .show();
              break;
            case AppConstants.ERROR2:
              Toast.makeText(
                      appContext, appContext.getString(R.string.system_error), Toast.LENGTH_LONG)
                  .show();
              break;
            default:
              break;
          }

          loadingLayout.setVisibility(View.GONE);
        }
Exemplo n.º 20
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_new_post, container, false);
    mPostText = (MultiAutoCompleteTextView) rootView.findViewById(R.id.postText);
    mUsersListAdapter = new UserCompletionAdapter(getActivity());
    mPostText.setAdapter(mUsersListAdapter);
    mPostText.setTokenizer(new SymbolTokenizer('@'));
    mIsPrivate = (Switch) rootView.findViewById(R.id.isPrivate);
    mTagsListAdapter =
        new ArrayAdapter<>(getActivity(), android.R.layout.simple_dropdown_item_1line);
    mPostTags = (MultiAutoCompleteTextView) rootView.findViewById(R.id.postTags);
    mPostTags.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    mPostTags.setAdapter(mTagsListAdapter);
    mImagesPanel = (ImageUploadingPanel) rootView.findViewById(R.id.imagesPanel);
    setHasOptionsMenu(true);
    if (savedInstanceState == null) {
      Bundle args = getArguments();
      if (args != null) {
        mPostId = args.getString(ARG_ID);
        mPostText.setText(args.getString(ARG_TEXT, ""));
        String[] tags = args.getStringArray(ARG_TAGS);
        mIsPrivate.setChecked(args.getBoolean(ARG_PRIVATE));
        if (tags != null) {
          mPostTags.setText(TextUtils.join(", ", tags));
        }
        ArrayList<Uri> images = args.getParcelableArrayList(ARG_IMAGES);
        if (images != null)
          for (Uri image : images) {
            mImagesPanel.addImage(image, mMime);
          }
        mMime = args.getString(ARG_MIME);
      }
    }
    if (mPostId == null) {
      mIsPrivate.setVisibility(View.VISIBLE);
    } else {
      mIsPrivate.setVisibility(View.GONE);
    }
    mProgressDialog =
        new MaterialDialog.Builder(getActivity())
            .cancelable(false)
            .customView(R.layout.dialog_progress, false)
            .build();

    TagsRequest request = new TagsRequest(PointConnectionManager.getInstance().loginResult.login);
    getSpiceManager()
        .getFromCacheAndLoadFromNetworkIfExpired(
            request, request.getCacheName(), DurationInMillis.ONE_DAY, mTagsRequestListener);
    UserSubscriptionsRequest request2 =
        new UserSubscriptionsRequest(PointConnectionManager.getInstance().loginResult.login);
    getSpiceManager()
        .getFromCacheAndLoadFromNetworkIfExpired(
            request2, request2.getCacheName(), DurationInMillis.ONE_DAY, mUsersRequestListener);
    return rootView;
  }
 @Override
 public Loader<List<File>> onCreateLoader(final int id, final Bundle args) {
   final String[] extensions = args.getStringArray(EXTRA_FILE_EXTENSIONS);
   final String path = args.getString(EXTRA_PATH);
   File currentDir = path != null ? new File(path) : getExternalStorageDirectory();
   if (currentDir == null) {
     currentDir = new File("/");
   }
   getArguments().putString(EXTRA_PATH, currentDir.getAbsolutePath());
   return new FilesLoader(getActivity(), currentDir, extensions);
 }
  @Override
  void restoreState(Bundle inState) {
    super.restoreState(inState);

    int[] rows = inState.getIntArray("rows");
    int[] cols = inState.getIntArray("cols");
    String[] notes = inState.getStringArray("notes");

    for (int i = 0; i < rows.length; i++) {
      mOldNotes.add(new NoteEntry(rows[i], cols[i], CellNote.deserialize(notes[i])));
    }
  }
  /**
   * ***************************************************
   *
   * <p>Called when the fragment is created.
   *
   * <p>***************************************************
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Try to get any common arguments

    Bundle arguments = getArguments();

    if (arguments != null) {
      mProductIds = arguments.getStringArray(BUNDLE_KEY_PRODUCT_IDS);
    }
  }
  private void _restorePreviousInstanceInformation(Bundle savedInstanceState) {
    _lastMenuItemIDRequested = savedInstanceState.getInt(BUNDLE_KEY_LAST_MENU_ITEM_ID_REQUESTED);
    _isANonDrawerScreenShowing =
        savedInstanceState.getBoolean(BUNDLE_KEY_IS_A_NON_DRAWER_SCREEN_SHOWING);

    String[] previousFragmentTags =
        savedInstanceState.getStringArray(BUNDLE_KEY_MAIN_FRAGMENT_TAGS);
    stringFragmentHashMap =
        new HashMap<String, Fragment>(); // Android destroyed the previous HashMap. Must rebuild
    for (String fragTag : previousFragmentTags) {
      stringFragmentHashMap.put(fragTag, null);
    }
  }
Exemplo n.º 25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.nav_scrolling);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    ActionBar ab = getSupportActionBar();

    // Enable the Up button
    ab.setDisplayHomeAsUpEnabled(true);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    /*ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    */
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    Bundle b = getIntent().getExtras();
    name = b.getStringArray("data");
    int a = Integer.parseInt(name[1]);
    if (a != 0) {
      accessDatabase(a);
    }

    FloatingActionButton fab2 = (FloatingActionButton) findViewById(R.id.fab2);
    assert fab2 != null;
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    assert fab != null;
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            name[0] = "ScrollingActivity";
            Intent intent = new Intent(ScrollingActivity.this, MapsActivity.class);
            Bundle mBundle = new Bundle();
            mBundle.putStringArray("data", name);
            intent.putExtras(mBundle);

            startActivity(intent);
            finish();
            /*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
            .setAction("Action", null).show();*/
          }
        });
  }
Exemplo n.º 26
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get permissions array
    Bundle args = getArguments();
    assert args != null;
    String[] p = args.getStringArray(KEY_PERMISSIONS);
    mPermissions = new Permission[p.length];
    for (int i = 0; i < p.length; i++) {
      final String name = p[i];
      mPermissions[i] = Permission.newInstance(getActivity(), name);
    }
  }
Exemplo n.º 27
0
 @Override
 public void onHandleMessage(Message message) {
   if (message == null) {
     return;
   }
   Bundle bundle = message.getData();
   switch (message.what) {
     case MSG_IS_APP_INSTALLED:
       isAppInstalledMsg(bundle.getStringArray(BUNDLE_DATA));
       break;
     default:
       super.onHandleMessage(message);
   }
 }
Exemplo n.º 28
0
  @Override
  public Builder customizeBuilder(Builder builder, Bundle args) {
    // リスナーを設定

    // 選択モード設定
    String[] choices = args.getStringArray(WAYS);
    if (args.getBoolean(CHOICE_MODE_MULTIPLE, false)) {
      builder = setMutlipleChoiceMode(builder, choices);
    } else if (args.getBoolean(CHOICE_MODE_SINGLE, false)) {
      builder = setSingleChoiceMode(builder, choices);
    } else {
      builder.setItems(choices, getOnClickListener());
    }
    return builder;
  }
Exemplo n.º 29
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_conformula);
   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
   barra = (SeekBar) findViewById(R.id.barra);
   barra.setOnSeekBarChangeListener(this);
   barra2 = (SeekBar) findViewById(R.id.barra2);
   barra2.setOnSeekBarChangeListener(this);
   iz = (TextView) findViewById(R.id.lblizq);
   de = (TextView) findViewById(R.id.lblder);
   Bundle bundle = getIntent().getExtras();
   dato = bundle.getStringArray("1 2 3");
   // Toast.makeText(this, dato[7], Toast.LENGTH_SHORT).show();
 }
Exemplo n.º 30
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    isTablet = getResources().getBoolean(R.bool.isTablet);
    isPortrait = getResources().getBoolean(R.bool.isPortrait);

    if (savedInstanceState != null) {
      detailItemPosition = savedInstanceState.getInt(DETAIL_ITEM_POSITION, -1);
      isDetailShowing = savedInstanceState.getBoolean(IS_DETAIL_SHOWING, false);
      contentNames = savedInstanceState.getStringArray(MainActivity.EXTRA_CONTENT_NAMES);
      contentImages = savedInstanceState.getIntArray(MainActivity.EXTRA_CONTENT_IMAGES);
    } else {
      contentNames = getArguments().getStringArray(MainActivity.EXTRA_CONTENT_NAMES);
      contentImages = getArguments().getIntArray(MainActivity.EXTRA_CONTENT_IMAGES);
    }
  }