1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2025-09-10 02:39:43 +02:00

Update and improve buildscript

This commit is contained in:
Gregor Santner 2017-11-18 20:04:59 +01:00
parent 255c6d650e
commit 28dac50d84
No known key found for this signature in database
GPG key ID: 7E83A7834AECB009
5 changed files with 90 additions and 46 deletions

View file

@ -12,8 +12,11 @@
package net.gsantner.opoc.util;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.StringRes;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
@ -96,6 +99,13 @@ public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
}
}
public void showSoftKeyboard() {
InputMethodManager inputMethodManager = (InputMethodManager) _activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
if (_activity.getCurrentFocus() != null && _activity.getCurrentFocus().getWindowToken() != null) {
inputMethodManager.showSoftInput(_activity.getCurrentFocus(), InputMethodManager.SHOW_FORCED);
}
}
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String html) {
showDialogWithHtmlTextView(resTitleId, html, true, null);
}
@ -129,4 +139,18 @@ public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
}
_activity.getWindow().setAttributes(attrs);
}
public void showRateOnGplayDialog() {
String pkgId = "details?id=" + _activity.getPackageName();
Intent goToMarket = new Intent(Intent.ACTION_VIEW, Uri.parse("market://" + pkgId));
goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
(Build.VERSION.SDK_INT >= 21 ? Intent.FLAG_ACTIVITY_NEW_DOCUMENT : Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) |
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
try {
_activity.startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
_activity.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/" + pkgId)));
}
}
}