Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-scale PC and Game Grid Text on supported Android Versions #1162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/src/main/java/com/limelight/grid/PcGridAdapter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.limelight.grid;

import android.content.Context;
import android.os.Build;
import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
Expand Down Expand Up @@ -65,6 +67,12 @@ public void populateView(View parentView, ImageView imgView, ProgressBar prgView
prgView.setVisibility(View.INVISIBLE);
}

// Auto-scale text on supported Android versions
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
txtView.setAutoSizeTextTypeUniformWithConfiguration(5, 25, 1, TypedValue.COMPLEX_UNIT_SP);
}
txtView.setMaxLines(1);

txtView.setText(obj.details.name);
if (obj.details.state == ComputerDetails.State.ONLINE) {
txtView.setAlpha(1.0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.util.TypedValue;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
Expand Down Expand Up @@ -341,6 +343,13 @@ public boolean populateImageView(NvApp app, ImageView imgView, TextView textView
return true;
}


// Auto-scale text on supported Android versions
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
textView.setAutoSizeTextTypeUniformWithConfiguration(5, 25, 1, TypedValue.COMPLEX_UNIT_SP);
}
textView.setMaxLines(1);

// Always set the name text so we have it if needed later
textView.setText(app.getAppName());

Expand Down