Example usage for android.view View INVISIBLE

List of usage examples for android.view View INVISIBLE

Introduction

In this page you can find the example usage for android.view View INVISIBLE.

Prototype

int INVISIBLE

To view the source code for android.view View INVISIBLE.

Click Source Link

Document

This view is invisible, but it still takes up space for layout purposes.

Usage

From source file:com.cryart.sabbathschool.viewmodel.SSReadingViewModel.java

private void loadLessonInfo() {
    ssLessonLoadingVisibility.set(View.VISIBLE);
    ssLessonOfflineStateVisibility.set(View.INVISIBLE);
    ssLessonErrorStateVisibility.set(View.INVISIBLE);
    ssLessonCoordinatorVisibility.set(View.INVISIBLE);

    mDatabase.child(SSConstants.SS_FIREBASE_LESSON_INFO_DATABASE).child(ssLessonIndex)
            .addListenerForSingleValueEvent(new ValueEventListener() {
                @Override//from w w w  .jav a  2  s  .  c o m
                public void onDataChange(DataSnapshot dataSnapshot) {
                    if (dataSnapshot != null) {
                        ssLessonInfo = dataSnapshot.getValue(SSLessonInfo.class);
                        if (dataListener != null)
                            dataListener.onLessonInfoChanged(ssLessonInfo);

                        if (ssLessonInfo != null && ssLessonInfo.days.size() > 0) {
                            DateTime today = DateTime.now().withTimeAtStartOfDay();

                            int idx = 0;

                            ssTotalReadsCount = ssLessonInfo.days.size();
                            ssReads = new ArrayList<SSRead>(ssTotalReadsCount);
                            ssReadHighlights = new ArrayList<SSReadHighlights>(ssTotalReadsCount);
                            ssReadComments = new ArrayList<SSReadComments>(ssTotalReadsCount);

                            for (SSDay ssDay : ssLessonInfo.days) {
                                DateTime startDate = DateTimeFormat.forPattern(SSConstants.SS_DATE_FORMAT)
                                        .parseLocalDate(ssDay.date).toDateTimeAtStartOfDay();
                                if (startDate.isEqual(today) && ssReadIndex == null && ssReadIndexInt < 6) {
                                    ssReadIndexInt = idx;
                                } else if (ssReadIndex != null && ssReadIndex.equals(ssDay.index)) {
                                    ssReadIndexInt = idx;
                                }

                                downloadHighlights(ssDay.index, idx);
                                idx++;
                            }
                        }
                    } else {
                        ssLessonOfflineStateVisibility.set(View.VISIBLE);
                        ssLessonErrorStateVisibility.set(View.INVISIBLE);
                        ssLessonLoadingVisibility.set(View.INVISIBLE);
                        ssLessonCoordinatorVisibility.set(View.INVISIBLE);
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    ssLessonErrorStateVisibility.set(View.VISIBLE);
                    ssLessonLoadingVisibility.set(View.INVISIBLE);
                    ssLessonOfflineStateVisibility.set(View.INVISIBLE);
                    ssLessonCoordinatorVisibility.set(View.INVISIBLE);
                }
            });
}

From source file:net.kourlas.voipms_sms.Api.java

public void updateSmses(boolean silent) {
    if (preferences.getEmail().equals("")) {
        if (!silent) {
            Toast.makeText(context.getApplicationContext(), "Update SMSes: VoIP.ms portal email not set",
                    Toast.LENGTH_SHORT).show();
        }/*from  w  w  w. j  a va2  s .  c o m*/
    } else if (preferences.getPassword().equals("")) {
        if (!silent) {
            Toast.makeText(context.getApplicationContext(), "Update SMSes: VoIP.ms API password not set",
                    Toast.LENGTH_SHORT).show();
        }
    } else if (preferences.getDid().equals("")) {
        if (!silent) {
            Toast.makeText(context.getApplicationContext(), "Update SMSes: DID not set", Toast.LENGTH_SHORT)
                    .show();
        }
    } else if (isNetworkConnectionAvailable()) {
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        calendar.add(Calendar.DAY_OF_YEAR, -preferences.getDaysToSync());

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));

        try {
            String voipUrl = "https://www.voip.ms/api/v1/rest.php?" + "&" + "api_username="
                    + URLEncoder.encode(preferences.getEmail(), "UTF-8") + "&" + "api_password="
                    + URLEncoder.encode(preferences.getPassword(), "UTF-8") + "&" + "method=getSMS" + "&"
                    + "did=" + URLEncoder.encode(preferences.getDid(), "UTF-8") + "&" + "limit="
                    + URLEncoder.encode("1000000", "UTF-8") + "&" + "from="
                    + URLEncoder.encode(sdf.format(calendar.getTime()), "UTF-8") + "&" + "to="
                    + URLEncoder.encode(sdf.format(Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime()),
                            "UTF-8")
                    + "&" + "timezone=-1";
            new UpdateSmsesAsyncTask().execute(voipUrl, Boolean.toString(silent));
            return;
        } catch (UnsupportedEncodingException ex) {
            if (!silent) {
                Toast.makeText(context.getApplicationContext(),
                        "Update SMSes: Email address or password contains invalid characters "
                                + "(UnsupportedEncodingException)",
                        Toast.LENGTH_SHORT).show();
            }
        }
    } else {
        if (!silent) {
            Toast.makeText(context.getApplicationContext(), "Update SMSes: Network connection unavailable",
                    Toast.LENGTH_SHORT).show();
        }
    }

    if (context instanceof ConversationsActivity) {
        SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) ((ConversationsActivity) context)
                .findViewById(R.id.swipe_refresh_layout);
        swipeRefreshLayout.setRefreshing(false);
    } else if (context instanceof ConversationActivity) {
        ProgressBar progressBar = (ProgressBar) ((ConversationActivity) context)
                .findViewById(R.id.progress_bar);
        progressBar.setVisibility(View.INVISIBLE);

    }
}

From source file:com.owncloud.android.ui.adapter.FileListListAdapter.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View view = convertView;/*from   w  w w  . j a  v a 2  s  . co m*/
    if (view == null) {
        LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflator.inflate(R.layout.list_item, null);
    }

    if (mFiles != null && mFiles.size() > position) {
        OCFile file = mFiles.get(position);
        TextView fileName = (TextView) view.findViewById(R.id.Filename);
        String name = file.getFileName();
        if (dataSourceShareFile == null)
            dataSourceShareFile = new DbShareFile(mContext);

        Account account = AccountUtils.getCurrentOwnCloudAccount(mContext);
        String[] accountNames = account.name.split("@");

        if (accountNames.length > 2) {
            accountName = accountNames[0] + "@" + accountNames[1];
            url = accountNames[2];
        }
        Map<String, String> fileSharers = dataSourceShareFile.getUsersWhoSharedFilesWithMe(accountName);
        TextView sharer = (TextView) view.findViewById(R.id.sharer);
        ImageView shareButton = (ImageView) view.findViewById(R.id.shareItem);
        fileName.setText(name);
        ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);
        fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype()));
        ImageView localStateView = (ImageView) view.findViewById(R.id.imageView2);
        FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder();
        FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();
        if (fileSharers.size() != 0 && (!file.equals("Shared") && file.getRemotePath().contains("Shared"))) {
            if (fileSharers.containsKey(name)) {
                sharer.setText(fileSharers.get(name));
                fileSharers.remove(name);
            } else {
                sharer.setText(" ");
            }
        } else {
            sharer.setText(" ");
        }

        if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) {
            localStateView.setImageResource(R.drawable.downloading_file_indicator);
            localStateView.setVisibility(View.VISIBLE);
        } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) {
            localStateView.setImageResource(R.drawable.uploading_file_indicator);
            localStateView.setVisibility(View.VISIBLE);
        } else if (file.isDown()) {
            localStateView.setImageResource(R.drawable.local_file_indicator);
            localStateView.setVisibility(View.VISIBLE);
        } else {
            localStateView.setVisibility(View.INVISIBLE);
        }

        TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);
        TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
        ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
        shareButton.setOnClickListener(new OnClickListener() {
            String shareStatusDisplay;
            int flagShare = 0;

            @Override
            public void onClick(View v) {
                final Dialog dialog = new Dialog(mContext);
                final OCFile fileToBeShared = (OCFile) getItem(position);
                final ArrayAdapter<String> shareWithFriends;
                final ArrayAdapter<String> shareAdapter;
                final String filePath;
                sharedWith = new ArrayList<String>();
                dataSource = new DbFriends(mContext);
                dataSourceShareFile = new DbShareFile(mContext);
                dialog.setContentView(R.layout.share_file_with);
                dialog.setTitle("Share");
                Account account = AccountUtils.getCurrentOwnCloudAccount(mContext);
                String[] accountNames = account.name.split("@");

                if (accountNames.length > 2) {
                    accountName = accountNames[0] + "@" + accountNames[1];
                    url = accountNames[2];
                }

                final AutoCompleteTextView textView = (AutoCompleteTextView) dialog
                        .findViewById(R.id.autocompleteshare);
                Button shareBtn = (Button) dialog.findViewById(R.id.ShareBtn);
                Button doneBtn = (Button) dialog.findViewById(R.id.ShareDoneBtn);
                final ListView listview = (ListView) dialog.findViewById(R.id.alreadySharedWithList);

                textView.setThreshold(2);
                final String itemType;

                filePath = "files" + String.valueOf(fileToBeShared.getRemotePath());
                final String fileName = fileToBeShared.getFileName();
                final String fileRemotePath = fileToBeShared.getRemotePath();
                if (dataSourceShareFile == null)
                    dataSourceShareFile = new DbShareFile(mContext);
                sharedWith = dataSourceShareFile.getUsersWithWhomIhaveSharedFile(fileName, fileRemotePath,
                        accountName, String.valueOf(1));
                shareAdapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1,
                        sharedWith);
                listview.setAdapter(shareAdapter);
                final String itemSource;
                if (fileToBeShared.isDirectory()) {
                    itemType = "folder";
                    int lastSlashInFolderPath = filePath.lastIndexOf('/');
                    itemSource = filePath.substring(0, lastSlashInFolderPath);
                } else {
                    itemType = "file";
                    itemSource = filePath;
                }

                //Permissions disabled with friends app
                ArrayList<String> friendList = dataSource.getFriendList(accountName);
                dataSource.close();
                shareWithFriends = new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1,
                        friendList);
                textView.setAdapter(shareWithFriends);
                textView.setFocusableInTouchMode(true);
                dialog.show();
                textView.setOnItemClickListener(new OnItemClickListener() {

                    @Override
                    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

                    }
                });
                final Handler finishedHandler = new Handler() {
                    @Override
                    public void handleMessage(Message msg) {
                        shareAdapter.notifyDataSetChanged();
                        Toast.makeText(mContext, shareStatusDisplay, Toast.LENGTH_SHORT).show();

                    }
                };
                shareBtn.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        final String shareWith = textView.getText().toString();

                        if (shareWith.equals("")) {
                            textView.setHint("Share With");
                            Toast.makeText(mContext,
                                    "Please enter the friends name with whom you want to share",
                                    Toast.LENGTH_SHORT).show();
                        } else if (sharedWith.contains(shareWith)) {
                            textView.setHint("Share With");
                            Toast.makeText(mContext, "You have shared the file with that person",
                                    Toast.LENGTH_SHORT).show();
                        } else {

                            textView.setText("");
                            Runnable runnable = new Runnable() {
                                @Override
                                public void run() {
                                    HttpPost post = new HttpPost(
                                            "http://" + url + "/owncloud/androidshare.php");
                                    final ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();

                                    params.add(new BasicNameValuePair("itemType", itemType));
                                    params.add(new BasicNameValuePair("itemSource", itemSource));
                                    params.add(new BasicNameValuePair("shareType", shareType));
                                    params.add(new BasicNameValuePair("shareWith", shareWith));
                                    params.add(new BasicNameValuePair("permission", permissions));
                                    params.add(new BasicNameValuePair("uidOwner", accountName));
                                    HttpEntity entity;
                                    String shareSuccess = "false";
                                    try {
                                        entity = new UrlEncodedFormEntity(params, "utf-8");
                                        HttpClient client = new DefaultHttpClient();
                                        post.setEntity(entity);
                                        HttpResponse response = client.execute(post);

                                        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                                            HttpEntity entityresponse = response.getEntity();
                                            String jsonentity = EntityUtils.toString(entityresponse);
                                            JSONObject obj = new JSONObject(jsonentity);
                                            shareSuccess = obj.getString("SHARE_STATUS");
                                            flagShare = 1;
                                            if (shareSuccess.equals("true")) {
                                                dataSourceShareFile.putNewShares(fileName, fileRemotePath,
                                                        accountName, shareWith);
                                                sharedWith.add(shareWith);
                                                shareStatusDisplay = "File share succeeded";
                                            } else if (shareSuccess.equals("INVALID_FILE")) {
                                                shareStatusDisplay = "File you are trying to share does not exist";
                                            } else if (shareSuccess.equals("INVALID_SHARETYPE")) {
                                                shareStatusDisplay = "File Share type is invalid";
                                            } else {
                                                shareStatusDisplay = "Share did not succeed. Please check your internet connection";
                                            }

                                            finishedHandler.sendEmptyMessage(flagShare);

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

                                }
                            };
                            new Thread(runnable).start();

                        }

                        if (flagShare == 1) {
                        }

                    }

                });
                doneBtn.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();
                        //dataSourceShareFile.close();
                    }
                });
            }

        });
        //dataSourceShareFile.close();
        if (!file.isDirectory()) {
            fileSizeV.setVisibility(View.VISIBLE);
            fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));
            lastModV.setVisibility(View.VISIBLE);
            lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp()));
            // this if-else is needed even thoe fav icon is visible by default
            // because android reuses views in listview
            if (!file.keepInSync()) {
                view.findViewById(R.id.imageView3).setVisibility(View.GONE);
            } else {
                view.findViewById(R.id.imageView3).setVisibility(View.VISIBLE);
            }

            ListView parentList = (ListView) parent;
            if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
                checkBoxV.setVisibility(View.GONE);
            } else {
                if (parentList.isItemChecked(position)) {
                    checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
                } else {
                    checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
                }
                checkBoxV.setVisibility(View.VISIBLE);
            }

        } else {

            fileSizeV.setVisibility(View.VISIBLE);
            fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));
            lastModV.setVisibility(View.VISIBLE);
            lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp()));
            checkBoxV.setVisibility(View.GONE);
            view.findViewById(R.id.imageView3).setVisibility(View.GONE);
        }
    }

    return view;
}

From source file:com.digipom.manteresting.android.adapter.NailCursorAdapter.java

/**
 * BindView will also be called after newView. See {@link CursorAdapter}
 *//*from   w  w w .  ja v a 2s. c o  m*/
@Override
public void bindView(View view, Context context, Cursor cursor) {
    try {
        // 84, or 0.825, comes from the margins/paddings around the
        // image. This will need to be changed if the margins/paddings are
        // changed or multi-column mode is used.
        final int approxImageWidthInPixels = (int) (context.getResources().getDisplayMetrics().widthPixels
                * 0.825f);

        // Request a load of the bitmaps on either side, to avoid
        // problems when scrolling up and down.
        final int cursorPosition = cursor.getPosition();

        if (cursorPosition > 0) {
            cursor.moveToPrevious();
            if (cursor.getString(nailObjectColumnIndex) != null) {
                cacheDataAndGet(context, cursor, approxImageWidthInPixels);
            }
            cursor.moveToNext();
        }

        if (cursorPosition < cursor.getCount() - 1) {
            cursor.moveToNext();
            if (cursor.getString(nailObjectColumnIndex) != null) {
                cacheDataAndGet(context, cursor, approxImageWidthInPixels);
            }
            cursor.moveToPrevious();
        }

        final ViewHolder viewHolder = (ViewHolder) view.getTag();

        final CachedData cachedDataForThisNailItem = cacheDataAndGet(context, cursor, approxImageWidthInPixels);

        viewHolder.nailDescription.setText(cachedDataForThisNailItem.nailDescription);
        viewHolder.nailUserAndCategory.setText(cachedDataForThisNailItem.styledUserAndCategory);

        if (failedDownloads.contains(cachedDataForThisNailItem.originalImageUriString)) {
            // This image has failed. The user will have to select to
            // retry this image. INVISIBLE and not GONE so that the view
            // doesn't jump in sizes for couldNotLoadImageIndicator.
            viewHolder.imageLoadingIndicator.setVisibility(View.INVISIBLE);
            viewHolder.couldNotLoadImageIndicator.setVisibility(View.VISIBLE);
            viewHolder.loadedImage.setVisibility(View.GONE);
        } else {
            // Should default to WRAP_CONTENT
            viewHolder.loadedImage.getLayoutParams().height = LayoutParams.WRAP_CONTENT;

            Bitmap bitmap = null;

            if (serviceConnector.getService() != null) {
                bitmap = serviceConnector.getService().getOrLoadLifoAsync(
                        cachedDataForThisNailItem.originalImageUriString, approxImageWidthInPixels,
                        bitmapCompleteReceiver);
            }

            if (bitmap == null) {
                viewHolder.imageLoadingIndicator.setVisibility(View.VISIBLE);
                viewHolder.couldNotLoadImageIndicator.setVisibility(View.INVISIBLE);
                viewHolder.loadedImage.setVisibility(View.GONE);
            } else {
                viewHolder.imageLoadingIndicator.setVisibility(View.GONE);
                viewHolder.couldNotLoadImageIndicator.setVisibility(View.GONE);
                viewHolder.loadedImage.setVisibility(View.VISIBLE);

                viewHolder.loadedImage.setImageBitmap(bitmap);
            }
        }
    } catch (JSONException e) {
        if (LoggerConfig.canLog(Log.ERROR)) {
            Log.e(TAG, "Could not load JSON object from database.", e);
        }
    } catch (Exception e) {
        if (LoggerConfig.canLog(Log.ERROR)) {
            Log.e(TAG, "Error binding view.", e);
        }
    }
}

From source file:com.arctech.stikyhive.ChattingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    recipientStkid = getIntent().getExtras().getString("recipientStkid");
    chatRecipient = getIntent().getExtras().getString("chatRecipient");
    chatRecipientUrl = getIntent().getExtras().getString("chatRecipientUrl");
    senderToken = getIntent().getExtras().getString("senderToken");
    recipientToken = getIntent().getExtras().getString("recipientToken");
    noti = getIntent().getExtras().getBoolean("noti");
    message = getIntent().getExtras().getString("message");
    rows = getIntent().getExtras().getInt("rows");

    pref = PreferenceManager.getDefaultSharedPreferences(this);
    ws = new JsonWebService();
    dbHelper = new DBHelper(this);
    dialog = new ProgressDialog(this);
    listChatContact = new ArrayList<>();
    listChatContact = dbHelper.getChatContact();
    Log.i(" Chat Contact ", " " + listChatContact.size());
    //to change font
    faceSemi_bold = Typeface.createFromAsset(getAssets(), fontOSSemi_bold);
    Typeface faceLight = Typeface.createFromAsset(getAssets(), fontOSLight);
    faceRegular = Typeface.createFromAsset(getAssets(), fontOSRegular);

    imageLoader = ImageLoader.getInstance();
    if (!imageLoader.isInited()) {
        imageLoader.init(ImageLoaderConfiguration.createDefault(this));
    }/*from   w ww  .j  a  va  2  s  .c  om*/

    start = new Date();
    SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm");
    timeSend = oFormat.format(start);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.chat);

    txtUserName = (TextView) findViewById(R.id.txtChatName);
    edTxtMsg = (EditText) findViewById(R.id.edTxtMsg);
    imgViewProfile = (ImageView) findViewById(R.id.imgViewChat);
    imgViewAddCon = (ImageView) findViewById(R.id.imgAddContact);
    lv = (ListView) findViewById(R.id.listView1);
    layoutLabel = (LinearLayout) findViewById(R.id.layoutLabel);
    txtLabel1 = (TextView) findViewById(R.id.txtLabel1);
    txtLabel2 = (TextView) findViewById(R.id.txtLabel2);
    txtLabel3 = (TextView) findViewById(R.id.txtLabel3);
    txtLabel2.setText(" " + chatRecipient + " ");
    txtLabel1.setTypeface(faceLight);
    txtLabel2.setTypeface(faceRegular);
    txtLabel3.setTypeface(faceLight);
    // lv.smoothScrollToPosition(adapter.getCount() - 1);

    for (ChatContact contact : listChatContact) {
        if (contact.getContactId().equals(recipientStkid)) {
            imgViewAddCon.setVisibility(View.INVISIBLE);
            layoutLabel.setVisibility(View.GONE);
            break;
        }
    }
    Log.i(TAG, " come back again");
    adapter = new ChatArrayAdapter(getApplicationContext(), R.layout.messaging_listview, faceSemi_bold,
            faceRegular);
    lv.setAdapter(adapter);
    // adapter.add(new StikyChat(chatRecipientUrl, "Hello", false, "12.10.2015", "12.1.2014"));

    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    // BEGIN_INCLUDE (change_colors)
    // Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids
    swipeRefreshLayout.setColorScheme(R.color.swipe_color_1, R.color.swipe_color_2, R.color.swipe_color_3,
            R.color.swipe_color_4);
    limitMsg = 7;
    // END_INCLUDE (change_colors)
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            Log.i(" Refresh Layout ", "onRefresh called from SwipeRefreshLayout");
            if (limitMsg < rows) {
                Log.i("Limit Message ", " " + limitMsg);
                limitMsg *= 2;
                fetchRecords();
            } else if (limitMsg > rows && (limitMsg - rows < 7)) {
                fetchRecords();
            } else {
                Log.i("No data ", "to refresh");
                swipeRefreshLayout.setRefreshing(false);
                Toast.makeText(getApplicationContext(), "No data to refresh!", Toast.LENGTH_SHORT).show();
            }

            // initiateRefresh();
        }
    });

    LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout headerLayout = (LinearLayout) findViewById(R.id.header);
    View header = inflator.inflate(R.layout.header, null);

    TextView textView = (TextView) header.findViewById(R.id.textView1);
    textView.setText("StikyChat");
    textView.setTypeface(faceSemi_bold);
    textView.setVisibility(View.VISIBLE);
    headerLayout.addView(header);
    LinearLayout layoutRight = (LinearLayout) header.findViewById(R.id.layoutRight);
    layoutRight.setVisibility(View.GONE);

    txtUserName.setText(chatRecipient);
    Log.i(TAG, "Activity Name " + txtUserName.getText().toString());
    txtUserName.setTypeface(faceSemi_bold);

    String url = "";
    if (chatRecipientUrl.contains("http")) {
        url = chatRecipientUrl;
    } else {
        url = this.getResources().getString(R.string.url) + "/" + chatRecipientUrl;
    }
    addAndroidUniversalImageLoader(imgViewProfile, url);
    //        if (noti && (!message.equals(""))) {
    //            adapter.add(new StikyChat(chatRecipientUrl, message, true, timeSend, ""));
    //            lv.smoothScrollToPosition(adapter.getCount() - 1);
    //        }

    //to show history chats between two users(sender & recipient)
    dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    dateFormat2 = new SimpleDateFormat("dd MMM HH:mm");
    listHistory = dbHelper.getStikyChat();
    if (listHistory.size() > 0) {
        Collections.reverse(listHistory);
        for (StikyChatTb chatTb : listHistory) {
            String getDate = chatTb.getSendDate();
            String fromStikyBee = chatTb.getSender();
            try {
                String createDate = dateFormat2.format(dateFormat.parse(getDate));
                if (fromStikyBee.equals(pref.getString("stkid", ""))) {
                    adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), false, createDate, ""));
                } else {
                    adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), true, createDate, ""));
                }
                lv.smoothScrollToPosition(adapter.getCount() - 1);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
    }

    mRegistrationBroadcastReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
            messageGCM = sharedPreferences.getString("message", "");
            recipientProfileGCM = sharedPreferences.getString("chatRecipientUrl", "");
            recipientNameGCM = sharedPreferences.getString("chatRecipientName", "");
            recipientStkidGCM = sharedPreferences.getString("recipientStkid", "");
            recipientTokenGCM = sharedPreferences.getString("recipientToken", "");
            senderTokenGCM = sharedPreferences.getString("senderToken", "");

            Log.i(TAG, "..." + recipientStkidGCM.trim() + " STKID " + recipientStkid.trim() + ":");
            if (firstConnect) {
                if (recipientStkidGCM.trim() == recipientStkid.trim()
                        || recipientStkidGCM.equals(recipientStkid)) {
                    MyGcmListenerService.flagSendNoti = false;
                    Log.i(TAG, " " + message);
                    // (1) get today's date
                    start = new Date();
                    SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm");
                    timeSend = oFormat.format(start);

                    Log.i(TAG, "First connect " + firstConnect);
                    StikyChat stikyChat = new StikyChat(recipientProfileGCM, messageGCM, true, timeSend, "");
                    Log.i(TAG, " First " + message + " " + recipientProfileGCM + " " + timeSend);
                    Log.i(TAG, "User " + txtUserName.getText().toString());
                    //txtUserName.setText(message);
                    Log.i(TAG, "User 2 " + txtUserName.getText().toString());
                    adapter.add(stikyChat);
                    adapter.notifyDataSetChanged();
                    //new regTask2().execute("Obj ");
                    lv.smoothScrollToPosition(adapter.getCount() - 1);
                } else {
                    Log.i(TAG, "..." + recipientStkidGCM.trim());
                    Log.i(TAG, "&&&" + recipientStkid.trim());
                    Log.i(TAG, "else casee");
                    //notificaton send
                    flagNotifi = true;
                    new regTask2().execute("Notification");
                }
                firstConnect = false;
            }
        }
    };
}

From source file:com.ichi2.anki.CardTemplateEditor.java

@Override
public void showProgressBar() {
    super.showProgressBar();
    findViewById(R.id.progress_description).setVisibility(View.VISIBLE);
    findViewById(R.id.fragment_parent).setVisibility(View.INVISIBLE);
}

From source file:zjut.soft.finalwork.fragment.LeftFragment.java

private void selectedItemWithArrow(int id) {
    ImageView[] ivs = new ImageView[] { iv1, iv2, iv3, iv4, iv5 };
    // /*from w ww .  java2s.  c om*/
    for (ImageView iv : ivs) {
        iv.setVisibility(View.INVISIBLE);
    }

    switch (id) {
    case R.id.sliding_activity_user_manage:
        iv1.setVisibility(View.VISIBLE);
        break;
    case R.id.sliding_activity_query_system:
        iv2.setVisibility(View.VISIBLE);
        break;
    case R.id.sliding_activity_pay_query:
        iv3.setVisibility(View.VISIBLE);
        break;
    case R.id.sliding_activity_unregister_user:
        iv5.setVisibility(View.VISIBLE);
        break;
    case R.id.sliding_activity_about_us:
        iv4.setVisibility(View.VISIBLE);
        break;
    }
}

From source file:com.ichi2.anki.CardTemplateEditor.java

@Override
public void hideProgressBar() {
    super.hideProgressBar();
    findViewById(R.id.progress_description).setVisibility(View.INVISIBLE);
    findViewById(R.id.fragment_parent).setVisibility(View.VISIBLE);
}

From source file:org.openplans.rcavl.RCAVL.java

public void loggedIn() {
    spinner.setIndeterminate(false);// ww w  . j a va  2s . c  o  m
    spinner.setVisibility(View.INVISIBLE);

    /*
     * Handle adding the user's email address to the frequently used email
     * address list
     */
    SharedPreferences preferences = getPreferences(MODE_PRIVATE);
    String emails = preferences.getString("emails", null);
    userEmail = emailField.getText().toString();
    if (emails == null) {
        emails = userEmail;
    } else {
        String[] past_emails = emails.split(",");
        if (!Arrays.asList(past_emails).contains(userEmail)) {
            emails = emails + "," + userEmail;
        }
    }
    Editor editor = preferences.edit();
    editor.putString("emails", emails);
    editor.commit();

    toast("Logged in");
    switchToRunning();
}