Fixes issue #73 - The fix

This commit is contained in:
stom79 2017-12-02 17:18:38 +01:00
parent c979bd9ee4
commit 5a7ecf6bca
2 changed files with 5 additions and 6 deletions

View File

@ -75,7 +75,7 @@
<activity
android:name=".activities.MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:launchMode="singleTask"
android:windowSoftInputMode = "adjustResize"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/AppThemeDark_NoActionBar">

View File

@ -20,7 +20,6 @@ import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
@ -1566,8 +1565,8 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
newContent += deltaSearch;
newContent += "@" + account.getAcct() + " ";
int newPosition = newContent.length();
if (currentCursorPosition < oldContent.length() - 1)
newContent += oldContent.substring(currentCursorPosition, oldContent.length() - 1);
if (currentCursorPosition < oldContent.length() )
newContent += oldContent.substring(currentCursorPosition, oldContent.length());
toot_content.setText(newContent);
toot_space_left.setText(String.valueOf(toot_content.length()));
toot_content.setSelection(newPosition);
@ -1617,7 +1616,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
newContent += deltaSearch;
newContent += ":" + shortcode + ": ";
int newPosition = newContent.length();
if( currentCursorPosition < oldContent.length() - 1)
if( currentCursorPosition < oldContent.length() )
newContent += oldContent.substring(currentCursorPosition, oldContent.length()-1);
toot_content.setText(newContent);
toot_space_left.setText(String.valueOf(toot_content.length()));
@ -1670,7 +1669,7 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
newContent += deltaSearch;
newContent += "#" + tag + " ";
int newPosition = newContent.length();
if( currentCursorPosition < oldContent.length() - 1)
if( currentCursorPosition < oldContent.length() )
newContent += oldContent.substring(currentCursorPosition, oldContent.length()-1);
toot_content.setText(newContent);
toot_space_left.setText(String.valueOf(toot_content.length()));