Fixed a minor bug in login activity (could not add dialog to activity) as well as spinner hint adapter (array out of bound)
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
|||||||
applicationId "org.deke.risk.riskahead"
|
applicationId "org.deke.risk.riskahead"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 50
|
versionCode 52
|
||||||
versionName "3.1.6"
|
versionName "3.1.8"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":50,"versionName":"3.1.6","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":52,"versionName":"3.1.8","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||||
@@ -63,6 +63,8 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
private ProgressDialog pDialog;
|
private ProgressDialog pDialog;
|
||||||
private SessionManager session;
|
private SessionManager session;
|
||||||
|
|
||||||
|
static boolean active = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -91,6 +93,18 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
active = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void isNetworkAvailable() {
|
public void isNetworkAvailable() {
|
||||||
NetworkInfo activeNetworkInfo = null;
|
NetworkInfo activeNetworkInfo = null;
|
||||||
|
|
||||||
@@ -876,7 +890,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
try {
|
try {
|
||||||
JSONObject jObj = new JSONObject(response);
|
JSONObject jObj = new JSONObject(response);
|
||||||
boolean error = jObj.getBoolean("error");
|
boolean error = jObj.getBoolean("error");
|
||||||
if (!error) {
|
if (!error && active) {
|
||||||
new AlertDialog.Builder(LoginActivity.this)
|
new AlertDialog.Builder(LoginActivity.this)
|
||||||
.setTitle(getString(R.string.alert_accregistration_title))
|
.setTitle(getString(R.string.alert_accregistration_title))
|
||||||
.setMessage(getString(R.string.alert_accregistration_text))
|
.setMessage(getString(R.string.alert_accregistration_text))
|
||||||
@@ -890,7 +904,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
})
|
})
|
||||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
.show();
|
.show();
|
||||||
} else {
|
} else if (error){
|
||||||
String errorMsg = jObj.getString("error_msg");
|
String errorMsg = jObj.getString("error_msg");
|
||||||
Crashlytics.log(Log.ERROR, TAG, "Error occured: "+errorMsg);
|
Crashlytics.log(Log.ERROR, TAG, "Error occured: "+errorMsg);
|
||||||
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_register), Toast.LENGTH_LONG).show();
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.deke.risk.riskahead.adapter;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
|
import android.nfc.Tag;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -42,14 +44,16 @@ public class SpinnerHintAdapter implements SpinnerAdapter, ListAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final View getView(int position, View convertView, ViewGroup parent) {
|
public final View getView(int position, View convertView, ViewGroup parent) {
|
||||||
if (position == 0) {
|
isInInitialState = position == 0;
|
||||||
isInInitialState = true;
|
|
||||||
|
if (isInInitialState) {
|
||||||
return getNothingSelectedView(parent);
|
return getNothingSelectedView(parent);
|
||||||
|
}else{
|
||||||
|
int numOfItems = adapter.getCount();
|
||||||
|
position = (position > numOfItems-1) ? numOfItems-1 : position;
|
||||||
|
|
||||||
|
return adapter.getView(position - EXTRA, null, parent);
|
||||||
}
|
}
|
||||||
isInInitialState = false;
|
|
||||||
|
|
||||||
return adapter.getView(position - EXTRA, null, parent); // Could re-use
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected View getNothingSelectedView(ViewGroup parent) {
|
protected View getNothingSelectedView(ViewGroup parent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user