forked from bradywwang/JLUlife
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bradywang
committed
Nov 27, 2015
1 parent
9bb4b8e
commit 7b33a06
Showing
32 changed files
with
254 additions
and
30 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
app/src/main/java/com/brady/jlulife/Fragments/LibrarySearchFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.brady.jlulife.Fragments; | ||
|
||
|
||
import android.os.Bundle; | ||
import android.app.Fragment; | ||
import android.view.KeyEvent; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.webkit.WebView; | ||
import android.webkit.WebViewClient; | ||
import android.widget.Toast; | ||
|
||
import com.brady.jlulife.R; | ||
import com.brady.jlulife.Utils.ConstValue; | ||
|
||
/** | ||
* A simple {@link Fragment} subclass. | ||
*/ | ||
public class LibrarySearchFragment extends BaseFragment { | ||
private static LibrarySearchFragment instance; | ||
WebView webView; | ||
|
||
public static LibrarySearchFragment getInstance() { | ||
if (instance == null) | ||
instance = new LibrarySearchFragment(); | ||
return instance; | ||
} | ||
|
||
|
||
public LibrarySearchFragment() { | ||
// Required empty public constructor | ||
} | ||
|
||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_library_search, container, false); | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
webView = (WebView) view.findViewById(R.id.lib_view); | ||
webView.getSettings().setJavaScriptEnabled(true); | ||
webView.getSettings().setBuiltInZoomControls(true); | ||
webView.loadUrl(ConstValue.LIBRARY_SEARCH_URI); | ||
webView.setWebViewClient(new WebViewClient() { | ||
@Override | ||
public boolean shouldOverrideUrlLoading(WebView view, String url) { | ||
// TODO Auto-generated method stub | ||
view.loadUrl(url);// 使用当前WebView处理跳转 | ||
return true;//true表示此事件在此处被处理,不需要再广播 | ||
} | ||
|
||
@Override //转向错误时的处理 | ||
public void onReceivedError(WebView view, int errorCode, | ||
String description, String failingUrl) { | ||
} | ||
}); | ||
} | ||
|
||
public void preformBack() { | ||
webView.goBack(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.