|
|
@@ -15,6 +15,7 @@ import android.app.AlertDialog.Builder;
|
|
|
import android.app.DownloadManager.Request;
|
|
|
import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
|
+import android.content.Intent;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.net.Uri;
|
|
|
import android.os.AsyncTask;
|
|
|
@@ -44,18 +45,23 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
* OnGestureListener
|
|
|
*/
|
|
|
{
|
|
|
-// DataFragment mdataFragment;
|
|
|
+
|
|
|
+ private static final int REQUEST_LOGINACTIVITY = 1;
|
|
|
+
|
|
|
+ // DataFragment mdataFragment;
|
|
|
|
|
|
/* private GestureDetector mGestureDetector; */
|
|
|
@Override
|
|
|
- public void onCreate(Bundle savedInstanceState) {
|
|
|
+ public void onCreate(Bundle savedInstanceState)
|
|
|
+ {
|
|
|
// TODO Auto-generated method stub
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void onDestroyView() {
|
|
|
+ public void onDestroyView()
|
|
|
+ {
|
|
|
Log.d("DetailFragment", "onDestroyView()");
|
|
|
super.onDestroyView();
|
|
|
}
|
|
|
@@ -65,35 +71,37 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
// return fragment_content;
|
|
|
// }
|
|
|
|
|
|
- LinearLayout ll_root;
|
|
|
- ScrollView sl_root;
|
|
|
- String mimeType = "text/html";
|
|
|
- private SearchTask m_task = null;
|
|
|
- SparseIntArray control = new SparseIntArray();
|
|
|
+ LinearLayout ll_root;
|
|
|
+ ScrollView sl_root;
|
|
|
+ String mimeType = "text/html";
|
|
|
+ private SearchTask m_task = null;
|
|
|
+ SparseIntArray control = new SparseIntArray();
|
|
|
// private TextView mStatusMessageView;
|
|
|
- private View mStatusView;
|
|
|
+ private View mStatusView;
|
|
|
|
|
|
- String fragment_content = null;
|
|
|
+ String fragment_content = null;
|
|
|
|
|
|
- public void requestdata() {
|
|
|
+ public void requestdata()
|
|
|
+ {
|
|
|
|
|
|
- if (m_task != null) {
|
|
|
+ if (m_task != null)
|
|
|
+ {
|
|
|
return;
|
|
|
}
|
|
|
- if(fragment_content!=null)
|
|
|
+ if (fragment_content != null)
|
|
|
{
|
|
|
LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
|
|
|
- .get_instance().getSystemService(
|
|
|
- Context.LAYOUT_INFLATER_SERVICE);
|
|
|
- init(fragment_content,inflater);
|
|
|
+ .get_instance().getSystemService(
|
|
|
+ Context.LAYOUT_INFLATER_SERVICE);
|
|
|
+ init(fragment_content, inflater);
|
|
|
return;
|
|
|
}
|
|
|
-// if (mdataFragment.get_result() != null) {
|
|
|
-// LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
|
|
|
-// .get_instance().getSystemService(
|
|
|
-// Context.LAYOUT_INFLATER_SERVICE);
|
|
|
-// init(mdataFragment.get_result(), inflater);
|
|
|
-// }
|
|
|
+ // if (mdataFragment.get_result() != null) {
|
|
|
+ // LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
|
|
|
+ // .get_instance().getSystemService(
|
|
|
+ // Context.LAYOUT_INFLATER_SERVICE);
|
|
|
+ // init(mdataFragment.get_result(), inflater);
|
|
|
+ // }
|
|
|
// if (fragment_content != null)
|
|
|
// return;
|
|
|
// mStatusMessageView.setText("Loading");
|
|
|
@@ -102,16 +110,19 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
m_task.execute();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
public void set_content(String content)
|
|
|
{
|
|
|
- fragment_content=content;
|
|
|
+ fragment_content = content;
|
|
|
}
|
|
|
|
|
|
- private void showProgress(final boolean show) {
|
|
|
+ private void showProgress(final boolean show)
|
|
|
+ {
|
|
|
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
|
|
|
// for very easy animations. If available, use these APIs to fade-in
|
|
|
// the progress spinner.
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
|
|
|
+ {
|
|
|
int shortAnimTime = ApexTrackingApplication.get_instance()
|
|
|
.getResources()
|
|
|
.getInteger(android.R.integer.config_shortAnimTime);
|
|
|
@@ -119,9 +130,11 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
mStatusView.setVisibility(View.VISIBLE);
|
|
|
mStatusView.animate().setDuration(shortAnimTime)
|
|
|
.alpha(show ? 1 : 0)
|
|
|
- .setListener(new AnimatorListenerAdapter() {
|
|
|
+ .setListener(new AnimatorListenerAdapter()
|
|
|
+ {
|
|
|
@Override
|
|
|
- public void onAnimationEnd(Animator animation) {
|
|
|
+ public void onAnimationEnd(Animator animation)
|
|
|
+ {
|
|
|
mStatusView.setVisibility(show ? View.VISIBLE
|
|
|
: View.INVISIBLE);
|
|
|
}
|
|
|
@@ -129,14 +142,18 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
|
|
|
ll_root.setVisibility(View.VISIBLE);
|
|
|
ll_root.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1)
|
|
|
- .setListener(new AnimatorListenerAdapter() {
|
|
|
+ .setListener(new AnimatorListenerAdapter()
|
|
|
+ {
|
|
|
@Override
|
|
|
- public void onAnimationEnd(Animator animation) {
|
|
|
+ public void onAnimationEnd(Animator animation)
|
|
|
+ {
|
|
|
ll_root.setVisibility(show ? View.INVISIBLE
|
|
|
: View.VISIBLE);
|
|
|
}
|
|
|
});
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
// The ViewPropertyAnimator APIs are not available, so simply show
|
|
|
// and hide the relevant UI components.
|
|
|
mStatusView.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
|
|
|
@@ -164,7 +181,8 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
|
|
|
@Override
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
- Bundle savedInstanceState) {
|
|
|
+ Bundle savedInstanceState)
|
|
|
+ {
|
|
|
/* mGestureDetector = new GestureDetector(this); */
|
|
|
View view = inflater.inflate(R.layout.detail_fragment, null);
|
|
|
sl_root = (ScrollView) view.findViewById(R.id.sl_root);
|
|
|
@@ -178,10 +196,12 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
mStatusView = view.findViewById(R.id.status);
|
|
|
LinearLayout ll = (LinearLayout) view.findViewById(R.id.ll_refresh);
|
|
|
Button btn_refresh = (Button) ll.findViewById(R.id.btn_refresh);
|
|
|
- btn_refresh.setOnClickListener(new View.OnClickListener() {
|
|
|
+ btn_refresh.setOnClickListener(new View.OnClickListener()
|
|
|
+ {
|
|
|
|
|
|
@Override
|
|
|
- public void onClick(View v) {
|
|
|
+ public void onClick(View v)
|
|
|
+ {
|
|
|
LinearLayout ll = (LinearLayout) ll_root
|
|
|
.findViewById(R.id.ll_refresh);
|
|
|
ll.setVisibility(View.GONE);
|
|
|
@@ -190,44 +210,49 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
|
|
|
}
|
|
|
});
|
|
|
-// FragmentManager fm = getFragmentManager();
|
|
|
-// List<Fragment> fragments = fm.getFragments();
|
|
|
-// if (fragments != null) {
|
|
|
-// Log.e("DetailFragment", "fragments count=" + fragments.size());
|
|
|
-//// for (int i = 0; i < fragments.size(); i++)
|
|
|
-//// Log.e("DetailFragment", "fragments name=" + fragments.size());
|
|
|
-//
|
|
|
-// }
|
|
|
-//// this.getFragmentManager();
|
|
|
-// String tag = getArguments().getString("module_name");
|
|
|
-// // Check to see if we have retained the worker fragment.
|
|
|
-// mdataFragment = (DataFragment) fm.findFragmentById(12345);
|
|
|
-//
|
|
|
-// // If not retained (or first time running), we need to create it.
|
|
|
-// if (mdataFragment == null) {
|
|
|
-// Log.e("dataFragment creaded ", "tag=data_" + tag);
|
|
|
-// mdataFragment = new DataFragment();
|
|
|
-// // Tell it who it is working with.
|
|
|
-// mdataFragment.setTargetFragment(this, 0);
|
|
|
-// fm.beginTransaction().add(12345,mdataFragment, "data+" + tag).commit();
|
|
|
-// }
|
|
|
+ // FragmentManager fm = getFragmentManager();
|
|
|
+ // List<Fragment> fragments = fm.getFragments();
|
|
|
+ // if (fragments != null) {
|
|
|
+ // Log.e("DetailFragment", "fragments count=" + fragments.size());
|
|
|
+ // // for (int i = 0; i < fragments.size(); i++)
|
|
|
+ // // Log.e("DetailFragment", "fragments name=" + fragments.size());
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // // this.getFragmentManager();
|
|
|
+ // String tag = getArguments().getString("module_name");
|
|
|
+ // // Check to see if we have retained the worker fragment.
|
|
|
+ // mdataFragment = (DataFragment) fm.findFragmentById(12345);
|
|
|
+ //
|
|
|
+ // // If not retained (or first time running), we need to create it.
|
|
|
+ // if (mdataFragment == null) {
|
|
|
+ // Log.e("dataFragment creaded ", "tag=data_" + tag);
|
|
|
+ // mdataFragment = new DataFragment();
|
|
|
+ // // Tell it who it is working with.
|
|
|
+ // mdataFragment.setTargetFragment(this, 0);
|
|
|
+ // fm.beginTransaction().add(12345,mdataFragment, "data+" +
|
|
|
+ // tag).commit();
|
|
|
+ // }
|
|
|
requestdata();
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
- void init(String jstr, LayoutInflater inflater) {
|
|
|
+ void init(String jstr, LayoutInflater inflater)
|
|
|
+ {
|
|
|
String TAG = "init@DetailFragment";
|
|
|
Log.d(TAG, jstr);
|
|
|
- try {
|
|
|
+ try
|
|
|
+ {
|
|
|
JSONObject jsonObj = new JSONObject(jstr);
|
|
|
int group_count = jsonObj.getInt("count");
|
|
|
- if (group_count == 0) {
|
|
|
+ if (group_count == 0)
|
|
|
+ {
|
|
|
|
|
|
TextView tv_empty = (TextView) ll_root
|
|
|
.findViewById(R.id.tv_empty);
|
|
|
tv_empty.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
- for (int i = 0; i < group_count; i++) {
|
|
|
+ for (int i = 0; i < group_count; i++)
|
|
|
+ {
|
|
|
// String key = (String) it.next();
|
|
|
// if (key.equals("result"))
|
|
|
// continue;
|
|
|
@@ -242,7 +267,8 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
ll_root.addView(v);
|
|
|
String grouptype = groupobj.getString("_type");
|
|
|
// groupobj.remove("_type");
|
|
|
- if (grouptype.equals("mapping")) {
|
|
|
+ if (grouptype.equals("mapping"))
|
|
|
+ {
|
|
|
LinearLayout mappingview = (LinearLayout) inflater.inflate(
|
|
|
R.layout.key_mapping, null);
|
|
|
mappingview.setId(commonUtil.generateViewId());
|
|
|
@@ -250,7 +276,8 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
ll_root.addView(mappingview);
|
|
|
|
|
|
int map_count = groupobj.getInt("count");
|
|
|
- for (int j = 0; j < map_count; j++) {
|
|
|
+ for (int j = 0; j < map_count; j++)
|
|
|
+ {
|
|
|
// String keygroup = (String) itgroup.next();
|
|
|
JSONObject itemobj = groupobj.getJSONObject("item" + j);
|
|
|
String key = (String) itemobj.keys().next();
|
|
|
@@ -273,7 +300,9 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
//
|
|
|
//
|
|
|
// }
|
|
|
- } else if (grouptype.equals("table")) {
|
|
|
+ }
|
|
|
+ else if (grouptype.equals("table"))
|
|
|
+ {
|
|
|
String content = groupobj.getString("content");
|
|
|
WebView wv;
|
|
|
|
|
|
@@ -282,12 +311,14 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
wv.getSettings().setDefaultTextEncodingName("UTF-8");
|
|
|
wv.setId(commonUtil.generateViewId());
|
|
|
wv.setWebViewClient(new MyWebViewClient());
|
|
|
- wv.setDownloadListener(new DownloadListener() {
|
|
|
+ wv.setDownloadListener(new DownloadListener()
|
|
|
+ {
|
|
|
|
|
|
@Override
|
|
|
public void onDownloadStart(String url,
|
|
|
String userAgent, String contentDisposition,
|
|
|
- String mimetype, long contentLength) {
|
|
|
+ String mimetype, long contentLength)
|
|
|
+ {
|
|
|
Log.d("WebView", "Download Action");
|
|
|
Log.i("tag", "url=" + url);
|
|
|
// Log.i("tag", "userAgent="+userAgent);
|
|
|
@@ -334,27 +365,32 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
|
|
|
builder.setTitle(getString(R.string.str_confirmdownload));
|
|
|
|
|
|
- builder.setPositiveButton(getString(R.string.str_download),
|
|
|
- new Dialog.OnClickListener() {
|
|
|
+ builder.setPositiveButton(
|
|
|
+ getString(R.string.str_download),
|
|
|
+ new Dialog.OnClickListener()
|
|
|
+ {
|
|
|
|
|
|
@Override
|
|
|
public void onClick(
|
|
|
DialogInterface dialog,
|
|
|
- int which) {
|
|
|
- downloadManager
|
|
|
- .enqueue(request);
|
|
|
+ int which)
|
|
|
+ {
|
|
|
+ downloadManager.enqueue(request);
|
|
|
dialog.dismiss();
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- builder.setNegativeButton(getString(R.string.str_cancel),
|
|
|
- new Dialog.OnClickListener() {
|
|
|
+ builder.setNegativeButton(
|
|
|
+ getString(R.string.str_cancel),
|
|
|
+ new Dialog.OnClickListener()
|
|
|
+ {
|
|
|
|
|
|
@Override
|
|
|
public void onClick(
|
|
|
DialogInterface dialog,
|
|
|
- int which) {
|
|
|
+ int which)
|
|
|
+ {
|
|
|
dialog.dismiss();
|
|
|
}
|
|
|
});
|
|
|
@@ -384,14 +420,16 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
Log.d("table content", content);
|
|
|
|
|
|
}
|
|
|
- if (grouptype.equals("list")) {
|
|
|
+ if (grouptype.equals("list"))
|
|
|
+ {
|
|
|
LinearLayout listview = (LinearLayout) inflater.inflate(
|
|
|
R.layout.list_content, null);
|
|
|
listview.setId(commonUtil.generateViewId());
|
|
|
control.put(v.getId(), listview.getId());
|
|
|
ll_root.addView(listview);
|
|
|
long list_count = groupobj.getInt("count");
|
|
|
- for (int j = 0; j < list_count; j++) {
|
|
|
+ for (int j = 0; j < list_count; j++)
|
|
|
+ {
|
|
|
RelativeLayout listitem = (RelativeLayout) inflater
|
|
|
.inflate(R.layout.list_item, null);
|
|
|
|
|
|
@@ -425,14 +463,17 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
// {
|
|
|
//
|
|
|
// }
|
|
|
- } catch (JSONException e) {
|
|
|
+ }
|
|
|
+ catch (JSONException e)
|
|
|
+ {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void onClick(View v) {
|
|
|
+ public void onClick(View v)
|
|
|
+ {
|
|
|
View view = ll_root.findViewById(control.get(v.getId()));
|
|
|
if (view.getVisibility() == View.VISIBLE)
|
|
|
view.setVisibility(View.GONE);
|
|
|
@@ -440,30 +481,37 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
view.setVisibility(View.VISIBLE);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
|
|
|
@Override
|
|
|
public void onDestroy()
|
|
|
{
|
|
|
- if(m_task!=null)
|
|
|
+ if (m_task != null)
|
|
|
m_task.cancel(false);
|
|
|
super.onDestroy();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data)
|
|
|
+ {
|
|
|
+ ((DetailActivity) getActivity()).showlogin = false;
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onDetach()
|
|
|
{
|
|
|
- if(m_task!=null)
|
|
|
+ if (m_task != null)
|
|
|
m_task.cancel(false);
|
|
|
super.onDetach();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- class SearchTask extends AsyncTask<Void, Void, Boolean> {
|
|
|
- int errorcode;
|
|
|
+ class SearchTask extends AsyncTask<Void, Void, Boolean>
|
|
|
+ {
|
|
|
+ int errorcode;
|
|
|
|
|
|
@Override
|
|
|
- protected Boolean doInBackground(Void... params) {
|
|
|
+ protected Boolean doInBackground(Void... params)
|
|
|
+ {
|
|
|
Log.d("SearchTask", "doInBackground");
|
|
|
if (!Network.NetworkIsAvailable())
|
|
|
|
|
|
@@ -472,18 +520,18 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
return false;
|
|
|
}
|
|
|
String jstr = Network.get_detail(getArguments());
|
|
|
- if (jstr == null || jstr.length() <= 0) {
|
|
|
+ if (jstr == null || jstr.length() <= 0)
|
|
|
+ {
|
|
|
// Log.d(TAG, "json is wrong");
|
|
|
|
|
|
errorcode = Network.RESULT_NET_ERROR;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-// mdataFragment.put_result(jstr);
|
|
|
- fragment_content=jstr;
|
|
|
- DetailActivity activity=(DetailActivity) getActivity();
|
|
|
+ // mdataFragment.put_result(jstr);
|
|
|
+ fragment_content = jstr;
|
|
|
+ DetailActivity activity = (DetailActivity) getActivity();
|
|
|
activity.save_content(getArguments().getString("action_type"), jstr);
|
|
|
-
|
|
|
|
|
|
errorcode = Network.RESULT_TRUE;
|
|
|
|
|
|
@@ -491,55 +539,83 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected void onPostExecute(Boolean success) {
|
|
|
+ protected void onPostExecute(Boolean success)
|
|
|
+ {
|
|
|
Log.i("onPostExecute", "entry");
|
|
|
m_task = null;
|
|
|
showProgress(false);
|
|
|
|
|
|
- switch (errorcode) {
|
|
|
- case Network.RESULT_NET_NOTAVAILABLE: {
|
|
|
- Toast toast = Toast.makeText(
|
|
|
- ApexTrackingApplication.get_instance(),
|
|
|
- getText(R.string.msg_connection_none),
|
|
|
- Toast.LENGTH_LONG);
|
|
|
- toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
- toast.show();
|
|
|
- break;
|
|
|
- }
|
|
|
- case Network.RESULT_NET_ERROR: {
|
|
|
- Toast toast = Toast.makeText(
|
|
|
- ApexTrackingApplication.get_instance(),
|
|
|
- getText(R.string.msg_net_error), Toast.LENGTH_LONG);
|
|
|
- toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
- toast.show();
|
|
|
- break;
|
|
|
- }
|
|
|
- case Network.RESULT_ERROR:
|
|
|
- // case Network.RESULT_RESPONSE_NULL:
|
|
|
+ if (ApexTrackingApplication.get_authorization() == false)
|
|
|
{
|
|
|
+ if(((DetailActivity) getActivity()).showlogin == true)
|
|
|
+ return;
|
|
|
+ ((DetailActivity) getActivity()).showlogin = true;
|
|
|
+ LinearLayout ll = (LinearLayout) ll_root
|
|
|
+ .findViewById(R.id.ll_refresh);
|
|
|
+ ll.setVisibility(View.VISIBLE);
|
|
|
Toast toast = Toast.makeText(
|
|
|
ApexTrackingApplication.get_instance(),
|
|
|
- getText(R.string.msg_net_resulterror),
|
|
|
- Toast.LENGTH_LONG);
|
|
|
+ getText(R.string.msg_net_passwordchangedremote) , Toast.LENGTH_LONG);
|
|
|
toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
toast.show();
|
|
|
- break;
|
|
|
+ Intent i = new Intent();
|
|
|
+ i.setClass(getActivity(), ApexActivity.class);
|
|
|
+ startActivityForResult(i, REQUEST_LOGINACTIVITY);
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
+ switch (errorcode)
|
|
|
+ {
|
|
|
+ case Network.RESULT_NET_NOTAVAILABLE:
|
|
|
+ {
|
|
|
+ Toast toast = Toast.makeText(
|
|
|
+ ApexTrackingApplication.get_instance(),
|
|
|
+ getText(R.string.msg_connection_none),
|
|
|
+ Toast.LENGTH_LONG);
|
|
|
+ toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
+ toast.show();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case Network.RESULT_NET_ERROR:
|
|
|
+ {
|
|
|
+ Toast toast = Toast.makeText(
|
|
|
+ ApexTrackingApplication.get_instance(),
|
|
|
+ getText(R.string.msg_net_error), Toast.LENGTH_LONG);
|
|
|
+ toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
+ toast.show();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case Network.RESULT_ERROR:
|
|
|
+ // case Network.RESULT_RESPONSE_NULL:
|
|
|
+ {
|
|
|
+
|
|
|
+ Toast toast = Toast.makeText(
|
|
|
+ ApexTrackingApplication.get_instance(),
|
|
|
+ getText(R.string.msg_net_resulterror) + ":"
|
|
|
+ + errorcode, Toast.LENGTH_LONG);
|
|
|
+ toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
+ toast.show();
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- default:
|
|
|
- break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
- if (success) {
|
|
|
+ if (success)
|
|
|
+ {
|
|
|
LayoutInflater inflater = (LayoutInflater) ApexTrackingApplication
|
|
|
.get_instance().getSystemService(
|
|
|
Context.LAYOUT_INFLATER_SERVICE);
|
|
|
|
|
|
init(fragment_content, inflater/*
|
|
|
- * getActivity().
|
|
|
- * getLayoutInflater()
|
|
|
- */);
|
|
|
- } else {
|
|
|
+ * getActivity().
|
|
|
+ * getLayoutInflater()
|
|
|
+ */);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
LinearLayout ll = (LinearLayout) ll_root
|
|
|
.findViewById(R.id.ll_refresh);
|
|
|
ll.setVisibility(View.VISIBLE);
|
|
|
@@ -548,54 +624,60 @@ public class DetailFragment extends Fragment implements OnClickListener /*
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected void onCancelled() {
|
|
|
+ protected void onCancelled()
|
|
|
+ {
|
|
|
m_task = null;
|
|
|
showProgress(false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// public class DataFragment extends Fragment {
|
|
|
-//
|
|
|
-// String result = null;
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onCreate(Bundle savedInstanceState) {
|
|
|
-// setRetainInstance(true);
|
|
|
-// super.onCreate(savedInstanceState);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public String get_result() {
|
|
|
-// return result;
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// public void put_result(String s) {
|
|
|
-// result = s;
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
- public class MyWebViewClient extends WebViewClient {
|
|
|
+ // public class DataFragment extends Fragment {
|
|
|
+ //
|
|
|
+ // String result = null;
|
|
|
+ //
|
|
|
+ // @Override
|
|
|
+ // public void onCreate(Bundle savedInstanceState) {
|
|
|
+ // setRetainInstance(true);
|
|
|
+ // super.onCreate(savedInstanceState);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // public String get_result() {
|
|
|
+ // return result;
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // public void put_result(String s) {
|
|
|
+ // result = s;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // }
|
|
|
+
|
|
|
+ public class MyWebViewClient extends WebViewClient
|
|
|
+ {
|
|
|
// 如果页面中链接,如果希望点击链接继续在当前browser中响应,
|
|
|
// 而不是新开Android的系统browser中响应该链接,必须覆盖 webview的WebViewClient对象。
|
|
|
- public boolean shouldOverviewUrlLoading(WebView view, String url) {
|
|
|
+ public boolean shouldOverviewUrlLoading(WebView view, String url)
|
|
|
+ {
|
|
|
// L.i("shouldOverviewUrlLoading");
|
|
|
view.loadUrl(url);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
|
|
+ public void onPageStarted(WebView view, String url, Bitmap favicon)
|
|
|
+ {
|
|
|
// L.i("onPageStarted");
|
|
|
// showProgress();
|
|
|
}
|
|
|
|
|
|
- public void onPageFinished(WebView view, String url) {
|
|
|
+ public void onPageFinished(WebView view, String url)
|
|
|
+ {
|
|
|
// L.i("onPageFinished");
|
|
|
// closeProgress();
|
|
|
}
|
|
|
|
|
|
public void onReceivedError(WebView view, int errorCode,
|
|
|
- String description, String failingUrl) {
|
|
|
+ String description, String failingUrl)
|
|
|
+ {
|
|
|
// L.i("onReceivedError");
|
|
|
// closeProgress();
|
|
|
}
|