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"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 50
|
||||
versionName "3.1.6"
|
||||
versionCode 52
|
||||
versionName "3.1.8"
|
||||
multiDexEnabled true
|
||||
}
|
||||
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 SessionManager session;
|
||||
|
||||
static boolean active = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle 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() {
|
||||
NetworkInfo activeNetworkInfo = null;
|
||||
|
||||
@@ -876,7 +890,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
||||
try {
|
||||
JSONObject jObj = new JSONObject(response);
|
||||
boolean error = jObj.getBoolean("error");
|
||||
if (!error) {
|
||||
if (!error && active) {
|
||||
new AlertDialog.Builder(LoginActivity.this)
|
||||
.setTitle(getString(R.string.alert_accregistration_title))
|
||||
.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)
|
||||
.show();
|
||||
} else {
|
||||
} else if (error){
|
||||
String errorMsg = jObj.getString("error_msg");
|
||||
Crashlytics.log(Log.ERROR, TAG, "Error occured: "+errorMsg);
|
||||
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.database.DataSetObserver;
|
||||
import android.nfc.Tag;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -42,14 +44,16 @@ public class SpinnerHintAdapter implements SpinnerAdapter, ListAdapter {
|
||||
|
||||
@Override
|
||||
public final View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (position == 0) {
|
||||
isInInitialState = true;
|
||||
isInInitialState = position == 0;
|
||||
|
||||
if (isInInitialState) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user