Adds some fixes with strreaming api
This commit is contained in:
parent
3ad5493c3c
commit
5c06197b58
|
@ -41,6 +41,7 @@ import android.support.v4.view.ViewPager;
|
|||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -161,11 +162,11 @@ public class MainActivity extends AppCompatActivity
|
|||
userIdService = b.getString("userIdService", null);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
if( userIdService != null && userIdService.equals(userId)) {
|
||||
|
||||
if (eventStreaming == StreamingService.EventStreaming.NOTIFICATION) {
|
||||
Notification notification = b.getParcelable("data");
|
||||
if (notificationsFragment != null) {
|
||||
notificationsFragment.refresh(notification);
|
||||
countNewNotifications++;
|
||||
} else {
|
||||
tempNotifications.add(notification);
|
||||
}
|
||||
|
@ -173,7 +174,6 @@ public class MainActivity extends AppCompatActivity
|
|||
Status status = b.getParcelable("data");
|
||||
if (homeFragment != null) {
|
||||
homeFragment.refresh(status);
|
||||
countNewStatus++;
|
||||
} else {
|
||||
tempStatuses.add(status);
|
||||
}
|
||||
|
@ -218,15 +218,6 @@ public class MainActivity extends AppCompatActivity
|
|||
return;
|
||||
}
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
List<Account> accounts = new AccountDAO(getApplicationContext(), db).getAllAccount();
|
||||
if( accounts != null){
|
||||
for (Account account: accounts) {
|
||||
Intent intent = new Intent(getApplicationContext(), StreamingService.class);
|
||||
intent.putExtra("accountId", account.getId());
|
||||
intent.putExtra("accountAcct", account.getAcct());
|
||||
startService(intent);
|
||||
}
|
||||
}
|
||||
Helper.canPin = false;
|
||||
Helper.fillMapEmoji(getApplicationContext());
|
||||
//Here, the user is authenticated
|
||||
|
|
|
@ -261,6 +261,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
View v = lv_notifications.getChildAt(0);
|
||||
int top = (v == null) ? 0 : v.getTop();
|
||||
notifications.add(0, notification);
|
||||
MainActivity.countNewNotifications++;
|
||||
notificationsListAdapter.notifyDataSetChanged();
|
||||
lv_notifications.setSelectionFromTop(index, top);
|
||||
if( textviewNoAction.getVisibility() == View.VISIBLE)
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.support.v4.app.Fragment;
|
|||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -335,6 +336,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
int top = (v == null) ? 0 : v.getTop();
|
||||
status.setReplies(new ArrayList<Status>());
|
||||
statuses.add(0,status);
|
||||
MainActivity.countNewStatus++;
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
lv_status.setSelectionFromTop(index, top);
|
||||
if (textviewNoAction.getVisibility() == View.VISIBLE)
|
||||
|
|
|
@ -223,6 +223,7 @@ public class StreamingService extends Service {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
b.putString("userIdService",account.getId());
|
||||
Intent intentBC = new Intent(Helper.RECEIVE_DATA);
|
||||
intentBC.putExtra("eventStreaming", event);
|
||||
intentBC.putExtras(b);
|
||||
|
|
|
@ -168,7 +168,6 @@ public class MainActivity extends AppCompatActivity
|
|||
Notification notification = b.getParcelable("data");
|
||||
if (notificationsFragment != null) {
|
||||
notificationsFragment.refresh(notification);
|
||||
countNewNotifications++;
|
||||
} else {
|
||||
tempNotifications.add(notification);
|
||||
}
|
||||
|
@ -176,7 +175,6 @@ public class MainActivity extends AppCompatActivity
|
|||
Status status = b.getParcelable("data");
|
||||
if (homeFragment != null) {
|
||||
homeFragment.refresh(status);
|
||||
countNewStatus++;
|
||||
} else {
|
||||
tempStatuses.add(status);
|
||||
}
|
||||
|
@ -222,15 +220,6 @@ public class MainActivity extends AppCompatActivity
|
|||
return;
|
||||
}
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
List<Account> accounts = new AccountDAO(getApplicationContext(), db).getAllAccount();
|
||||
if( accounts != null){
|
||||
for (Account account: accounts) {
|
||||
Intent intent = new Intent(getApplicationContext(), StreamingService.class);
|
||||
intent.putExtra("accountId", account.getId());
|
||||
intent.putExtra("accountAcct", account.getAcct());
|
||||
startService(intent);
|
||||
}
|
||||
}
|
||||
Helper.canPin = false;
|
||||
Helper.fillMapEmoji(getApplicationContext());
|
||||
//Here, the user is authenticated
|
||||
|
|
Loading…
Reference in New Issue