app推广:

     一.基本情况

      我们把推广和调研都放在了一起,主要是调研,主要通过调查问卷和直接访问的方式,让调查的人能够看到我们app的主要功能,

然后做出评价和对此改善的意见。调研推广主要通过QQ,微信和微博的群发功能和发表链接,让有兴趣的人参与进我们的调查。基本

情况如下图所示。

二.问卷和访问分析

      通过调查问卷和直接访问我们得知调查的对象主要是广东省的在校大学生。超过一半的人觉得小学生可以用app的方式做数学题目。其余的

都是中立和反对的意见。总的来说四则运算app还是挺有市场前景的。对于出题的要超过半数的人认为要出不同难度的题目和生成不同类型和范

围的数给学生是算术题目的核心考虑问题。少部分觉得还需要加其他条件,比如阶乘等特殊条件运算。

      在辅助功能方面。一半的人认为要加计算器的功能,其余建议更换皮肤等。对于我们app的初略评价,从五分为总分的情况看,调查出来的

平均分为4.14,看来调查人员对我们的app还是蛮有信心的。

       以下是问卷截图。

                                           1                                                                                       2                                    

                                              3                                                                                            4  

                                                                                                                                   

三.总结

      总的来说,如果要进入应用市场还是有一定的距离。因为还有需要算术方面的功能细节需要考虑。此外还有辅助功能,如果设计比较好看的

界面,把娱乐和做题结合吸引小学生是我们接下来要考虑的最主要的问题。推广的过程艰辛,不过用户还是挺期待的,愿接下来我们团队能够继

续完善成功发布在应用市场。

主要代码

    按照老师发的极简github项目创建与提交链接做到第五步就卡住了,问题一些同学以及上网查了也不成功,所以只能上传代码了,等明天

看教程再放上github。

  1. package com.example.operation;
  2. import mehdi.sakout.fancybuttons.FancyButton;
  3. import android.annotation.SuppressLint;
  4. import android.annotation.TargetApi;
  5. import android.app.ActionBar;
  6. import android.app.Activity;
  7. import android.content.Intent;
  8. import android.os.Build;
  9. import android.os.Bundle;
  10. import android.view.Menu;
  11. import android.view.MenuInflater;
  12. import android.view.MenuItem;
  13.  
  14. public class About extends Activity{
  15.  
  16. @Override
  17. protected void onCreate(Bundle savedInstanceState) {
  18. // TODO Auto-generated method stub
  19. super.onCreate(savedInstanceState);
  20. setContentView(R.layout.aboutlayout);
  21.  
  22. }
  23. @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  24. @SuppressLint("NewApi")
  25. public boolean onCreateOptionsMenu(Menu menu) {
  26. // Inflate the menu; this adds items to the action bar if it is present.
  27. MenuInflater inflater=new MenuInflater(this);
  28. inflater.inflate(R.menu.main, menu);
  29. getMenuInflater().inflate(R.menu.main, menu);
  30.  
  31. ActionBar actionBar = getActionBar();
  32. actionBar.setDisplayHomeAsUpEnabled(true);
  33. actionBar.setDisplayShowHomeEnabled(true);
  34.  
  35. return super.onCreateOptionsMenu(menu);
  36. }
  37. @Override
  38. public boolean onOptionsItemSelected(MenuItem item) {
  39. // TODO Auto-generated method stub
  40. switch (item.getItemId()) {
  41. case android.R.id.home:
  42. //创建启动MainActivity的Intent
  43. Intent intent=new Intent(this,MainActivity.class);
  44. //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
  45. //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  46. startActivity(intent);
  47. break;
  48. case R.id.item1:
  49. startActivity(new Intent(About.this,Game.class));
  50. break;
  51. case R.id.item2:
  52. startActivity(new Intent(About.this,Game1.class));
  53. break;
  54. case R.id.item3:
  55. startActivity(new Intent(About.this,About.class));
  56. break;
  57. case R.id.item4:
  58. startActivity(new Intent(About.this,About.class));
  59. break;
  60. default:
  61. break;
  62. }
  63. return super.onOptionsItemSelected(item);
  64. }
  65.  
  66. }
  1. package com.example.operation;
  2. import java.util.Arrays;
  3. import mehdi.sakout.fancybuttons.FancyButton;
  4. import android.annotation.SuppressLint;
  5. import android.annotation.TargetApi;
  6. import android.app.ActionBar;
  7. import android.app.Activity;
  8. import android.content.Context;
  9. import android.content.Intent;
  10. import android.os.Build;
  11. import android.os.Bundle;
  12. import android.os.Handler;
  13. import android.os.Message;
  14. import android.util.Log;
  15. import android.view.Menu;
  16. import android.view.MenuInflater;
  17. import android.view.MenuItem;
  18. import android.view.View;
  19. import android.view.View.OnClickListener;
  20. import android.widget.EditText;
  21. import android.widget.TextView;
  22. import android.widget.Toast;
  23. import bsh.EvalError;
  24. import bsh.Interpreter;
  25.  
  26. import com.example.operation.R;
  27.  
  28. @SuppressLint("NewApi")
  29. public class Game extends Activity {
  30. //EditText rsText = null;
  31. // private TextView tv2;
  32.  
  33. private TextView textView1;
  34. private FancyButton btn_1;
  35. boolean isClear = false;
  36. private TextView tv=null;
  37. private TextView tv_tishu;
  38. private TextView tv_tishu1;
  39. private long start;
  40. private long end;
  41. private boolean flag = false;
  42. private EditText editText1;
  43. private EditText editText2;
  44. private String [] answer = new String [100];
  45. private String [] right = new String [100];
  46. private int jishu;
  47. long millisecond;
  48. long second;
  49. long minute;
  50. @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  51. @SuppressLint("NewApi")
  52. @Override
  53. protected void onCreate(Bundle savedInstanceState) {
  54. super.onCreate(savedInstanceState);
  55. setContentView(R.layout.gamelayout);
  56. // rsText = (EditText) findViewById(R.id.rsText);//editText1 是电脑答案
  57. textView1 = (TextView) findViewById(R.id.textView3);
  58. tv = (TextView) findViewById(R.id.show);
  59. tv_tishu = (TextView) findViewById(R.id.tishutext);
  60. tv_tishu1 = (TextView) findViewById(R.id.textView2);
  61. editText1 = (EditText) findViewById(R.id.editText1);//editText1 是用户输入的题目
  62. editText2 = (EditText) findViewById(R.id.editText2);//editText1 是用户输入的答案
  63. // ActionBar actionBar = getActionBar();//获取ActionBar对象
  64. // actionBar.setDisplayShowHomeEnabled(true);//显示应用程序图标
  65. // actionBar.setDisplayHomeAsUpEnabled(true);//将应用程序图标转变为
  66. Context context=getApplicationContext();
  67. final Toast toast= Toast.makeText(context, "很遗憾,你的答案是错的", 1);
  68.  
  69. answer [0]="";
  70. btn_1 = (FancyButton) findViewById(R.id.is);
  71. btn_1.setOnClickListener(new OnClickListener() {
  72. int count = 0;
  73. // String[] readomHard = new String[20];
  74. // readomHard[count] =String.valueOf(d);
  75. @Override
  76. public void onClick(View v) {
  77. count = count + 1;
  78. String a = null;
  79. String b = null;
  80. String c = null;
  81. //String d = null;
  82. //String e = null;
  83. String[] readomHard = new String[20];
  84. jishu=Integer.parseInt(editText1.getText().toString());
  85. //Toast.makeText(Game.this,jishu+"", 1).show();
  86. //Toast.makeText(Game.this,count+"***", 1).show();
  87. // readomHard[count] =String.valueOf(exp);
  88. if ( count<=Integer.parseInt(editText1.getText().toString()) || end < 6) {
  89.  
  90. String[] readomWord = { "+", "-", "*", "/" };
  91. int readomWordIndex = (int) (Math.random() * 4);
  92. c = readomWord[readomWordIndex];
  93. a = String.valueOf((int) (Math.random() * 30));
  94. b = String.valueOf((int) (Math.random() * 30));
  95. //d = String.valueOf((int) (Math.random() * 30));
  96. //e = readomWord[readomWordIndex2];
  97. textView1.setText(a+c+b);// ....
  98. answer[count] = editText2.getText().toString();
  99. // textView1.setText("("+a + c + b+")"+e+d);// ....
  100.  
  101. String exp = textView1.getText().toString();
  102. // rsText.setText(exp);
  103. //right[count-1]=exp;
  104. //获取答案跟比较答案/
  105. /* String temp = editText2.getText().toString();
  106. Double temp1 = Double.parseDouble (temp);
  107. temp1 = (int)(temp1*1000)/1000.0;
  108. */
  109. /*Double exp1 = Double.parseDouble (temp);
  110. exp1 = (int)(exp1*1000)/1000.0;
  111. if(temp1==exp1){
  112. Toast.makeText(Game.this, "Right ", Toast.LENGTH_LONG).show();
  113. }*/
  114.  
  115. // if(Integer.parseInt(editText2.getText().toString())==Integer.parseInt(exp))
  116. // {
  117. // Toast.makeText(Game.this,"right", 1).show();
  118. // if (exp == null || exp.trim().length() == 0)
  119. // return;
  120. exp = getRs(exp);
  121. right[count-1]=exp;
  122. if (exp.endsWith(".0")) {
  123. exp = exp.substring(1, exp.indexOf(".0"));
  124. }
  125. // rsText.setText(exp);
  126.  
  127. //Log.i("info",right[count-1]);
  128. isClear = false;// ....
  129. if (!flag && count==1){
  130. flag=true;
  131. start();
  132. } if(flag&&count>Integer.parseInt(editText1.getText().toString())) {
  133. pause();
  134. }
  135. readomHard[count] = String.valueOf(exp);
  136. tv_tishu.setText("第" + count + "题");
  137.  
  138. // tv_tishu1.setText(readomHard[count]);
  139. }
  140. else {
  141. btn_1.setEnabled(false);
  142. answer[count] = editText2.getText().toString();
  143. // Log.i("info",answer[count-1]);
  144. tv_tishu.setText("结束");
  145. //跳转到新的页面里面去显示答案.顺便带走答案根用户答案的数组.
  146. //用户答案智能从1开始储存,电脑的从0
  147. Log.i("info",answer[0]+"-"+answer[1]+"-"+answer[2]+"-"+answer[3]+"-"+answer[4]+"-"+answer[5]);
  148. Log.i("info",right[0]+"-"+right[1]+"-"+right[2]+"-"+right[3]+"-"+right[4]);
  149.  
  150. Intent intent = new Intent(Game.this,Show.class);
  151. Bundle bundle = new Bundle();
  152. bundle.putStringArray("user", answer);
  153. bundle.putStringArray("Computer", right);
  154. bundle.putInt("man", count-1);
  155. bundle.putString("time",toTime(end));
  156. intent.putExtras(bundle);
  157. startActivity(intent);
  158.  
  159. pause();
  160. }
  161. }// ....
  162.  
  163. });
  164.  
  165. }
  166.  
  167. //////答案
  168.  
  169. /***
  170. * @param exp
  171. * 算数表达式
  172. * @return 根据表达式返回结果
  173. */
  174.  
  175. private String getRs(String exp) {
  176. Interpreter bsh = new Interpreter();
  177. Number result = null;
  178. try {
  179. exp = filterExp(exp);
  180. result = (Number) bsh.eval(exp);
  181. } catch (EvalError e) {
  182. e.printStackTrace();
  183. isClear = true;
  184. return "算数公式错误";
  185. }
  186. return result.intValue() + "";
  187. }
  188.  
  189. /**
  190. * @param exp
  191. * 算数表达式
  192. * @return 因为计算过程中,全程需要有小数参与.
  193. */
  194.  
  195. private String filterExp(String exp) {
  196. String num[] = exp.split("");
  197. String temp = null;
  198. int begin = 0, end = 0;
  199. for (int i = 1; i < num.length; i++) {
  200. temp = num[i];
  201. if (temp.matches("[+-/()*]")) {
  202. if (temp.equals("."))
  203. continue;
  204. end = i - 1;
  205. temp = exp.substring(begin, end);
  206. if (temp.trim().length() > 0 && temp.indexOf(".") < 0)
  207. num[i - 1] = num[i - 1] + ".0";
  208. begin = end + 1;
  209. }
  210. }
  211. return Arrays.toString(num).replaceAll("[\\[\\], ]", "");
  212. }
  213. ////////////////////////////////////////////
  214. private Handler handler = new Handler() {
  215. @Override
  216. public void handleMessage(Message msg) {
  217. super.handleMessage(msg);
  218. end = System.currentTimeMillis() - start;
  219. tv.setText(toTime(end));
  220. }
  221. };
  222.  
  223. public class MyThread implements Runnable {
  224. @Override
  225. public void run() {
  226. while (flag) {
  227. try {
  228. Thread.sleep(100);
  229. Message message = handler.obtainMessage();
  230. message.what = 1;
  231. handler.sendMessage(message);
  232. } catch (InterruptedException e) {
  233. e.printStackTrace();
  234. }
  235. }
  236. }
  237. }
  238.  
  239. public void pause() {
  240. flag = false;
  241. }
  242.  
  243. public void start() {
  244. start = System.currentTimeMillis();
  245. flag = true;
  246. new Thread(new MyThread()).start();
  247. }
  248.  
  249. private String toTime(long start) {
  250. millisecond = start % 1000;
  251. millisecond /= 100;
  252. start /= 1000;
  253. minute = start / 60;
  254. second = start % 60;
  255. minute %= 60;
  256. return String.format("%02d:%02d:%01d", minute, second, millisecond);
  257. }
  258.  
  259. @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  260. @SuppressLint("NewApi")
  261. public boolean onCreateOptionsMenu(Menu menu) {
  262. // Inflate the menu; this adds items to the action bar if it is present.
  263. MenuInflater inflater=new MenuInflater(this);
  264. inflater.inflate(R.menu.main, menu);
  265. getMenuInflater().inflate(R.menu.main, menu);
  266.  
  267. ActionBar actionBar = getActionBar();
  268. actionBar.setDisplayHomeAsUpEnabled(true);
  269. actionBar.setDisplayShowHomeEnabled(true);
  270.  
  271. return super.onCreateOptionsMenu(menu);
  272. }
  273. @Override
  274. public boolean onOptionsItemSelected(MenuItem item) {
  275. // TODO Auto-generated method stub
  276. switch (item.getItemId()) {
  277. case android.R.id.home:
  278. //创建启动MainActivity的Intent
  279. Intent intent=new Intent(this,MainActivity.class);
  280. //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
  281. //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  282. startActivity(intent);
  283. break;
  284. case R.id.item1:
  285. startActivity(new Intent(Game.this,Game.class));
  286. break;
  287. case R.id.item2:
  288. startActivity(new Intent(Game.this,Game1.class));
  289. break;
  290. case R.id.item3:
  291. startActivity(new Intent(Game.this,About.class));
  292. break;
  293. case R.id.item4:
  294. startActivity(new Intent(Game.this,About.class));
  295. break;
  296. default:
  297. break;
  298. }
  299. return super.onOptionsItemSelected(item);
  300. }
  301.  
  302. public boolean adjust(String answer,String useranswer){
  303. /*double a = Double.parseDouble(answer);
  304. int temp = (int)Math.round(a*1000);
  305. a = temp/1000.0;
  306.  
  307. double b =Double.parseDouble(useranswer);
  308. if(a!=b)*/
  309. if(answer!=useranswer)
  310. return false;
  311. return true;
  312. }
  313.  
  314. }
  1. package com.example.operation;
  2. import java.util.Arrays;
  3. import mehdi.sakout.fancybuttons.FancyButton;
  4. import android.annotation.SuppressLint;
  5. import android.annotation.TargetApi;
  6. import android.app.ActionBar;
  7. import android.app.Activity;
  8. import android.content.Context;
  9. import android.content.Intent;
  10. import android.os.Build;
  11. import android.os.Bundle;
  12. import android.os.Handler;
  13. import android.os.Message;
  14. import android.util.Log;
  15. import android.view.Menu;
  16. import android.view.MenuInflater;
  17. import android.view.MenuItem;
  18. import android.view.View;
  19. import android.view.View.OnClickListener;
  20. import android.widget.EditText;
  21. import android.widget.TextView;
  22. import android.widget.Toast;
  23. import bsh.EvalError;
  24. import bsh.Interpreter;
  25.  
  26. import com.example.operation.R;
  27.  
  28. @SuppressLint("NewApi")
  29. public class Game1 extends Activity {
  30. //EditText rsText = null;
  31. // private TextView tv2;
  32.  
  33. private TextView textView1;
  34. private FancyButton btn_1;
  35. boolean isClear = false;
  36. private TextView tv=null;
  37. private TextView tv_tishu;
  38. private TextView tv_tishu1;
  39. private long start;
  40. private long end;
  41. private boolean flag = false;
  42. private EditText editText1;
  43. private EditText editText2;
  44. private String [] answer = new String [100];
  45. private String [] right = new String [100];
  46. private int jishu;
  47. long millisecond;
  48. long second;
  49. long minute;
  50. @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  51. @SuppressLint("NewApi")
  52. @Override
  53. protected void onCreate(Bundle savedInstanceState) {
  54. super.onCreate(savedInstanceState);
  55. setContentView(R.layout.gamelayout);
  56. // rsText = (EditText) findViewById(R.id.rsText);//editText1 是电脑答案
  57. textView1 = (TextView) findViewById(R.id.textView3);
  58. tv = (TextView) findViewById(R.id.show);
  59. tv_tishu = (TextView) findViewById(R.id.tishutext);
  60. tv_tishu1 = (TextView) findViewById(R.id.textView2);
  61. editText1 = (EditText) findViewById(R.id.editText1);//editText1 是用户输入的题目
  62. editText2 = (EditText) findViewById(R.id.editText2);//editText1 是用户输入的答案
  63. // ActionBar actionBar = getActionBar();//获取ActionBar对象
  64. // actionBar.setDisplayShowHomeEnabled(true);//显示应用程序图标
  65. // actionBar.setDisplayHomeAsUpEnabled(true);//将应用程序图标转变为
  66. Context context=getApplicationContext();
  67. final Toast toast= Toast.makeText(context, "很遗憾,你的答案是错的", 1);
  68.  
  69. answer [0]="";
  70. btn_1 = (FancyButton) findViewById(R.id.is);
  71. btn_1.setOnClickListener(new OnClickListener() {
  72. int count = 0;
  73. // String[] readomHard = new String[20];
  74. // readomHard[count] =String.valueOf(d);
  75. @Override
  76. public void onClick(View v) {
  77. count = count + 1;
  78. String a = null;
  79. String b = null;
  80. String c = null;
  81. String d = null;
  82. String e = null;
  83. String[] readomHard = new String[20];
  84.  
  85. jishu=Integer.parseInt(editText1.getText().toString());
  86. //Toast.makeText(Game.this,jishu+"", 1).show();
  87. //Toast.makeText(Game.this,count+"***", 1).show();
  88. // readomHard[count] =String.valueOf(exp);
  89. if ( count<=Integer.parseInt(editText1.getText().toString()) || end < 6) {
  90.  
  91. String[] readomWord = { "+", "-", "*", "/" };
  92. int readomWordIndex = (int) (Math.random() * 4);
  93. int readomWordIndex2 = (int) (Math.random() * 4);
  94. c = readomWord[readomWordIndex];
  95. a = String.valueOf((int) (Math.random() * 30));
  96. b = String.valueOf((int) (Math.random() * 30));
  97. d = String.valueOf((int) (Math.random() * 30));
  98. e = readomWord[readomWordIndex2];
  99. // textView1.setText(a+c+b);// ....
  100. answer[count] = editText2.getText().toString();
  101. textView1.setText("("+a + c + b+")"+e+d);// ....
  102.  
  103. String exp = textView1.getText().toString();
  104. // rsText.setText(exp);
  105. //right[count-1]=exp;
  106. //获取答案跟比较答案/
  107. /* String temp = editText2.getText().toString();
  108. Double temp1 = Double.parseDouble (temp);
  109. temp1 = (int)(temp1*1000)/1000.0;
  110. */
  111. /*Double exp1 = Double.parseDouble (temp);
  112. exp1 = (int)(exp1*1000)/1000.0;
  113. if(temp1==exp1){
  114. Toast.makeText(Game.this, "Right ", Toast.LENGTH_LONG).show();
  115. }*/
  116.  
  117. // if(Integer.parseInt(editText2.getText().toString())==Integer.parseInt(exp))
  118. // {
  119. // Toast.makeText(Game.this,"right", 1).show();
  120. // if (exp == null || exp.trim().length() == 0)
  121. // return;
  122. exp = getRs(exp);
  123. right[count-1]=exp;
  124. if (exp.endsWith(".0")) {
  125. exp = exp.substring(1, exp.indexOf(".0"));
  126. }
  127. // rsText.setText(exp);
  128.  
  129. //Log.i("info",right[count-1]);
  130. isClear = false;// ....
  131. if (!flag && count==1){
  132. flag=true;
  133. start();
  134. } if(flag&&count>Integer.parseInt(editText1.getText().toString())) {
  135. pause();
  136. }
  137. readomHard[count] = String.valueOf(exp);
  138. tv_tishu.setText("第" + count + "题");
  139.  
  140. // tv_tishu1.setText(readomHard[count]);
  141. }
  142. else {
  143. btn_1.setEnabled(false);
  144. answer[count] = editText2.getText().toString();
  145. // Log.i("info",answer[count-1]);
  146. tv_tishu.setText("结束");
  147. //跳转到新的页面里面去显示答案.顺便带走答案根用户答案的数组.
  148. //用户答案智能从1开始储存,电脑的从0
  149. Log.i("info",answer[0]+"-"+answer[1]+"-"+answer[2]+"-"+answer[3]+"-"+answer[4]+"-"+answer[5]);
  150. Log.i("info",right[0]+"-"+right[1]+"-"+right[2]+"-"+right[3]+"-"+right[4]);
  151.  
  152. Intent intent = new Intent(Game1.this,Show.class);
  153. Bundle bundle = new Bundle();
  154. bundle.putStringArray("user", answer);
  155. bundle.putStringArray("Computer", right);
  156. bundle.putInt("man", count-1);
  157. bundle.putString("time",toTime(end));
  158. intent.putExtras(bundle);
  159. startActivity(intent);
  160.  
  161. pause();
  162. }
  163. }// ....
  164.  
  165. });
  166.  
  167. }
  168.  
  169. //////答案
  170.  
  171. /***
  172. * @param exp
  173. * 算数表达式
  174. * @return 根据表达式返回结果
  175. */
  176.  
  177. private String getRs(String exp) {
  178. Interpreter bsh = new Interpreter();
  179. Number result = null;
  180. try {
  181. exp = filterExp(exp);
  182. result = (Number) bsh.eval(exp);
  183. } catch (EvalError e) {
  184. e.printStackTrace();
  185. isClear = true;
  186. return "算数公式错误";
  187. }
  188. return result.intValue() + "";
  189. }
  190.  
  191. /**
  192. * @param exp
  193. * 算数表达式
  194. * @return 因为计算过程中,全程需要有小数参与.
  195. */
  196.  
  197. private String filterExp(String exp) {
  198. String num[] = exp.split("");
  199. String temp = null;
  200. int begin = 0, end = 0;
  201. for (int i = 1; i < num.length; i++) {
  202. temp = num[i];
  203. if (temp.matches("[+-/()*]")) {
  204. if (temp.equals("."))
  205. continue;
  206. end = i - 1;
  207. temp = exp.substring(begin, end);
  208. if (temp.trim().length() > 0 && temp.indexOf(".") < 0)
  209. num[i - 1] = num[i - 1] + ".0";
  210. begin = end + 1;
  211. }
  212. }
  213. return Arrays.toString(num).replaceAll("[\\[\\], ]", "");
  214. }
  215. ////////////////////////////////////////////
  216. private Handler handler = new Handler() {
  217. @Override
  218. public void handleMessage(Message msg) {
  219. super.handleMessage(msg);
  220. end = System.currentTimeMillis() - start;
  221. tv.setText(toTime(end));
  222. }
  223. };
  224.  
  225. public class MyThread implements Runnable {
  226. @Override
  227. public void run() {
  228. while (flag) {
  229. try {
  230. Thread.sleep(100);
  231. Message message = handler.obtainMessage();
  232. message.what = 1;
  233. handler.sendMessage(message);
  234. } catch (InterruptedException e) {
  235. e.printStackTrace();
  236. }
  237. }
  238. }
  239. }
  240.  
  241. public void pause() {
  242. flag = false;
  243. }
  244.  
  245. public void start() {
  246. start = System.currentTimeMillis();
  247. flag = true;
  248. new Thread(new MyThread()).start();
  249. }
  250.  
  251. private String toTime(long start) {
  252. millisecond = start % 1000;
  253. millisecond /= 100;
  254. start /= 1000;
  255. minute = start / 60;
  256. second = start % 60;
  257. minute %= 60;
  258. return String.format("%02d:%02d:%01d", minute, second, millisecond);
  259. }
  260.  
  261. @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  262. @SuppressLint("NewApi")
  263. public boolean onCreateOptionsMenu(Menu menu) {
  264. // Inflate the menu; this adds items to the action bar if it is present.
  265. MenuInflater inflater=new MenuInflater(this);
  266. inflater.inflate(R.menu.main, menu);
  267. getMenuInflater().inflate(R.menu.main, menu);
  268.  
  269. ActionBar actionBar = getActionBar();
  270. actionBar.setDisplayHomeAsUpEnabled(true);
  271. actionBar.setDisplayShowHomeEnabled(true);
  272.  
  273. return super.onCreateOptionsMenu(menu);
  274. }
  275. @Override
  276. public boolean onOptionsItemSelected(MenuItem item) {
  277. // TODO Auto-generated method stub
  278. switch (item.getItemId()) {
  279. case android.R.id.home:
  280. //创建启动MainActivity的Intent
  281. Intent intent=new Intent(this,MainActivity.class);
  282. //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
  283. //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  284. startActivity(intent);
  285. break;
  286. case R.id.item1:
  287. startActivity(new Intent(Game1.this,Game.class));
  288. break;
  289. case R.id.item2:
  290. startActivity(new Intent(Game1.this,Game1.class));
  291. break;
  292. case R.id.item3:
  293. startActivity(new Intent(Game1.this,About.class));
  294. break;
  295. case R.id.item4:
  296. startActivity(new Intent(Game1.this,About.class));
  297. break;
  298. default:
  299. break;
  300. }
  301. return super.onOptionsItemSelected(item);
  302. }
  303.  
  304. public boolean adjust(String answer,String useranswer){
  305. /*double a = Double.parseDouble(answer);
  306. int temp = (int)Math.round(a*1000);
  307. a = temp/1000.0;
  308.  
  309. double b =Double.parseDouble(useranswer);
  310. if(a!=b)*/
  311. if(answer!=useranswer)
  312. return false;
  313. return true;
  314. }
  315.  
  316. }
  1. package com.example.operation;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.MotionEvent;
  6. import android.widget.RelativeLayout;
  7.  
  8. public class Introduce extends Activity {
  9. int Draw[] = {R.drawable.aaa,R.drawable.bbb,R.drawable.ccc,R.drawable.ddd,R.drawable.eee,R.drawable.fff};
  10. int currentPicIndex = 0;
  11. int changeIndex;
  12. RelativeLayout test;
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.introduce);
  17. test = (RelativeLayout)findViewById(R.id.test);
  18. }
  19.  
  20. @Override
  21. public boolean onTouchEvent(MotionEvent event) {
  22. test.setBackgroundResource(Draw[currentPicIndex]);
  23. changeIndex = currentPicIndex + 1;
  24. currentPicIndex = changeIndex;
  25. if(currentPicIndex > 5)
  26. currentPicIndex = 0;
  27. return super.onTouchEvent(event);
  28. }}
  1. package com.example.operation;
  2.  
  3. import java.util.Timer;
  4. import java.util.TimerTask;
  5.  
  6. import android.app.Activity;
  7. import android.content.Context;
  8. import android.content.Intent;
  9. import android.os.Bundle;
  10. import android.view.Menu;
  11. import android.view.MenuItem;
  12. import android.view.Window;
  13. import android.view.inputmethod.InputMethodManager;
  14. import android.widget.EditText;
  15.  
  16. public class LoginActivity extends Activity {
  17. //账号输入框
  18. EditText accountEdit;
  19. //密码输入框
  20. EditText pwdEdit;
  21.  
  22. @Override
  23. protected void onCreate(Bundle savedInstanceState) {
  24. // TODO Auto-generated method stub
  25. super.onCreate(savedInstanceState);
  26. requestWindowFeature(Window.FEATURE_NO_TITLE);
  27. setContentView(R.layout.login);
  28.  
  29. //获取账号控件,并自动弹出软键盘
  30. accountEdit = (EditText)findViewById(R.id.accountEdittext);
  31. accountEdit.setFocusable(true);
  32. accountEdit.setFocusableInTouchMode(true);
  33. accountEdit.requestFocus();
  34. Timer timer = new Timer();
  35. timer.schedule(new TimerTask() {
  36. public void run() {
  37. InputMethodManager inputManager = (InputMethodManager) accountEdit
  38. .getContext().getSystemService(
  39. Context.INPUT_METHOD_SERVICE);
  40. inputManager.showSoftInput(accountEdit, 0);
  41. }
  42. },
  43. 998);
  44. }
  45. @Override
  46. public boolean onCreateOptionsMenu(Menu menu) {
  47. getMenuInflater().inflate(R.menu.main, menu);
  48. return true;
  49. }
  50. public boolean onOptionsItemSelected(MenuItem item) {
  51. // TODO Auto-generated method stub
  52. switch (item.getItemId()) {
  53. case android.R.id.home:
  54. //创建启动MainActivity的Intent
  55. Intent intent=new Intent(this,MainActivity.class);
  56. //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
  57. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  58. startActivity(intent);
  59. break;
  60. }
  61. return super.onOptionsItemSelected(item);}}
  1. package com.example.operation;
  2. import mehdi.sakout.fancybuttons.FancyButton;
  3. import android.annotation.SuppressLint;
  4. import android.annotation.TargetApi;
  5. import android.app.ActionBar;
  6. import android.app.Activity;
  7. import android.content.Intent;
  8. import android.os.Build;
  9. import android.os.Bundle;
  10.  
  11. import android.view.Menu;
  12. import android.view.MenuItem;
  13. import android.view.View;
  14. import android.view.View.OnClickListener;
  15.  
  16. import android.widget.TextView;
  17. import com.example.operation.R;
  18. //import com.example.tet.R;
  19. //import com.example.operation.MainActivity.MyThread;
  20.  
  21. @SuppressLint("NewApi")
  22. public class MainActivity extends Activity {
  23.  
  24. private FancyButton btn1;
  25. private FancyButton btn2;
  26. private FancyButton btn3;
  27. private FancyButton btn5;
  28. private FancyButton btn6;
  29. private TextView tv1;
  30. private boolean flag = false;
  31. // private long start;
  32. // private long end;
  33. // private boolean flag = false;
  34.  
  35. @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  36. @SuppressLint("NewApi")
  37. @Override
  38. protected void onCreate(Bundle savedInstanceState) {
  39. super.onCreate(savedInstanceState);
  40. setContentView(R.layout.menulayout);
  41. ActionBar actionBar = getActionBar();//获取ActionBar对象
  42. actionBar.setDisplayShowHomeEnabled(true);//显示应用程序图标
  43. actionBar.setDisplayHomeAsUpEnabled(true);//将应用程序图标转变为
  44.  
  45. // tv1=(TextView)findViewById(R.id.biaoti);
  46. btn1=(FancyButton)findViewById(R.id.button1);
  47. btn2=(FancyButton)findViewById(R.id.button2);
  48. btn3=(FancyButton)findViewById(R.id.button3);
  49. btn5=(FancyButton)findViewById(R.id.button5);
  50. btn6=(FancyButton)findViewById(R.id.button6);
  51. btn1.setOnClickListener(new OnClickListener() {
  52.  
  53. @Override
  54. public void onClick(View arg0) {
  55. Intent intent=new Intent(MainActivity.this,Game.class);
  56. startActivity(intent);
  57. }
  58. });
  59. btn2.setOnClickListener(new OnClickListener() {
  60.  
  61. @Override
  62. public void onClick(View arg0) {
  63. Intent intent=new Intent(MainActivity.this,Game1.class);
  64. startActivity(intent);
  65. }
  66. });
  67.  
  68. btn3.setOnClickListener(new OnClickListener() {
  69.  
  70. @Override
  71. public void onClick(View arg0) {
  72. Intent intent=new Intent(MainActivity.this,Introduce.class);
  73. startActivity(intent);
  74. }
  75. });
  76. btn5.setOnClickListener(new OnClickListener() {
  77.  
  78. @Override
  79. public void onClick(View arg0) {
  80. Intent intent=new Intent(MainActivity.this,About.class);
  81. startActivity(intent);
  82. }
  83. });
  84.  
  85. btn6.setOnClickListener(new OnClickListener() {
  86.  
  87. @Override
  88. public void onClick(View arg0) {
  89. Intent intent=new Intent(MainActivity.this,LoginActivity.class);
  90. startActivity(intent);
  91. }
  92. });
  93. }
  94.  
  95. @Override
  96. public boolean onCreateOptionsMenu(Menu menu) {
  97. getMenuInflater().inflate(R.menu.main, menu);
  98. return true;
  99. }
  100.  
  101. @Override
  102. public boolean onOptionsItemSelected(MenuItem item) {
  103. // TODO Auto-generated method stub
  104. switch (item.getItemId()) {
  105. case android.R.id.home:
  106. //创建启动MainActivity的Intent
  107. Intent intent=new Intent(this,MainActivity.class);
  108. //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
  109. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  110. startActivity(intent);
  111. break;
  112. case R.id.item1:
  113. startActivity(new Intent(MainActivity.this,Game.class));
  114. break;
  115. case R.id.item2:
  116. startActivity(new Intent(MainActivity.this,Game1.class));
  117. break;
  118. case R.id.item3:
  119. startActivity(new Intent(MainActivity.this,About.class));
  120. break;
  121. case R.id.item4:
  122. startActivity(new Intent(MainActivity.this,About.class));
  123. break;
  124. default:
  125. break;
  126. }
  127. return super.onOptionsItemSelected(item);
  128. }}
  1. package com.example.operation;
  2. import android.annotation.SuppressLint;
  3. import android.annotation.TargetApi;
  4. import android.app.ActionBar;
  5. import android.app.Activity;
  6. import android.content.Intent;
  7. import android.os.Build;
  8. import android.os.Bundle;
  9. import android.util.Log;
  10. import android.view.Menu;
  11. import android.view.MenuInflater;
  12. import android.view.MenuItem;
  13. import android.widget.TextView;
  14. public class Show extends Activity {
  15. private TextView t1;
  16. private TextView t2;
  17. private TextView t3;
  18. private TextView t4;
  19. private TextView t5;
  20. private TextView t6;
  21. private TextView t7;
  22. private TextView t8;
  23. private TextView t9;
  24. private TextView t10;
  25. private TextView t11;
  26. @Override
  27. protected void onCreate(Bundle savedInstanceState) {
  28. // TODO Auto-generated method stub
  29. int count=0;
  30. super.onCreate(savedInstanceState);
  31. setContentView(R.layout.showlayout);
  32. TextView t[]=new TextView[100];
  33. t1 = (TextView)findViewById(R.id.textView1);
  34. t2 = (TextView)findViewById(R.id.textView2);
  35. t3 = (TextView)findViewById(R.id.textView3);
  36. t4 = (TextView)findViewById(R.id.textView4);
  37. t5 = (TextView)findViewById(R.id.textView5);
  38. t6 = (TextView)findViewById(R.id.textView6);
  39. t7 = (TextView)findViewById(R.id.textView7);
  40. t8 = (TextView)findViewById(R.id.textView8);
  41. t9 = (TextView)findViewById(R.id.textView9);
  42. t10 = (TextView)findViewById(R.id.textView10);
  43. t11= (TextView)findViewById(R.id.time);
  44. //获取
  45. Bundle bundle2 = getIntent().getExtras();
  46. String []user = new String[100];
  47. String []computer = new String[100];
  48. String time ;
  49.  
  50. int man;
  51. user = bundle2.getStringArray("user");
  52. computer = bundle2.getStringArray("Computer");
  53. man=bundle2.getInt("man");
  54. time=bundle2.getString("time");
  55. t11.setText("答题所用的时间为:"+time);
  56.  
  57. // Log.i("info",computer[0]+"*"+computer[1]+"*"+computer[2]+"*"+computer[3]+"*"+computer[4]
  58. // +"*"+computer[5]+"*"+computer[6]+"*"+computer[7]+"*"+computer[8]+"*"+computer[9] );
  59. //Log.i("info",user[2]+"*"+user[3]+"*"+user[4]+"*"+user[5]+"*"+user[6]+"*"+user[7]+"*"+user[8]
  60. // +"*"+user[9]+"*"+user[10]+"*"+user[11]);
  61. // Log.i("info",""+man);
  62. if (user[2].equals(computer[0]))
  63. t1.setText("你答对了第一题"+","+"答案是"+":"+computer[0]);
  64. else
  65. t1.setText("你答错了第一题"+","+"答案是"+":"+computer[0]);
  66.  
  67. if (user[3]==null&&computer[1]==null)
  68. t2.setText("2");
  69. else if (user[3].equals(computer[1]))
  70. t2.setText("你答对了第二题"+","+"答案是"+":"+computer[1]);
  71. else
  72. t2.setText("你答错了第二题"+","+"答案是"+":"+computer[1]);
  73.  
  74. if (user[4]==null&&computer[2]==null)
  75. t3.setText("3");
  76. else if (user[4].equals(computer[2]))
  77. t3.setText("你答对了第三题"+","+"答案是"+":"+computer[2]);
  78. else
  79. t3.setText("你答错了第三题"+","+"答案是"+":"+computer[2]);
  80.  
  81. if (user[5]==null&&computer[3]==null)
  82. t4.setText("4");
  83. else if (user[5].equals(computer[3]))
  84. t4.setText("你答对了第四题"+","+"答案是"+":"+computer[3]);
  85. else
  86. t4.setText("你答错了第四题"+","+"答案是"+":"+computer[3]);
  87.  
  88. if (user[6]==null&&computer[4]==null)
  89. t5.setText("5");
  90. else if (user[6].equals(computer[4]))
  91. t5.setText("你答对了第五题"+","+"答案是"+":"+computer[4]);
  92. else
  93. t5.setText("你答错了第五题"+","+"答案是"+":"+computer[4]);
  94.  
  95. if (user[7]==null&&computer[5]==null)
  96. t6.setText("6");
  97. else if (user[7].equals(computer[5]))
  98. t6.setText("你答对了第六题"+","+"答案是"+":"+computer[5]);
  99. else
  100. t6.setText("你答错了第六题"+","+"答案是"+":"+computer[5]);
  101.  
  102. if (user[8]==null&&computer[6]==null)
  103. t7.setText("7");
  104. else if (user[8].equals(computer[6]))
  105. t7.setText("你答对了第七题"+","+"答案是"+":"+computer[6]);
  106. else
  107. t7.setText("你答错了第七题"+","+"答案是"+":"+computer[6]);
  108.  
  109. if (user[9]==null&&computer[7]==null)
  110. t8.setText("8");
  111. else if (user[9].equals(computer[7]))
  112. t8.setText("你答对了第八题"+","+"答案是"+":"+computer[7]);
  113. else
  114. t8.setText("你答错了第八题"+","+"答案是"+":"+computer[7]);
  115.  
  116. if (user[10]==null&&computer[8]==null)
  117. t9.setText("9");
  118. else if (user[10].equals(computer[8]))
  119. t9.setText("你答对了第九题"+","+"答案是"+":"+computer[8]);
  120. else
  121. t9.setText("你答错了第九题"+","+"答案是"+":"+computer[8]);
  122.  
  123. if (user[11]==null&&computer[9]==null)
  124. t10.setText("10");
  125. else if (user[11].equals(computer[9]))
  126. t10.setText("你答对了第十题"+","+"答案是"+":"+computer[9]);
  127. else
  128. t10.setText("你答错了第十题"+","+"答案是"+":"+computer[9]);
  129.  
  130. }
  131. @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  132. @SuppressLint("NewApi")
  133. public boolean onCreateOptionsMenu(Menu menu) {
  134. // Inflate the menu; this adds items to the action bar if it is present.
  135. MenuInflater inflater=new MenuInflater(this);
  136. inflater.inflate(R.menu.main, menu);
  137. getMenuInflater().inflate(R.menu.main, menu);
  138.  
  139. ActionBar actionBar = getActionBar();
  140. actionBar.setDisplayHomeAsUpEnabled(true);
  141. actionBar.setDisplayShowHomeEnabled(true);
  142.  
  143. return super.onCreateOptionsMenu(menu);
  144. }
  145. @Override
  146. public boolean onOptionsItemSelected(MenuItem item) {
  147. // TODO Auto-generated method stub
  148. switch (item.getItemId()) {
  149. case android.R.id.home:
  150. //创建启动MainActivity的Intent
  151. Intent intent=new Intent(this,MainActivity.class);
  152. //添加额外的Flag,将Activity栈中处于MainActivity之上的Activity弹出
  153. //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  154. startActivity(intent);
  155. break;
  156. case R.id.item1:
  157. startActivity(new Intent(Show.this,Game.class));
  158. break;
  159. case R.id.item2:
  160. startActivity(new Intent(Show.this,Game1.class));
  161. break;
  162. case R.id.item3:
  163. startActivity(new Intent(Show.this,About.class));
  164. break;
  165. case R.id.item4:
  166. startActivity(new Intent(Show.this,About.class));
  167. break;
  168. default:
  169. break;
  170. }
  171. return super.onOptionsItemSelected(item);
  172. }
  173.  
  174. }
  1. package com.example.operation;
  2.  
  3. import android.annotation.SuppressLint;
  4. import android.os.Handler;
  5. import android.os.Message;
  6. import android.widget.Button;
  7. import android.widget.TextView;
  8.  
  9. public class time {
  10.  
  11. private TextView tv;
  12. private long start;
  13. private long end;
  14. private boolean flag = false;
  15. private Button btnStart;
  16. @SuppressLint("HandlerLeak")
  17. private Handler handler = new Handler() {
  18. @Override
  19. public void handleMessage(android.os.Message msg) {
  20. super.handleMessage(msg);
  21. end = System.currentTimeMillis() - start;
  22. tv.setText(toTime(end));
  23. }
  24. };
  25.  
  26. public class MyThread implements Runnable {
  27. @Override
  28. public void run() {
  29. while (flag) {
  30. try {
  31. Thread.sleep(100);
  32. Message message = handler.obtainMessage();
  33. message.what = 1;
  34. handler.sendMessage(message);
  35. } catch (InterruptedException e) {
  36. e.printStackTrace();
  37. }
  38. }
  39. }
  40. }
  41.  
  42. public void pause() {
  43. flag = false;
  44. }
  45.  
  46. public void start() {
  47. start = System.currentTimeMillis();
  48. flag = true;
  49. new Thread(new MyThread()).start();
  50. }
  51.  
  52. private String toTime(long start) {
  53. long millisecond = start % 1000;
  54. millisecond /= 100;
  55. start /= 1000;
  56. long minute = start / 60;
  57. long second = start % 60;
  58. minute %= 60;
  59. return String.format("%02d:%02d:%01d", minute, second, millisecond);
  60. }
  61.  
  62. }
  1. package mehdi.sakout.fancybuttons;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import android.annotation.SuppressLint;
  6. import android.content.Context;
  7. import android.content.res.TypedArray;
  8. import android.graphics.Color;
  9. import android.graphics.Typeface;
  10. import android.graphics.drawable.Drawable;
  11. import android.graphics.drawable.GradientDrawable;
  12. import android.graphics.drawable.StateListDrawable;
  13. import android.util.AttributeSet;
  14. import android.util.Log;
  15. import android.view.Gravity;
  16. import android.view.View;
  17. import android.widget.Button;
  18. import android.widget.ImageView;
  19. import android.widget.LinearLayout;
  20. import android.widget.TextView;
  21.  
  22. import com.example.operation.*;
  23.  
  24. @SuppressWarnings("unused")
  25. public class FancyButton extends LinearLayout{
  26.  
  27. private Context mContext;
  28.  
  29. // # Background Attributes
  30. private int mDefaultBackgroundColor = Color.BLACK;
  31. private int mFocusBackgroundColor = 0;
  32.  
  33. // # Text Attributes
  34. private int mDefaultTextColor = Color.WHITE;
  35. private int mDefaultIconColor = Color.WHITE;
  36. private int mTextPosition = 1;
  37. private int mDefaultTextSize = 15;
  38. private int mDefaultTextGravity = 0x11; // Gravity.CENTER
  39. private String mText = null;
  40.  
  41. // # Icon Attributes
  42. private Drawable mIconResource = null;
  43. private int mFontIconSize = 15;
  44. private String mFontIcon = null;
  45. private int mIconPosition = 1;
  46.  
  47. private int mIconPaddingLeft = 10;
  48. private int mIconPaddingRight = 10;
  49. private int mIconPaddingTop = 0;
  50. private int mIconPaddingBottom = 0;
  51.  
  52. private int mBorderColor = Color.TRANSPARENT;
  53. private int mBorderWidth = 0;
  54.  
  55. private int mRadius = 0;
  56.  
  57. private Typeface mTextTypeFace = null;
  58. private Typeface mIconTypeFace = null;
  59.  
  60. /**
  61. * Tags to identify icon position
  62. */
  63. public static final int POSITION_LEFT = 1;
  64. public static final int POSITION_RIGHT = 2;
  65. public static final int POSITION_TOP = 3;
  66. public static final int POSITION_BOTTOM = 4;
  67.  
  68. private String mDefaultIconFont = "fontawesome.ttf";
  69. private String mDefaultTextFont = "robotoregular.ttf";
  70.  
  71. private ImageView mIconView;
  72. private TextView mFontIconView;
  73. private TextView mTextView;
  74.  
  75. private boolean mGhost = false ; // Default is a solid button !
  76.  
  77. /**
  78. * Default constructor
  79. * @param context : Context
  80. */
  81. public FancyButton(Context context){
  82. super(context);
  83. this.mContext = context;
  84.  
  85. mTextTypeFace = Typeface.createFromAsset(mContext.getAssets(), String.format("fonts/%s",mDefaultTextFont));
  86. mIconTypeFace = Typeface.createFromAsset(mContext.getAssets(), String.format("iconfonts/%s",mDefaultIconFont));
  87.  
  88. initializeFancyButton();
  89. }
  90.  
  91. /**
  92. * Default constructor called from Layouts
  93. * @param context : Context
  94. * @param attrs : Attributes Array
  95. */
  96. public FancyButton(Context context, AttributeSet attrs){
  97. super(context,attrs);
  98. this.mContext = context;
  99.  
  100. TypedArray attrsArray = context.obtainStyledAttributes(attrs,R.styleable.FancyButtonsAttrs, 0, 0);
  101. initAttributsArray(attrsArray);
  102. attrsArray.recycle();
  103.  
  104. initializeFancyButton();
  105.  
  106. }
  107. /**
  108. * Initialize Button dependencies
  109. * - Initialize Button Container : The LinearLayout
  110. * - Initialize Button TextView
  111. * - Initialize Button Icon
  112. * - Initialize Button Font Icon
  113. */
  114. private void initializeFancyButton(){
  115.  
  116. initializeButtonContainer();
  117.  
  118. mTextView = setupTextView();
  119. mIconView = setupIconView();
  120. mFontIconView = setupFontIconView();
  121.  
  122. int iconIndex,textIndex;
  123. View view1,view2;
  124.  
  125. if(mIconView == null && mFontIconView == null && mTextView == null){
  126. Button tempTextView = new Button(mContext);
  127. tempTextView.setText("Fancy Button");
  128. this.addView(tempTextView);
  129.  
  130. }else{
  131. this.removeAllViews();
  132. setupBackground();
  133.  
  134. ArrayList<View> views = new ArrayList<View>();
  135.  
  136. if(mIconPosition == POSITION_LEFT || mIconPosition == POSITION_TOP){
  137.  
  138. if(mIconView != null){
  139. views.add(mIconView);
  140. }
  141.  
  142. if(mFontIconView != null){
  143. views.add(mFontIconView);
  144. }
  145. if(mTextView != null){
  146. views.add(mTextView);
  147. }
  148.  
  149. }else{
  150. if(mTextView != null){
  151. views.add(mTextView);
  152. }
  153.  
  154. if(mIconView != null){
  155. views.add(mIconView);
  156. }
  157.  
  158. if(mFontIconView != null){
  159. views.add(mFontIconView);
  160. }
  161.  
  162. }
  163.  
  164. for(View view : views){
  165. this.addView(view);
  166. }
  167. }
  168. }
  169.  
  170. /**
  171. * Setup Text View
  172. * @return : TextView
  173. */
  174. private TextView setupTextView(){
  175. if (mText != null) {
  176. TextView textView = new TextView(mContext);
  177. textView.setText(mText);
  178. textView.setGravity(mDefaultTextGravity);
  179. textView.setTextColor(mDefaultTextColor);
  180. textView.setTextSize(mDefaultTextSize);
  181.  
  182. textView.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
  183. if (!isInEditMode() && mTextTypeFace!=null) {
  184. textView.setTypeface(mTextTypeFace);
  185. }
  186. return textView;
  187. }
  188. return null;
  189. }
  190.  
  191. /**
  192. * Setup Font Icon View
  193. * @return : TextView
  194. */
  195. private TextView setupFontIconView(){
  196.  
  197. if(mFontIcon!=null){
  198. TextView fontIconView = new TextView(mContext);
  199. fontIconView.setTextColor(mDefaultIconColor);
  200.  
  201. LayoutParams iconTextViewParams = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
  202. iconTextViewParams.rightMargin = mIconPaddingRight;
  203. iconTextViewParams.leftMargin = mIconPaddingLeft;
  204. iconTextViewParams.topMargin = mIconPaddingTop;
  205. iconTextViewParams.bottomMargin = mIconPaddingBottom;
  206.  
  207. if(mTextView != null){
  208.  
  209. if(mIconPosition==POSITION_TOP || mIconPosition==POSITION_BOTTOM){
  210. iconTextViewParams.gravity = Gravity.CENTER;
  211. fontIconView.setGravity(Gravity.CENTER);
  212. }
  213. else{
  214. fontIconView.setGravity(Gravity.CENTER_VERTICAL);
  215. iconTextViewParams.gravity = Gravity.CENTER_VERTICAL;
  216. }
  217. }else{
  218. iconTextViewParams.gravity = Gravity.CENTER;
  219. fontIconView.setGravity(Gravity.CENTER_VERTICAL);
  220. }
  221.  
  222. fontIconView.setLayoutParams(iconTextViewParams);
  223. if(!isInEditMode()){
  224. fontIconView.setTextSize(mFontIconSize);
  225. fontIconView.setText(mFontIcon);
  226. fontIconView.setTypeface(mIconTypeFace);
  227. }else{
  228. fontIconView.setText("O");
  229. }
  230. return fontIconView;
  231. }
  232. return null;
  233. }
  234.  
  235. /**
  236. * Text Icon resource view
  237. * @return : ImageView
  238. */
  239. private ImageView setupIconView(){
  240. if (mIconResource != null){
  241. ImageView iconView = new ImageView(mContext);
  242. iconView.setImageDrawable(mIconResource);
  243. iconView.setPadding(mIconPaddingLeft, mIconPaddingTop, mIconPaddingRight, mIconPaddingBottom);
  244.  
  245. LayoutParams iconViewParams = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
  246. if(mTextView!=null){
  247. if(mIconPosition==POSITION_TOP || mIconPosition==POSITION_BOTTOM)
  248. iconViewParams.gravity = Gravity.CENTER;
  249. else
  250. iconViewParams.gravity = Gravity.START;
  251.  
  252. iconViewParams.rightMargin = 10;
  253. iconViewParams.leftMargin = 10;
  254. }else{
  255. iconViewParams.gravity = Gravity.CENTER_VERTICAL;
  256. }
  257. iconView.setLayoutParams(iconViewParams);
  258.  
  259. return iconView;
  260. }
  261. return null;
  262. }
  263.  
  264. /**
  265. * Initialize Attributes arrays
  266. * @param attrsArray : Attributes array
  267. */
  268. private void initAttributsArray(TypedArray attrsArray){
  269.  
  270. mDefaultBackgroundColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_defaultColor,mDefaultBackgroundColor);
  271. mFocusBackgroundColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_focusColor,mFocusBackgroundColor);
  272.  
  273. mDefaultTextColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_textColor,mDefaultTextColor);
  274. // if default color is set then the icon's color is the same (the default for icon's color)
  275. mDefaultIconColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_iconColor,mDefaultTextColor);
  276. mDefaultTextSize = (int) attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_textSize,mDefaultTextSize);
  277. mDefaultTextGravity = attrsArray.getInt(R.styleable.FancyButtonsAttrs_fb_textGravity, mDefaultTextGravity);
  278.  
  279. mBorderColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_borderColor,mBorderColor);
  280. mBorderWidth = (int) attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_borderWidth,mBorderWidth);
  281.  
  282. mRadius = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_radius,mRadius);
  283. mFontIconSize = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_fontIconSize,mFontIconSize);
  284.  
  285. mIconPaddingLeft = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingLeft,mIconPaddingLeft);
  286. mIconPaddingRight = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingRight,mIconPaddingRight);
  287. mIconPaddingTop = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingTop,mIconPaddingTop);
  288. mIconPaddingBottom = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingBottom,mIconPaddingBottom);
  289.  
  290. mGhost = attrsArray.getBoolean(R.styleable.FancyButtonsAttrs_fb_ghost, mGhost);
  291.  
  292. String text = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_text);
  293. mIconPosition = attrsArray.getInt(R.styleable.FancyButtonsAttrs_fb_iconPosition,mIconPosition);
  294.  
  295. String fontIcon = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_fontIconResource);
  296.  
  297. String iconFontFamily = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_iconFont);
  298. String textFontFamily = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_textFont);
  299.  
  300. Drawable icon = null;
  301. try{
  302. mIconResource = attrsArray.getDrawable(R.styleable.FancyButtonsAttrs_fb_iconResource);
  303.  
  304. }catch(Exception e){
  305. mIconResource = null;
  306. }
  307.  
  308. if(fontIcon!=null)
  309. mFontIcon = fontIcon;
  310.  
  311. if(text!=null)
  312. mText = text;
  313.  
  314. if(!isInEditMode()){
  315. if(iconFontFamily!=null){
  316. try{
  317. mIconTypeFace = Typeface.createFromAsset(mContext.getAssets(), String.format("iconfonts/%s",iconFontFamily));
  318. }catch(Exception e){
  319. Log.e("Fancy",e.getMessage());
  320. mIconTypeFace= Typeface.createFromAsset(mContext.getAssets(), String.format("iconfonts/%s",mDefaultIconFont));
  321. }
  322.  
  323. }else{
  324. mIconTypeFace= Typeface.createFromAsset(mContext.getAssets(), String.format("iconfonts/%s",mDefaultIconFont));
  325. }
  326.  
  327. if(textFontFamily!=null){
  328. try{
  329. mTextTypeFace = Typeface.createFromAsset(mContext.getAssets(), String.format("fonts/%s",textFontFamily));
  330. }
  331. catch(Exception e){
  332. mTextTypeFace= Typeface.createFromAsset(mContext.getAssets(), String.format("fonts/%s",mDefaultTextFont));
  333. }
  334.  
  335. }else{
  336. mTextTypeFace= Typeface.createFromAsset(mContext.getAssets(), String.format("fonts/%s",mDefaultTextFont));
  337. }
  338.  
  339. }
  340.  
  341. }
  342. @SuppressLint("NewApi")
  343. private void setupBackground(){
  344.  
  345. // Default Drawable
  346. GradientDrawable drawable = new GradientDrawable();
  347. drawable.setCornerRadius(mRadius);
  348. if (mGhost){
  349. drawable.setColor(getResources().getColor(android.R.color.transparent)); // Hollow Background
  350. }
  351. else {
  352. drawable.setColor(mDefaultBackgroundColor);
  353. }
  354. if (mBorderColor != 0) {
  355. drawable.setStroke(mBorderWidth, mBorderColor);
  356. }
  357.  
  358. // Focus/Pressed Drawable
  359. GradientDrawable drawable2 = new GradientDrawable();
  360. drawable2.setCornerRadius(mRadius);
  361. if (mGhost){
  362. drawable2.setColor(getResources().getColor(android.R.color.transparent)); // No focus color
  363. }
  364. else {
  365. drawable2.setColor(mFocusBackgroundColor);
  366. }
  367. if (mBorderColor != 0) {
  368. if (mGhost) {
  369. drawable2.setStroke(mBorderWidth, mFocusBackgroundColor); // Border is the main part of button now
  370. }
  371. else {
  372. drawable2.setStroke(mBorderWidth, mBorderColor);
  373. }
  374. }
  375.  
  376. StateListDrawable states = new StateListDrawable();
  377.  
  378. if(mFocusBackgroundColor!=0){
  379. states.addState(new int[] { android.R.attr.state_pressed }, drawable2);
  380. states.addState(new int[] { android.R.attr.state_focused }, drawable2);
  381. }
  382. states.addState(new int[] {}, drawable);
  383.  
  384. if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
  385. this.setBackgroundDrawable(states);
  386. } else {
  387. this.setBackground(states);
  388. }
  389. }
  390.  
  391. /**
  392. * Initialize button container
  393. */
  394. private void initializeButtonContainer(){
  395.  
  396. if(mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM){
  397. this.setOrientation(LinearLayout.VERTICAL);
  398. }else{
  399. this.setOrientation(LinearLayout.HORIZONTAL);
  400. }
  401. LayoutParams containerParams = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
  402. this.setLayoutParams(containerParams);
  403. this.setGravity(Gravity.CENTER);
  404. this.setClickable(true);
  405. this.setFocusable(true);
  406. if(mIconResource==null && mFontIcon==null && getPaddingLeft()==0 && getPaddingRight()==0 && getPaddingTop()==0 && getPaddingBottom()==0){
  407. this.setPadding(20, 20, 20, 20);
  408. }
  409. }
  410.  
  411. /**
  412. * Set Text of the button
  413. * @param text : Text
  414. */
  415. public void setText(String text){
  416. this.mText = text;
  417. if(mTextView == null)
  418. initializeFancyButton();
  419. else
  420. mTextView.setText(text);
  421. }
  422.  
  423. /**
  424. * Set the color of text
  425. * @param color : Color
  426. * use Color.parse('#code')
  427. */
  428. public void setTextColor(int color){
  429. this.mDefaultTextColor = color;
  430. if(mTextView == null)
  431. initializeFancyButton();
  432. else
  433. mTextView.setTextColor(color);
  434.  
  435. }
  436.  
  437. /**
  438. * Setting the icon's color independent of the text color
  439. * @param color : Color
  440. */
  441. public void setIconColor(int color){
  442. if(mFontIconView != null) {
  443. mFontIconView.setTextColor(color);
  444. }
  445. }
  446.  
  447. /**
  448. * Set Background color of the button
  449. * @param color : use Color.parse('#code')
  450. */
  451. @Override
  452. public void setBackgroundColor(int color){
  453. this.mDefaultBackgroundColor = color;
  454. if(mIconView != null || mFontIconView != null || mTextView != null){
  455. this.setupBackground();
  456. }
  457. }
  458.  
  459. /**
  460. * Set Focus color of the button
  461. * @param color : use Color.parse('#code')
  462. */
  463. public void setFocusBackgroundColor(int color){
  464. this.mFocusBackgroundColor = color;
  465. if(mIconView != null || mFontIconView != null || mTextView != null)
  466. this.setupBackground();
  467.  
  468. }
  469.  
  470. /**
  471. * Set the size of Text
  472. * @param textSize : Text Size
  473. */
  474. public void setTextSize(int textSize){
  475. this.mDefaultTextSize = textSize;
  476. if(mTextView != null)
  477. mTextView.setTextSize(textSize);
  478. }
  479.  
  480. /**
  481. * Set the gravity of Text
  482. * @param gravity : Text Gravity
  483. */
  484.  
  485. public void setTextGravity(int gravity) {
  486. this.mDefaultTextGravity = gravity;
  487. if (mTextView != null) {
  488. mTextView.setGravity(gravity);
  489. }
  490. }
  491.  
  492. /**
  493. * Set Padding for mIconView and mFontIconSize
  494. * @param paddingLeft : Padding Left
  495. * @param paddingTop : Padding Top
  496. * @param paddingRight : Padding Right
  497. * @param paddingBottom : Padding Bottom
  498. */
  499. public void setIconPadding(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom){
  500. this.mIconPaddingLeft = paddingLeft;
  501. this.mIconPaddingTop = paddingTop;
  502. this.mIconPaddingRight = paddingRight;
  503. this.mIconPaddingBottom = paddingBottom;
  504. if(mIconView != null){
  505. mIconView.setPadding(this.mIconPaddingLeft, this.mIconPaddingTop, this.mIconPaddingRight, this.mIconPaddingBottom);
  506. }
  507. if(mFontIconView != null){
  508. mFontIconView.setPadding(this.mIconPaddingLeft, this.mIconPaddingTop, this.mIconPaddingRight, this.mIconPaddingBottom);
  509. }
  510. }
  511.  
  512. /**
  513. * Set an icon from resources to the button
  514. * @param drawable : Drawable resource
  515. */
  516. public void setIconResource(int drawable){
  517. this.mIconResource = mContext.getResources().getDrawable(drawable);
  518. if(mIconView == null || mFontIconView != null) {
  519. mFontIconView= null;
  520. initializeFancyButton();
  521. }
  522. else
  523. mIconView.setImageDrawable(mIconResource);
  524. }
  525.  
  526. /**
  527. * Set a font icon to the button (eg FFontAwesome or Entypo...)
  528. * @param icon : Icon value eg : \uf082
  529. */
  530. public void setIconResource(String icon){
  531. this.mFontIcon = icon;
  532. if(mFontIconView == null) {
  533. mIconView=null;
  534. initializeFancyButton();
  535. }
  536. else
  537. mFontIconView.setText(icon);
  538. }
  539.  
  540. /**
  541. * Set Icon size of the button (for only font icons)
  542. * @param iconSize : Icon Size
  543. */
  544. public void setFontIconSize(int iconSize){
  545. this.mFontIconSize = iconSize;
  546. if(mFontIconView!=null)
  547. mFontIconView.setTextSize(iconSize);
  548. }
  549.  
  550. /**
  551. * Set Icon Position
  552. * Use the global variables (FancyButton.POSITION_LEFT, FancyButton.POSITION_RIGHT, FancyButton.POSITION_TOP, FancyButton.POSITION_BOTTOM)
  553. * @param position : Position
  554. */
  555. public void setIconPosition(int position){
  556. if(position>0 && position<5)
  557. mIconPosition = position;
  558. else
  559. mIconPosition = POSITION_LEFT;
  560.  
  561. initializeFancyButton();
  562. }
  563.  
  564. /**
  565. * Set color of the button border
  566. * @param color : Color
  567. * use Color.parse('#code')
  568. */
  569. public void setBorderColor(int color){
  570. this.mBorderColor = color;
  571. if(mIconView!=null || mFontIconView!=null || mTextView!=null){
  572. this.setupBackground();
  573. }
  574. }
  575.  
  576. /**
  577. * Set Width of the button
  578. * @param width : Width
  579. */
  580. public void setBorderWidth(int width){
  581. this.mBorderWidth = width;
  582. if(mIconView != null || mFontIconView != null || mTextView != null){
  583. this.setupBackground();
  584. }
  585. }
  586.  
  587. /**
  588. * Set Border Radius of the button
  589. * @param radius : Radius
  590. */
  591. public void setRadius(int radius){
  592. this.mRadius = radius;
  593. if(mIconView != null || mFontIconView != null || mTextView != null){
  594. this.setupBackground();
  595. }
  596. }
  597.  
  598. /**
  599. * Set custom font for button Text
  600. * @param fontName : Font Name
  601. * Place your text fonts in assets/fonts/
  602. */
  603. public void setCustomTextFont(String fontName){
  604. try{
  605. mTextTypeFace = Typeface.createFromAsset(mContext.getAssets(), String.format("fonts/%s",fontName));
  606. }catch(Exception e){
  607. Log.e("FancyButtons",e.getMessage());
  608. mTextTypeFace= Typeface.createFromAsset(mContext.getAssets(), String.format("fonts/%s",mDefaultTextFont));
  609. }
  610.  
  611. if(mTextView==null)
  612. initializeFancyButton();
  613. else
  614. mTextView.setTypeface(mTextTypeFace);
  615.  
  616. }
  617.  
  618. /**
  619. * Set Custom font for button icon
  620. * @param fontName : Font Name
  621. * Place your icon fonts in assets/iconfonts/
  622. */
  623. public void setCustomIconFont(String fontName){
  624. try{
  625. mIconTypeFace = Typeface.createFromAsset(mContext.getAssets(), String.format("iconfonts/%s",fontName));
  626. }catch(Exception e){
  627. Log.e("FancyButtons",e.getMessage());
  628. mIconTypeFace= Typeface.createFromAsset(mContext.getAssets(), String.format("iconfonts/%s",mDefaultIconFont));
  629. }
  630.  
  631. if(mFontIconView == null)
  632. initializeFancyButton();
  633. else
  634. mFontIconView.setTypeface(mIconTypeFace);
  635.  
  636. }
  637.  
  638. /**
  639. * Setting the button to have hollow or solid shape
  640. * @param ghost
  641. */
  642. public void setGhost(boolean ghost) {
  643. this.mGhost = ghost;
  644.  
  645. if(mIconView != null || mFontIconView != null || mTextView != null){
  646. this.setupBackground();
  647. }
  648.  
  649. }
  650.  
  651. /**
  652. * Return Text of the button
  653. * @return Text
  654. */
  655. public CharSequence getText(){
  656. if (mTextView != null)
  657. return mTextView.getText();
  658. else
  659. return "";
  660. }
  661.  
  662. /**
  663. * Return TextView Object of the FancyButton
  664. * @return TextView Object
  665. */
  666. public TextView getTextViewObject(){
  667. return mTextView;
  668. }
  669.  
  670. /**
  671. * Return Icon Font of the FancyButton
  672. * @return TextView Object
  673. */
  674. public TextView getIconFontObject(){
  675. return mFontIconView;
  676. }
  677.  
  678. /**
  679. * Return Icon of the FancyButton
  680. * @return ImageView Object
  681. */
  682. public ImageView getIconImageObject(){
  683. return mIconView;
  684. }
  685.  
  686. }

 

                                                                                     

app推广及主要代码的更多相关文章

  1. 详细的App推广前的准备工作

    App开发完成后,推广App自然就成为下一步工作的重点.兵马未动,粮草先行,这里为大家整理了一份App推广前需要准备一些事项,希望能给正在准备开展App推广的小伙伴们一些帮助. 众所周知,App推广的 ...

  2. APP推广入门之AppStore数据分析

    AppStore中有很多数据,但对于一个App推广者而言,最需要关注的无非这么几个,即下载量.评论.权重.榜单排名.搜索排名以及热词搜索等.至于这些数据具体代表着什么,下面就先由下载量开始,来简单介绍 ...

  3. 史上最全APP推广渠道

    群主做App推广的过程中,有过失败也尝过成功的甜头,渐渐地在APP推广尤其是渠道推广中积累了一些实战经验想同大家分享.如果各位有更好的推广建议,欢迎沟通分享哦!   一.应用商店推广   1.应用市场 ...

  4. 【转】APP推广什么是cpa,cps,cpm

    转载自:http://www.apptg.cn 经常做做APP推广和做运营的同学对于cpa,cps,cpm,cpc这些名词肯定不会陌生,也基本都知道其表示的含义,但是对于新手来说,这几个词的含义还是不 ...

  5. 谋哥:App推广最有效的是自推广

    [谋哥每天一原创,第一百五十二篇] 目前市场上,各类App已经覆盖到所有你能想到的领域,并且各个山头也被占得差不多了,网上 的说法就是布局已经完成.如果你想现在再插那么一杠子进去,就得看你的真本事了, ...

  6. 谋哥:转型之痒与App推广之痛

    昨天<重庆今日教育>的副主编汪熙坤老师先加我微信,谋哥的微信每天有几十个不同领域的朋友加.几句客套后,他马上就直奔主题了.为什么这么着急呢?是因为危机感,是因为感受到了互联网给传统纸媒带来 ...

  7. openinstall的免费服务对App推广有哪些帮助?

    想在微信中下载 App,需要“点击右上角打开浏览器”,太麻烦: 想深入查看微信分享内容,需要手动打开 App 搜索,不方便: 想给 App 做推广,Android 需要多个渠道人工打包,效率低: .. ...

  8. APP携参安装技术怎样帮助APP推广

    APP 如何自动实现携带参数安装?这是许多开发者感兴趣的问题,毕竟在 APP 开发的许多逻辑上常常不可避免的需要判断安装来源,比如:广告投放.用户邀请.用户行为.社交分享等 APP 推广环节,国内的 ...

  9. 移动互联网App推广的十大难题

    常常有朋友来问."我做了一个App,请问怎么推广啊?"或者就是"我们公司开发了一个App.想短时间内获取巨大的量."还有的就是问"有没有什么好渠道三个 ...

随机推荐

  1. 学生&部门智能匹配程序

    Github链接 结对成员: 031502308 付逸豪 031502113 胡俊钦 数据生成 样例链接: 来点我啊 由于在生成数据的时候做了很多符合实际情况的限制,所以生成的数据都挺好的,就随便选了 ...

  2. node_01_自定义模块(先创建package.json)

    package.json必须是json格式 你必须确保所有的字符串,包括属性名,都是使用双引号而不是单引号 { "name": "163", "ver ...

  3. centos7下安装docker(12.3容器之间的连通性)

    我们接着盗图,如下: 在这张图上,可以看到,如果两个容器使用同一个bridge,那么两个容器之间是互相能通的 可以看到两个容器在同一个bridge下是可以互相ping通的 当两个容器在不同的bridg ...

  4. 手把手实战:eclipse 搭建 SpringMvc 框架环境

    环境准备 eclipse jdk1.8 tomcat 7 步骤总纲       a.准备好开发环境     b.下载相关jar包     c.在eclipse 中创建好工程     d.引进下载的ja ...

  5. JDK文档中关于Semaphore的正确使用以及使用场景

    import java.util.concurrent.Semaphore; /** * * JDK文档使用备注:<br> * Semaphores are often used to r ...

  6. BugFree设置邮箱通知(这里以163邮箱为例)

    公司用bugfree在进行新建Bug指派抄送给同事的时候,总是有人不及时登录BugFree去查看指派给自己的,所以要加一个邮箱通知,这样可以及时通知到被指派的同事. 百度上很多用的是QQ邮箱来实现的, ...

  7. windows下安装ElasticSearch的Head插件

    es5以上版本安装head需要安装node和grunt(之前的直接用plugin命令即可安装) (一)从地址:https://nodejs.org/en/download/ 下载相应系统的msi,双击 ...

  8. http请求的全过程

    参考资料 http://blog.jobbole.com/106632/ https://www.cnblogs.com/engeng/articles/5959335.html https://ww ...

  9. java-深克隆和浅克隆

    文章参考 https://www.cnblogs.com/acode/p/6306887.html 一.前提 1.使用clone()方法的类,必须实现Cloneable接口, 否则调用clone()方 ...

  10. Linux系统学习之字符处理

    管道 管道是一种使用非常频繁的通信机制,我们可以使用管道符"|"来连接进程,由管道连接起来订单进程可以自动运行,如同有一个数据流一样,所以管道表现为输入输出重定向的一种方法,它可以 ...