|
|
@@ -1,9 +1,14 @@
|
|
|
package com.usai.apex.mainframe;
|
|
|
|
|
|
+import android.app.Dialog;
|
|
|
import android.content.ComponentName;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.content.Intent.ShortcutIconResource;
|
|
|
+import android.content.SharedPreferences;
|
|
|
import android.os.Bundle;
|
|
|
+import android.support.v4.content.LocalBroadcastManager;
|
|
|
+import android.support.v7.app.AlertDialog;
|
|
|
import android.util.Log;
|
|
|
import android.view.View;
|
|
|
import android.widget.ListView;
|
|
|
@@ -11,6 +16,7 @@ import android.widget.ListView;
|
|
|
import com.usai.apex.AboutActivity;
|
|
|
import com.usai.apex.AnnouncementActivity;
|
|
|
import com.usai.apex.ApexHistoryActivity;
|
|
|
+import com.usai.apex.ApexTrackingApplication;
|
|
|
import com.usai.apex.InnerMapActivity;
|
|
|
import com.usai.apex.R;
|
|
|
|
|
|
@@ -185,6 +191,7 @@ public class ToolsFragment extends StaticModelistFragment
|
|
|
Log.d("FragmentList", "Item clicked: " + id);
|
|
|
|
|
|
String title = (String) getData(jsonobj).get(position-1).get("title");
|
|
|
+ String type = (String) getData(jsonobj).get(position-1).get("type");
|
|
|
// try {
|
|
|
//// title = jsonobj.getJSONArray("modelist").getJSONObject(position);
|
|
|
////
|
|
|
@@ -242,6 +249,42 @@ public class ToolsFragment extends StaticModelistFragment
|
|
|
|
|
|
// startActivityForResult(intent, REQUEST_CHANGEPASSWORD_ACTIVITY);
|
|
|
// return;
|
|
|
+ }
|
|
|
+ else if (type.equals("clear_login"))
|
|
|
+ {
|
|
|
+
|
|
|
+ String msg = "It will clear your account and password,are your sure?";
|
|
|
+ if (ApexTrackingApplication.m_bauthorized) {
|
|
|
+ msg = "It will clear your account and password then logout,are your sure?";
|
|
|
+ }
|
|
|
+
|
|
|
+ new AlertDialog.Builder(getContext())
|
|
|
+ .setTitle("Warning")
|
|
|
+ .setMessage(msg)
|
|
|
+ .setNegativeButton("No",null)
|
|
|
+ .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+
|
|
|
+ SharedPreferences pref = ApexTrackingApplication.get_instance().getSharedPreferences("Apex", 0);
|
|
|
+ SharedPreferences.Editor editor = pref.edit();
|
|
|
+ editor.putString("user", null);
|
|
|
+ editor.putString("password", null);
|
|
|
+ editor.putBoolean("autologin", false);
|
|
|
+ editor.commit();
|
|
|
+
|
|
|
+ String UNIQUE_STRING = "com.usai.apex.push.cancel";
|
|
|
+ Intent intent = new Intent(UNIQUE_STRING);
|
|
|
+ getActivity().sendBroadcast(intent);
|
|
|
+
|
|
|
+ Intent bintent = new Intent("Login");
|
|
|
+ bintent.putExtra("state", false);
|
|
|
+ LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(bintent);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .show();
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
else if (title.equals("About"))
|
|
|
{
|