Merge pull request #679 from serpentspirale/v3_openjdk

Fix improper play button size on big screen devices, such as tablets
This commit is contained in:
LegacyGamerHD 2021-01-22 20:06:23 +01:00 committed by GitHub
commit b6da9961dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 14 deletions

View File

@ -284,26 +284,22 @@ public class PojavLauncherActivity extends BaseLauncherActivity
}
private void restoreOldLook(boolean oldLookState){
Guideline guideLine = findViewById(R.id.guidelineLeft);
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) guideLine.getLayoutParams();
if(oldLookState){
//UI v1 Style
//Hide the sidebar
Guideline guideLine = findViewById(R.id.guidelineLeft);
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) guideLine.getLayoutParams();
params.guidePercent = 0; // 0%, range: 0 <-> 1
guideLine.setLayoutParams(params);
//Remove the selected Tab
selected.setVisibility(View.GONE);
//Enlarge the button, but just a bit.
params = (ConstraintLayout.LayoutParams) mPlayButton.getLayoutParams();
params.width = (int)(params.width*1.80);
mPlayButton.setLayoutParams(params);
params.matchConstraintPercentWidth = 0.35f;
}else{
//UI v2 Style
//Show the sidebar back
Guideline guideLine = findViewById(R.id.guidelineLeft);
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) guideLine.getLayoutParams();
params.guidePercent = 0.23f; // 23%, range: 0 <-> 1
guideLine.setLayoutParams(params);
@ -312,12 +308,9 @@ public class PojavLauncherActivity extends BaseLauncherActivity
//Set the default button size
params = (ConstraintLayout.LayoutParams) mPlayButton.getLayoutParams();
params.width = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
160,
getResources().getDisplayMetrics());
mPlayButton.setLayoutParams(params);
params.matchConstraintPercentWidth = 0.25f;
}
mPlayButton.setLayoutParams(params);
}
}

View File

@ -242,14 +242,15 @@
<com.kdt.mcgui.MineButton
android:id="@+id/launchermainPlayButton"
android:layout_width="160dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:onClick="launchGame"
android:text="@string/main_play"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent="0.25"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="@+id/guidelineLeft"
app:layout_constraintTop_toTopOf="@+id/guidelineBottom" />