Search in sources :

Example 6 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project AndroidDevelop by 7449.

the class SingletonActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_singleton);
    AppCompatTextView tv1 = (AppCompatTextView) findViewById(R.id.test1);
    AppCompatTextView tv2 = (AppCompatTextView) findViewById(R.id.test2);
    SingletonComponent build = DaggerSingletonComponent.builder().build();
    build.register(this);
    tv1.setText(test1.toString());
    tv2.setText(test2.toString());
}
Also used : AppCompatTextView(android.support.v7.widget.AppCompatTextView)

Example 7 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project AndroidDevelop by 7449.

the class FilterAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RVHolder holder, @SuppressLint("RecyclerView") final int position) {
    if (list == null) {
        return;
    }
    final FilterBean filterBean = list.get(position);
    switch(getItemViewType(position)) {
        case TYPE_ITEM:
            AppCompatTextView tv = holder.get(R.id.filter_tv_content);
            tv.setText(filterBean.content);
            tv.setSelected(TextUtils.equals(list.get(position).content, map.get(filterBean.titleType)));
            tv.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    if (!v.isSelected()) {
                        map.put(filterBean.titleType, filterBean.content);
                    }
                    notifyDataSetChanged();
                }
            });
            break;
        case TYPE_TITLE:
            holder.setTextView(R.id.filter_tv_title, filterBean.titleType);
            break;
        default:
            break;
    }
}
Also used : AppCompatTextView(android.support.v7.widget.AppCompatTextView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AppCompatTextView(android.support.v7.widget.AppCompatTextView)

Example 8 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project AndroidDevelop by 7449.

the class CheckAdapter method onBind.

@Override
protected void onBind(ViewHolder holder, int position, AppModel appModel) {
    boolean isShowApp = AppUtils.isEquals(appModel.getPkgName());
    AppCompatCheckBox checkBox = holder.getAppCompatCheckBox(R.id.check_cb_check);
    AppCompatTextView textView = holder.getAppCompatTextView(R.id.check_tv_app_name);
    textView.setText(appModel.getAppLabel());
    TextDrawableUtils.setAppDrawable(textView, appModel.getAppIcon());
    textView.setScaleX(isShowCheckBox ? 0.9f : 1);
    textView.setScaleY(isShowCheckBox ? 0.9f : 1);
    checkBox.setChecked(booleanArray.get(position));
    checkBox.setVisibility(isShowCheckBox && !isShowApp ? View.VISIBLE : View.GONE);
    holder.setBackgroundColor(holder.itemView, AppUtils.getColor(!isShowApp));
}
Also used : AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox)

Example 9 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project Rashr by DsLNeXuS.

the class FlashAsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View fragment = inflater.inflate(R.layout.fragment_flash_as, container, false);
    AppCompatTextView tvFlashAs = fragment.findViewById(R.id.tvFlashAs);
    tvFlashAs.setText(String.format(getString(R.string.flash_as).replace("%", "%%"), mImg.getName()));
    mOptAsRecovery = fragment.findViewById(R.id.optAsRecovery);
    mOptAsKernel = fragment.findViewById(R.id.optAsKernel);
    mButFlashAs = fragment.findViewById(R.id.bFlashAs);
    final AppCompatButton ButCancel = fragment.findViewById(R.id.bCancel);
    ButCancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mActivity.finish();
        }
    });
    View.OnClickListener listener = new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (view.getTag().toString().equals("recovery")) {
                mOptAsKernel.setChecked(false);
            } else {
                mOptAsRecovery.setChecked(false);
            }
            mButFlashAs.setEnabled(true);
        }
    };
    mButFlashAs.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (mImg.exists()) {
                int job = mOptAsRecovery.isChecked() ? FlashUtil.JOB_FLASH_RECOVERY : FlashUtil.JOB_FLASH_KERNEL;
                final FlashUtil flashUtil = new FlashUtil(mActivity, mImg, job);
                flashUtil.setOnFlashListener(new FlashUtil.OnFlashListener() {

                    @Override
                    public void onSuccess() {
                        flashUtil.showRebootDialog();
                    }

                    @Override
                    public void onFail(Exception e) {
                        App.ERRORS.add(e.toString());
                        AlertDialog.Builder d = new AlertDialog.Builder(mContext);
                        d.setTitle(R.string.flash_error);
                        d.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        if (e instanceof FlashUtil.ImageNotValidException) {
                            d.setMessage(getString(R.string.image_not_valid_message));
                            d.setNeutralButton(R.string.settings, new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    mActivity.switchTo(new SettingsFragment());
                                }
                            });
                        } else if (e instanceof FlashUtil.ImageToBigException) {
                            FlashUtil.ImageToBigException exception = (FlashUtil.ImageToBigException) e;
                            // Size in MB
                            int sizeOfImage = exception.getCustomSize() / (1024 * 1024);
                            int sizeOfPart = exception.getPartitionSize() / (1024 * 1024);
                            d.setMessage(String.format(getString(R.string.image_to_big_message), sizeOfImage, sizeOfPart));
                            d.setNeutralButton(R.string.settings, new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    mActivity.switchTo(new SettingsFragment());
                                }
                            });
                        } else {
                            d.setMessage(e.getMessage());
                        }
                        d.show();
                    }
                });
                flashUtil.execute();
            } else {
                mActivity.finish();
            }
        }
    });
    mOptAsRecovery.setOnClickListener(listener);
    mOptAsKernel.setOnClickListener(listener);
    ViewGroup parent;
    if (!App.Device.isRecoverySupported()) {
        if ((parent = (ViewGroup) mOptAsRecovery.getParent()) != null) {
            parent.removeView(mOptAsRecovery);
            mOptAsKernel.setChecked(true);
        }
    }
    if (!App.Device.isKernelSupported()) {
        if ((parent = (ViewGroup) mOptAsKernel.getParent()) != null) {
            parent.removeView(mOptAsKernel);
        }
    }
    return fragment;
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) FlashUtil(de.mkrtchyan.recoverytools.FlashUtil) DialogInterface(android.content.DialogInterface) ViewGroup(android.view.ViewGroup) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) BindView(butterknife.BindView) View(android.view.View) AppCompatButton(android.support.v7.widget.AppCompatButton)

Example 10 with AppCompatTextView

use of android.support.v7.widget.AppCompatTextView in project material-components-android by material-components.

the class CoordinatorSnackbarWithFabTest method testBehaviorBasedSlidingFromClassAnnotation.

@Test
public void testBehaviorBasedSlidingFromClassAnnotation() {
    // Use a layout in which a custom child view has Behavior object configured via
    // annotation on the class that extends AppCompatTextView
    onView(withId(R.id.coordinator_stub)).perform(inflateViewStub(R.layout.design_snackbar_behavior_annotation));
    // Create and show a snackbar
    mSnackbar = Snackbar.make(mCoordinatorLayout, MESSAGE_TEXT, Snackbar.LENGTH_INDEFINITE).setAction(ACTION_TEXT, mock(View.OnClickListener.class));
    SnackbarUtils.showTransientBottomBarAndWaitUntilFullyShown(mSnackbar);
    final AppCompatTextView textView = (AppCompatTextView) mCoordinatorLayout.findViewById(R.id.text);
    verifySnackbarViewStacking(textView, 0);
}
Also used : AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) Espresso.onView(android.support.test.espresso.Espresso.onView) View(android.view.View) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test)

Aggregations

AppCompatTextView (android.support.v7.widget.AppCompatTextView)20 View (android.view.View)10 AppCompatButton (android.support.v7.widget.AppCompatButton)4 Espresso.onView (android.support.test.espresso.Espresso.onView)3 MediumTest (android.support.test.filters.MediumTest)3 ViewGroup (android.view.ViewGroup)3 TextView (android.widget.TextView)3 File (java.io.File)3 Test (org.junit.Test)3 DialogInterface (android.content.DialogInterface)2 AlertDialog (android.support.v7.app.AlertDialog)2 RecyclerView (android.support.v7.widget.RecyclerView)2 SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 Resources (android.content.res.Resources)1 Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 TestFloatingBehavior (android.support.design.testapp.custom.TestFloatingBehavior)1 ActionBar (android.support.v7.app.ActionBar)1