Commit 4c38b95f authored by feihuaduo's avatar feihuaduo

增加一些注释

parent a145c556
......@@ -96,11 +96,11 @@ public class YGOMobileActivity extends NativeActivity implements
return mApp;
}
@SuppressWarnings("WrongConstant")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e("YGOStarter","跳转完成"+System.currentTimeMillis());
mFullScreenUtils = new FullScreenUtils(this, app().isImmerSiveMode());
mFullScreenUtils.fullscreen();
mFullScreenUtils.onCreate();
......@@ -119,12 +119,14 @@ public class YGOMobileActivity extends NativeActivity implements
.setPackage(getPackageName()));
}
//电池管理
private PowerManager mPM;
private PowerManager.WakeLock mLock;
@Override
protected void onResume() {
super.onResume();
Log.e("YGOStarter","ygo显示"+System.currentTimeMillis());
if (mLock == null) {
if (mPM == null) {
mPM = (PowerManager) getSystemService(POWER_SERVICE);
......
......@@ -40,17 +40,17 @@ public final class IrrlichtBridge {
}
public static int sNativeHandle;
//显示卡图
public static native byte[] nativeBpgImage(byte[] data);
//插入文本(大概是发送消息)
private static native void nativeInsertText(int handle, String text);
//刷新文字
private static native void nativeRefreshTexture(int handle);
//忽略时点
private static native void nativeIgnoreChain(int handle, boolean begin);
//强制时点
private static native void nativeReactChain(int handle, boolean begin);
//取消连锁
private static native void nativeCancelChain(int handle);
private static native void nativeSetCheckBoxesSelection(int handle, int idx);
......
......@@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
......@@ -78,7 +79,8 @@ public class YGOStarter {
//读取当前的背景图,如果卡的话,可以考虑缓存bitmap
File bgfile = new File(AppsSettings.get().getCoreSkinPath(), Constants.CORE_SKIN_BG);
if (bgfile.exists()) {
Glide.with(activity.getApplicationContext()).load(bgfile)
// .getApplicationContext()
Glide.with(activity).load(bgfile)
.signature(new StringSignature(bgfile.getName() + bgfile.lastModified()))
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(activityShowInfo.mViewTarget);
......@@ -151,9 +153,13 @@ public class YGOStarter {
private static long lasttime = 0;
public static void startGame(Activity activity, YGOGameOptions options) {
//如果距离上次加入游戏的时间大于1秒才处理
if (System.currentTimeMillis() - lasttime >= 1000) {
lasttime = System.currentTimeMillis();
Log.e("YGOStarter","设置背景前"+System.currentTimeMillis());
//显示加载背景
showLoadingBg(activity);
Log.e("YGOStarter","设置背景后"+System.currentTimeMillis());
if (!ComponentUtils.isActivityRunning(activity, new ComponentName(activity, YGOMobileActivity.class))) {
//random tips
String[] tipsList = activity.getResources().getStringArray(R.array.tips);
......@@ -162,27 +168,42 @@ public class YGOStarter {
Toast.makeText(activity, tips, Toast.LENGTH_LONG).show();
// } else {
// options = null;
}
}
Intent intent = new Intent(activity, YGOMobileActivity.class);
if (options != null) {
intent.putExtra(YGOGameOptions.YGO_GAME_OPTIONS_BUNDLE_KEY, options);
intent.putExtra(YGOGameOptions.YGO_GAME_OPTIONS_BUNDLE_TIME, System.currentTimeMillis());
}
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.e("YGOStarter","跳转前"+System.currentTimeMillis());
activity.startActivity(intent);
Log.e("YGOStarter","跳转后"+System.currentTimeMillis());
}
}
private static HashMap<Activity, ActivityShowInfo> Infos = new HashMap<>();
private static class ActivityShowInfo {
//根布局
View mRoot;
ViewTarget mViewTarget;
//是否显示了标题栏
boolean hasSupperbar;
//是否显示了标题栏
boolean hasBar;
View mContentView;
//activity背景
Drawable rootOld;
boolean isFirst = true;
//屏幕方向
// screenOrientations属性共有7中可选值(常量定义在 android.content.pm.ActivityInfo类中):
//1.landscape:横屏(风景照),显示时宽度大于高度;
//2.portrait:竖屏(肖像照), 显示时高度大于宽度;
//3.user:用户当前的首选方向;
//4.behind:继承Activity堆栈中当前Activity下面的那个Activity的方向;
//5.sensor:由物理感应器决定显示方向,它取决于用户如何持有设备,当设备被旋转时方向会随之变化——在横屏与竖屏之间;
//6.nosensor:忽略物理感应器——即显示方向与物理感应器无关,不管用户如何旋转设备显示方向都不会随着改变("unspecified"设置除外);
//7.unspecified:未指定,此为默认值,由Android系统自己选择适当的方向,选择策略视具体设备的配置情况而定,因此不同的设备会有不同的方向选择;
int oldRequestedOrientation;
boolean isRunning = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment