-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
653 lines (589 loc) · 27.4 KB
/
MainActivity.java
File metadata and controls
653 lines (589 loc) · 27.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
package com.ShakespeareReaderNew.app;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import java.util.concurrent.ExecutionException;
///////////////////////////////////////////////////
///////////////////////////////////////////////////
// NOTE: this code merely demonstrates the basic //
// way we constructed the PhiloReader apps using //
// a drawer for search fields and fragments for //
// successive display pages. It should not be //
// considered functional. If you want to see or //
// learn more, please contact the ARTFL Project. //
///////////////////////////////////////////////////
///////////////////////////////////////////////////
public class MainActivity extends FragmentActivity implements
ListResultFragment.PassQueryUri,
ListResultFragment.BuildFullTextFragmentNew,
ListResultFragment.BuildTOCFrag,
ListResultFragment.QuickLinkBibFragment,
FullResultFragment.BuildFullTextFragmentNew,
FullResultFragment.BuildTOCFrag,
FullResultFragment.PassBookmarkGoodies,
TOCResultFragment.BuildFullTextFragmentNew,
FreqResultFragment.BuildListFragment,
QuickLinksFragment.QuickLinkSearch,
InfoFragment.QuickLinkSearch {
///////////////////////////////////////////////////////////
// UI code and boilerplate code for basic funcationality //
///////////////////////////////////////////////////////////
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Drawer settings //
setContentView(R.layout.drawer_main);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_mainView);
spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getApplicationContext(), R.array.report_options,
R.layout.spinner_item);
spinner.setAdapter(adapter);
// ActionBar code //
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
// Check internet connection //
cd = new com.ShakespeareReaderNew.app.ConnectionDetector(getApplicationContext());
if (!cd.isConnectingToInternet()) {
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
dialog.setContentView(R.layout.no_connection_dialog);
dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_action_warning );
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|WindowManager.LayoutParams.DIM_AMOUNT_CHANGED, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
dialog.getWindow().getAttributes().dimAmount = 0;
final Button b = (Button) dialog.findViewById(R.id.no_connection_button);
b.setOnLongClickListener(new Button.OnLongClickListener() {
public boolean onLongClick(final View v) {
b.setBackgroundColor(0xffde5800);
dialog.dismiss();
System.exit(0);
return true;
}
});
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
else {
// Check remote server status //
url_con = new com.ShakespeareReaderNew.app.UrlConnect();
url_con.execute();
try {
if (!url_con.get()) {
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
dialog.setContentView(R.layout.server_down_dialog);
dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_action_warning );
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|WindowManager.LayoutParams.DIM_AMOUNT_CHANGED, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
dialog.getWindow().getAttributes().dimAmount = 0;
final Button b = (Button) dialog.findViewById(R.id.server_down_button);
b.setOnLongClickListener(new Button.OnLongClickListener() {
public boolean onLongClick(final View v) {
b.setBackgroundColor(0xffde5800);
dialog.dismiss();
System.exit(0);
return true;
}
});
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
addBookmark = new com.ShakespeareReaderNew.app.AddBookmark(getApplicationContext());
addBookmark.createDataBase();
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,R.string.open_drawer, R.string.close_drawer) {
public void onDrawerClosed(View view) {
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
invalidateOptionsMenu();
conc_from_freq = null;
spinner = (Spinner) findViewById(R.id.spinner);
spinner.setOnItemSelectedListener(new OnItemSelectedListener(){
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id){
String query_type_to_send = parent.getItemAtPosition(pos).toString();
spinner_value = newQuerySelector(query_type_to_send);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
} // end onDrawerOpened
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
// Deal with search form submit and reset //
Button search = (Button) findViewById(R.id.search_button);
search_et = (EditText)findViewById(R.id.search_edittext);
speaker_et = (EditText) findViewById(R.id.speaker_edittext);
//author_et = (EditText) findViewById(R.id.author_edittext);
title_et = (EditText) findViewById(R.id.title_edittext);
search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = MainActivity.this;
final String my_start_hit = "1";
final String my_end_hit = "25";
makeMyQueryUri(my_start_hit, my_end_hit, spinner_value);
mDrawerLayout.closeDrawer(Gravity.LEFT);
InputMethodManager imm = (InputMethodManager)getSystemService(context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(search_et.getWindowToken(), 0);
}
});
Button reset = (Button) findViewById(R.id.search_reset);
reset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
search_et.setText("");
speaker_et.setText("");
title_et.setText("");
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setSelection(0);
}
});
if (findViewById(R.id.text) != null) {
if (savedInstanceState != null) {
return;
}
QuickLinksFragment quickLinksFragment = new QuickLinksFragment();
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.addToBackStack(null);
fragTransaction.add(R.id.text, quickLinksFragment).commit();
}
}
public String newQuerySelector(String query_selection){
if (query_selection.contains("Concordance Report")){
query_search_type = "concordance";
}
//else if (query_selection.contains("Frequency by Author")){
// query_search_type = "author";
//}
else if (query_selection.contains("Frequency by Title")){
query_search_type = "title";
}
else if (query_selection.contains("Frequency by Date")){
query_search_type = "date";
}
else if (query_selection.contains("Frequency by Speaker")) {
query_search_type = "who";
}
return query_search_type;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft;
ft = fm.beginTransaction();
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
if (fm.getBackStackEntryCount() == 1){
mDrawerLayout.openDrawer(Gravity.LEFT);
return false;
}
ft.commit();
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
// show bookmarks here //
bookmarkMenu = menu.findItem(R.id.show_bookmarks).getSubMenu();
Cursor cursor = addBookmark.showBookmarkItems();
if (cursor == null){
}
else {
cursor.moveToFirst();
if (cursor.moveToFirst()){
do {
bookmarkMenu.add(cursor.getString(1));
} while (cursor.moveToNext());
}
cursor.close();
}
addBookmark.close();
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu){
return super.onPrepareOptionsMenu(menu);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
switch (item.getItemId()){
case R.id.app_info:
lookingAtInfo = true;
return true;
case R.id.info1:
displayInfoDialog("about_app");
return true;
case R.id.info2:
displayInfoDialog("about_artfl");
return true;
case R.id.info3:
displayInfoDialog("quick_links");
return true;
case R.id.show_bookmarks:
lookingAtInfo = false;
return true;
case R.id.bookmark_this:
invalidateOptionsMenu();
if (canAddBookmark){
if (thisIsABookmark){
Toast.makeText(this, "You are viewing a bookmarked page.", Toast.LENGTH_SHORT).show();
}
else {
invalidateOptionsMenu();
bookMark();
}
}
else {
if (thisIsABookmark) {
Toast.makeText(this, "You are viewing a bookmarked page.", Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(this, "This element cannot be bookmarked.", Toast.LENGTH_SHORT).show();
}
}
return true;
default:
if (!lookingAtInfo){
selected_bookmark = item.toString();
final String[] items = {getResources().getString(R.string.view_bookmark), getResources().getString(R.string.delete_bookmark)};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(item.getTitle());
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
if (items[item].equals(getResources().getString(R.string.view_bookmark)) ) {
String bookmark_uri = addBookmark.getBookmarkedText(selected_bookmark);
Bundle bundle = new Bundle();
bundle.putString("query_uri", bookmark_uri);
Fragment fr;
fr = new com.ShakespeareReaderNew.app.FullResultFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.addToBackStack(null);
fragTransaction.commit();
thisIsABookmark = true;
}
else if (items[item].equals(getResources().getString(R.string.delete_bookmark)) ) {
addBookmark.deleteBookmark(selected_bookmark);
invalidateOptionsMenu();
Toast.makeText(getApplicationContext(), "Deleting " + selected_bookmark, Toast.LENGTH_SHORT).show();
}
}
});
AlertDialog alert = builder.create();
alert.show();
addBookmark.close();
}
return true;
} // end switch logic
}
public void passBookmarkGoodies(String full_shrtcit, boolean addBookmarkBoolean, String bookmarkPhiloId2Send) {
bookmarkShrtCit = full_shrtcit;
canAddBookmark = addBookmarkBoolean;
bookmarkPhiloId = bookmarkPhiloId2Send;
}
public void bookMark() {
addBookmark.open();
addBookmark.addBookmarkItem(bookmarkPhiloId, bookmarkShrtCit);
addBookmark.close();
bookmarkShrtCit = "";
canAddBookmark = false;
bookmarkPhiloId = "";
}
/////////////////////////////////////////////////////////////////////
/// Here on down are query building and navigation/fragment code. ///
/// All pretty much similar, just creating URLs to send and get ///
/// results in new fragments... ///
/////////////////////////////////////////////////////////////////////
public void makeMyQueryUri(String my_start_hit, String my_end_hit, String spinner_value) {
//////////////////////////////////////////
// ** Build all query uris by hand! ** //
// ** Uri.Builder does NOT work well ** //
//////////////////////////////////////////
String my_report_value = "";
String my_query_uri = "";
String frequency_field = "";
if (search_et.getText().toString().isEmpty()) {
my_report_value = "bibliography";
String query_speaker = speaker_et.getText().toString();
query_speaker = query_speaker.trim();
query_speaker = query_speaker.replaceAll(" ", "+");
String query_title = title_et.getText().toString();
query_title = query_title.trim();
query_title = query_title.replaceAll(" ", "+");
query_title = query_title.replace("|", "%7C");
my_query_uri = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name + "/query?" +
"report=bibliography&q=&method=proxy&title=" +
query_title +
"&who=" + query_speaker +
"&start=" + my_start_hit + "&end=" + my_end_hit + "&pagenum=25&format=json";
} else {
if (conc_from_freq != null){
my_report_value = "concordance";
freq_search_term = freq_search_term.trim();
freq_search_term = freq_search_term.replaceAll(" ", "+");
freq_search_term = freq_search_term.replace("|", "%7C");
//conc_author_from_freq = conc_author_from_freq.trim();
//conc_author_from_freq = conc_author_from_freq.replaceAll(" ", "+");
conc_title_from_freq = conc_title_from_freq.trim();
conc_title_from_freq = conc_title_from_freq.replaceAll(" ", "+");
conc_title_from_freq = conc_title_from_freq.replace("|", "%7C");
my_query_uri = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name + "/navigate?" +
"report=concordance&" + freq_search_term + "&method=proxy&" +
conc_title_from_freq + "&" + conc_date_from_freq +
"&start=" + my_start_hit + "&end=" + my_end_hit + "&pagenum=25&format=json";
}
else if (spinner_value.contains("concordance")) {
my_report_value = "concordance";
String query_term = search_et.getText().toString();
query_term = query_term.trim();
query_term = query_term.replaceAll(" ", "+");
query_term = query_term.replace("|", "%7C");
String query_title = title_et.getText().toString();
query_title = query_title.trim();
query_title = query_title.replaceAll(" ", "+");
query_title = query_title.replace("|", "%7C");
String query_speaker = speaker_et.getText().toString();
query_speaker = query_speaker.trim();
query_speaker = query_speaker.replaceAll(" ", "+");
my_query_uri = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name + "/navigate?" +
"report=concordance&q=" + query_term + "&method=proxy&title=" +
query_title +
"&who=" + query_speaker +
"&start=" + my_start_hit + "&end=" + my_end_hit + "&pagenum=25&format=json";
} else {
frequency_field = spinner_value;
my_report_value = "frequency";
String query_term = search_et.getText().toString();
query_term = query_term.trim();
query_term = query_term.replaceAll(" ", "+");
String query_title = title_et.getText().toString();
query_title = query_title.trim();
query_title = query_title.replaceAll(" ", "+");
query_title = query_title.replace("|", "%7C");
String query_speaker = speaker_et.getText().toString();
query_speaker = query_speaker.trim();
query_speaker = query_speaker.replaceAll(" ", "+");
my_query_uri = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name + "/scripts/get_frequency.py?" +
"report=concordance&q=" + query_term + "&method=proxy&title=" +
query_title +
"&who=" + query_speaker +
"&frequency_field=" + frequency_field + "&format=json";
}
}
Bundle bundle = new Bundle();
bundle.putString("query_uri", my_query_uri);
Fragment fr;
if (my_report_value.contains("frequency")){
fr = new com.ShakespeareReaderNew.app.FreqResultFragment();
}
else {
fr = new com.ShakespeareReaderNew.app.ListResultFragment();
}
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.addToBackStack(null);
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.commit();
}
public void displayInfoDialog(String info_string){
String file_name = info_string + ".html";
Bundle bundle = new Bundle();
bundle.putString("file_name", file_name);
Fragment fr;
fr = new com.ShakespeareReaderNew.app.InfoFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
Log.i(TAG, " Info click backstack count: " + fm.getBackStackEntryCount());
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.addToBackStack(null);
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.commit();
lookingAtInfo = false;
}
public void quickLinkSearch(String quick_link_url){
String my_query_url = quick_link_url.replace("file://", "");
my_query_url = "http://" + uri_authority + "/" + philo_dir + "/"+ build_name + my_query_url;
Bundle bundle = new Bundle();
bundle.putString("query_uri", my_query_url);
Fragment fr;
fr = new ListResultFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.addToBackStack(null);
fragTransaction.replace(R.id.text, fr,"text");
fragTransaction.commit();
}
public void quickLinkBibFragment(String ql_bib_url){
String my_query_url = "";
if (ql_bib_url.contains("author")){
ql_bib_url = ql_bib_url.replace("./?q=", "");
my_query_url = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name +
"/navigate?report=bibliography&" + ql_bib_url + "&format=json";
Bundle bundle = new Bundle();
bundle.putString("query_uri", my_query_url);
Fragment fr;
fr = new com.ShakespeareReaderNew.app.ListResultFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.addToBackStack(null);
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.commit();
}
else {
my_query_url = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name +
"/scripts/get_table_of_contents.py?" +
"philo_id=" + ql_bib_url + "&format=json";
Bundle bundle = new Bundle();
bundle.putString("query_uri", my_query_url);
Fragment fr;
fr = new TOCResultFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.addToBackStack(null);
fragTransaction.commit();
}
}
public void buildListFragment(String query_uri_from_freq){
conc_from_freq = true;
conc_title_from_freq = "";
conc_author_from_freq = "";
conc_date_from_freq = "";
freq_search_term = "";
String query_uri_to_munge = query_uri_from_freq;
String[] freq_query_params = query_uri_to_munge.split("&");
for (int i = 0; i < freq_query_params.length; i++){
Log.i(TAG, "Your freq_query_params: " + freq_query_params[i]);
if (freq_query_params[i].contains("q=")){
freq_search_term = freq_query_params[i];
}
else if (freq_query_params[i].contains("title=")){
conc_title_from_freq = freq_query_params[i];
}
else if (freq_query_params[i].contains("author=")){
conc_author_from_freq = freq_query_params[i];
}
else if (freq_query_params[i].contains("date=")){
conc_date_from_freq = freq_query_params[i];
}
}
Bundle bundle = new Bundle();
bundle.putString("query_uri", query_uri_from_freq);
Fragment fr;
fr = new com.ShakespeareReaderNew.app.ListResultFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.addToBackStack(null);
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.commit();
}
public void buildTOCFragment(String[] pid_toc_query_array){
String pid_toc_address = "";
String toc_query_uri = "";
pid_toc_address = pid_toc_query_array[0].replaceFirst("\\[", "");
toc_query_uri = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name +
"/scripts/get_table_of_contents.py?" +
"philo_id=" + pid_toc_address + "&format=json";
Bundle bundle = new Bundle();
bundle.putString("query_uri", toc_query_uri);
Fragment fr;
fr = new com.ShakespeareReaderNew.app.TOCResultFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.addToBackStack(null);
fragTransaction.commit();
}
public void buildFullTextFragmentNew(String url){
String new_query_uri = "";
url = url.replace("file:///", "");
new_query_uri = "http://" + uri_authority + "/" +
philo_dir + "/" +
build_name + "/" +
url;
Bundle bundle = new Bundle();
bundle.putString("query_uri", new_query_uri);
Fragment fr;
fr = new FullResultFragment();
fr.setArguments(bundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragTransaction = fm.beginTransaction();
fragTransaction.replace(R.id.text, fr, "text");
fragTransaction.addToBackStack(null);
fragTransaction.commit();
}
} // the end, beautiful friend