If you think the Android project bitfynd-wallet-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2011-2014 the original author or authors.
*/*fromwww.java2s.com*/
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/package de.schildbach.wallet.ui;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import de.schildbach.wallet.WalletApplication;
import de.schildbach.wallet.R;
/**
* @author Andreas Schildbach
*/publicabstractclass AbstractWalletActivity extends ActionBarActivity
{
private WalletApplication application;
protectedstaticfinal Logger log = LoggerFactory.getLogger(AbstractWalletActivity.class);
@Override
protectedvoid onCreate(final Bundle savedInstanceState)
{
application = (WalletApplication) getApplication();
super.onCreate(savedInstanceState);
}
protected WalletApplication getWalletApplication()
{
return application;
}
protectedfinalvoid toast(@Nonnull final String text, final Object... formatArgs)
{
toast(text, 0, Toast.LENGTH_SHORT, formatArgs);
}
protectedfinalvoid longToast(@Nonnull final String text, final Object... formatArgs)
{
toast(text, 0, Toast.LENGTH_LONG, formatArgs);
}
protectedfinalvoid toast(@Nonnull final String text, finalint imageResId, finalint duration, final Object... formatArgs)
{
final View view = getLayoutInflater().inflate(R.layout.transient_notification, null);
TextView tv = (TextView) view.findViewById(R.id.transient_notification_text);
tv.setText(String.format(text, formatArgs));
tv.setCompoundDrawablesWithIntrinsicBounds(imageResId, 0, 0, 0);
final Toast toast = new Toast(this);
toast.setView(view);
toast.setDuration(duration);
toast.show();
}
protectedfinalvoid toast(finalint textResId, final Object... formatArgs)
{
toast(textResId, 0, Toast.LENGTH_SHORT, formatArgs);
}
protectedfinalvoid longToast(finalint textResId, final Object... formatArgs)
{
toast(textResId, 0, Toast.LENGTH_LONG, formatArgs);
}
protectedfinalvoid toast(finalint textResId, finalint imageResId, finalint duration, final Object... formatArgs)
{
final View view = getLayoutInflater().inflate(R.layout.transient_notification, null);
TextView tv = (TextView) view.findViewById(R.id.transient_notification_text);
tv.setText(getString(textResId, formatArgs));
tv.setCompoundDrawablesWithIntrinsicBounds(imageResId, 0, 0, 0);
final Toast toast = new Toast(this);
toast.setView(view);
toast.setDuration(duration);
toast.show();
}
}