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);
}
}
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);
}
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;
}
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);
}
}
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);
}
Aggregations