本文整理汇总了Java中com.devspark.appmsg.AppMsg.Style方法的典型用法代码示例。如果您正苦于以下问题:Java AppMsg.Style方法的具体用法?Java AppMsg.Style怎么用?Java AppMsg.Style使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.devspark.appmsg.AppMsg
的用法示例。
在下文中一共展示了AppMsg.Style方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.devspark.appmsg.AppMsg; //导入方法依赖的package包/类
/** Shows given message with given style
*
* @param activity Activity on which the message will be shown
* @param message Message to show
* @param style Style of the message */
private void show(final Activity activity, final String message, final AppMsg.Style style)
{
new Handler(Looper.getMainLooper()).post(new Runnable()
{
@Override
public void run()
{
AppMsg appMsg = AppMsg.makeText(activity, message, style);
appMsg.setLayoutGravity(Gravity.CENTER);
appMsg.show();
}
});
}
示例2: showMsg
import com.devspark.appmsg.AppMsg; //导入方法依赖的package包/类
public static void showMsg(Activity context, String msg, AppMsg.Style style) {
AppMsg.makeText(context, msg, style).show();
}
示例3: validateNumber
import com.devspark.appmsg.AppMsg; //导入方法依赖的package包/类
private void validateNumber(View view, DocumentType documentType) {
String number = Functions.getCleanText(mEditText.getText().toString());
if (!Functions.isDocumentNumberReady(number)) {
setErrorMessage(getString(R.string.error_doc_invalid));
return;
}
AppMsg appMsg = null;
AppMsg.cancelAll(this);
AppMsg.Style style = new AppMsg.Style(AppMsg.LENGTH_SHORT, R.color.green_stuff);
String errorMessage = null;
switch (documentType) {
case BI:
if (ValidatorHelper.isNifOrBiValid(number)) {
appMsg = AppMsg.makeText(MainActivity.this, getString(R.string.valid_bi), style);
} else {
errorMessage = getString(R.string.error_bi);
}
break;
case NIF:
if (ValidatorHelper.isNifOrBiValid(number)) {
appMsg = AppMsg.makeText(MainActivity.this, getString(R.string.valid_nif), style);
} else {
errorMessage = getString(R.string.error_nif);
}
break;
case CC:
if (ValidatorHelper.isCcValid(number)) {
appMsg = AppMsg.makeText(MainActivity.this, getString(R.string.valid_cc), style);
} else {
errorMessage = getString(R.string.error_cc);
}
break;
case NISS:
if (ValidatorHelper.isNissValid(number)) {
appMsg = AppMsg.makeText(MainActivity.this, getString(R.string.valid_niss), style);
} else {
errorMessage = getString(R.string.error_niss);
}
break;
default:
}
if (appMsg != null) {
appMsg.getView().setOnClickListener(new CancelAppMsg(appMsg));
appMsg.setLayoutGravity(Gravity.BOTTOM);
appMsg.show();
}
invalidateViews((BetterButton) view, errorMessage);
}
示例4: onCreate
import com.devspark.appmsg.AppMsg; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setSupportProgressBarIndeterminate(true);
// requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_main);
context = this;
Global.setContext(context);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
if(!Global.userIsConnected()) onDisconnect();
// Volume
final View view = getLayoutInflater().inflate(R.layout.volume_action_view, null);
if(view != null) {
mVolumeControls = (SeekBar) view.findViewById(R.id.volume_control);
if (mVolumeControls != null) {
mVolumeControls.setMax(100);
mVolumeControls.setOnSeekBarChangeListener(this);
} else {
Toast.makeText(this, "Error findViewById for volume action view", Toast.LENGTH_SHORT).show();
}
// Apply the custom View to the ActionBar
getSupportActionBar().setCustomView(view, new ActionBar.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
ConnectivityManager connManager = (ConnectivityManager) Global.getStaticContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWifi != null && !mWifi.isConnected()) {
AppMsg.Style style = new AppMsg.Style(AppMsg.LENGTH_STICKY, R.color.alert_wifi);
AppMsg provided = AppMsg.makeText(this, R.string.wifi_error, style);
provided.getView()
.setOnClickListener(new CancelAppMsg(provided));
provided.show();
}
}