mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-21 09:01:56 -07:00
Merge branch 'v3_openjdk' of https://github.com/PojavLauncherTeam/PojavLauncher into v3_openjdk
This commit is contained in:
commit
9f73f983cb
6 changed files with 64 additions and 27 deletions
|
|
@ -42,11 +42,44 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
|
|||
}
|
||||
|
||||
private int getInternalId(String type, String name) {
|
||||
/*
|
||||
int id = Resources.getSystem().getIdentifier(name, type, "com.android.internal");
|
||||
if (id == 0) {
|
||||
mHandleView.getContext().getResources().getIdentifier(name, type, "android");
|
||||
}
|
||||
return id;
|
||||
*/
|
||||
|
||||
try {
|
||||
for (Class perType : Class.forName("com.android.internal.R").getDeclaredClasses()) {
|
||||
if (perType.getSimpleName().equals(type)) {
|
||||
try {
|
||||
Field f = perType.getDeclaredField(name);
|
||||
f.setAccessible(true);
|
||||
return (int) f.get(null);
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// If unable to find in com.android.internal.R, go find in android.R
|
||||
for (Class perType : android.R.class.getDeclaredClasses()) {
|
||||
if (perType.getSimpleName().equals(type)) {
|
||||
try {
|
||||
Field f = perType.getDeclaredField(name);
|
||||
f.setAccessible(true);
|
||||
return (int) f.get(null);
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -107,9 +107,11 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
// private static Collection<? extends Provider.Service> rsaPkcs1List;
|
||||
|
||||
// @Override
|
||||
public void onCreate(Bundle savedInstanceState, int resId)
|
||||
{
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
protected void initLayout(int resId) {
|
||||
setContentView(resId);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ public class CustomCtrlMainActivity extends BaseMainActivity implements OnClickL
|
|||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState, R.layout.main_with_customctrl);
|
||||
super.onCreate(savedInstanceState);
|
||||
initLayout(R.layout.main_with_customctrl);
|
||||
|
||||
ControlData[] specialButtons = ControlData.getSpecialButtons();
|
||||
for (ControlData specialButton : specialButtons) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ public class MainActivity extends BaseMainActivity implements OnClickListener, O
|
|||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState, R.layout.main);
|
||||
super.onCreate(savedInstanceState);
|
||||
initLayout(R.layout.main);
|
||||
|
||||
this.upButton = findButton(R.id.control_up);
|
||||
this.downButton = findButton(R.id.control_down);
|
||||
|
|
|
|||
|
|
@ -348,8 +348,8 @@ public final class Tools
|
|||
public static float dpToPx(Context ctx, float dp) {
|
||||
// 921600 = 1280 * 720, default scale
|
||||
// TODO better way to scaling
|
||||
float scaledDp = dp / 921600 * CallbackBridge.windowWidth * CallbackBridge.windowHeight;
|
||||
return (scaledDp * ctx.getResources().getDisplayMetrics().density);
|
||||
// float scaledDp = dp / 921600 * CallbackBridge.windowWidth * CallbackBridge.windowHeight;
|
||||
return (dp /* scaledDp */ * ctx.getResources().getDisplayMetrics().density);
|
||||
}
|
||||
|
||||
public static void copyAssetFile(Context ctx, String fileName, String output, boolean overwrite) throws Exception
|
||||
|
|
|
|||
|
|
@ -13,11 +13,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<net.kdt.pojavlaunch.customcontrols.ControlLayout
|
||||
android:id="@+id/main_control_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<net.kdt.pojavlaunch.MinecraftGLView
|
||||
android:id="@+id/main_game_render_view"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
@ -38,6 +33,11 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<net.kdt.pojavlaunch.customcontrols.ControlLayout
|
||||
android:id="@+id/main_control_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue