Search in sources :

Example 1 with AppCompatTextView

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

the class RecoverySystemFragment method onCreateView.

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    mActivity = (RashrActivity) getActivity();
    final ScrollView root = (ScrollView) inflater.inflate(R.layout.fragment_recovery_system, container, false);
    mContext = root.getContext();
    final AppCompatTextView tvTitle = (AppCompatTextView) root.findViewById(R.id.tvSysName);
    tvTitle.setText(mTitle.toUpperCase());
    final AppCompatTextView tvDesc = (AppCompatTextView) root.findViewById(R.id.tvRecSysDesc);
    tvDesc.setText(mDesc);
    final AppCompatSpinner spVersions = (AppCompatSpinner) root.findViewById(R.id.spVersions);
    ArrayList<String> formatedVersions = new ArrayList<>();
    for (String versionLinks : mVersions) {
        formatedVersions.add(formatName(versionLinks, mTitle));
    }
    final ArrayAdapter<String> adapter = new ArrayAdapter<>(root.getContext(), android.R.layout.simple_list_item_1, formatedVersions);
    spVersions.setAdapter(adapter);
    spVersions.setSelection(0);
    final AppCompatTextView tvDev = (AppCompatTextView) root.findViewById(R.id.tvDevName);
    tvDev.setText(mDev);
    final AppCompatImageView imLogo = (AppCompatImageView) root.findViewById(R.id.ivRecLogo);
    if (mLogo == 0) {
        root.removeView(imLogo);
    } else {
        imLogo.setImageResource(mLogo);
    }
    final AppCompatButton bFlash = (AppCompatButton) root.findViewById(R.id.bFlashRecovery);
    bFlash.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            flashSupportedRecovery(mTitle, mVersions.get(spVersions.getSelectedItemPosition()));
        }
    });
    final LinearLayout ScreenshotLayout = (LinearLayout) root.findViewById(R.id.ScreenshotLayout);
    if (mScreenshotURL == null) {
        ((ViewGroup) ScreenshotLayout.getParent()).removeView(ScreenshotLayout);
    } else {
        try {
            Downloader jsonDownloader = new Downloader(new URL(mScreenshotURL + "/getScreenshots.php"), new File(mContext.getExternalCacheDir(), "screenhots.json"));
            jsonDownloader.setOverrideFile(true);
            jsonDownloader.setOnDownloadListener(new Downloader.OnDownloadListener() {

                @Override
                public void onSuccess(File file) {
                    try {
                        JSONArray arr = new JSONArray(Common.fileContent(file));
                        for (int i = 0; i < arr.length(); i++) {
                            final String name = arr.get(i).toString();
                            if (name.equals(".") || name.equals("..") || name.equals("getScreenshots.php"))
                                continue;
                            Downloader imageDownloader = new Downloader(new URL(mScreenshotURL + "/" + name), new File(file.getParentFile(), name));
                            //Do not redownload predownloaded images
                            imageDownloader.setOverrideFile(false);
                            imageDownloader.setOnDownloadListener(new Downloader.OnDownloadListener() {

                                @Override
                                public void onSuccess(File file) {
                                    AppCompatImageView iv = (AppCompatImageView) inflater.inflate(R.layout.recovery_screenshot, null);
                                    try {
                                        final BitmapFactory.Options options = new BitmapFactory.Options();
                                        options.inSampleSize = 8;
                                        Bitmap screenshot = BitmapFactory.decodeFile(file.toString());
                                        iv.setImageBitmap(screenshot);
                                        ScreenshotLayout.addView(iv);
                                    } catch (OutOfMemoryError e) {
                                        App.ERRORS.add("Screenshot " + file.toString() + " could not be decoded " + e.toString());
                                    }
                                }

                                @Override
                                public void onFail(Exception e) {
                                }
                            });
                            imageDownloader.download();
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        onFail(e);
                    }
                }

                @Override
                public void onFail(Exception e) {
                    e.printStackTrace();
                }
            });
            jsonDownloader.download();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
    return root;
}
Also used : MalformedURLException(java.net.MalformedURLException) ArrayList(java.util.ArrayList) Downloader(de.mkrtchyan.utils.Downloader) URL(java.net.URL) Bitmap(android.graphics.Bitmap) BitmapFactory(android.graphics.BitmapFactory) ViewGroup(android.view.ViewGroup) AppCompatTextView(android.support.v7.widget.AppCompatTextView) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException) IOException(java.io.IOException) AppCompatImageView(android.support.v7.widget.AppCompatImageView) View(android.view.View) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) ScrollView(android.widget.ScrollView) AppCompatSpinner(android.support.v7.widget.AppCompatSpinner) JSONException(org.json.JSONException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) AppCompatButton(android.support.v7.widget.AppCompatButton) ScrollView(android.widget.ScrollView) File(java.io.File) ArrayAdapter(android.widget.ArrayAdapter) LinearLayout(android.widget.LinearLayout)

Example 2 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 3 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 4 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 5 with AppCompatTextView

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

the class TextInputLayout method setErrorEnabled.

/**
   * Whether the error functionality is enabled or not in this layout. Enabling this functionality
   * before setting an error message via {@link #setError(CharSequence)}, will mean that this layout
   * will not change size when an error is displayed.
   *
   * @attr ref android.support.design.R.styleable#TextInputLayout_errorEnabled
   */
public void setErrorEnabled(boolean enabled) {
    if (mErrorEnabled != enabled) {
        if (mErrorView != null) {
            ViewCompat.animate(mErrorView).cancel();
        }
        if (enabled) {
            mErrorView = new AppCompatTextView(getContext());
            mErrorView.setId(R.id.textinput_error);
            if (mTypeface != null) {
                mErrorView.setTypeface(mTypeface);
            }
            boolean useDefaultColor = false;
            try {
                TextViewCompat.setTextAppearance(mErrorView, mErrorTextAppearance);
                if (Build.VERSION.SDK_INT >= 23 && mErrorView.getTextColors().getDefaultColor() == Color.MAGENTA) {
                    // Caused by our theme not extending from Theme.Design*. On API 23 and
                    // above, unresolved theme attrs result in MAGENTA rather than an exception.
                    // Flag so that we use a decent default
                    useDefaultColor = true;
                }
            } catch (Exception e) {
                // Caused by our theme not extending from Theme.Design*. Flag so that we use
                // a decent default
                useDefaultColor = true;
            }
            if (useDefaultColor) {
                // Probably caused by our theme not extending from Theme.Design*. Instead
                // we manually set something appropriate
                TextViewCompat.setTextAppearance(mErrorView, android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Caption);
                mErrorView.setTextColor(ContextCompat.getColor(getContext(), R.color.design_textinput_error_color_light));
            }
            mErrorView.setVisibility(INVISIBLE);
            ViewCompat.setAccessibilityLiveRegion(mErrorView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
            addIndicator(mErrorView, 0);
        } else {
            mErrorShown = false;
            updateEditTextBackground();
            removeIndicator(mErrorView);
            mErrorView = null;
        }
        mErrorEnabled = enabled;
    }
}
Also used : AppCompatTextView(android.support.v7.widget.AppCompatTextView)

Aggregations

AppCompatTextView (android.support.v7.widget.AppCompatTextView)45 View (android.view.View)26 AppCompatButton (android.support.v7.widget.AppCompatButton)9 AppCompatImageView (android.support.v7.widget.AppCompatImageView)7 ProgressBar (android.widget.ProgressBar)7 Sigchain (co.krypt.krypton.team.Sigchain)7 AlertDialog (android.support.v7.app.AlertDialog)6 Button (android.widget.Button)6 DialogInterface (android.content.DialogInterface)4 ConstraintLayout (android.support.constraint.ConstraintLayout)4 ViewGroup (android.view.ViewGroup)4 TextView (android.widget.TextView)4 Context (android.content.Context)3 Handler (android.os.Handler)3 Nullable (android.support.annotation.Nullable)3 Espresso.onView (android.support.test.espresso.Espresso.onView)3 MediumTest (android.support.test.filters.MediumTest)3 AppCompatEditText (android.support.v7.widget.AppCompatEditText)3 SuppressLint (android.annotation.SuppressLint)2 Intent (android.content.Intent)2