Skip to content

Commit

Permalink
fixed help
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev committed Jan 28, 2018
1 parent d44c7f0 commit 927d3bd
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public synchronized void handleMessage(Message msg) {
if (messageType != null && messageType == Config.UIUTILS_SHOWALERT_HTML) {
String title = (String) b.get("title");
String body = (String) b.get("body");
UIAlertHtml(title, body, activity);
UIUtils.UIAlertHtml(title, body, activity);
}
if (messageType != null && messageType == Config.STATUS_CHANGED) {
String status_changed = (String) b.get("status_changed");
Expand Down Expand Up @@ -435,7 +435,7 @@ public static void UIAlertLicense(String title, String html, final Activity acti
public void onClick(DialogInterface dialog, int which) {
if (isFirstLaunch()) {
install();
onHelp();
UIUtils.onHelp(activity);
onChangeLog();
}
setFirstLaunch();
Expand All @@ -457,21 +457,7 @@ public void onCancel(DialogInterface dialog) {
alertDialog.show();
}

public static void UIAlertHtml(String title, String html, Activity activity) {

AlertDialog alertDialog;
alertDialog = new AlertDialog.Builder(activity).create();
alertDialog.setTitle(title);
WebView webview = new WebView(activity);
webview.loadData(html, "text/html", "UTF-8");
alertDialog.setView(webview);
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();
}

// Generic Message to update UI
public static void sendHandlerMessage(Handler handler, int message_type, String message_var, String message_value) {
Expand Down Expand Up @@ -528,25 +514,6 @@ private static void onTap() {
}
}

private static void onHelp() {
PackageInfo pInfo = null;

try {
pInfo = activity.getPackageManager().getPackageInfo(activity.getClass().getPackage().getName(),
PackageManager.GET_META_DATA);
} catch (NameNotFoundException e) {
e.printStackTrace();
}

FileUtils fileutils = new FileUtils();
try {
showAlertHtml(Config.APP_NAME + " v" + pInfo.versionName, fileutils.LoadFile(activity, "HELP", false),
OShandler);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

private static void onChangeLog() {
PackageInfo pInfo = null;
Expand Down Expand Up @@ -5677,7 +5644,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
} else if (item.getItemId() == this.IMPORT) {
this.onImportMachines();
} else if (item.getItemId() == this.HELP) {
this.onHelp();
UIUtils.onHelp(this);
} else if (item.getItemId() == this.VIEWLOG) {
this.onViewLog();
} else if (item.getItemId() == this.CHANGELOG) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
this.setZoomable();
} else if (item.getItemId() == this.QUIT) {
} else if (item.getItemId() == R.id.itemHelp) {
this.onMenuHelp();
UIUtils.onHelp(this);
} else if (item.getItemId() == R.id.itemHideToolbar) {
this.onHideToolbar();
} else if (item.getItemId() == R.id.itemViewLog) {
Expand Down Expand Up @@ -562,13 +562,6 @@ public void onHideToolbar(){
}
}

private static void onMenuHelp() {
String url = "https://github.com/limboemu/limbo";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
LimboActivity.activity.startActivity(i);

}

private void onMouse() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.limbo.emu.lib.R;
import com.max2idea.android.limbo.utils.DrivesDialogBox;
import com.max2idea.android.limbo.utils.FileUtils;
import com.max2idea.android.limbo.utils.MachineOpenHelper;
import com.max2idea.android.limbo.utils.QmpClient;
import com.max2idea.android.limbo.utils.UIUtils;

Expand Down Expand Up @@ -384,7 +385,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
} else if (item.getItemId() == R.id.itemCenterMouse) {
return onMouse();
} else if (item.getItemId() == R.id.itemHelp) {
this.onMenuHelp();
UIUtils.onHelp(this);
} else if (item.getItemId() == R.id.itemHideToolbar) {
this.onHideToolbar();
} else if (item.getItemId() == R.id.itemViewLog) {
Expand Down Expand Up @@ -976,13 +977,6 @@ public void run() {
return save_state;
}

private static void onMenuHelp() {
String url = "https://github.com/limboemu/limbo";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
LimboActivity.activity.startActivity(i);

}

public void onBackPressed() {

Expand Down Expand Up @@ -1011,6 +1005,8 @@ public void onHideToolbar(){
public void onConnected() {
this.resumeVMMonitor();
LimboActivity.currMachine.paused = 0;
MachineOpenHelper.getInstance(activity).update(LimboActivity.currMachine,
MachineOpenHelper.getInstance(activity).PAUSED, 0 + "");
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.max2idea.android.limbo.utils;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.os.Handler;
import android.os.Looper;
Expand All @@ -11,11 +15,15 @@
import android.support.v7.widget.Toolbar;
import android.view.Display;
import android.view.Gravity;
import android.webkit.WebView;
import android.widget.Toast;

import com.limbo.emu.lib.R;
import com.max2idea.android.limbo.main.Config;
import com.max2idea.android.limbo.main.LimboSettingsManager;

import java.io.IOException;

public class UIUtils {

public static void toastLong(final Context activity, final String errStr) {
Expand Down Expand Up @@ -114,4 +122,40 @@ public static boolean isLandscapeOrientation(Activity activity)
return false;
return true;
}


public static void onHelp(Activity activity) {
PackageInfo pInfo = null;

try {
pInfo = activity.getPackageManager().getPackageInfo(activity.getApplicationContext().getPackageName(),
PackageManager.GET_META_DATA);
} catch (Exception e) {
e.printStackTrace();
}

FileUtils fileutils = new FileUtils();
try {
UIAlertHtml(Config.APP_NAME + " v" + pInfo.versionName, fileutils.LoadFile(activity, "HELP", false), activity);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public static void UIAlertHtml(String title, String html, Activity activity) {

AlertDialog alertDialog;
alertDialog = new AlertDialog.Builder(activity).create();
alertDialog.setTitle(title);
WebView webview = new WebView(activity);
webview.loadData(html, "text/html", "UTF-8");
alertDialog.setView(webview);
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();
}
}

0 comments on commit 927d3bd

Please sign in to comment.