use of android.widget.ScrollView in project android_frameworks_base by crdroidandroid.
the class DpiTestActivity method scrollWrap.
private View scrollWrap(View view) {
ScrollView scroller = new ScrollView(this);
scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT, ScrollView.LayoutParams.MATCH_PARENT));
return scroller;
}
use of android.widget.ScrollView in project android_frameworks_base by AOSPA.
the class BigCache method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
final LinearLayout testBed = new LinearLayout(this);
testBed.setOrientation(LinearLayout.VERTICAL);
testBed.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
final int cacheSize = ViewConfiguration.getMaximumDrawingCacheSize();
final Display display = getWindowManager().getDefaultDisplay();
final int screenWidth = display.getWidth();
final int screenHeight = display.getHeight();
final View tiny = new View(this);
tiny.setId(R.id.a);
tiny.setBackgroundColor(0xFFFF0000);
tiny.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, screenHeight));
final View large = new View(this);
large.setId(R.id.b);
large.setBackgroundColor(0xFF00FF00);
// Compute the height of the view assuming a cache size based on ARGB8888
final int height = 2 * (cacheSize / 2) / screenWidth;
large.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, height));
final ScrollView scroller = new ScrollView(this);
scroller.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
testBed.addView(tiny);
testBed.addView(large);
scroller.addView(testBed);
setContentView(scroller);
}
use of android.widget.ScrollView in project easy by MehdiBenmesa.
the class Utils method canScroll.
static boolean canScroll(View view) {
if (view instanceof ScrollView) {
ScrollView scrollView = (ScrollView) view;
View child = scrollView.getChildAt(0);
if (child != null) {
int childHeight = child.getHeight();
return scrollView.getHeight() < childHeight + scrollView.getPaddingTop() + scrollView.getPaddingBottom();
}
return false;
} else if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
int yOffset = recyclerView.computeVerticalScrollOffset();
return yOffset != 0;
}
return true;
}
use of android.widget.ScrollView in project LeafPic by HoraApps.
the class AlertDialogsHelper method showChangelogDialog.
public static AlertDialog showChangelogDialog(final ThemedActivity activity) {
final AlertDialog.Builder changelogDialogBuilder = new AlertDialog.Builder(activity, activity.getDialogStyle());
View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_changelog, null);
TextView dialogTitle = dialogLayout.findViewById(R.id.dialog_changelog_title);
TextView dialogMessage = dialogLayout.findViewById(R.id.dialog_changelog_text);
CardView cvBackground = dialogLayout.findViewById(R.id.dialog_changelog_card);
ScrollView scrChangelog = dialogLayout.findViewById(R.id.changelog_scrollview);
cvBackground.setCardBackgroundColor(activity.getCardBackgroundColor());
dialogTitle.setBackgroundColor(activity.getPrimaryColor());
activity.getThemeHelper().setScrollViewColor(scrChangelog);
dialogTitle.setText(activity.getString(R.string.changelog));
Bypass bypass = new Bypass(activity);
String markdownString;
try {
markdownString = getChangeLogFromAssets(activity);
} catch (IOException e) {
ChromeCustomTabs.launchUrl(activity, LEAFPIC_CHANGELOG);
return null;
}
CharSequence string = bypass.markdownToSpannable(markdownString);
dialogMessage.setText(string);
dialogMessage.setMovementMethod(LinkMovementMethod.getInstance());
dialogMessage.setTextColor(activity.getTextColor());
changelogDialogBuilder.setView(dialogLayout);
changelogDialogBuilder.setPositiveButton(activity.getString(R.string.ok_action).toUpperCase(), null);
changelogDialogBuilder.setNeutralButton(activity.getString(R.string.show_full).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ChromeCustomTabs.launchUrl(activity, LEAFPIC_CHANGELOG);
}
});
return changelogDialogBuilder.show();
}
use of android.widget.ScrollView in project LeafPic by HoraApps.
the class SettingsActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
unbinder = ButterKnife.bind(this);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(getToolbarIcon(GoogleMaterial.Icon.gmd_arrow_back));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
optionStatusbar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
updateTheme();
setStatusBarColor();
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (ViewUtil.hasNavBar(this)) {
optionColoredNavbar.setOnClickListener(new View.OnClickListener() {
@SuppressLint("NewApi")
@Override
public void onClick(View view) {
updateTheme();
getWindow().setNavigationBarColor(isNavigationBarColored() ? getPrimaryColor() : ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
}
});
} else
optionColoredNavbar.setVisibility(View.GONE);
}
ScrollView scrollView = findViewById(R.id.settingAct_scrollView);
setScrollViewColor(scrollView);
}
Aggregations