issue #777 closed

parent 11b85186
...@@ -19,7 +19,8 @@ import org.json.JSONObject; ...@@ -19,7 +19,8 @@ import org.json.JSONObject;
* @author Fernando Martinez Santiago * @author Fernando Martinez Santiago
* @version 1.0 * @version 1.0
*/ */
public class Picto extends Img { public class
Picto extends Img {
public final static class JSON_ATTTRS { public final static class JSON_ATTTRS {
......
package com.yottacode.pictogram.tabletlibrary.gui.session; package com.yottacode.pictogram.tabletlibrary.gui.session;
import android.app.Activity; import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
...@@ -14,6 +15,7 @@ import android.widget.AdapterView; ...@@ -14,6 +15,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.ListView;
import com.yottacode.pictogram.tabletlibrary.gui.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper; import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
...@@ -114,13 +116,17 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -114,13 +116,17 @@ public class ListInstructionsFragment extends Fragment{
} }
private void checkStudent() { private void checkStudent() {
SessionWrapper.validateStudent(new SessionWrapper.iValidateStudent() { SessionWrapper.validateStudent(new SessionWrapper.iValidateStudent() {
void close() {
ListInstructionsFragment.this.getActivity().finish();
startActivity(new Intent(getActivity(), PictogramActivity.class));
}
@Override @Override
public void validLicense(boolean valid_license, String sexpiration) { public void validLicense(boolean valid_license, String sexpiration) {
if (!valid_license) { if (!valid_license) {
GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.loginExpiredLicenseMsg, sexpiration, new GUITools.iOKListener() { GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.loginExpiredLicenseMsg, sexpiration, new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
ListInstructionsFragment.this.getActivity().finish(); close();
} }
}); });
} }
...@@ -131,7 +137,7 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -131,7 +137,7 @@ public class ListInstructionsFragment extends Fragment{
GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_notclosed, getString(R.string.server), new GUITools.iOKListener() { GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_notclosed, getString(R.string.server), new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
ListInstructionsFragment.this.getActivity().finish(); close();
} }
}); });
} }
...@@ -142,7 +148,7 @@ public class ListInstructionsFragment extends Fragment{ ...@@ -142,7 +148,7 @@ public class ListInstructionsFragment extends Fragment{
GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_error, message,new GUITools.iOKListener() { GUITools.show_alert(ListInstructionsFragment.this.getContext(), R.string.session_error, message,new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
ListInstructionsFragment.this.getActivity().finish(); close();
} }
}); });
} }
......
...@@ -329,6 +329,10 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -329,6 +329,10 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
findViewById(R.id.sessionTopbarMethodName).setVisibility(View.INVISIBLE); findViewById(R.id.sessionTopbarMethodName).setVisibility(View.INVISIBLE);
findViewById(R.id.sessionTopbarInstructionName).setVisibility(View.INVISIBLE); findViewById(R.id.sessionTopbarInstructionName).setVisibility(View.INVISIBLE);
} }
void close() {
finish();
startActivity(new Intent(SessionActivity.this, PictogramActivity.class));
}
private void set_fragment(boolean isChecked) { private void set_fragment(boolean isChecked) {
if (isChecked) { if (isChecked) {
...@@ -346,7 +350,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -346,7 +350,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
GUITools.show_alert(SessionActivity.this, R.string.session_error, "error " + error, new GUITools.iOKListener() { GUITools.show_alert(SessionActivity.this, R.string.session_error, "error " + error, new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
finish(); close();
} }
}); });
} }
...@@ -359,7 +363,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -359,7 +363,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
GUITools.show_alert(SessionActivity.this, R.string.session_closed_ok, end, new GUITools.iOKListener() { GUITools.show_alert(SessionActivity.this, R.string.session_closed_ok, end, new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
finish(); close();
} }
}); });
...@@ -370,7 +374,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -370,7 +374,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
GUITools.show_alert(SessionActivity.this, R.string.session_error, getString(R.string.server) + "(error " + error + ")", new GUITools.iOKListener() { GUITools.show_alert(SessionActivity.this, R.string.session_error, getString(R.string.server) + "(error " + error + ")", new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
finish(); close();
} }
}); });
} }
......
...@@ -154,7 +154,7 @@ public class SessionWrapper { ...@@ -154,7 +154,7 @@ public class SessionWrapper {
JSONObject jlicense = new JSONObject(license); JSONObject jlicense = new JSONObject(license);
sexpiration = jlicense.getString("expiration_ts"); sexpiration = jlicense.getString("expiration_ts");
sexpiration = sexpiration.substring(0, sexpiration.indexOf('T')); sexpiration = sexpiration.substring(0, sexpiration.indexOf('T'));
Date dexpiration = new java.text.SimpleDateFormat("yyyy-mm-dd").parse(sexpiration); Date dexpiration = new java.text.SimpleDateFormat("yyyy-MM-dd").parse(sexpiration);
valid_license = dexpiration.after(new Date()); valid_license = dexpiration.after(new Date());
} }
listener.validLicense(valid_license,sexpiration); listener.validLicense(valid_license,sexpiration);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment