Example usage for android.view ViewGroup getContext

List of usage examples for android.view ViewGroup getContext

Introduction

In this page you can find the example usage for android.view ViewGroup getContext.

Prototype

@ViewDebug.CapturedViewProperty
public final Context getContext() 

Source Link

Document

Returns the context the view is running in, through which it can access the current theme, resources, etc.

Usage

From source file:com.fatelon.partyphotobooth.setup.fragments.EventInfoSetupFragment.java

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

    mContext = container.getContext();
    /*/*  ww  w.jav a2  s  . c  om*/
     * Inflate views from XML.
     */
    View view = inflater.inflate(R.layout.fragment_event_info_setup, container, false);
    mLineOne = (EditText) view.findViewById(R.id.setup_event_info_line_one);
    mLineTwo = (EditText) view.findViewById(R.id.setup_event_info_line_two);
    mLogoUri = (TextView) view.findViewById(R.id.setup_event_info_logo_uri);
    mLogoClear = (ImageView) view.findViewById(R.id.setup_event_info_logo_clear);
    mDate = (DatePicker) view.findViewById(R.id.setup_event_info_date);
    mDateHidden = (CheckBox) view.findViewById(R.id.setup_event_info_date_hidden);
    mNext = (Button) view.findViewById(R.id.setup_event_info_button_next);

    return view;
}

From source file:com.gy.myframework.UI.view.gesture.CustomViewDragHelper.java

/**
 * Factory method to create a new ViewDragHelper.
 *
 * @param forParent Parent view to monitor
 * @param cb Callback to provide information and receive events
 * @return a new ViewDragHelper instance
 */// ww w.  jav a  2 s .  c o  m
public static CustomViewDragHelper create(ViewGroup forParent, Callback cb) {
    return new CustomViewDragHelper(forParent.getContext(), forParent, cb);
}

From source file:com.velo.cityon.fragment.SwipeRefreshListFragment.java

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

    // Create the posting_list fragment's content view by calling the super method
    final View listFragmentView = super.onCreateView(inflater, container, savedInstanceState);

    // Now create a SwipeRefreshLayout to wrap the fragment's content view
    mSwipeRefreshLayout = new ListFragmentSwipeRefreshLayout(container.getContext());

    // Add the posting_list fragment's content view to the SwipeRefreshLayout, making sure that it fills
    // the SwipeRefreshLayout
    mSwipeRefreshLayout.addView(listFragmentView, ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);

    // Make sure that the SwipeRefreshLayout will fill the fragment
    mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // Now return the SwipeRefreshLayout as this fragment's content view
    return mSwipeRefreshLayout;
}

From source file:ayushi.view.customview.ViewDragHelper.java

/**
 * Factory method to create a new ViewDragHelper.
 *
 * @param forParent Parent view to monitor
 * @param cb Callback to provide information and receive events
 * @return a new ViewDragHelper instance
 *//*from  w  ww.ja v a  2  s .c  o  m*/
public static ViewDragHelper create(ViewGroup forParent, Callback cb) {
    return new ViewDragHelper(forParent.getContext(), forParent, null, cb);
}

From source file:com.waz.zclient.pages.main.conversation.views.image.ImageDragViewHelper.java

/**
 * Factory method to create a new ViewDragHelper.
 *
 * @param forParent Parent view to monitor
 * @param cb Callback to provide information and receive events
 * @return a new ViewDragHelper instance
 *///from  www. j  a  va 2 s  .  co m
public static ImageDragViewHelper create(ViewGroup forParent, Callback cb) {
    return new ImageDragViewHelper(forParent.getContext(), forParent, cb);
}

From source file:com.hhwt.travelplanner.adapter.MyCategorylistadapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_mycategorylist, parent, false);
    mContext = parent.getContext();//  ww  w  . ja va2s.  c o  m
    //Thread.setDefaultUncaughtExceptionHandler(new ACRA_Page(mContext));
    v.setOnClickListener(this);
    return new ViewHolder(v);
}

From source file:com.kumapower.utility.ViewDragHelperX.java

/**
 * Factory method to create a new ViewDragHelper.
 *
 * @param forParent Parent view to monitor
 * @param cb Callback to provide information and receive events
 * @return a new ViewDragHelper instance
 *//*from  w ww. j a v  a2s .co m*/
public static ViewDragHelperX create(ViewGroup forParent, Callback cb) {
    return new ViewDragHelperX(forParent.getContext(), forParent, cb);
}

From source file:de.kodejak.hashr.fragmentHashFromFile.java

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

    this.fragJob = getArguments().getInt("job");

    switch (this.fragJob) {
    case 1:/*  w  ww  .ja  v a 2 s. c  o  m*/
        fragTitle = "MD5 from file";
        fragJobStr = "MD5";
        fragJobExt = ".md5";
        break;
    case 2:
        fragTitle = "SHA-1 from file";
        fragJobStr = "SHA-1";
        fragJobExt = ".sha1";
        break;
    case 3:
        fragTitle = "SHA-256 from file";
        fragJobStr = "SHA-256";
        fragJobExt = ".sha256";
        break;

    }

    lastFile = this.getArguments().getString("sumfile");

    Log.d(TAG, fragTitle + " / " + fragJobStr + " / " + lastFile);

    SharedPreferences mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    uppercaseHash = mySharedPreferences.getBoolean("uppercase_hash", false);
    trimHash = mySharedPreferences.getBoolean("trim_hash", false);

    TextView tvHead = (TextView) rootView.findViewById(R.id.tvHeader);
    tvHead.setText(fragTitle);
    Button btnGen = (Button) rootView.findViewById(R.id.btnGenerate);
    btnGen.setText("Generate " + fragJobStr + " hash");
    Button btnComp = (Button) rootView.findViewById(R.id.btnCompare);
    btnComp.setText("Compare " + fragJobStr + " hashes");
    CheckBox checkToFile = (CheckBox) rootView.findViewById(R.id.checkToFile);
    checkToFile.setText("Save " + fragJobStr + " to " + fragJobExt + " file");

    sdk = android.os.Build.VERSION.SDK_INT;

    tvMatch = (TextView) rootView.findViewById(R.id.tvCompare);
    inputEdit = (EditText) rootView.findViewById(R.id.edInput);
    inputEdit.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            tvMatch.setText("");
            tvMatch.setVisibility(View.GONE);
        }
    });
    compareEdit = (EditText) rootView.findViewById(R.id.edCompare);
    compareEdit.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            tvMatch.setText("");
            tvMatch.setVisibility(View.GONE);
        }
    });

    return rootView;
}

From source file:com.hitherejoe.animate.util.MorphButtonToDialog.java

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
        final TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null)
        return null;

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);

    if (startColor == null || endColor == null)
        return null;

    MorphDrawable background = new MorphDrawable(startColor, 0);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);

    // ease in the dialog's child views (slide up & fade_fast in)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        float offset = vg.getHeight() / 3;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.setTranslationY(offset);//from  ww w .j  a v  a 2 s.co m
            v.setAlpha(0f);
            v.animate().alpha(1f).translationY(0f).setDuration(150).setStartDelay(150).setInterpolator(
                    AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_slow_in));
            offset *= 1.8f;
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, color);
    transition.setDuration(300);
    transition.setInterpolator(
            AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    return transition;
}

From source file:com.example.cassi.hal.adapter.CardPresenter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    Log.d(TAG, "onCreateViewHolder");

    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.selected_background);
    mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override/*from w  ww.  j  a v  a2  s.  c  o m*/
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}