Example usage for java.lang String contentEquals

List of usage examples for java.lang String contentEquals

Introduction

In this page you can find the example usage for java.lang String contentEquals.

Prototype

public boolean contentEquals(CharSequence cs) 

Source Link

Document

Compares this string to the specified CharSequence .

Usage

From source file:com.homeworkreminder.Main.java

private static void deleteLinkedTask(Task t) {
    // TODO Auto-generated method stub
    // handles only database single linked task deletion
    String prev_tag = t.getPreviousTag();
    String nxt_tag = t.getNextTag();
    if (prev_tag == null || nxt_tag == null) {
        return;//from www  .  j a v  a2s. c  om
    }
    if (prev_tag.contentEquals(EditTask.getLinkedStartTag())
            && !nxt_tag.contentEquals(EditTask.getLinkedEndTag())) {
        // deleting the first node
        Task second_task = Database.queryById(Integer.parseInt(t.getNextTag()));
        Task old_second_task = second_task.deepCopy();
        second_task.setPreviousTag(EditTask.getLinkedStartTag());
        Database.updateRepeatingTask(second_task.getId(), second_task.getName(), second_task.getType(),
                second_task.getSubject(), second_task.getStatus(), second_task.getDue().get(Calendar.YEAR),
                second_task.getDue().get(Calendar.MONTH), second_task.getDue().get(Calendar.DAY_OF_MONTH),
                second_task.getDue().get(Calendar.HOUR), second_task.getDue().get(Calendar.MINUTE),
                second_task.getReminders(), second_task.getNotes(),
                Util.isAlarmActive(second_task.isAlarmActive()), second_task.getIndex(),
                second_task.getInterval(), second_task.getPreviousTag(), second_task.getNextTag());
        updateInTaskHolder(old_second_task, second_task);
        updateInCompleted(old_second_task, second_task);
        updateInSubjectMap(old_second_task, second_task);
        updateInTaskMap(old_second_task, second_task);
    } else if (!prev_tag.contentEquals(EditTask.getLinkedStartTag())
            && nxt_tag.contentEquals(EditTask.getLinkedEndTag())) {
        // deleting the last node
        Task secondlast_task = Database.queryById(Integer.parseInt(prev_tag));
        Task old_secondlast_task = secondlast_task.deepCopy();
        secondlast_task.setNextTag(EditTask.getLinkedEndTag());
        Database.updateRepeatingTask(secondlast_task.getId(), secondlast_task.getName(),
                secondlast_task.getType(), secondlast_task.getSubject(), secondlast_task.getStatus(),
                secondlast_task.getDue().get(Calendar.YEAR), secondlast_task.getDue().get(Calendar.MONTH),
                secondlast_task.getDue().get(Calendar.DAY_OF_MONTH),
                secondlast_task.getDue().get(Calendar.HOUR), secondlast_task.getDue().get(Calendar.MINUTE),
                secondlast_task.getReminders(), secondlast_task.getNotes(),
                Util.isAlarmActive(secondlast_task.isAlarmActive()), secondlast_task.getIndex(),
                secondlast_task.getInterval(), secondlast_task.getPreviousTag(), secondlast_task.getNextTag());
        updateInTaskHolder(old_secondlast_task, old_secondlast_task);
        updateInCompleted(old_secondlast_task, secondlast_task);
        updateInSubjectMap(old_secondlast_task, secondlast_task);
        updateInTaskMap(old_secondlast_task, secondlast_task);
    } else if (!prev_tag.contentEquals(EditTask.getLinkedStartTag())
            && !nxt_tag.contentEquals(EditTask.getLinkedEndTag())) {
        // deleting a middle node
        Task previous_task = Database.queryById(Integer.parseInt(prev_tag));
        Log.d("CRASH", ":" + prev_tag);
        Task old_prev_task = previous_task.deepCopy();
        previous_task.setNextTag(nxt_tag);
        Database.updateRepeatingTask(previous_task.getId(), previous_task.getName(), previous_task.getType(),
                previous_task.getSubject(), previous_task.getStatus(),
                previous_task.getDue().get(Calendar.YEAR), previous_task.getDue().get(Calendar.MONTH),
                previous_task.getDue().get(Calendar.DAY_OF_MONTH), previous_task.getDue().get(Calendar.HOUR),
                previous_task.getDue().get(Calendar.MINUTE), previous_task.getReminders(),
                previous_task.getNotes(), Util.isAlarmActive(previous_task.isAlarmActive()),
                previous_task.getIndex(), previous_task.getInterval(), previous_task.getPreviousTag(),
                previous_task.getNextTag());
        updateInTaskHolder(old_prev_task, previous_task);
        updateInCompleted(old_prev_task, previous_task);
        updateInSubjectMap(old_prev_task, previous_task);
        updateInTaskMap(old_prev_task, previous_task);

        Task next_task = Database.queryById(Integer.parseInt(nxt_tag));
        Task old_next_task = next_task.deepCopy();
        next_task.setPreviousTag(prev_tag);
        Database.updateRepeatingTask(next_task.getId(), next_task.getName(), next_task.getType(),
                next_task.getSubject(), next_task.getStatus(), next_task.getDue().get(Calendar.YEAR),
                next_task.getDue().get(Calendar.MONTH), next_task.getDue().get(Calendar.DAY_OF_MONTH),
                next_task.getDue().get(Calendar.HOUR), next_task.getDue().get(Calendar.MINUTE),
                next_task.getReminders(), next_task.getNotes(), Util.isAlarmActive(next_task.isAlarmActive()),
                next_task.getIndex(), next_task.getInterval(), next_task.getPreviousTag(),
                next_task.getNextTag());
        updateInTaskHolder(old_next_task, next_task);
        updateInCompleted(old_next_task, next_task);
        updateInSubjectMap(old_next_task, next_task);
        updateInTaskMap(old_next_task, next_task);
    }
    Database.deleteRecord(t.getId());
}

From source file:org.gvnix.service.roo.addon.addon.ws.export.WSExportWsdlConfigServiceImpl.java

/**
 * Retrieve Web Service implemented interface from interface list. TODO to
 * be removed?. This method could be useless outside this service.
 * //  ww  w . ja va  2s.co  m
 * @param classOrInterfaceDeclaration to retrieve its implemented interface.
 * @return {@link ClassOrInterfaceDeclaration} interface that implements
 *         classOrInterfaceDeclaratio, null if not exists.
 * @throws IOException
 * @throws ParseException
 */
private ClassOrInterfaceDeclaration getWebServiceInterface(
        ClassOrInterfaceDeclaration classOrInterfaceDeclaration) throws ParseException, IOException {

    ClassOrInterfaceDeclaration implementedInterface = null;

    List<ClassOrInterfaceType> implementedInterfacesList = classOrInterfaceDeclaration.getImplements();

    String interfaceName;
    String fileInterfaceName;

    CompilationUnit compilationUnit;
    TypeDeclaration type;

    for (ClassOrInterfaceType classOrInterfaceType : implementedInterfacesList) {

        interfaceName = classOrInterfaceType.getName();
        interfaceName = interfaceName.concat(".java");

        for (File interfaceFile : webServiceInterfaces) {
            fileInterfaceName = wsExportWsdl.getFilename(interfaceFile.getAbsolutePath());

            if (!fileInterfaceName.contentEquals(interfaceName)) {
                continue;
            }

            compilationUnit = JavaParser.parse(interfaceFile);

            List<TypeDeclaration> types = compilationUnit.getTypes();
            if (types == null) {
                continue;
            }

            type = types.get(0);
            if (type instanceof ClassOrInterfaceDeclaration) {

                implementedInterface = (ClassOrInterfaceDeclaration) type;
                return implementedInterface;
            }
        }

    }

    return implementedInterface;
}

From source file:org.runnerup.view.DetailActivity.java

/** Called when the activity is first created. */
@Override/*from w  w w  .  j  av  a 2  s.c o  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.detail);
    WidgetUtil.addLegacyOverflowButton(getWindow());

    Intent intent = getIntent();
    mID = intent.getLongExtra("ID", -1);
    String mode = intent.getStringExtra("mode");

    mDBHelper = new DBHelper(this);
    mDB = mDBHelper.getReadableDatabase();
    uploadManager = new UploadManager(this);
    formatter = new Formatter(this);

    if (mode.contentEquals("save")) {
        this.mode = MODE_SAVE;
    } else if (mode.contentEquals("details")) {
        this.mode = MODE_DETAILS;
    } else {
        assert (false);
    }

    saveButton = (Button) findViewById(R.id.save_button);
    discardButton = (Button) findViewById(R.id.discard_button);
    resumeButton = (Button) findViewById(R.id.resume_button);
    uploadButton = (Button) findViewById(R.id.upload_button);
    activityTime = (TextView) findViewById(R.id.activity_time);
    activityDistance = (TextView) findViewById(R.id.activity_distance);
    activityPace = (TextView) findViewById(R.id.activity_pace);
    sport = (TitleSpinner) findViewById(R.id.summary_sport);
    notes = (EditText) findViewById(R.id.notes_text);
    notes.setHint("Notes about your workout");
    map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

    if (map != null) {
        map.setOnCameraChangeListener(new OnCameraChangeListener() {

            @Override
            public void onCameraChange(CameraPosition arg0) {
                if (mapBounds != null) {
                    // Move camera.
                    map.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds, 5));
                    // Remove listener to prevent position reset on camera
                    // move.
                    map.setOnCameraChangeListener(null);
                }
            }
        });
    }
    saveButton.setOnClickListener(saveButtonClick);
    uploadButton.setOnClickListener(uploadButtonClick);
    if (this.mode == MODE_SAVE) {
        resumeButton.setOnClickListener(resumeButtonClick);
        discardButton.setOnClickListener(discardButtonClick);
        setEdit(true);
    } else if (this.mode == MODE_DETAILS) {
        resumeButton.setVisibility(View.GONE);
        discardButton.setVisibility(View.GONE);
        setEdit(false);
    }
    uploadButton.setVisibility(View.GONE);

    fillHeaderData();
    requery();

    loadRoute();

    TabHost th = (TabHost) findViewById(R.id.tabhost);
    th.setup();
    TabSpec tabSpec = th.newTabSpec("notes");
    tabSpec.setIndicator(WidgetUtil.createHoloTabIndicator(this, "Notes"));
    tabSpec.setContent(R.id.tab_main);
    th.addTab(tabSpec);

    tabSpec = th.newTabSpec("laps");
    tabSpec.setIndicator(WidgetUtil.createHoloTabIndicator(this, "Laps"));
    tabSpec.setContent(R.id.tab_lap);
    th.addTab(tabSpec);

    tabSpec = th.newTabSpec("map");
    tabSpec.setIndicator(WidgetUtil.createHoloTabIndicator(this, "Map"));
    tabSpec.setContent(R.id.tab_map);
    th.addTab(tabSpec);

    tabSpec = th.newTabSpec("graph");
    tabSpec.setIndicator(WidgetUtil.createHoloTabIndicator(this, "Graph"));
    tabSpec.setContent(R.id.tab_graph);
    th.addTab(tabSpec);

    tabSpec = th.newTabSpec("share");
    tabSpec.setIndicator(WidgetUtil.createHoloTabIndicator(this, "Upload"));
    tabSpec.setContent(R.id.tab_upload);
    th.addTab(tabSpec);

    th.getTabWidget().setBackgroundColor(Color.DKGRAY);

    {
        ListView lv = (ListView) findViewById(R.id.laplist);
        LapListAdapter adapter = new LapListAdapter();
        adapters.add(adapter);
        lv.setAdapter(adapter);
    }
    {
        ListView lv = (ListView) findViewById(R.id.report_list);
        ReportListAdapter adapter = new ReportListAdapter();
        adapters.add(adapter);
        lv.setAdapter(adapter);
    }
    graphTab = (LinearLayout) findViewById(R.id.tab_graph);
    {
        graphView = new LineGraphView(this, "Pace") {
            @Override
            protected String formatLabel(double value, boolean isValueX) {
                if (!isValueX) {
                    return formatter.formatPace(Formatter.TXT_SHORT, value);
                } else
                    return formatter.formatDistance(Formatter.TXT_SHORT, (long) value);
            }
        };

        graphView2 = new LineGraphView(this, "HRM") {
            @Override
            protected String formatLabel(double value, boolean isValueX) {
                if (!isValueX) {
                    return Integer.toString((int) Math.round(value));
                } else {
                    return formatter.formatDistance(Formatter.TXT_SHORT, (long) value);
                }
            }
        };
    }
    hrzonesBarLayout = (LinearLayout) findViewById(R.id.hrzonesBarLayout);
    hrzonesBar = new HRZonesBar(this);
}

From source file:com.esri.android.mapsapp.MapFragment.java

/**
 * Initialize LocatorSuggestionParameters or LocatorFindParameters
 *
 * @param TYPE A String determining thr type of parameters to be initialized
 * @param query The string for which the locator parameters are to be initialized
 *//* ww w  .j  av  a  2 s  .  com*/
private void locatorParams(String TYPE, String query) {
    if (TYPE.contentEquals(SUGGEST_PLACE)) {
        // Create suggestion parameters
        suggestParams = new LocatorSuggestionParameters(query);

        // Use the centre of the current map extent as the location
        suggestParams.setLocation(mMapView.getCenter(), mMapView.getSpatialReference());

        // Calculate distance for search operation
        Envelope mapExtent = new Envelope();
        mMapView.getExtent().queryEnvelope(mapExtent);

        // assume map is in meters, other units wont work, double
        // current envelope
        double distance = (mapExtent.getWidth() > 0) ? mapExtent.getWidth() * 2 : 10000;
        suggestParams.setDistance(distance);

    }

    if (TYPE.contentEquals(FIND_PLACE)) {
        // Create find parameters
        LocatorFindParameters findParams = new LocatorFindParameters(query);

        // Use the centre of the current map extent as the location
        findParams.setLocation(mMapView.getCenter(), mMapView.getSpatialReference());

        // Calculate distance for search operation
        Envelope mapExtent = new Envelope();
        mMapView.getExtent().queryEnvelope(mapExtent);

        // assume map is in meters, double current envelope
        double distance = (mapExtent.getWidth() > 0) ? mapExtent.getWidth() * 2 : 10000;
        findParams.setDistance(distance);

        findParams.setOutSR(mMapView.getSpatialReference());
    }
}

From source file:com.msopentech.applicationgateway.EnterpriseBrowserActivity.java

/**
 * Shows dialog enabling user to bookmark current (by default) or any other page.
 * /*from w w  w . j av a2  s.  com*/
 * @param v View this method is attached to.
 */
public void showAddBookmarkDialog(View v) {
    try {
        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.create_bookmark_dialog);
        dialog.setTitle(getString(R.string.bookmark_dialog_title));
        dialog.setCanceledOnTouchOutside(false);

        TextView cancelButton = (TextView) dialog.findViewById(R.id.create_bookmark_cancel);
        TextView saveButton = (TextView) dialog.findViewById(R.id.create_bookmark_ok);

        OnClickListener listener = new OnClickListener() {
            public void onClick(View v) {
                switch (v.getId()) {
                case R.id.create_bookmark_cancel: {
                    dialog.dismiss();
                    break;
                }
                case R.id.create_bookmark_ok: {
                    String name = ((EditText) dialog.findViewById(R.id.create_bookmark_name)).getText()
                            .toString();
                    String address = ((EditText) dialog.findViewById(R.id.create_bookmark_url)).getText()
                            .toString();

                    if (null != name && !(name.contentEquals("")) && null != address
                            && !(address.contentEquals(""))) {
                        PersistenceManager.addRecord(PersistenceManager.ContentType.BOOKMARKS,
                                new URLInfo(address, name));
                    }

                    dialog.dismiss();
                    break;
                }
                }
            }
        };

        cancelButton.setOnClickListener(listener);
        saveButton.setOnClickListener(listener);

        EditText name = (EditText) dialog.findViewById(R.id.create_bookmark_name);
        EditText address = (EditText) dialog.findViewById(R.id.create_bookmark_url);

        name.setText(mActiveWebView.getTitle());
        address.setText(mUrlEditTextView.getText());

        dialog.show();
    } catch (final Exception e) {
        Utility.showAlertDialog(EnterpriseBrowserActivity.class.getSimpleName()
                + ".showAddBookmarkDialog(): Failed. " + e.toString(), EnterpriseBrowserActivity.this);
    }
}

From source file:org.runnerup.export.JoggSE.java

@Override
public Status connect() {
    if (isConnected) {
        return Status.OK;
    }/*from   w  w w  .ja v  a 2  s .c  o m*/

    Status s = Status.NEED_AUTH;
    s.authMethod = Uploader.AuthMethod.USER_PASS;
    if (username == null || password == null) {
        return s;
    }

    Exception ex = null;
    HttpURLConnection conn = null;
    try {
        /**
         * Login by making an empty save-gpx call and see what error message
         * you get Invalid/"Invalid Userdetails" => wrong user/pass
         * NOK/"Root element is missing" => OK
         */
        final String LOGIN_OK = "NOK";

        conn = (HttpURLConnection) new URL(BASE_URL).openConnection();
        conn.setDoOutput(true);
        conn.setRequestMethod("POST");
        conn.addRequestProperty("Host", "jogg.se");
        conn.addRequestProperty("Content-Type", "text/xml");

        final BufferedWriter wr = new BufferedWriter(new PrintWriter(conn.getOutputStream()));
        saveGPX(wr, "");
        wr.flush();
        wr.close();

        final InputStream in = new BufferedInputStream(conn.getInputStream());
        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        final DocumentBuilder db = dbf.newDocumentBuilder();
        final InputSource is = new InputSource();
        is.setByteStream(in);
        final Document doc = db.parse(is);
        conn.disconnect();
        conn = null;

        final String path[] = { "soap:Envelope", "soap:Body", "SaveGpxResponse", "SaveGpxResult",
                "ResponseStatus", "ResponseCode" };
        final Node e = navigate(doc, path);
        System.err.println("reply: " + e.getTextContent());
        if (e != null && e.getTextContent() != null && LOGIN_OK.contentEquals(e.getTextContent())) {
            isConnected = true;
            return Uploader.Status.OK;
        }

        return s;
    } catch (final MalformedURLException e) {
        ex = e;
    } catch (final IOException e) {
        ex = e;
    } catch (final ParserConfigurationException e) {
        ex = e;
    } catch (final SAXException e) {
        ex = e;
    }

    if (conn != null)
        conn.disconnect();

    s = Uploader.Status.ERROR;
    s.ex = ex;
    if (ex != null) {
        ex.printStackTrace();
    }
    return s;
}

From source file:org.runnerup.export.JoggSESynchronizer.java

@Override
public Status connect() {
    if (isConnected) {
        return Status.OK;
    }/*from www .ja  v  a2  s .  co  m*/

    Status s = Status.NEED_AUTH;
    s.authMethod = Synchronizer.AuthMethod.USER_PASS;
    if (username == null || password == null) {
        return s;
    }

    Exception ex = null;
    HttpURLConnection conn = null;
    try {
        /**
         * Login by making an empty save-gpx call and see what error message
         * you get Invalid/"Invalid Userdetails" => wrong user/pass
         * NOK/"Root element is missing" => OK
         */
        final String LOGIN_OK = "NOK";

        conn = (HttpURLConnection) new URL(BASE_URL).openConnection();
        conn.setDoOutput(true);
        conn.setRequestMethod(RequestMethod.POST.name());
        conn.addRequestProperty("Host", "jogg.se");
        conn.addRequestProperty("Content-Type", "text/xml");

        final BufferedWriter wr = new BufferedWriter(new PrintWriter(conn.getOutputStream()));
        saveGPX(wr, "");
        wr.flush();
        wr.close();

        final InputStream in = new BufferedInputStream(conn.getInputStream());
        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        final DocumentBuilder db = dbf.newDocumentBuilder();
        final InputSource is = new InputSource();
        is.setByteStream(in);
        final Document doc = db.parse(is);
        conn.disconnect();
        conn = null;

        final String path[] = { "soap:Envelope", "soap:Body", "SaveGpxResponse", "SaveGpxResult",
                "ResponseStatus", "ResponseCode" };
        final Node e = navigate(doc, path);
        Log.e(getName(), "reply: " + e.getTextContent());
        if (e != null && e.getTextContent() != null && LOGIN_OK.contentEquals(e.getTextContent())) {
            isConnected = true;
            return Synchronizer.Status.OK;
        }

        return s;
    } catch (final MalformedURLException e) {
        ex = e;
    } catch (final IOException e) {
        ex = e;
    } catch (final ParserConfigurationException e) {
        ex = e;
    } catch (final SAXException e) {
        ex = e;
    }

    if (conn != null)
        conn.disconnect();

    s = Synchronizer.Status.ERROR;
    s.ex = ex;
    if (ex != null) {
        ex.printStackTrace();
    }
    return s;
}

From source file:br.liveo.ndrawer.ui.fragment.FragmentNotificationsfacebook.java

@Override
public void onCompleted(GraphResponse graphResponse) {

    int postreversecounter = 1;
    ContentValues cv1 = null, cv2 = null, cv3 = null, cv4 = null;
    String abc1 = null, abc2 = null, abc3 = null;

    Log.i("response", graphResponse.toString());

    JSONObject data1 = graphResponse.getJSONObject();
    try {/*from  w  ww. j a  v  a  2 s.  co  m*/
        if (data1 != null) {
            JSONArray friends = data1.getJSONArray("data");

            // JSONObject pagingInfo = data1.getJSONObject("paging");
            // Log.i("response-paging",pagingInfo.toString());
            for (int i = 0; i < friends.length(); i++) {

                JSONObject currentFriend = friends.getJSONObject(i);
                Log.i("response1", currentFriend.toString());

                String abc = currentFriend.getString("message");
                String time = currentFriend.getString("created_time");
                // Notification notimessage=new Notification(abc);
                // Notification timestamp=new Notification(time);

                // data2.add(timestamp);
                // adapter2.notifyDataSetChanged();

                //DATE

                String year = time.substring(0, 4);
                String month = time.substring(5, 7);
                String dated = time.substring(8, 10);

                Integer imonth = Integer.parseInt(month);

                switch (imonth) {
                case 1:
                    month = "Jan";
                    break;
                case 2:
                    month = "Feb";
                    break;
                case 3:
                    month = "Mar";
                    break;
                case 4:
                    month = "Apr";
                    break;
                case 5:
                    month = "May";
                    break;
                case 6:
                    month = "June";
                    break;
                case 7:
                    month = "July";
                    break;
                case 8:
                    month = "Aug";
                    break;
                case 9:
                    month = "Sep";
                    break;
                case 10:
                    month = "Oct";
                    break;
                case 11:
                    month = "Nov";
                    break;
                case 12:
                    month = "Dec";
                    break;
                }

                String date = dated + " " + month + ", " + year;

                Log.i("date", date);

                Log.i("response year", year);

                Log.i("response year_m", month);

                Log.i("response year_d", date);

                //DATE END

                Log.i("response3", time);

                //TIme

                String meri = "PM";

                String utchh = time.substring(11, 13);
                String utcmm = time.substring(14, 16);

                Log.i("hh_h", utchh);
                Log.i("hh_m", utcmm);

                Integer iutchh = Integer.parseInt(utchh);
                iutchh = iutchh + 5;

                if (iutchh > 12) {
                    iutchh = iutchh - 12;
                    meri = "PM";
                } else {
                    iutchh = iutchh;
                    meri = "AM";
                }

                Integer iutcmm = Integer.parseInt(utcmm);
                iutcmm = iutcmm + 30;
                if (iutcmm > 59) {
                    iutcmm = iutcmm - 60;
                    iutchh = iutchh + 1;
                }

                String isthh = String.valueOf(iutchh);
                String istmm = String.valueOf(iutcmm);

                Log.i("time", isthh + " : " + istmm);

                String ftime = isthh + ":" + istmm + " " + meri;

                //TIME Ends

                //Toast.makeText(this, time, Toast.LENGTH_SHORT);

                //check for duplicate

                String[] col = new String[1];
                col[0] = NotificationSquliteOpenHelper.NOTIFICATION;
                // col[1]=NotificationSquliteOpenHelper.NOTIFICATION_DATE;
                // col[2]=NotificationSquliteOpenHelper.NOTIFICATION_TIME;

                String text = "text";

                int flag = 0;

                Cursor c = db.query(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, col, null, null, null,
                        null, null);
                while (c.moveToNext()) {
                    text = c.getString(c.getColumnIndex(NotificationSquliteOpenHelper.NOTIFICATION));
                    //  String datee=c.getString(c.getColumnIndex(NotificationSquliteOpenHelper.NOTIFICATION_DATE));
                    //   String timeee=c.getString(c.getColumnIndex(NotificationSquliteOpenHelper.NOTIFICATION_TIME));

                    // String

                    // Notification n1=new Notification(text);
                    //Log.i("text get", text);

                    if (text != null && text.contentEquals(abc)) {

                        flag = 1;
                    }

                    Log.i("text flag", String.valueOf(flag));
                    // postcount++;
                    //  Note nn1=new Note(text);
                    //  data2.add(n1);
                }

                if (postreversecounter == 2) {

                    if (abc.contentEquals(abc1)) {
                        flag = 1;
                    }

                } else if (postreversecounter == 3) {

                    if (abc.contentEquals(abc1) || abc.contentEquals(abc2)) {
                        flag = 1;
                    }

                } else if (postreversecounter == 4) {
                    if (abc.contentEquals(abc1) || abc.contentEquals(abc2) || abc.contentEquals(abc3)) {
                        flag = 1;
                    }

                }

                if (flag != 1)
                //
                {
                    // data2.add(notimessage);
                    // adapter2.notifyDataSetChanged();

                    ContentValues cv = new ContentValues();
                    cv.put(NotificationSquliteOpenHelper.NOTIFICATION, abc);
                    cv.put(NotificationSquliteOpenHelper.NOTIFICATION_DATE, date);
                    cv.put(NotificationSquliteOpenHelper.NOTIFICATION_TIME, ftime);
                    SQLiteDatabase db = helper.getWritableDatabase();
                    //getContentResolver().insert(Studentsquliteopenhelper.STUDENT_TABLE, cv);
                    db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv);

                    if (postreversecounter == 1) {

                        abc1 = abc;

                        cv1 = new ContentValues();
                        cv1.put(NotificationSquliteOpenHelper.NOTIFICATION, abc);
                        cv1.put(NotificationSquliteOpenHelper.NOTIFICATION_DATE, date);
                        cv1.put(NotificationSquliteOpenHelper.NOTIFICATION_TIME, ftime);

                        postreversecounter++;

                    }

                    //

                    //for 1st object

                    if (postreversecounter == 2) {

                        abc2 = abc;

                        cv2 = new ContentValues();
                        cv2.put(NotificationSquliteOpenHelper.NOTIFICATION, abc);
                        cv2.put(NotificationSquliteOpenHelper.NOTIFICATION_DATE, date);
                        cv2.put(NotificationSquliteOpenHelper.NOTIFICATION_TIME, ftime);

                        postreversecounter++;
                    }
                    //

                    //for 1st object

                    if (postreversecounter == 3) {

                        abc3 = abc;

                        cv3 = new ContentValues();
                        cv3.put(NotificationSquliteOpenHelper.NOTIFICATION, abc);
                        cv3.put(NotificationSquliteOpenHelper.NOTIFICATION_DATE, date);
                        cv3.put(NotificationSquliteOpenHelper.NOTIFICATION_TIME, ftime);

                        postreversecounter++;
                    }
                    //

                    //                        ContentValues cv2 = new ContentValues();
                    //                        cv2.put(NotificationSquliteOpenHelper.NOTIFICATION_DATE, date);
                    //                        db = helper.getWritableDatabase();
                    //                        //getContentResolver().insert(Studentsquliteopenhelper.STUDENT_TABLE, cv);
                    //                        db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv2);
                    //
                    //                        ContentValues cv3 = new ContentValues();
                    //                        cv3.put(NotificationSquliteOpenHelper.NOTIFICATION_TIME, ftime);
                    //                        db = helper.getWritableDatabase();
                    //                        //getContentResolver().insert(Studentsquliteopenhelper.STUDENT_TABLE, cv);
                    //                        db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv3);

                    Notification nn1 = new Notification(abc, date, ftime);
                    data2.add(nn1);
                    adapter2.notifyDataSetChanged();

                    // Note nnew=new Note(getnote);

                    //data.add(nnew);
                    //adapter2.notifyDataSetChanged();
                }

            }

        } else {
            Toast.makeText(getActivity(), "No internet Connection found", Toast.LENGTH_SHORT);
        }

        if (postreversecounter == 4) {
            // db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv3);
            // db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv2);
            // db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv1);
        } else if (postreversecounter == 3) {
            // db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv2);
            // db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv1);
        } else if (postreversecounter == 2) {
            //db.insert(NotificationSquliteOpenHelper.NOTIFICATION_TABLE, null, cv1);
        }

    } catch (JSONException e) {
        e.printStackTrace();
    }

}

From source file:skoa.helpers.Graficos.java

private void difAbs() {
    //Aplicarle la frmula a los valores de las dos direcciones, obteniendo un slo fichero.
    aplicarFormula(2); //Se le aplica con porcentajes.
    String tipo = unidad.substring(0, unidad.indexOf("\t"));
    if (tipo.contentEquals("ABS"))
        tipo = "DIF";
    unidad = unidad.substring(unidad.indexOf("\t") + 1);
    if (unidad.indexOf("C") >= 0)
        unidad = "C";
    TimeSeries serie = obtenerSerieEvolucion2(); //Reutilizamos este cdigo.
    TimeSeriesCollection dataset = new TimeSeriesCollection(serie); //Slo se obtiene una curva.
    JFreeChart grafica = ChartFactory.createTimeSeriesChart("Valores medidos de las direcciones de grupo", //titulo
            "Fechas", //titulo eje x
            "Mediciones en " + tipo + " " + "(" + unidad + ")", //titulo eje y
            dataset, //dataset
            true, //leyenda
            true, //tooltips
            false); //configure chart to generate URLs?
    //Dar color a cada categoria
    grafica.setBackgroundPaint(Color.WHITE); //Color del fondo del grafico
    if (fechaInicial.equals("") & fechaFinal.equals("")) { //Si estan vacas es porque no hay resultados para ese intervalo.
        fechaInicial = " ? ";
        fechaFinal = " ? ";
    }//from  w  w  w. j a v a  2  s.co  m
    TextTitle t = new TextTitle("desde " + fechaInicial + " hasta " + fechaFinal,
            new Font("SanSerif", Font.ITALIC, 12));
    grafica.addSubtitle(t);
    try {
        ChartUtilities.saveChartAsJPEG(new File(ruta + "DiferenciasSmall.jpg"), grafica, 400, 300);
        ChartUtilities.saveChartAsJPEG(new File(ruta + "DiferenciasBig.jpg"), grafica, 900, 600);
    } catch (IOException e1) {
        System.err.println("Problem occurred creating chart.");
    }
}

From source file:de.enlightened.peris.PerisMain.java

public final boolean onPrepareOptionsMenu(final Menu menu) {
    super.onPrepareOptionsMenu(menu);

    final String customChatForum = this.application.getSession().getServer().chatForum;
    final String customChatThread = this.application.getSession().getServer().chatThread;

    final MenuItem newMailItem = menu.findItem(R.id.main_menu_new_mail);
    newMailItem.setVisible(false);/* w  w  w  .  ja  v  a  2s  .c  o  m*/

    final MenuItem searchMenuItem = menu.findItem(R.id.search);
    if (this.serverUserid == null || !getString(R.string.subforum_id).contentEquals("0")) {
        searchMenuItem.setVisible(false);
    }

    final MenuItem itemLogin = menu.findItem(R.id.main_menu_open_login);
    final MenuItem itemChat = menu.findItem(R.id.main_menu_open_chat);

    if (this.serverUserid == null) {
        itemLogin.setVisible(true);
        itemChat.setVisible(false);
    } else {
        itemLogin.setVisible(false);

        if ((!getString(R.string.chat_thread).contentEquals("0"))
                || (!customChatForum.contentEquals("0") && !customChatThread.contentEquals("0"))) {
            itemChat.setVisible(true);
        }
    }

    if (this.seperator != null) {
        itemLogin.setVisible(false);
        itemChat.setVisible(false);
    }

    if (ThemeSetter.getForegroundDark(this.background)) {
        itemLogin.setIcon(R.drawable.ic_action_accounts_dark);
        itemChat.setIcon(R.drawable.ic_action_group_dark);
        newMailItem.setIcon(R.drawable.ic_action_email_dark);
    }
    return true;
}