Search in sources :

Example 1 with AppCompatImageView

use of android.support.v7.widget.AppCompatImageView in project BottomBar by roughike.

the class BottomBarBadge method adjustPositionAndSize.

void adjustPositionAndSize(BottomBarTab tab) {
    AppCompatImageView iconView = tab.getIconView();
    ViewGroup.LayoutParams params = getLayoutParams();
    int size = Math.max(getWidth(), getHeight());
    float xOffset = (float) (iconView.getWidth() / 1.25);
    setX(iconView.getX() + xOffset);
    setTranslationY(10);
    if (params.width != size || params.height != size) {
        params.width = size;
        params.height = size;
        setLayoutParams(params);
    }
}
Also used : ViewGroup(android.view.ViewGroup) AppCompatImageView(android.support.v7.widget.AppCompatImageView)

Example 2 with AppCompatImageView

use of android.support.v7.widget.AppCompatImageView in project android-advancedrecyclerview by h6ah4i.

the class ExpandableItemIndicatorImplNoAnim method onInit.

@Override
public void onInit(Context context, AttributeSet attrs, int defStyleAttr, ExpandableItemIndicator thiz) {
    View v = LayoutInflater.from(context).inflate(R.layout.widget_expandable_item_indicator, thiz, true);
    mImageView = (AppCompatImageView) v.findViewById(R.id.image_view);
}
Also used : AppCompatImageView(android.support.v7.widget.AppCompatImageView) View(android.view.View)

Example 3 with AppCompatImageView

use of android.support.v7.widget.AppCompatImageView 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 4 with AppCompatImageView

use of android.support.v7.widget.AppCompatImageView in project Rocket.Chat.Android by RocketChat.

the class RoomToolbar method setUnreadBudge.

public void setUnreadBudge(int numUnreadChannels, int numMentionsSum) {
    if (getNavigationIcon() == null) {
        return;
    }
    if (badgeImageView == null) {
        badgeImageView = new AppCompatImageView(getContext());
        badgeImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    }
    if (badgeImageView.getParent() != this) {
        //ref: Toolbar#isChildOrHidden
        addView(badgeImageView, generateDefaultLayoutParams());
    }
    if (numUnreadChannels > 0) {
        if (numMentionsSum > 0) {
            badgeImageView.setImageDrawable(getBadgeDrawable(numMentionsSum));
        } else {
            badgeImageView.setScaleType(ImageView.ScaleType.CENTER);
            badgeImageView.setImageResource(R.drawable.badge_without_number);
        }
        badgeImageView.setVisibility(View.VISIBLE);
    } else {
        badgeImageView.setVisibility(View.GONE);
    }
}
Also used : AppCompatImageView(android.support.v7.widget.AppCompatImageView)

Example 5 with AppCompatImageView

use of android.support.v7.widget.AppCompatImageView in project android-advancedrecyclerview by h6ah4i.

the class ExpandableItemIndicatorImplAnim method onInit.

@Override
public void onInit(Context context, AttributeSet attrs, int defStyleAttr, ExpandableItemIndicator thiz) {
    View v = LayoutInflater.from(context).inflate(R.layout.widget_expandable_item_indicator, thiz, true);
    mImageView = (AppCompatImageView) v.findViewById(R.id.image_view);
}
Also used : AppCompatImageView(android.support.v7.widget.AppCompatImageView) View(android.view.View)

Aggregations

AppCompatImageView (android.support.v7.widget.AppCompatImageView)5 View (android.view.View)3 ViewGroup (android.view.ViewGroup)2 Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 AppCompatButton (android.support.v7.widget.AppCompatButton)1 AppCompatSpinner (android.support.v7.widget.AppCompatSpinner)1 AppCompatTextView (android.support.v7.widget.AppCompatTextView)1 ArrayAdapter (android.widget.ArrayAdapter)1 LinearLayout (android.widget.LinearLayout)1 ScrollView (android.widget.ScrollView)1 Downloader (de.mkrtchyan.utils.Downloader)1 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 JSONArray (org.json.JSONArray)1 JSONException (org.json.JSONException)1