Example usage for android.widget RelativeLayout setVisibility

List of usage examples for android.widget RelativeLayout setVisibility

Introduction

In this page you can find the example usage for android.widget RelativeLayout setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.hybris.mobile.app.commerce.fragment.CatalogMenuFragment.java

/**
 * Add a child view to the view flipper//  w w w  .  jav  a2 s.  c  o  m
 *
 * @param parent
 * @param showCatalogMenuLogo
 */
private void buildChildrenView(final CategoryHierarchy parent, boolean showCatalogMenuLogo, boolean showNext) {
    // Layout for the view
    final View view = getActivity().getLayoutInflater().inflate(R.layout.include_catalog_menu_categories,
            mCatalogMenuViewFlipper, false);

    TextView textViewTopCategoryName = (TextView) view.findViewById(R.id.catalog_menu_top_category_name);
    RelativeLayout relativeLayoutTopCategory = (RelativeLayout) view
            .findViewById(R.id.catalog_menu_top_category);
    ListView listViewCategories = (ListView) view.findViewById(R.id.catalog_menu_list_category);

    // We set to visible the top category name
    relativeLayoutTopCategory.setVisibility(View.VISIBLE);

    // Setting the top category name
    textViewTopCategoryName.setText(parent.getName());
    textViewTopCategoryName.setVisibility(View.VISIBLE);
    textViewTopCategoryName.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (parent.getParent() != null) {
                mCurrentCategoryId = parent.getParent().getId();
            } else {
                mCurrentCategoryId = null;
            }

            // On click of the top category, we go back to the top view
            mCatalogMenuViewFlipper.setInAnimation(getActivity(), R.anim.translate_left_to_origin);
            mCatalogMenuViewFlipper.setOutAnimation(getActivity(), R.anim.translate_origin_to_right);
            mCatalogMenuViewFlipper.showPrevious();

            // And we remove the view we just came by
            mCatalogMenuViewFlipper.removeViewAt(mCatalogMenuViewFlipper.getChildCount() - 1);

            // We display the catalog logo if we are on the top view
            if (mCatalogMenuViewFlipper.getChildCount() == 1) {
                showCatalogMenuLogo(view, true);
            }

            // Updating the content view
            updateContentView(parent.getParent(), false);

        }
    });

    // Setting the list for the sub categories
    initListViewCatalog(listViewCategories, parent.getSubcategories());

    // Show the subcategories
    mCatalogMenuViewFlipper.addView(view);

    if (showNext) {
        mCatalogMenuViewFlipper.setInAnimation(getActivity(), R.anim.translate_right_to_origin);
        mCatalogMenuViewFlipper.setOutAnimation(getActivity(), R.anim.translate_origin_to_left);
        mCatalogMenuViewFlipper.showNext();

        // Updating the content view once the ViewFlipper has finished his animation
        updateContentView(parent, false);
    }

    // Hidding the catalog logo on subcategories
    showCatalogMenuLogo(view, showCatalogMenuLogo);

}

From source file:com.gh4a.IssueActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    setTheme(Gh4Application.THEME);// w  ww  .j  a v a 2 s.c  o  m
    super.onCreate(savedInstanceState);

    Bundle data = getIntent().getExtras();
    mRepoOwner = data.getString(Constants.Repository.REPO_OWNER);
    mRepoName = data.getString(Constants.Repository.REPO_NAME);
    mIssueNumber = data.getInt(Constants.Issue.ISSUE_NUMBER);
    mIssueState = data.getString(Constants.Issue.ISSUE_STATE);

    if (!isOnline()) {
        setErrorView();
        return;
    }

    setContentView(R.layout.issue);

    aq = new AQuery(this);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getResources().getString(R.string.issue) + " #" + mIssueNumber);
    actionBar.setSubtitle(mRepoOwner + "/" + mRepoName);
    actionBar.setDisplayHomeAsUpEnabled(true);

    RelativeLayout tlComment = (RelativeLayout) findViewById(R.id.rl_comment);
    if (!isAuthorized()) {
        tlComment.setVisibility(View.GONE);
    }

    getSupportLoaderManager().initLoader(0, null, this);
    getSupportLoaderManager().getLoader(0).forceLoad();

    getSupportLoaderManager().initLoader(1, null, this);
}

From source file:org.jitsi.android.gui.contactlist.ContactListFragment.java

private void updateSearchView(final String query) {
    View view = getView();/*from   w ww .  ja  v  a 2  s .  c  o m*/
    if (view == null) {
        logger.error("No view created yet!!! query: " + query);
        return;
    }

    RelativeLayout callSearchLayout = (RelativeLayout) view.findViewById(R.id.callSearchLayout);

    if (StringUtils.isNullOrEmpty(query)) {
        if (callSearchLayout != null) {
            callSearchLayout.setVisibility(View.INVISIBLE);
            callSearchLayout.getLayoutParams().height = 0;
        }
    } else {
        if (callSearchLayout != null) {
            TextView searchContactView = (TextView) callSearchLayout.findViewById(R.id.callSearchContact);

            searchContactView.setText(query);
            callSearchLayout.getLayoutParams().height = searchContactView.getResources()
                    .getDimensionPixelSize(R.dimen.account_list_row_height);

            callSearchLayout.setVisibility(View.VISIBLE);

            final ImageButton callButton = (ImageButton) callSearchLayout.findViewById(R.id.contactCallButton);
            callButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    AndroidCallUtil.createAndroidCall(getActivity(), callButton, query);
                }
            });
        }
    }
}

From source file:de.baumann.hhsmoodle.data_courses.Courses_Fragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_screen_notes, container, false);

    ImageView imgHeader = (ImageView) rootView.findViewById(R.id.imageView_header);
    helper_main.setImageHeader(getActivity(), imgHeader);

    PreferenceManager.setDefaultValues(getActivity(), R.xml.user_settings, false);
    sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    RelativeLayout filter_layout = (RelativeLayout) rootView.findViewById(R.id.filter_layout);
    filter_layout.setVisibility(View.GONE);
    lv = (ListView) rootView.findViewById(R.id.listNotes);
    viewPager = (ViewPager) getActivity().findViewById(R.id.viewpager);

    fabLayout1 = (LinearLayout) rootView.findViewById(R.id.fabLayout1);
    fabLayout2 = (LinearLayout) rootView.findViewById(R.id.fabLayout2);
    fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    TextView fab2_text = (TextView) rootView.findViewById(R.id.text_fab2);
    fab2_text.setText(getString(R.string.courseList_fromText));
    FloatingActionButton fab1 = (FloatingActionButton) rootView.findViewById(R.id.fab1);
    FloatingActionButton fab2 = (FloatingActionButton) rootView.findViewById(R.id.fab2);

    fab.setOnClickListener(new View.OnClickListener() {
        @Override//from w  w  w . j  av  a2s.com
        public void onClick(View view) {
            if (!isFABOpen) {
                showFABMenu();
            } else {
                closeFABMenu();
            }
        }
    });

    fab1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            closeFABMenu();

            android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity());
            View dialogView = View.inflate(getActivity(), R.layout.dialog_edit_entry, null);

            final EditText edit_title = (EditText) dialogView.findViewById(R.id.note_title_input);
            edit_title.setHint(R.string.title_hint);

            final EditText edit_cont = (EditText) dialogView.findViewById(R.id.note_text_input);
            edit_cont.setHint(R.string.text_hint);

            builder.setView(dialogView);
            builder.setTitle(R.string.number_edit_entry);
            builder.setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {

                    String inputTitle = edit_title.getText().toString().trim();
                    String inputCont = edit_cont.getText().toString().trim();

                    if (db.isExist(inputTitle)) {
                        Snackbar.make(lv, getString(R.string.toast_newTitle), Snackbar.LENGTH_LONG).show();
                    } else {
                        db.insert(inputTitle, inputCont, "", "", helper_main.createDate());
                        dialog.dismiss();
                        setCoursesList();
                        Snackbar.make(lv, R.string.bookmark_added, Snackbar.LENGTH_SHORT).show();
                    }
                }
            });
            builder.setNegativeButton(R.string.toast_cancel, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.cancel();
                }
            });

            final android.app.AlertDialog dialog2 = builder.create();
            // Display the custom alert dialog on interface
            dialog2.show();
            helper_main.showKeyboard(getActivity(), edit_title);
        }
    });

    fab2.setImageResource(R.drawable.account_multiple_plus);
    fab2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            closeFABMenu();
            Intent mainIntent = new Intent(getActivity(), Popup_files.class);
            mainIntent.setAction("file_chooseText");
            startActivity(mainIntent);
        }
    });

    //calling Notes_DbAdapter
    db = new Courses_DbAdapter(getActivity());
    db.open();

    setCoursesList();
    setHasOptionsMenu(true);

    return rootView;
}

From source file:mx.klozz.xperience.tweaker.fragments.DiskInfo.java

public Boolean set_part_info(String part, String titlu, TextView t1, TextView t2, TextView t3, TextView t4,
        ProgressBar b, RelativeLayout l) {
    if (new File(part).exists()) {
        final long v1 = Totalbytes(new File(part));
        if (v1 > 0) {
            t1.setText(titlu);// w  w  w  .  j  a va 2 s.c o m
            t2.setText(Helpers.ReadableByteCount(v1));

            final long v2 = Freebytes(new File(part));
            t4.setText(getString(R.string.free, Helpers.ReadableByteCount(v2)));
            t3.setText(getString(R.string.used, Helpers.ReadableByteCount(v1 - v2)));
            b.setProgress(Math.round(((v1 - v2) * 100) / v1));

            l.setVisibility(RelativeLayout.VISIBLE);
            return true;
        } else {
            l.setVisibility(RelativeLayout.GONE);
            return false;
        }
    } else {
        l.setVisibility(RelativeLayout.GONE);
        return false;
    }
}

From source file:com.rnd.snapsplit.view.OcrCaptureFragment.java

private void createNewThread() {
    t = new Thread() {

        @Override//from w w  w  . j  a  va2  s.  c  o m
        public void run() {
            try {
                while (shouldContinue) {
                    Thread.sleep(1);

                    if (getActivity() == null) {
                        return;
                    }
                    getActivity().runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            if (mGraphicOverlay.amountItem != null) {
                                final ImageView upArrow = (ImageView) getView().findViewById(R.id.arrow_up);
                                upArrow.animate().rotation(180).setDuration(500).start();
                                rotationAngle = 180;
                                TextView amountTV = (TextView) getView().findViewById(R.id.text_amount_value);
                                String amount = mGraphicOverlay.amountItem.getTextBlock().getValue();
                                amount = amount.replaceAll("\\s+", "");
                                amount = amount.replaceAll("[$]", "");
                                amountTV.setText(amount);
                                RelativeLayout box = (RelativeLayout) getView()
                                        .findViewById(R.id.recognition_box);
                                box.setVisibility(View.VISIBLE);
                                Animation slide_up = AnimationUtils
                                        .loadAnimation(getActivity().getApplicationContext(), R.anim.slide_up);

                                box.startAnimation(slide_up);
                                onPause();
                                t.interrupt();

                            }
                        }
                    });
                }
            } catch (InterruptedException e) {
            }
        }
    };
}

From source file:com.gh4a.IssueActivity.java

private void fillData() {
    new LoadCommentsTask(this).execute();

    Typeface boldCondensed = getApplicationContext().boldCondensed;

    ListView lvComments = (ListView) findViewById(R.id.list_view);
    // set details inside listview header
    LayoutInflater infalter = getLayoutInflater();
    LinearLayout mHeader = (LinearLayout) infalter.inflate(R.layout.issue_header, lvComments, false);
    mHeader.setClickable(false);//  w w w  .ja  va 2 s  . co  m

    lvComments.addHeaderView(mHeader, null, false);

    RelativeLayout rlComment = (RelativeLayout) findViewById(R.id.rl_comment);
    if (!isAuthorized()) {
        rlComment.setVisibility(View.GONE);
    }

    TextView tvCommentTitle = (TextView) mHeader.findViewById(R.id.comment_title);
    mCommentAdapter = new CommentAdapter(IssueActivity.this, new ArrayList<Comment>(), mIssue.getNumber(),
            mIssue.getState(), mRepoOwner, mRepoName);
    lvComments.setAdapter(mCommentAdapter);

    ImageView ivGravatar = (ImageView) mHeader.findViewById(R.id.iv_gravatar);
    aq.id(R.id.iv_gravatar).image(GravatarUtils.getGravatarUrl(mIssue.getUser().getGravatarId()), true, false,
            0, 0, aq.getCachedImage(R.drawable.default_avatar), AQuery.FADE_IN);

    ivGravatar.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            getApplicationContext().openUserInfoActivity(IssueActivity.this, mIssue.getUser().getLogin(), null);
        }
    });

    TextView tvExtra = (TextView) mHeader.findViewById(R.id.tv_extra);
    TextView tvState = (TextView) mHeader.findViewById(R.id.tv_state);
    TextView tvTitle = (TextView) mHeader.findViewById(R.id.tv_title);
    TextView tvDescTitle = (TextView) mHeader.findViewById(R.id.desc_title);
    tvDescTitle.setTypeface(getApplicationContext().boldCondensed);
    tvDescTitle.setTextColor(Color.parseColor("#0099cc"));

    tvCommentTitle.setTypeface(getApplicationContext().boldCondensed);
    tvCommentTitle.setTextColor(Color.parseColor("#0099cc"));
    tvCommentTitle
            .setText(getResources().getString(R.string.issue_comments) + " (" + mIssue.getComments() + ")");

    TextView tvDesc = (TextView) mHeader.findViewById(R.id.tv_desc);
    tvDesc.setMovementMethod(LinkMovementMethod.getInstance());

    TextView tvMilestone = (TextView) mHeader.findViewById(R.id.tv_milestone);

    ImageView ivComment = (ImageView) findViewById(R.id.iv_comment);
    if (Gh4Application.THEME == R.style.DefaultTheme) {
        ivComment.setImageResource(R.drawable.social_send_now_dark);
    }
    ivComment.setBackgroundResource(R.drawable.abs__list_selector_holo_dark);
    ivComment.setPadding(5, 2, 5, 2);
    ivComment.setOnClickListener(this);

    tvExtra.setText(mIssue.getUser().getLogin() + "\n" + pt.format(mIssue.getCreatedAt()));
    tvState.setTextColor(Color.WHITE);
    if ("closed".equals(mIssue.getState())) {
        tvState.setBackgroundResource(R.drawable.default_red_box);
        tvState.setText("C\nL\nO\nS\nE\nD");
    } else {
        tvState.setBackgroundResource(R.drawable.default_green_box);
        tvState.setText("O\nP\nE\nN");
    }
    tvTitle.setText(mIssue.getTitle());
    tvTitle.setTypeface(boldCondensed);

    boolean showInfoBox = false;
    if (mIssue.getAssignee() != null) {
        showInfoBox = true;
        TextView tvAssignee = (TextView) mHeader.findViewById(R.id.tv_assignee);
        tvAssignee.setText(mIssue.getAssignee().getLogin() + " is assigned");
        tvAssignee.setVisibility(View.VISIBLE);
        tvAssignee.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                getApplicationContext().openUserInfoActivity(IssueActivity.this,
                        mIssue.getAssignee().getLogin(), null);
            }
        });

        ImageView ivAssignee = (ImageView) mHeader.findViewById(R.id.iv_assignee);

        aq.id(R.id.iv_assignee).image(GravatarUtils.getGravatarUrl(mIssue.getAssignee().getGravatarId()), true,
                false, 0, 0, aq.getCachedImage(R.drawable.default_avatar), AQuery.FADE_IN);

        ivAssignee.setVisibility(View.VISIBLE);
        ivAssignee.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                getApplicationContext().openUserInfoActivity(IssueActivity.this,
                        mIssue.getAssignee().getLogin(), null);
            }
        });
    }

    if (mIssue.getMilestone() != null) {
        showInfoBox = true;
        tvMilestone.setText(
                getResources().getString(R.string.issue_milestone) + ": " + mIssue.getMilestone().getTitle());
    } else {
        tvMilestone.setVisibility(View.GONE);
    }

    String body = mIssue.getBodyHtml();
    if (!StringUtils.isBlank(body)) {
        HttpImageGetter imageGetter = new HttpImageGetter(this);
        body = HtmlUtils.format(body).toString();
        imageGetter.bind(tvDesc, body, mIssue.getNumber());
    }

    LinearLayout llLabels = (LinearLayout) findViewById(R.id.ll_labels);
    List<Label> labels = mIssue.getLabels();

    if (labels != null && !labels.isEmpty()) {
        showInfoBox = true;
        for (Label label : labels) {
            TextView tvLabel = new TextView(this);
            tvLabel.setSingleLine(true);
            tvLabel.setText(label.getName());
            tvLabel.setTextAppearance(this, R.style.default_text_small);
            tvLabel.setBackgroundColor(Color.parseColor("#" + label.getColor()));
            tvLabel.setPadding(5, 2, 5, 2);
            int r = Color.red(Color.parseColor("#" + label.getColor()));
            int g = Color.green(Color.parseColor("#" + label.getColor()));
            int b = Color.blue(Color.parseColor("#" + label.getColor()));
            if (r + g + b < 383) {
                tvLabel.setTextColor(getResources().getColor(android.R.color.primary_text_dark));
            } else {
                tvLabel.setTextColor(getResources().getColor(android.R.color.primary_text_light));
            }
            llLabels.addView(tvLabel);

            View v = new View(this);
            v.setLayoutParams(new LayoutParams(5, LayoutParams.WRAP_CONTENT));
            llLabels.addView(v);
        }
    } else {
        llLabels.setVisibility(View.GONE);
    }

    TextView tvPull = (TextView) mHeader.findViewById(R.id.tv_pull);
    if (mIssue.getPullRequest() != null && mIssue.getPullRequest().getDiffUrl() != null) {
        showInfoBox = true;
        tvPull.setVisibility(View.VISIBLE);
        tvPull.setOnClickListener(this);
    }

    if (!showInfoBox) {
        RelativeLayout rl = (RelativeLayout) mHeader.findViewById(R.id.info_box);
        rl.setVisibility(View.GONE);
    }
}

From source file:com.rnd.snapsplit.view.OcrCaptureFragment.java

/**
 * Initializes the UI and creates the detector pipeline.
 *//*from  ww w .j  a v  a  2 s.co  m*/
//    @Override
//    public void onActivityResult(int requestCode, int resultCode, Intent data) {
//        super.onActivityResult(requestCode, resultCode, data);
//
//        if (requestCode == TAKE_PHOTO_CODE && resultCode == RESULT_OK) {
//            Toast.makeText(getContext(), "pic saved", Toast.LENGTH_LONG).show();
//            Log.d("CameraDemo", "Pic saved");
//        }
//    }

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.view_ocr_capture, container, false);
    final Activity activity = getActivity();
    final Context context = getContext();

    ((Toolbar) activity.findViewById(R.id.tool_bar_hamburger))
            .setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent));
    final String dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
            + "/picFolder/";
    File newdir = new File(dir);
    newdir.mkdirs();

    mPreview = (CameraSourcePreview) view.findViewById(R.id.preview);
    mGraphicOverlay = (GraphicOverlay<OcrGraphic>) view.findViewById(R.id.graphicOverlay);

    StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
    StrictMode.setVmPolicy(builder.build());

    // Set good defaults for capturing text.
    boolean autoFocus = true;
    boolean useFlash = false;

    //        createNewThread();
    //        t.start();

    final ImageView upArrow = (ImageView) view.findViewById(R.id.arrow_up);
    upArrow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (rotationAngle == 0) { // arrow up
                //mCameraSource.takePicture(null, mPicture);
                //mGraphicOverlay.clear();
                //                    mGraphicOverlay.clear();
                //                    mGraphicOverlay.amountItem = null;
                onPause();
                //shouldContinue = false;
                //mCamera.takePicture(null, null, mPicture);

                File pictureFile = getOutputMediaFile();
                if (pictureFile == null) {
                    return;
                }
                try {
                    FileOutputStream fos = new FileOutputStream(pictureFile);
                    Bitmap receiptBitmap = byteStreamToBitmap(mCameraSource.mostRecentBitmap);
                    receiptBitmap.compress(Bitmap.CompressFormat.JPEG, 80, fos);
                    picPath = pictureFile.getAbsolutePath();
                    //fos.write(mCameraSource.mostRecentBitmap);
                    fos.close();
                } catch (FileNotFoundException e) {

                } catch (IOException e) {
                }

                upArrow.animate().rotation(180).setDuration(500).start();

                TextView amount = (TextView) view.findViewById(R.id.text_amount_value);
                if (mGraphicOverlay.amountItem == null) {
                    amount.setText("0.00");
                } else {
                    amount.setText(String.format("%.2f", mGraphicOverlay.amountItemAfterFormat));
                }
                TextView desc = (TextView) view.findViewById(R.id.text_name_value);
                desc.setText(mGraphicOverlay.description);

                RelativeLayout box = (RelativeLayout) view.findViewById(R.id.recognition_box);
                box.setVisibility(View.VISIBLE);
                Animation slide_up = AnimationUtils.loadAnimation(activity.getApplicationContext(),
                        R.anim.slide_up);

                box.startAnimation(slide_up);
                rotationAngle = 180;

            } else {
                //                    t.interrupt();
                //                    t = null;
                RelativeLayout box = (RelativeLayout) view.findViewById(R.id.recognition_box);
                Animation slide_down = AnimationUtils.loadAnimation(activity.getApplicationContext(),
                        R.anim.slide_down);

                upArrow.animate().rotation(0).setDuration(500).start();

                box.startAnimation(slide_down);
                box.setVisibility(View.INVISIBLE);
                //shouldContinue = true;
                mGraphicOverlay.amountItem = null;
                mGraphicOverlay.amountItemAfterFormat = 0f;
                mGraphicOverlay.description = "";
                onResume();
                //                    createNewThread();
                //                    t.start();
                rotationAngle = 0;
            }
        }
    });

    ImageView addButton = (ImageView) view.findViewById(R.id.add_icon);
    addButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // takePicture();
            EditText description = (EditText) view.findViewById(R.id.text_name_value);
            EditText amount = (EditText) view.findViewById(R.id.text_amount_value);
            float floatAmount = Float.parseFloat(amount.getText().toString());
            Summary t = new Summary(description.getText().toString(), floatAmount);

            Bundle bundle = new Bundle();
            bundle.putSerializable("splitTransaction", t);

            //                 ByteArrayOutputStream stream = new ByteArrayOutputStream();
            //                 mCameraSource.mostRecentBitmap.compress(Bitmap.CompressFormat.PNG, 80, stream);
            //                 byte[] byteArray = stream.toByteArray();
            //Bitmap receiptBitmap = byteStreamToBitmap(mCameraSource.mostRecentBitmap);
            //bundle.putParcelable("receiptPicture",receiptBitmap);
            bundle.putString("receiptPicture", picPath);

            FriendsSelectionFragment fragment = new FriendsSelectionFragment();
            fragment.setArguments(bundle);

            ((Toolbar) activity.findViewById(R.id.tool_bar_hamburger)).setVisibility(View.INVISIBLE);
            getActivity().getSupportFragmentManager().beginTransaction()
                    .add(R.id.fragment_holder, fragment, "FriendsSelectionFragment").addToBackStack(null)
                    .commit();
        }
    });

    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    int rc = ActivityCompat.checkSelfPermission(context, Manifest.permission.CAMERA);
    if (rc == PackageManager.PERMISSION_GRANTED) {
        createCameraSource(autoFocus, useFlash);
    } else {
        requestCameraPermission();
    }

    gestureDetector = new GestureDetector(context, new CaptureGestureListener());
    scaleGestureDetector = new ScaleGestureDetector(context, new ScaleListener());

    //        Snackbar.make(mGraphicOverlay, "Tap to Speak. Pinch/Stretch to zoom",
    //                Snackbar.LENGTH_LONG)
    //                .show();

    // Set up the Text To Speech engine.
    TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() {
        @Override
        public void onInit(final int status) {
            if (status == TextToSpeech.SUCCESS) {
                Log.d("OnInitListener", "Text to speech engine started successfully.");
                tts.setLanguage(Locale.US);
            } else {
                Log.d("OnInitListener", "Error starting the text to speech engine.");
            }
        }
    };
    tts = new TextToSpeech(activity.getApplicationContext(), listener);

    return view;
}

From source file:dynamite.zafroshops.app.fragment.TypedZopsFragment.java

private void resetVisibility(ListView zops, LinearLayout noZops, RelativeLayout loader, boolean showLoader) {
    Activity activity = getActivity();//  www. j ava 2s  . c  o m
    MainActivity mainActivity = (MainActivity) activity;

    if (typedZops.size() == 0 && mainActivity.Counts.get(zopType) == 0) {
        noZops.setVisibility(View.VISIBLE);
        zops.setVisibility(View.INVISIBLE);
    } else {
        noZops.setVisibility(View.INVISIBLE);
        zops.setVisibility(View.VISIBLE);
    }

    if (showLoader) {
        zops.setVisibility(View.INVISIBLE);
        noZops.setVisibility(View.INVISIBLE);
        loader.setVisibility(View.VISIBLE);
    } else {
        loader.setVisibility(View.INVISIBLE);
    }
}

From source file:org.smilec.smile.ui.GeneralActivity.java

@Override
protected void onResume() {
    super.onResume();

    // If we retake, we "reload" the status to START_MAKE phase 
    if (status.equals(CurrentMessageStatus.RE_TAKE.name())) {

        status = CurrentMessageStatus.START_MAKE.name();
        btSolve.setEnabled(true);/*from  ww  w .j av a2s.c  o  m*/
        btResults.setText(R.string.show_results);
        btResults.setEnabled(false);

        TextView tvTopScoreTitle = (TextView) GeneralActivity.this.findViewById(R.id.tv_top_scorers);
        tvTopScoreTitle.setVisibility(View.INVISIBLE);

        RelativeLayout topScorePanel = (RelativeLayout) GeneralActivity.this.findViewById(R.id.rl_top_scorers);
        topScorePanel.setVisibility(View.INVISIBLE);
    }

    btSolve.setOnClickListener(new SolveButtonListener());
    btResults.setOnClickListener(new ResultsButtonListener());

    btSolve.setEnabled(solve);
    if (btResults.isEnabled()) {
        btSolve.setEnabled(false);
    }
}