|
10 | 10 | import android.view.View.OnClickListener; |
11 | 11 | import android.view.ViewGroup; |
12 | 12 |
|
13 | | -import com.crashlytics.android.Crashlytics; |
14 | 13 | import com.tenmiles.helpstack.HSHelpStack; |
15 | 14 |
|
16 | 15 | public class MainActivity extends AppCompatActivity { |
17 | 16 |
|
18 | | - @Override |
19 | | - protected void onCreate(Bundle savedInstanceState) { |
20 | | - super.onCreate(savedInstanceState); |
21 | | - Crashlytics.start(this); |
22 | | - setContentView(R.layout.activity_main); |
| 17 | + @Override |
| 18 | + protected void onCreate(Bundle savedInstanceState) { |
| 19 | + super.onCreate(savedInstanceState); |
| 20 | + setContentView(R.layout.activity_main); |
23 | 21 |
|
24 | | - if (savedInstanceState == null) { |
25 | | - getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit(); |
26 | | - } |
27 | | - |
28 | | - getSupportActionBar().setDisplayHomeAsUpEnabled(false); |
29 | | - getSupportActionBar().setDisplayUseLogoEnabled(false); |
30 | | - getSupportActionBar().setIcon(R.color.hs_transparent_color); |
31 | | - } |
| 22 | + if (savedInstanceState == null) { |
| 23 | + getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit(); |
| 24 | + } |
32 | 25 |
|
33 | | - @Override |
34 | | - public boolean onCreateOptionsMenu(Menu menu) { |
35 | | - getMenuInflater().inflate(R.menu.main, menu); |
36 | | - return true; |
37 | | - } |
| 26 | + getSupportActionBar().setDisplayHomeAsUpEnabled(false); |
| 27 | + getSupportActionBar().setDisplayUseLogoEnabled(false); |
| 28 | + getSupportActionBar().setIcon(R.color.hs_transparent_color); |
| 29 | + } |
38 | 30 |
|
39 | | - @Override |
40 | | - public boolean onOptionsItemSelected(MenuItem item) { |
41 | | - int id = item.getItemId(); |
42 | | - if (id == R.id.action_settings) { |
43 | | - return true; |
44 | | - } |
45 | | - return super.onOptionsItemSelected(item); |
46 | | - } |
| 31 | + @Override |
| 32 | + public boolean onCreateOptionsMenu(Menu menu) { |
| 33 | + getMenuInflater().inflate(R.menu.main, menu); |
| 34 | + return true; |
| 35 | + } |
47 | 36 |
|
48 | | - /** |
49 | | - * A placeholder fragment containing a simple view. |
50 | | - */ |
51 | | - public static class PlaceholderFragment extends Fragment { |
| 37 | + @Override |
| 38 | + public boolean onOptionsItemSelected(MenuItem item) { |
| 39 | + int id = item.getItemId(); |
| 40 | + if (id == R.id.action_settings) { |
| 41 | + return true; |
| 42 | + } |
| 43 | + return super.onOptionsItemSelected(item); |
| 44 | + } |
52 | 45 |
|
53 | | - public PlaceholderFragment() { |
54 | | - } |
| 46 | + /** |
| 47 | + * A placeholder fragment containing a simple view. |
| 48 | + */ |
| 49 | + public static class PlaceholderFragment extends Fragment { |
55 | 50 |
|
56 | | - @Override |
57 | | - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
58 | | - View rootView = inflater.inflate(R.layout.fragment_main, container, false); |
59 | | - rootView.findViewById(R.id.button1).setOnClickListener(new OnClickListener() { |
60 | | - |
61 | | - @Override |
62 | | - public void onClick(View v) { |
63 | | - HSHelpStack.getInstance(getActivity()).showHelp(getActivity()); |
64 | | - } |
65 | | - }); |
66 | | - return rootView; |
67 | | - } |
68 | | - } |
| 51 | + public PlaceholderFragment() { |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
| 56 | + View rootView = inflater.inflate(R.layout.fragment_main, container, false); |
| 57 | + rootView.findViewById(R.id.button1).setOnClickListener(new OnClickListener() { |
| 58 | + |
| 59 | + @Override |
| 60 | + public void onClick(View v) { |
| 61 | + HSHelpStack.getInstance(getActivity()).showHelp(getActivity()); |
| 62 | + } |
| 63 | + }); |
| 64 | + rootView.findViewById(R.id.btnClearCache).setOnClickListener(new OnClickListener() { |
| 65 | + |
| 66 | + @Override |
| 67 | + public void onClick(View v) { |
| 68 | + HSHelpStack.getInstance(getActivity()).clear(getActivity()); |
| 69 | + } |
| 70 | + }); |
| 71 | + return rootView; |
| 72 | + } |
| 73 | + } |
69 | 74 |
|
70 | 75 | } |
0 commit comments