List of usage examples for java.lang String contentEquals
public boolean contentEquals(CharSequence cs)
From source file:com.netcompss.ffmpeg4android_client.BaseVideo.java
public void uploadtoserver() { try {//from ww w. ja v a 2 s . co m JSONArray arry = new JSONArray(jsondata); RequestParams params = new RequestParams(); JSONObject obj = arry.getJSONObject(2); if (obj.has("button_id")) { Log.d("buttonid", String.valueOf(obj.getInt("button_id"))); params.put("button_id", String.valueOf(obj.getInt("button_id"))); } if (obj.has("id")) { Log.d("id", obj.getString("id")); params.put("id", obj.getString("id")); } if (obj.has("title")) { Log.d("title", obj.getString("title")); params.put("title", obj.getString("title").toString()); } if (obj.has("text")) { Log.d("text", obj.getString("text")); String txt = obj.getString("text").toString().replace("<p>", "").replace("</p>", ""); params.put("text", txt); // Toast.makeText(context, txt, Toast.LENGTH_LONG).show(); } // Html.fromHtml(obj.getString("description")).toString()); if (obj.has("description")) { Log.d("description", obj.getString("description")); params.put("description", obj.getString("description").toString()); } if (obj.has("api_key")) { Log.d("api_key", obj.getString("api_key")); params.put("api_key", obj.getString("api_key")); } if (obj.has("video")) { Log.d("video", "/sdcard/videokit/final.mp4"); params.put("video", new File("/sdcard/videokit/final.mp4")); } if (Constant.img_url != null) { Log.d("video_thumbnail_url", Constant.img_url); params.put("video_thumbnail_url", Constant.img_url); } else { // video_thumbnail if (obj.has("video_thumbnail")) { String image = obj.getString("video_thumbnail"); if (image != null) { Log.d("video_thumbnail", image); if (image.contains("content") || image.contains("file")) { String getString = getFileNameByUri(context, Uri.parse(image)); String thumb = reporteds(getString); params.put("video_thumbnail", new File(thumb)); } else { String thumb = reporteds(image); params.put("video_thumbnail", new File(thumb)); } } else { String thumb = reporteds(video_thumbpath.getAbsolutePath()); params.put("video_thumbnail", new File(thumb)); Log.d("image path32", video_thumbpath.getAbsolutePath()); } } else { String thumb = reporteds(video_thumbpath.getAbsolutePath()); params.put("video_thumbnail", new File(thumb)); Log.d("image path33", video_thumbpath.getAbsolutePath()); } } if (obj.has("video_frame")) { String images = obj.getString("video_frame"); if (images != null) { Log.d("video_frame_url", images); if (images.contentEquals("null")) { } else if (images.contains("http") || images.contains("https")) { params.put("video_frame_url", images); } else if (Constant.frm_url != null) { params.put("video_frame_url", Constant.frm_url); } } } posted(arry, params); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:de.enlightened.peris.PerisMain.java
private Bundle initializeNewSession(final SharedPreferences appPreferences) { Log.d(TAG, "Back stack is blank, new session"); final Bundle bundle = new Bundle(); final String currentServerId = this.application.getSession().getServer().serverId; final String keyName = currentServerId + "_home_page"; final String valueName = appPreferences.getString(keyName, getString(R.string.subforum_id)); String baseName = this.application.getSession().getServer().serverName; if (baseName.contentEquals("0")) { baseName = "Forums"; }//from w w w . j a va 2 s . c o m if (valueName.contentEquals(getString(R.string.subforum_id))) { baseName = "Forums"; } if (valueName.contentEquals("forum_favs")) { baseName = "Favorites"; } if (valueName.contentEquals("participated")) { baseName = "Participated Topics"; } if (valueName.contentEquals("favs")) { baseName = "Subscribed Topics"; } if (valueName.contentEquals("unread")) { baseName = "Unread Topics"; } bundle.putString("subforum_id", valueName); bundle.putString("subforum_name", baseName); bundle.putString("inTab", "N"); bundle.putString("background", this.background); return bundle; }
From source file:com.cybussolutions.wikki.afri_pay.SignUp.java
@SuppressLint("NewApi") @Override/*from w w w .ja v a 2s .co m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_up); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); android.support.v7.app.ActionBar ab = getSupportActionBar(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Enable the Up button if (ab != null) { ab.setHomeAsUpIndicator(R.drawable.ic_back); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle("Registration"); } // BugSenseHandler.initAndStartSession(this, "1c9ce82c"); // chromeHelpPopup = new ChromeHelpPopup(SignUp.this, "Password should contain capital and small alphabets, one number and one special character. Example: Cybus@12"); // SelectedDateView = (TextView) findViewById(R.id.DatePickerInput); // imageView=(ImageView)findViewById(R.id.signup_imageView); firstname = (EditText) findViewById(R.id.signup_firstName); lastname = (EditText) findViewById(R.id.signup_lastName); email = (EditText) findViewById(R.id.signup_email); mobile = (EditText) findViewById(R.id.signup_mobile); gender = (RadioGroup) findViewById(R.id.genderRG); gender.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.mrRB: { genderText = "Male"; title = "Mr"; break; } case R.id.missRB: { genderText = "Female"; title = "Miss"; break; } case R.id.mrsRB: { genderText = "Female"; title = "Mrs"; break; } default: { break; } } } }); // idNo=(EditText) findViewById(R.id.signup_idNum); /* buttonchoose=(Button) findViewById(R.id.uploadimage); buttonchoose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // openGallery(v); } });*/ try { Button b = (Button) findViewById(R.id.signup_register); if (b != null) { b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub submit(v); } }); } Button cancel = (Button) findViewById(R.id.signup_cancel); if (cancel != null) { cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); } } catch (Exception e) { e.printStackTrace(); } /* doctype=(RadioGroup) findViewById(R.id.signup_doctype); doctype.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.signup_passport: value = "Passport"; typeid="5"; break; case R.id.signup_license: value = "Driving License"; typeid="4"; break; } } });*/ String COmpare = "United Kingdom"; CountriesObjects = new ArrayList<>(); CountriesName = new ArrayList<>(); DataBase DataBase = new DataBase(SignUp.this); CountriesObjects = DataBase.getCountriesDB(""); for (int i = 0; i < CountriesObjects.size(); i++) { CountriesName.add(CountriesObjects.get(i).getCountry_name()); } country = (Spinner) findViewById(R.id.signup_countries_spinner); ArrayAdapter adapter201 = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, CountriesName); country.setAdapter(adapter201); if (!COmpare.equals(null)) { int spinnerPosition = adapter201.getPosition(COmpare); country.setSelection(spinnerPosition); } country.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub // InputMethodManager inputMethodManager = (InputMethodManager) // getSystemService(Activity.INPUT_METHOD_SERVICE); // inputMethodManager.hideSoftInputFromWindow(getCurrentFocus() // .getWindowToken(), 0); return false; } }); country.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long arg3) { // TODO Auto-generated method stub countrycode = (TextView) findViewById(R.id.signup_code); countrycode.setText("+" + CountriesObjects.get(pos).getCalling_code()); countrycode.setEnabled(false); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); // user_name = (EditText) findViewById(R.id.signup_userName); password = (EditText) findViewById(R.id.signup_password); re_password = (EditText) findViewById(R.id.signup_confirmpassword); re_password.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub EditText e = (EditText) findViewById(R.id.signup_password); String pass = e.getText().toString(); TextView d = (TextView) findViewById(R.id.matchPassword); if (!pass.contentEquals(s)) { d.setText("Passwords Do not Match"); d.setVisibility(View.VISIBLE); } else { d.setVisibility(View.GONE); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); }
From source file:de.enlightened.peris.CategoriesFragment.java
@Override public final void onStart() { super.onStart(); if (!(this.application.getSession().getServer().serverBackground .contentEquals(this.application.getSession().getServer().serverBoxColor) && this.application.getSession().getServer().serverBoxBorder.contentEquals("0"))) { getListView().setDivider(null);//from w ww. j av a2 s . c o m } final Bundle bundle = getArguments(); this.subforumId = bundle.getString("subforum_id"); this.background = bundle.getString("background"); this.screenTitle = bundle.getString("subforum_name"); this.passedSubforum = this.subforumId; if (bundle.containsKey("query")) { this.searchQuery = bundle.getString("query"); } //Log.i(TAG, "**** New CategoriesFragment Instance ****"); //Log.d(TAG, "Passed subforum " + this.subforumId); this.totalHash = this.subforumId; if (this.subforumId.contains("###")) { this.subforumParts = this.subforumId.split("###"); Log.d(TAG, "Subforum has " + this.subforumParts.length + " parts."); this.subforumId = this.subforumParts[0]; //hashId = subforumParts[1]; } else { this.subforumParts = new String[1]; this.subforumParts[0] = this.subforumId; } Log.d(TAG, "Entering subforum " + this.subforumId); this.serverAddress = this.application.getSession().getServer().serverAddress; if (getString(R.string.server_location).contentEquals("0")) { this.storagePrefix = this.serverAddress + "_"; } this.userid = this.application.getSession().getServer().serverUserId; final String shareId = this.subforumId; if (shareId.contentEquals("0")) { this.shareURL = this.application.getSession().getServer().getURL(); } else { if (this.application.getSession().getApi().getConfig().getForumSystem() == Config.ForumSystem.PHPBB) { this.shareURL = this.application.getSession().getServer().getURL("viewforum.php?f=" + shareId); } } getListView().setOnScrollListener(this.listScrolled); }
From source file:com.asakusafw.runtime.io.text.driver.InputDriver.java
private boolean compareHeader() throws IOException { int matched = 0; for (FieldDriver<?, ?> field : fields) { while (reader.nextField()) { CharSequence value = reader.getContent(); String label = field.name; if (value != null) { if (trimExtraInput) { value = trimmer.wrap(value); label = label.trim(); }// ww w . j a va 2 s . c o m if (value.length() == 0 && field.skipEmptyInput) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("skip empty header field: path=%s, column=%,d", path, reader.getFieldIndex())); } continue; } } if (value == null || label.contentEquals(value) == false) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("header mismatch: path=%s, column=%,d, expected=%s, appeared=%s", //$NON-NLS-1$ path, reader.getFieldIndex(), TextUtil.quote(field.name), value == null ? "null" : TextUtil.quote(value))); //$NON-NLS-1$ } return false; } matched++; break; } } if (checkHeaderFieldCount(matched, onLessInput) == false) { return false; } if (checkHeaderFieldCount(fields.length + countRest(), onMoreInput) == false) { return false; } return true; }
From source file:de.enlightened.peris.NewPost.java
@Override public final void onResume() { super.onResume(); final SharedPreferences appPreferences = getSharedPreferences("prefs", 0); final String savedDraft = appPreferences .getString(this.mailSession.getServer().serverAddress + "_" + this.subforum + "_" + this.postType + "_" + this.parent + "_" + this.category + "_" + this.postId + "_draft", "0"); final String savedSubject = appPreferences .getString(this.mailSession.getServer().serverAddress + "_" + this.subforum + "_" + this.postType + "_" + this.parent + "_" + this.category + "_" + this.postId + "_draft_subject", "0"); //Restore draft if (!savedDraft.contentEquals("0")) { this.bodyInputter.setText(savedDraft); this.subjectInputter.setText(savedSubject); }/*w ww . j ava2s . co m*/ }
From source file:org.warlock.itk.distributionenvelope.Payload.java
/** * Internal Payload constructor called by the DistributionEnvelopeHelper when * parsing received XML.// w ww. j a v a2s .c o m */ Payload(String id, String m, String p, String b, String c, String e) { manifestId = id; mimeType = m; if (p != null && p.length() > 0) { profileId = p; } base64 = (b.contentEquals("true")); compressed = (c.contentEquals("true")); encrypted = (e.contentEquals("true")); }
From source file:org.jtrfp.trcl.core.ResourceManager.java
public VOXFile getVOXFile(String fileName) throws IllegalAccessException, IOException, FileLoadException { if (fileName == null) throw new NullPointerException("Passed VOX file name String is intolerably null."); //Special cases: Fury3, TV, fZone if (fileName.contentEquals("Fury3")) return new Fury3().getDefaultMission(); if (fileName.contentEquals("TV")) return new TV().getDefaultMission(); if (fileName.contentEquals("FurySE")) return new FZone().getDefaultMission(); InputStream is = getInputStreamFromResource("DATA\\" + fileName); VOXFile result = new Parser().readToNewBean(is, VOXFile.class); is.close();//from ww w .j av a2 s .c om return result; }
From source file:org.opendaylight.iotdm.onem2m.protocols.http.Onem2mHttpProvider.java
public void handle(IotDMPluginRequest request, IotDMPluginResponse response) { HttpServletRequest httpRequest = ((IotDMPluginHttpRequest) request).getHttpRequest(); HttpServletResponse httpResponse = ((IotDMPluginHttpResponse) response).getHttpResponse(); Onem2mRequestPrimitiveClientBuilder clientBuilder = new Onem2mRequestPrimitiveClientBuilder(); String headerValue;/*w w w . j a va 2s . c o m*/ clientBuilder.setProtocol(Onem2m.Protocol.HTTP); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS); String contentType = httpRequest.getContentType(); if (contentType == null) contentType = "json"; contentType = contentType.toLowerCase(); if (contentType.contains("json")) { clientBuilder.setContentFormat(Onem2m.ContentFormat.JSON); } else if (contentType.contains("xml")) { clientBuilder.setContentFormat(Onem2m.ContentFormat.XML); } else { httpResponse.setStatus(HttpServletResponse.SC_NOT_ACCEPTABLE); try { httpResponse.getWriter().println("Unsupported media type: " + contentType); } catch (IOException e) { e.printStackTrace(); } httpResponse.setContentType("text/json;charset=utf-8"); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_ERROR); return; } clientBuilder.setTo(Onem2m.translateUriToOnem2m(httpRequest.getRequestURI())); // pull fields out of the headers headerValue = httpRequest.getHeader(Onem2m.HttpHeaders.X_M2M_ORIGIN); if (headerValue != null) { clientBuilder.setFrom(headerValue); } headerValue = httpRequest.getHeader(Onem2m.HttpHeaders.X_M2M_RI); if (headerValue != null) { clientBuilder.setRequestIdentifier(headerValue); } headerValue = httpRequest.getHeader(Onem2m.HttpHeaders.X_M2M_NM); if (headerValue != null) { clientBuilder.setName(headerValue); } headerValue = httpRequest.getHeader(Onem2m.HttpHeaders.X_M2M_GID); if (headerValue != null) { clientBuilder.setGroupRequestIdentifier(headerValue); } headerValue = httpRequest.getHeader(Onem2m.HttpHeaders.X_M2M_RTU); if (headerValue != null) { clientBuilder.setResponseType(headerValue); } headerValue = httpRequest.getHeader(Onem2m.HttpHeaders.X_M2M_OT); if (headerValue != null) { clientBuilder.setOriginatingTimestamp(headerValue); } // the contentType string can have ty=val attached to it so we should handle this case Boolean resourceTypePresent = false; String contentTypeResourceString = parseContentTypeForResourceType(contentType); if (contentTypeResourceString != null) { resourceTypePresent = clientBuilder.parseQueryStringIntoPrimitives(contentTypeResourceString); } String method = httpRequest.getMethod().toLowerCase(); // look in query string if didnt find it in contentType header if (!resourceTypePresent) { resourceTypePresent = clientBuilder.parseQueryStringIntoPrimitives(httpRequest.getQueryString()); } else { clientBuilder.parseQueryStringIntoPrimitives(httpRequest.getQueryString()); } if (resourceTypePresent && !method.contentEquals("post")) { httpResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST); try { httpResponse.getWriter().println("Specifying resource type not permitted."); } catch (IOException e) { e.printStackTrace(); } Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_ERROR); return; } // take the entire payload text and put it in the CONTENT field; it is the representation of the resource String cn = request.getPayLoad(); if (cn != null && !cn.contentEquals("")) { clientBuilder.setPrimitiveContent(cn); } switch (method) { case "get": clientBuilder.setOperationRetrieve(); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_RETRIEVE); break; case "post": if (resourceTypePresent) { clientBuilder.setOperationCreate(); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_CREATE); } else { clientBuilder.setOperationNotify(); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_NOTIFY); } break; case "put": clientBuilder.setOperationUpdate(); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_UPDATE); break; case "delete": clientBuilder.setOperationDelete(); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_DELETE); break; default: httpResponse.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); try { httpResponse.getWriter().println("Unsupported method type: " + method); } catch (IOException e) { e.printStackTrace(); } httpResponse.setContentType("text/json;charset=utf-8"); //baseRequest.setHandled(true); Onem2mStats.getInstance().inc(Onem2mStats.HTTP_REQUESTS_ERROR); return; } // invoke the service request Onem2mRequestPrimitiveClient onem2mRequest = clientBuilder.build(); ResponsePrimitive onem2mResponse = Onem2m.serviceOnenm2mRequest(onem2mRequest, onem2mService); // now place the fields from the onem2m result response back in the http fields, and send try { sendHttpResponseFromOnem2mResponse(httpResponse, onem2mResponse); } catch (IOException e) { e.printStackTrace(); } }
From source file:org.ebayopensource.turmeric.eclipse.test.utils.TLUtil.java
/** * Removes the action.//from w w w. j a v a2s . c o m * * @param removeType the remove type * @param projectName the project name * @param typeName the type name * @param typeLibraryName the type library name * @param removeTypeName the remove type name * @param removeTypeNS the remove type ns * @return true, if successful */ public static boolean removeAction(String removeType, String projectName, String typeName, String typeLibraryName, String removeTypeName, String removeTypeNS) { IFile xsdFile = null; IEditorPart editorPart; try { UIUtil.getActivePage().saveAllEditors(true); UIUtil.getActivePage().closeAllEditors(true); IProject typeLibProject = ProjectUtil.getProject(projectName); xsdFile = typeLibProject.getFile(File.separator + "meta-src" + File.separator + "types" + File.separator + projectName + File.separator + typeName); System.out.println("Type Name --- " + xsdFile.getFullPath().toString()); IDE.openEditor(UIUtil.getActiveWorkBenchWindow().getActivePage(), xsdFile); editorPart = UIUtil.getActiveEditor(); LibraryType type = SOAGlobalRegistryAdapter.getInstance().getGlobalRegistry() .getType(new QName(removeTypeNS, removeTypeName)); ArrayList<LibraryType> selectedTypes = new ArrayList<LibraryType>(); selectedTypes.add(type); Object adaptedObject = TypeLibraryUtil.getAdapterClassFromWTPEditors(editorPart); XSDSchema parentXSDSchema = (XSDSchema) adaptedObject; Map<LibraryType, XSDSchemaDirective> importedTypesMap = TypeLibraryActivator .getAllTypeLibImports(parentXSDSchema); if (removeType.contentEquals("TYPELIB")) { new RemoveType().modifyXSD(selectedTypes, parentXSDSchema, importedTypesMap, typeLibProject, xsdFile); editorPart.doSave(ProgressUtil.getDefaultMonitor(null)); } return true; } catch (Exception e) { e.printStackTrace(); return false; } }