1 |
/**
|
2 |
* ZANavi, Zoff Android Navigation system.
|
3 |
* Copyright (C) 2013 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.util.TypedValue;
|
26 |
import android.view.Gravity;
|
27 |
import android.view.View;
|
28 |
import android.view.View.OnClickListener;
|
29 |
import android.view.WindowManager;
|
30 |
import android.widget.Button;
|
31 |
import android.widget.EditText;
|
32 |
import android.widget.TextView;
|
33 |
|
34 |
public class NavitFeedbackFormActivity extends ActionBarActivity
|
35 |
{
|
36 |
private EditText feedback_text;
|
37 |
|
38 |
@Override
|
39 |
protected void onCreate(Bundle savedInstanceState)
|
40 |
{
|
41 |
Navit.applySharedTheme(this, Navit.p.PREF_current_theme);
|
42 |
|
43 |
super.onCreate(savedInstanceState);
|
44 |
|
45 |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
|
46 |
|
47 |
setContentView(R.layout.feedback_dialog);
|
48 |
|
49 |
android.support.v7.widget.Toolbar bar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar2);
|
50 |
bar.setTitle(Navit.get_text("send feedback"));
|
51 |
bar.setNavigationOnClickListener(new View.OnClickListener()
|
52 |
{
|
53 |
@Override
|
54 |
public void onClick(View v)
|
55 |
{
|
56 |
finish();
|
57 |
}
|
58 |
});
|
59 |
|
60 |
// scrollview
|
61 |
//ScrollView sv = new ScrollView(this);
|
62 |
//sv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
|
63 |
|
64 |
// panel linearlayout
|
65 |
//LinearLayout panel = new LinearLayout(this);
|
66 |
//panel.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
67 |
//panel.setOrientation(LinearLayout.VERTICAL);
|
68 |
|
69 |
// label
|
70 |
TextView addr_view = (TextView) findViewById(R.id.fb_label);
|
71 |
addr_view.setText(Navit.get_text("Enter your Feedback text")); //TRANS
|
72 |
addr_view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);
|
73 |
//addr_view.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
|
74 |
addr_view.setPadding(4, 4, 4, 4);
|
75 |
|
76 |
// feedback string exidbox
|
77 |
feedback_text = (EditText) findViewById(R.id.fb_text);
|
78 |
feedback_text.setText("");
|
79 |
feedback_text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);
|
80 |
//feedback_text.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 300));
|
81 |
feedback_text.setMinLines(6);
|
82 |
feedback_text.setGravity(Gravity.TOP);
|
83 |
|
84 |
// send button
|
85 |
Button btnSearch = (Button) findViewById(R.id.fb_sendbutton);
|
86 |
btnSearch.setText(Navit.get_text("send")); //TRANS
|
87 |
//btnSearch.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
|
88 |
btnSearch.setGravity(Gravity.CENTER);
|
89 |
btnSearch.setOnClickListener(new OnClickListener()
|
90 |
{
|
91 |
public void onClick(View v)
|
92 |
{
|
93 |
executeDone();
|
94 |
}
|
95 |
});
|
96 |
|
97 |
// actually adding the views (that have layout set on them) to the panel
|
98 |
//panel.addView(addr_view);
|
99 |
//panel.addView(feedback_text);
|
100 |
//panel.addView(btnSearch);
|
101 |
|
102 |
//sv.addView(panel);
|
103 |
|
104 |
// set the main view
|
105 |
//setContentView(sv);
|
106 |
}
|
107 |
|
108 |
private void executeDone()
|
109 |
{
|
110 |
Intent resultIntent = new Intent();
|
111 |
resultIntent.putExtra("feedback_text", NavitFeedbackFormActivity.this.feedback_text.getText().toString());
|
112 |
|
113 |
setResult(ActionBarActivity.RESULT_OK, resultIntent);
|
114 |
finish();
|
115 |
}
|
116 |
|
117 |
}
|