1 |
/**
|
2 |
* ZANavi, Zoff Android Navigation system.
|
3 |
* Copyright (C) 2014 Zoff <zoff@zoff.cc>
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* version 2 as published by the Free Software Foundation.
|
8 |
*
|
9 |
* This program is distributed in the hope that it will be useful,
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
* GNU General Public License for more details.
|
13 |
*
|
14 |
* You should have received a copy of the GNU General Public License
|
15 |
* along with this program; if not, write to the
|
16 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
17 |
* Boston, MA 02110-1301, USA.
|
18 |
*/
|
19 |
|
20 |
package com.zoffcc.applications.zanavi;
|
21 |
|
22 |
import android.content.Intent;
|
23 |
import android.os.Bundle;
|
24 |
import android.support.v7.app.ActionBarActivity;
|
25 |
import android.text.ClipboardManager;
|
26 |
import android.view.View;
|
27 |
import android.widget.Button;
|
28 |
import android.widget.TextView;
|
29 |
import android.widget.Toast;
|
30 |
|
31 |
public class ZANaviDonateActivity extends ActionBarActivity
|
32 |
{
|
33 |
@Override
|
34 |
protected void onCreate(Bundle savedInstanceState)
|
35 |
{
|
36 |
Navit.applySharedTheme(this, Navit.p.PREF_current_theme);
|
37 |
|
38 |
super.onCreate(savedInstanceState);
|
39 |
setContentView(R.layout.activity_donate);
|
40 |
|
41 |
android.support.v7.widget.Toolbar bar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar2bd);
|
42 |
bar.setTitle(Navit.get_text("Donate with Bitcoin"));
|
43 |
bar.setNavigationOnClickListener(new View.OnClickListener()
|
44 |
{
|
45 |
@Override
|
46 |
public void onClick(View v)
|
47 |
{
|
48 |
finish();
|
49 |
}
|
50 |
});
|
51 |
|
52 |
((TextView) findViewById(R.id.t1_donate_with_bitcoin)).setText(Navit.get_text("Donate with Bitcoin"));
|
53 |
|
54 |
((Button) findViewById(R.id.b1_bitcoin_to_clip)).setText(Navit.get_text("copy Bitcoinaddress to Clipboard"));
|
55 |
((Button) findViewById(R.id.b1_bitcoin_to_email)).setText(Navit.get_text("send Bitcoinaddress and QR Code as Email"));
|
56 |
((Button) findViewById(R.id.b1_bitcoin_to_wallet)).setText(Navit.get_text("Donate with Bitcoin Wallet App"));
|
57 |
}
|
58 |
|
59 |
public void onBitcoinWallet(View arg0)
|
60 |
{
|
61 |
try
|
62 |
{
|
63 |
de.schildbach.wallet.integration.android.BitcoinIntegration.request(this, Navit.BITCOIN_DONATE_ADDR);
|
64 |
}
|
65 |
catch (Exception e)
|
66 |
{
|
67 |
}
|
68 |
}
|
69 |
|
70 |
public void onBitcoinEmail(View arg0)
|
71 |
{
|
72 |
try
|
73 |
{
|
74 |
final String subject = Navit.get_text("ZANavi Donation with Bitcoin");
|
75 |
final String body = Navit.get_text("Bitcoin address") + ":\n" + Navit.BITCOIN_DONATE_ADDR + "\n\n" + Navit.get_text("generate QR code") + ":\n" + "https://chart.googleapis.com/chart?cht=qr&chl=bitcoin%3A" + Navit.BITCOIN_DONATE_ADDR + "&choe=UTF-8&chs=300x300";
|
76 |
|
77 |
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
|
78 |
emailIntent.setType("plain/text");
|
79 |
if (subject != null) emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
|
80 |
if (body != null) emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
|
81 |
|
82 |
startActivity(Intent.createChooser(emailIntent, Navit.get_text("Send Bitcoin address to email ...")));
|
83 |
}
|
84 |
catch (Exception e)
|
85 |
{
|
86 |
}
|
87 |
}
|
88 |
|
89 |
public void onBitcoinClipboard(View arg0)
|
90 |
{
|
91 |
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
92 |
|
93 |
clipboard.setText(Navit.BITCOIN_DONATE_ADDR);
|
94 |
Toast.makeText(this, Navit.get_text("Bitcoinaddress copied to Clipboard"), Toast.LENGTH_LONG).show();
|
95 |
}
|
96 |
}
|