Merge branch 'bug_fix' into develop
This commit is contained in:
commit
1ad15d5e02
|
@ -24,6 +24,7 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -74,6 +75,8 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
private static boolean client_id_for_webview = false;
|
||||
private String instance;
|
||||
private AutoCompleteTextView login_instance;
|
||||
private EditText login_uid;
|
||||
private EditText login_passwd;
|
||||
boolean isLoadingInstance = false;
|
||||
|
||||
@Override
|
||||
|
@ -94,8 +97,11 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
}else {
|
||||
changeDrawableColor(getApplicationContext(), R.drawable.mastodon_icon, R.color.mastodonC3);
|
||||
}
|
||||
final Button connectionButton = (Button) findViewById(R.id.login_button);
|
||||
login_instance = (AutoCompleteTextView) findViewById(R.id.login_instance);
|
||||
final Button connectionButton = findViewById(R.id.login_button);
|
||||
login_instance = findViewById(R.id.login_instance);
|
||||
login_uid = findViewById(R.id.login_uid);
|
||||
login_passwd = findViewById(R.id.login_passwd);
|
||||
|
||||
|
||||
if( theme == Helper.THEME_LIGHT) {
|
||||
connectionButton.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.white));
|
||||
|
@ -153,7 +159,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
|
||||
|
||||
connectionButton.setEnabled(false);
|
||||
login_two_step = (TextView) findViewById(R.id.login_two_step);
|
||||
login_two_step = findViewById(R.id.login_two_step);
|
||||
login_two_step.setVisibility(View.GONE);
|
||||
login_two_step.setPaintFlags(login_two_step.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
login_two_step.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -181,7 +187,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onResume(){
|
||||
super.onResume();
|
||||
Button connectionButton = (Button) findViewById(R.id.login_button);
|
||||
Button connectionButton = findViewById(R.id.login_button);
|
||||
if (login_instance.getText() != null && login_instance.getText().toString().length() > 0 && client_id_for_webview) {
|
||||
connectionButton.setEnabled(false);
|
||||
client_id_for_webview = false;
|
||||
|
@ -190,7 +196,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void retrievesClientId(){
|
||||
final Button connectionButton = (Button) findViewById(R.id.login_button);
|
||||
final Button connectionButton = findViewById(R.id.login_button);
|
||||
try {
|
||||
instance = URLEncoder.encode(login_instance.getText().toString().trim(), "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
@ -254,8 +260,6 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
requestParams.add(Helper.CLIENT_ID, sharedpreferences.getString(Helper.CLIENT_ID, null));
|
||||
requestParams.add(Helper.CLIENT_SECRET, sharedpreferences.getString(Helper.CLIENT_SECRET, null));
|
||||
requestParams.add("grant_type", "password");
|
||||
EditText login_uid = (EditText) findViewById(R.id.login_uid);
|
||||
EditText login_passwd = (EditText) findViewById(R.id.login_passwd);
|
||||
requestParams.add("username",login_uid.getText().toString().trim());
|
||||
requestParams.add("password",login_passwd.getText().toString().trim());
|
||||
requestParams.add("scope"," read write follow");
|
||||
|
|
|
@ -1213,6 +1213,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
toot_content.setThreshold(1);
|
||||
toot_content.setAdapter(accountsListAdapter);
|
||||
final String oldContent = toot_content.getText().toString();
|
||||
if( oldContent.length() >= currentCursorPosition) {
|
||||
String[] searchA = oldContent.substring(0, currentCursorPosition).split("@");
|
||||
if (searchA.length > 0) {
|
||||
final String search = searchA[searchA.length - 1];
|
||||
|
@ -1247,6 +1248,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveSearch(Results results, Error error) {
|
||||
|
|
|
@ -767,9 +767,10 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
notifications.removeAll(notificationsToRemove);
|
||||
notificationsListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if( targetedId != null ) {
|
||||
if (statusAction == API.StatusAction.REBLOG) {
|
||||
for (Notification notification : notifications) {
|
||||
if (notification.getStatus().getId().equals(targetedId)) {
|
||||
if (notification.getStatus() != null && notification.getStatus().getId().equals(targetedId)) {
|
||||
notification.getStatus().setReblogs_count(notification.getStatus().getReblogs_count() + 1);
|
||||
break;
|
||||
}
|
||||
|
@ -777,7 +778,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
notificationsListAdapter.notifyDataSetChanged();
|
||||
} else if (statusAction == API.StatusAction.UNREBLOG) {
|
||||
for (Notification notification : notifications) {
|
||||
if (notification.getStatus().getId().equals(targetedId)) {
|
||||
if (notification.getStatus() != null && notification.getStatus().getId().equals(targetedId)) {
|
||||
if (notification.getStatus().getReblogs_count() - 1 >= 0)
|
||||
notification.getStatus().setReblogs_count(notification.getStatus().getReblogs_count() - 1);
|
||||
break;
|
||||
|
@ -786,7 +787,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
notificationsListAdapter.notifyDataSetChanged();
|
||||
} else if (statusAction == API.StatusAction.FAVOURITE) {
|
||||
for (Notification notification : notifications) {
|
||||
if (notification.getStatus().getId().equals(targetedId)) {
|
||||
if (notification.getStatus() != null && notification.getStatus().getId().equals(targetedId)) {
|
||||
notification.getStatus().setFavourites_count(notification.getStatus().getFavourites_count() + 1);
|
||||
break;
|
||||
}
|
||||
|
@ -794,7 +795,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
notificationsListAdapter.notifyDataSetChanged();
|
||||
} else if (statusAction == API.StatusAction.UNFAVOURITE) {
|
||||
for (Notification notification : notifications) {
|
||||
if (notification.getStatus().getId().equals(targetedId)) {
|
||||
if (notification.getStatus() != null && notification.getStatus().getId().equals(targetedId)) {
|
||||
if (notification.getStatus().getFavourites_count() - 1 >= 0)
|
||||
notification.getStatus().setFavourites_count(notification.getStatus().getFavourites_count() - 1);
|
||||
break;
|
||||
|
@ -803,6 +804,7 @@ public class NotificationsListAdapter extends BaseAdapter implements OnPostActio
|
|||
notificationsListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostNotificationsAction(APIResponse apiResponse, Notification notification) {
|
||||
|
|
|
@ -44,12 +44,15 @@
|
|||
android:id="@+id/login_instance"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeOptions="actionNext"
|
||||
android:maxLines="1"
|
||||
android:inputType="textWebEmailAddress"
|
||||
android:hint="@string/instance_example"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/login_uid"
|
||||
android:layout_width="300dp"
|
||||
android:maxLines="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
android:hint="@string/email"
|
||||
|
@ -57,6 +60,7 @@
|
|||
<EditText
|
||||
android:id = "@+id/login_passwd"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/password"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -44,13 +44,16 @@
|
|||
android:id="@+id/login_instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textWebEmailAddress"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/instance_example"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/login_uid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:inputType="textEmailAddress"
|
||||
android:hint="@string/email"
|
||||
/>
|
||||
|
@ -58,6 +61,7 @@
|
|||
android:id = "@+id/login_passwd"
|
||||
android:inputType="textPassword"
|
||||
android:hint="@string/password"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue