Some fixes
This commit is contained in:
parent
fa2c2654da
commit
af32fad854
|
@ -211,7 +211,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
|
|
||||||
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
PackageManager pm = getPackageManager();
|
PackageManager pm = getPackageManager();
|
||||||
|
@ -1376,7 +1376,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
DisplayStatusFragment fragment = new DisplayStatusFragment();
|
DisplayStatusFragment fragment = new DisplayStatusFragment();
|
||||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.MYVIDEOS);
|
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.MYVIDEOS);
|
||||||
bundle.putString("instanceType", "PEERTUBE");
|
bundle.putString("instanceType", "PEERTUBE");
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
||||||
|
@ -1670,7 +1670,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
Helper.deleteDir(dir);
|
Helper.deleteDir(dir);
|
||||||
}
|
}
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new TimelineCacheDAO(contextReference.get(), db).removeAll();
|
new TimelineCacheDAO(contextReference.get(), db).removeAll();
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
@ -1683,7 +1683,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
if (mPageReferenceMap != null)
|
if (mPageReferenceMap != null)
|
||||||
mPageReferenceMap = null;
|
mPageReferenceMap = null;
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("isMainActivityRunning", false).apply();
|
PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("isMainActivityRunning", false).apply();
|
||||||
if( Sqlite.db != null ) {
|
if (Sqlite.db != null) {
|
||||||
Sqlite.db.close();
|
Sqlite.db.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1813,7 +1813,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.MYVIDEOS);
|
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.MYVIDEOS);
|
||||||
bundle.putString("instanceType", "PEERTUBE");
|
bundle.putString("instanceType", "PEERTUBE");
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
||||||
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
@ -1829,7 +1829,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PEERTUBE_HISTORY);
|
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PEERTUBE_HISTORY);
|
||||||
bundle.putString("instanceType", "PEERTUBE");
|
bundle.putString("instanceType", "PEERTUBE");
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(BaseMainActivity.this));
|
||||||
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
@ -1970,7 +1970,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
startActivity(myIntent);
|
startActivity(myIntent);
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BaseMainActivity.this, db).getUniqAccount(userId, instance);
|
||||||
Helper.updateHeaderAccountInfo(activity, account, headerLayout);
|
Helper.updateHeaderAccountInfo(activity, account, headerLayout);
|
||||||
}
|
}
|
||||||
|
@ -2274,7 +2274,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manageTab(RetrieveFeedsAsyncTask.Type type, int value) {
|
public void manageTab(RetrieveFeedsAsyncTask.Type type, int value) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<ManageTimelines> tls = new TimelinesDAO(BaseMainActivity.this, db).getDisplayedTimelines();
|
List<ManageTimelines> tls = new TimelinesDAO(BaseMainActivity.this, db).getDisplayedTimelines();
|
||||||
for (ManageTimelines tl : tls) {
|
for (ManageTimelines tl : tls) {
|
||||||
if (type == ManageTimelines.transform(BaseMainActivity.this, tl.getType())) {
|
if (type == ManageTimelines.transform(BaseMainActivity.this, tl.getType())) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class BookmarkActivity extends BaseActivity implements OnRetrieveFeedsInt
|
||||||
setTitle(R.string.bookmarks);
|
setTitle(R.string.bookmarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BookmarkActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(BookmarkActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BookmarkActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class CustomSharingActivity extends BaseActivity implements OnCustomShari
|
||||||
} else {
|
} else {
|
||||||
setTitle(R.string.settings_title_custom_sharing);
|
setTitle(R.string.settings_title_custom_sharing);
|
||||||
}
|
}
|
||||||
SQLiteDatabase db = Sqlite.getInstance(CustomSharingActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(CustomSharingActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(CustomSharingActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
|
||||||
} else {
|
} else {
|
||||||
setTitle(R.string.settings_title_profile);
|
setTitle(R.string.settings_title_profile);
|
||||||
}
|
}
|
||||||
SQLiteDatabase db = Sqlite.getInstance(EditProfileActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(EditProfileActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(EditProfileActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
|
||||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.tag_pin, menu);
|
getMenuInflater().inflate(R.menu.tag_pin, menu);
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(HashTagActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<String> searchInDb = new SearchDAO(HashTagActivity.this, db).getSearchByKeyword(tag.trim());
|
List<String> searchInDb = new SearchDAO(HashTagActivity.this, db).getSearchByKeyword(tag.trim());
|
||||||
if (searchInDb != null && searchInDb.size() > 0) {
|
if (searchInDb != null && searchInDb.size() > 0) {
|
||||||
menu.findItem(R.id.action_pin).setVisible(false);
|
menu.findItem(R.id.action_pin).setVisible(false);
|
||||||
|
@ -186,7 +186,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_pin:
|
case R.id.action_pin:
|
||||||
SQLiteDatabase db = Sqlite.getInstance(HashTagActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new SearchDAO(HashTagActivity.this, db).insertSearch(tag);
|
new SearchDAO(HashTagActivity.this, db).insertSearch(tag);
|
||||||
Intent intent = new Intent(HashTagActivity.this, MainActivity.class);
|
Intent intent = new Intent(HashTagActivity.this, MainActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class LiveNotificationSettingsAccountsActivity extends BaseActivity {
|
||||||
RecyclerView list_of_accounts = findViewById(R.id.list_of_accounts);
|
RecyclerView list_of_accounts = findViewById(R.id.list_of_accounts);
|
||||||
|
|
||||||
ArrayList<Account> accounts = new ArrayList<>();
|
ArrayList<Account> accounts = new ArrayList<>();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(LiveNotificationSettingsAccountsActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Account> accountStreams = new AccountDAO(LiveNotificationSettingsAccountsActivity.this, db).getAllAccountCrossAction();
|
List<Account> accountStreams = new AccountDAO(LiveNotificationSettingsAccountsActivity.this, db).getAllAccountCrossAction();
|
||||||
if (accountStreams == null || accountStreams.size() == 0) {
|
if (accountStreams == null || accountStreams.size() == 0) {
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -608,7 +608,7 @@ public class LoginActivity extends BaseActivity {
|
||||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, basicAuth);
|
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, basicAuth);
|
||||||
account.setInstance(instance);
|
account.setInstance(instance);
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(LoginActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
boolean userExists = new AccountDAO(LoginActivity.this, db).userExist(account);
|
boolean userExists = new AccountDAO(LoginActivity.this, db).userExist(account);
|
||||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||||
editor.putBoolean(Helper.PREF_IS_MODERATOR, account.isModerator());
|
editor.putBoolean(Helper.PREF_IS_MODERATOR, account.isModerator());
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
||||||
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerChartsActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(OwnerChartsActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(OwnerChartsActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
@ -169,7 +169,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
||||||
loader = findViewById(R.id.loader);
|
loader = findViewById(R.id.loader);
|
||||||
validate = findViewById(R.id.validate);
|
validate = findViewById(R.id.validate);
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerChartsActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
dateIni = new StatusCacheDAO(OwnerChartsActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
|
dateIni = new StatusCacheDAO(OwnerChartsActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||||
dateEnd = new StatusCacheDAO(OwnerChartsActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
|
dateEnd = new StatusCacheDAO(OwnerChartsActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
||||||
style = R.style.Dialog;
|
style = R.style.Dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerNotificationActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(OwnerNotificationActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(OwnerNotificationActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
Helper.loadGiF(OwnerNotificationActivity.this, account, pp_actionBar);
|
Helper.loadGiF(OwnerNotificationActivity.this, account, pp_actionBar);
|
||||||
|
@ -310,7 +310,7 @@ public class OwnerNotificationActivity extends BaseActivity implements OnRetriev
|
||||||
dialogBuilder.setView(dialogView);
|
dialogBuilder.setView(dialogView);
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerNotificationActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (dateIni == null)
|
if (dateIni == null)
|
||||||
dateIni = new NotificationCacheDAO(OwnerNotificationActivity.this, db).getSmallerDate();
|
dateIni = new NotificationCacheDAO(OwnerNotificationActivity.this, db).getSmallerDate();
|
||||||
if (dateEnd == null)
|
if (dateEnd == null)
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
||||||
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerNotificationChartsActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(OwnerNotificationChartsActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(OwnerNotificationChartsActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
@ -176,7 +176,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
||||||
loader = findViewById(R.id.loader);
|
loader = findViewById(R.id.loader);
|
||||||
validate = findViewById(R.id.validate);
|
validate = findViewById(R.id.validate);
|
||||||
LinearLayout date_container = findViewById(R.id.date_container);
|
LinearLayout date_container = findViewById(R.id.date_container);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerNotificationChartsActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (status_id == null) {
|
if (status_id == null) {
|
||||||
dateIni = new NotificationCacheDAO(OwnerNotificationChartsActivity.this, db).getSmallerDate();
|
dateIni = new NotificationCacheDAO(OwnerNotificationChartsActivity.this, db).getSmallerDate();
|
||||||
dateEnd = new NotificationCacheDAO(OwnerNotificationChartsActivity.this, db).getGreaterDate();
|
dateEnd = new NotificationCacheDAO(OwnerNotificationChartsActivity.this, db).getGreaterDate();
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
||||||
style = R.style.Dialog;
|
style = R.style.Dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerStatusActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(OwnerStatusActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(OwnerStatusActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
Helper.loadGiF(OwnerStatusActivity.this, account, pp_actionBar);
|
Helper.loadGiF(OwnerStatusActivity.this, account, pp_actionBar);
|
||||||
|
@ -319,7 +319,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
||||||
dialogBuilder.setView(dialogView);
|
dialogBuilder.setView(dialogView);
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(OwnerStatusActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (dateIni == null)
|
if (dateIni == null)
|
||||||
dateIni = new StatusCacheDAO(OwnerStatusActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
|
dateIni = new StatusCacheDAO(OwnerStatusActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||||
if (dateEnd == null)
|
if (dateEnd == null)
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PeertubeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(PeertubeActivity.this));
|
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(PeertubeActivity.this));
|
||||||
Account account = new AccountDAO(PeertubeActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(PeertubeActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
@ -609,7 +609,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
Helper.manageDownloads(PeertubeActivity.this, peertube.getFileDownloadUrl(null, peertube.isStreamService()));
|
Helper.manageDownloads(PeertubeActivity.this, peertube.getFileDownloadUrl(null, peertube.isStreamService()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PeertubeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Peertube> peertubes = new PeertubeFavoritesDAO(PeertubeActivity.this, db).getSinglePeertube(peertube);
|
List<Peertube> peertubes = new PeertubeFavoritesDAO(PeertubeActivity.this, db).getSinglePeertube(peertube);
|
||||||
|
|
||||||
Drawable img;
|
Drawable img;
|
||||||
|
|
|
@ -668,7 +668,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
}
|
}
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
ArrayList<Uri> sharedUri = new ArrayList<>();
|
ArrayList<Uri> sharedUri = new ArrayList<>();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PixelfedComposeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
restored = -1;
|
restored = -1;
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
scheduledstatus = b.getParcelable("storedStatus");
|
scheduledstatus = b.getParcelable("storedStatus");
|
||||||
|
@ -1452,10 +1452,10 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
|
|
||||||
if (apiResponse.getError() == null || apiResponse.getError().getStatusCode() != -33) {
|
if (apiResponse.getError() == null || apiResponse.getError().getStatusCode() != -33) {
|
||||||
if (restored != -1) {
|
if (restored != -1) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PixelfedComposeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StatusStoredDAO(PixelfedComposeActivity.this, db).remove(restored);
|
new StatusStoredDAO(PixelfedComposeActivity.this, db).remove(restored);
|
||||||
} else if (currentToId != -1) {
|
} else if (currentToId != -1) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PixelfedComposeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StatusStoredDAO(PixelfedComposeActivity.this, db).remove(currentToId);
|
new StatusStoredDAO(PixelfedComposeActivity.this, db).remove(currentToId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1673,7 +1673,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreToot(long id) {
|
private void restoreToot(long id) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PixelfedComposeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
StoredStatus draft = new StatusStoredDAO(PixelfedComposeActivity.this, db).getStatus(id);
|
StoredStatus draft = new StatusStoredDAO(PixelfedComposeActivity.this, db).getStatus(id);
|
||||||
if (draft == null)
|
if (draft == null)
|
||||||
return;
|
return;
|
||||||
|
@ -1886,7 +1886,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
||||||
toot.setContent(PixelfedComposeActivity.this, currentContent);
|
toot.setContent(PixelfedComposeActivity.this, currentContent);
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(PixelfedComposeActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
try {
|
try {
|
||||||
if (currentToId == -1) {
|
if (currentToId == -1) {
|
||||||
currentToId = new StatusStoredDAO(PixelfedComposeActivity.this, db).insertStatus(toot, null);
|
currentToId = new StatusStoredDAO(PixelfedComposeActivity.this, db).insertStatus(toot, null);
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
|
||||||
dialogBuilder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
dialogBuilder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(ReorderTimelinesActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instanceName = instance_list.getText().toString().trim().replace("@", "");
|
String instanceName = instance_list.getText().toString().trim().replace("@", "");
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -353,7 +353,7 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
|
||||||
updated = false;
|
updated = false;
|
||||||
RecyclerView lv_reorder_tabs = findViewById(R.id.lv_reorder_tabs);
|
RecyclerView lv_reorder_tabs = findViewById(R.id.lv_reorder_tabs);
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(ReorderTimelinesActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
timelines = new TimelinesDAO(ReorderTimelinesActivity.this, db).getAllTimelines();
|
timelines = new TimelinesDAO(ReorderTimelinesActivity.this, db).getAllTimelines();
|
||||||
adapter = new ReorderTabAdapter(timelines, ReorderTimelinesActivity.this, ReorderTimelinesActivity.this);
|
adapter = new ReorderTabAdapter(timelines, ReorderTimelinesActivity.this, ReorderTimelinesActivity.this);
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
undo_container.setVisibility(View.GONE);
|
undo_container.setVisibility(View.GONE);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(ReorderTimelinesActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
switch (manageTimelines.getType()) {
|
switch (manageTimelines.getType()) {
|
||||||
case TAG:
|
case TAG:
|
||||||
new SearchDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines.getTagTimeline().getName());
|
new SearchDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines.getTagTimeline().getName());
|
||||||
|
|
|
@ -378,7 +378,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
||||||
//Timed muted account
|
//Timed muted account
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(ShowAccountActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
final Account authenticatedAccount = new AccountDAO(ShowAccountActivity.this, db).getUniqAccount(userId, instance);
|
final Account authenticatedAccount = new AccountDAO(ShowAccountActivity.this, db).getUniqAccount(userId, instance);
|
||||||
boolean isTimedMute = new TempMuteDAO(ShowAccountActivity.this, db).isTempMuted(authenticatedAccount, accountId);
|
boolean isTimedMute = new TempMuteDAO(ShowAccountActivity.this, db).isTempMuted(authenticatedAccount, accountId);
|
||||||
if (isTimedMute) {
|
if (isTimedMute) {
|
||||||
|
@ -1110,7 +1110,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
||||||
} else {
|
} else {
|
||||||
style = R.style.Dialog;
|
style = R.style.Dialog;
|
||||||
}
|
}
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(ShowAccountActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_follow_instance:
|
case R.id.action_follow_instance:
|
||||||
String finalInstanceName = splitAcct[1];
|
String finalInstanceName = splitAcct[1];
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
detailsStatus.setFocused(true);
|
detailsStatus.setFocused(true);
|
||||||
//Some spannable
|
//Some spannable
|
||||||
Status.fillSpan(ShowConversationActivity.this, detailsStatus);
|
Status.fillSpan(ShowConversationActivity.this, detailsStatus);
|
||||||
if( detailsStatus.getPoll() != null ) {
|
if (detailsStatus.getPoll() != null) {
|
||||||
Status.makeEmojiPoll(ShowConversationActivity.this, detailsStatus.getPoll());
|
Status.makeEmojiPoll(ShowConversationActivity.this, detailsStatus.getPoll());
|
||||||
}
|
}
|
||||||
Account.makeAccountNameEmoji(ShowConversationActivity.this, detailsStatus.getAccount());
|
Account.makeAccountNameEmoji(ShowConversationActivity.this, detailsStatus.getAccount());
|
||||||
|
@ -199,7 +199,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(ShowConversationActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(ShowConversationActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(ShowConversationActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class TagCacheActivity extends BaseActivity {
|
||||||
setContentView(R.layout.activity_tag_cache);
|
setContentView(R.layout.activity_tag_cache);
|
||||||
|
|
||||||
tag_list = findViewById(R.id.tag_list);
|
tag_list = findViewById(R.id.tag_list);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(TagCacheActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
EditText tag_add = findViewById(R.id.tag_add);
|
EditText tag_add = findViewById(R.id.tag_add);
|
||||||
ImageButton save_tag = findViewById(R.id.save_tag);
|
ImageButton save_tag = findViewById(R.id.save_tag);
|
||||||
|
|
||||||
|
|
|
@ -942,7 +942,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
|
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
ArrayList<Uri> sharedUri = new ArrayList<>();
|
ArrayList<Uri> sharedUri = new ArrayList<>();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(TootActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
restored = -1;
|
restored = -1;
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
tootReply = b.getParcelable("tootReply");
|
tootReply = b.getParcelable("tootReply");
|
||||||
|
@ -1643,7 +1643,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(@NotNull MenuItem item) {
|
public boolean onOptionsItemSelected(@NotNull MenuItem item) {
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(TootActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
int style;
|
int style;
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
@ -2250,7 +2250,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
}
|
}
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
MenuItem itemEmoji = menu.findItem(R.id.action_emoji);
|
MenuItem itemEmoji = menu.findItem(R.id.action_emoji);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(TootActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
final List<Emojis> emojis = new CustomEmojiDAO(TootActivity.this, db).getAllEmojis();
|
final List<Emojis> emojis = new CustomEmojiDAO(TootActivity.this, db).getAllEmojis();
|
||||||
//Displays button only if custom emojis
|
//Displays button only if custom emojis
|
||||||
if (emojis != null && emojis.size() > 0) {
|
if (emojis != null && emojis.size() > 0) {
|
||||||
|
@ -2538,10 +2538,10 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
}
|
}
|
||||||
if (apiResponse.getError() == null || apiResponse.getError().getStatusCode() != -33) {
|
if (apiResponse.getError() == null || apiResponse.getError().getStatusCode() != -33) {
|
||||||
if (restored != -1) {
|
if (restored != -1) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(TootActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StatusStoredDAO(TootActivity.this, db).remove(restored);
|
new StatusStoredDAO(TootActivity.this, db).remove(restored);
|
||||||
} else if (currentToId != -1) {
|
} else if (currentToId != -1) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(TootActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StatusStoredDAO(TootActivity.this, db).remove(currentToId);
|
new StatusStoredDAO(TootActivity.this, db).remove(currentToId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2954,7 +2954,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreToot(long id) {
|
private void restoreToot(long id) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(TootActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
StoredStatus draft = new StatusStoredDAO(TootActivity.this, db).getStatus(id);
|
StoredStatus draft = new StatusStoredDAO(TootActivity.this, db).getStatus(id);
|
||||||
if (draft == null)
|
if (draft == null)
|
||||||
return;
|
return;
|
||||||
|
@ -3616,7 +3616,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
||||||
toot.setPoll(poll);
|
toot.setPoll(poll);
|
||||||
if (tootReply != null)
|
if (tootReply != null)
|
||||||
toot.setIn_reply_to_id(tootReply.getId());
|
toot.setIn_reply_to_id(tootReply.getId());
|
||||||
SQLiteDatabase db = Sqlite.getInstance(TootActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
try {
|
try {
|
||||||
if (currentToId == -1) {
|
if (currentToId == -1) {
|
||||||
currentToId = new StatusStoredDAO(TootActivity.this, db).insertStatus(toot, tootReply);
|
currentToId = new StatusStoredDAO(TootActivity.this, db).insertStatus(toot, tootReply);
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class WebviewActivity extends BaseActivity {
|
||||||
url = "http://" + url;
|
url = "http://" + url;
|
||||||
if (trackingDomains == null) {
|
if (trackingDomains == null) {
|
||||||
AsyncTask.execute(() -> {
|
AsyncTask.execute(() -> {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(WebviewActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
trackingDomains = new DomainBlockDAO(WebviewActivity.this, db).getAll();
|
trackingDomains = new DomainBlockDAO(WebviewActivity.this, db).getAll();
|
||||||
if (trackingDomains == null)
|
if (trackingDomains == null)
|
||||||
trackingDomains = new ArrayList<>();
|
trackingDomains = new ArrayList<>();
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class DownloadTrackingDomainsAsyncTask extends AsyncTask<Void, Void, Bool
|
||||||
br.close();
|
br.close();
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new DomainBlockDAO(context.get(), db).set(domains);
|
new DomainBlockDAO(context.get(), db).set(domains);
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ManagePlaylistsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
SharedPreferences sharedpreferences = contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(contextReference.get()));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(contextReference.get()));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(contextReference.get(), db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(contextReference.get(), db).getUniqAccount(userId, instance);
|
||||||
if (apiAction == action.GET_PLAYLIST) {
|
if (apiAction == action.GET_PLAYLIST) {
|
||||||
apiResponse = new PeertubeAPI(contextReference.get()).getPlayists(account.getUsername());
|
apiResponse = new PeertubeAPI(contextReference.get()).getPlayists(account.getUsername());
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
} else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS) {
|
} else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS) {
|
||||||
statusCode = api.muteNotifications(targetedId, muteNotifications);
|
statusCode = api.muteNotifications(targetedId, muteNotifications);
|
||||||
} else if (apiAction == API.StatusAction.UNBOOKMARK && targetedId == null) {
|
} else if (apiAction == API.StatusAction.UNBOOKMARK && targetedId == null) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<app.fedilab.android.client.Entities.Status> bookmarks = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
List<app.fedilab.android.client.Entities.Status> bookmarks = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
||||||
for (app.fedilab.android.client.Entities.Status status : bookmarks) {
|
for (app.fedilab.android.client.Entities.Status status : bookmarks) {
|
||||||
statusCode = api.postAction(apiAction, status.getId());
|
statusCode = api.postAction(apiAction, status.getId());
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class PostStatusAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
public void run() {
|
public void run() {
|
||||||
String content = status.getContent();
|
String content = status.getContent();
|
||||||
if (content != null && content.length() > 0) {
|
if (content != null && content.length() > 0) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Matcher matcher = Helper.hashtagPattern.matcher(content);
|
Matcher matcher = Helper.hashtagPattern.matcher(content);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
int matchStart = matcher.start(1);
|
int matchStart = matcher.start(1);
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class RemoveAccountAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activityReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activityReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new AccountDAO(activityReference.get(), db).removeUser(account);
|
new AccountDAO(activityReference.get(), db).removeUser(account);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class RetrieveAccountsForReplyAsyncTask extends AsyncTask<Void, Void, Voi
|
||||||
|
|
||||||
private boolean canBeAdded(String acct) {
|
private boolean canBeAdded(String acct) {
|
||||||
final SharedPreferences sharedpreferences = this.contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = this.contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account currentAccount = new AccountDAO(this.contextReference.get(), db).getUniqAccount(userId, instance);
|
Account currentAccount = new AccountDAO(this.contextReference.get(), db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class RetrieveChartsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
charts = new StatusCacheDAO(contextReference.get(), db).getCharts(dateIni, dateEnd);
|
charts = new StatusCacheDAO(contextReference.get(), db).getCharts(dateIni, dateEnd);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class RetrieveEmojiAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
emojis = new CustomEmojiDAO(contextReference.get(), db).getEmojiStartingBy(shortcode);
|
emojis = new CustomEmojiDAO(contextReference.get(), db).getEmojiStartingBy(shortcode);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
API api = new API(this.contextReference.get());
|
API api = new API(this.contextReference.get());
|
||||||
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (action == null)
|
if (action == null)
|
||||||
return null;
|
return null;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
@ -365,24 +365,24 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
break;
|
break;
|
||||||
case CACHE_BOOKMARKS:
|
case CACHE_BOOKMARKS:
|
||||||
apiResponse = new APIResponse();
|
apiResponse = new APIResponse();
|
||||||
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<app.fedilab.android.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
List<app.fedilab.android.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
||||||
for(app.fedilab.android.client.Entities.Status status: statuses){
|
for (app.fedilab.android.client.Entities.Status status : statuses) {
|
||||||
app.fedilab.android.client.Entities.Status.fillSpan(contextReference.get(), status);
|
app.fedilab.android.client.Entities.Status.fillSpan(contextReference.get(), status);
|
||||||
app.fedilab.android.client.Entities.Status.makeEmojiPoll(contextReference.get(), status.getReblog()!= null?status.getReblog().getPoll():status.getPoll());
|
app.fedilab.android.client.Entities.Status.makeEmojiPoll(contextReference.get(), status.getReblog() != null ? status.getReblog().getPoll() : status.getPoll());
|
||||||
Account.makeAccountNameEmoji(contextReference.get(), status.getReblog()!= null?status.getReblog().getAccount():status.getAccount());
|
Account.makeAccountNameEmoji(contextReference.get(), status.getReblog() != null ? status.getReblog().getAccount() : status.getAccount());
|
||||||
}
|
}
|
||||||
apiResponse.setStatuses(statuses);
|
apiResponse.setStatuses(statuses);
|
||||||
break;
|
break;
|
||||||
case CACHE_BOOKMARKS_PEERTUBE:
|
case CACHE_BOOKMARKS_PEERTUBE:
|
||||||
apiResponse = new APIResponse();
|
apiResponse = new APIResponse();
|
||||||
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Peertube> peertubes = new PeertubeFavoritesDAO(contextReference.get(), db).getAllPeertube();
|
List<Peertube> peertubes = new PeertubeFavoritesDAO(contextReference.get(), db).getAllPeertube();
|
||||||
apiResponse.setPeertubes(peertubes);
|
apiResponse.setPeertubes(peertubes);
|
||||||
break;
|
break;
|
||||||
case CACHE_STATUS:
|
case CACHE_STATUS:
|
||||||
apiResponse = new APIResponse();
|
apiResponse = new APIResponse();
|
||||||
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, filterToots, max_id);
|
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, filterToots, max_id);
|
||||||
if (statuses != null && statuses.size() > 0) {
|
if (statuses != null && statuses.size() > 0) {
|
||||||
apiResponse.setStatuses(statuses);
|
apiResponse.setStatuses(statuses);
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class RetrieveMissingFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
else if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE)
|
else if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE)
|
||||||
apiResponse = api.getInstanceTimelineSinceId(remoteInstance, since_id);
|
apiResponse = api.getInstanceTimelineSinceId(remoteInstance, since_id);
|
||||||
else if (type == RetrieveFeedsAsyncTask.Type.TAG) {
|
else if (type == RetrieveFeedsAsyncTask.Type.TAG) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
ManageTimelines manageTimelines = new TimelinesDAO(contextReference.get(), db).getById(timelineId);
|
ManageTimelines manageTimelines = new TimelinesDAO(contextReference.get(), db).getById(timelineId);
|
||||||
if (manageTimelines != null && manageTimelines.getTagTimeline() != null) {
|
if (manageTimelines != null && manageTimelines.getTagTimeline() != null) {
|
||||||
TagTimeline tagTimeline = manageTimelines.getTagTimeline();
|
TagTimeline tagTimeline = manageTimelines.getTagTimeline();
|
||||||
|
@ -146,7 +146,7 @@ public class RetrieveMissingFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
else if (type == RetrieveFeedsAsyncTask.Type.GNU_WHOLE)
|
else if (type == RetrieveFeedsAsyncTask.Type.GNU_WHOLE)
|
||||||
apiResponse = gnuapi.getPublicTimelineSinceId(false, since_id);
|
apiResponse = gnuapi.getPublicTimelineSinceId(false, since_id);
|
||||||
else if (type == RetrieveFeedsAsyncTask.Type.GNU_TAG) {
|
else if (type == RetrieveFeedsAsyncTask.Type.GNU_TAG) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<TagTimeline> tagTimelines = new SearchDAO(contextReference.get(), db).getTimelineInfo(remoteInstance);
|
List<TagTimeline> tagTimelines = new SearchDAO(contextReference.get(), db).getTimelineInfo(remoteInstance);
|
||||||
if (tagTimelines != null && tagTimelines.size() > 0) {
|
if (tagTimelines != null && tagTimelines.size() > 0) {
|
||||||
TagTimeline tagTimeline = tagTimelines.get(0);
|
TagTimeline tagTimeline = tagTimelines.get(0);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class RetrieveNotificationChartsAsyncTask extends AsyncTask<Void, Void, V
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
charts = new NotificationCacheDAO(contextReference.get(), db).getChartsEvolution(status_id, dateIni, dateEnd);
|
charts = new NotificationCacheDAO(contextReference.get(), db).getChartsEvolution(status_id, dateIni, dateEnd);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class RetrieveNotificationStatsAsyncTask extends AsyncTask<Void, Void, Vo
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
statistics = new NotificationCacheDAO(contextReference.get(), db).getStat();
|
statistics = new NotificationCacheDAO(contextReference.get(), db).getStat();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class RetrieveNotificationsCacheAsyncTask extends AsyncTask<Void, Void, V
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Notification> notifications = new NotificationCacheDAO(contextReference.get(), db).getNotificationsFromID(filterNotifications, max_id);
|
List<Notification> notifications = new NotificationCacheDAO(contextReference.get(), db).getNotificationsFromID(filterNotifications, max_id);
|
||||||
apiResponse = new APIResponse();
|
apiResponse = new APIResponse();
|
||||||
apiResponse.setNotifications(notifications);
|
apiResponse.setNotifications(notifications);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class RetrievePeertubeChannelsAsyncTask extends AsyncTask<Void, Void, Voi
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
|
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
SharedPreferences sharedpreferences = contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(contextReference.get()));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(contextReference.get()));
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class RetrieveScheduledTootsAsyncTask extends AsyncTask<Void, Void, Void>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//Retrieves job asked by the user
|
//Retrieves job asked by the user
|
||||||
if (type == DisplayScheduledTootsFragment.typeOfSchedule.TOOT)
|
if (type == DisplayScheduledTootsFragment.typeOfSchedule.TOOT)
|
||||||
storedStatuses = new StatusStoredDAO(this.contextReference.get(), db).getAllScheduled();
|
storedStatuses = new StatusStoredDAO(this.contextReference.get(), db).getAllScheduled();
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class RetrieveSearchAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
else {
|
else {
|
||||||
//search tags only
|
//search tags only
|
||||||
apiResponse = api.search(query);
|
apiResponse = api.search(query);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<String> cachedTags = new TagsCacheDAO(contextReference.get(), db).getBy(query);
|
List<String> cachedTags = new TagsCacheDAO(contextReference.get(), db).getBy(query);
|
||||||
if (apiResponse != null && apiResponse.getResults() != null && apiResponse.getResults().getHashtags() != null) {
|
if (apiResponse != null && apiResponse.getResults() != null && apiResponse.getResults().getHashtags() != null) {
|
||||||
//If cache contains matching tags
|
//If cache contains matching tags
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class RetrieveStatsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
statistics = new StatusCacheDAO(contextReference.get(), db).getStat();
|
statistics = new StatusCacheDAO(contextReference.get(), db).getStat();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class SyncBookmarksAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (type == sync.IMPORT) {
|
if (type == sync.IMPORT) {
|
||||||
String max_id = null;
|
String max_id = null;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class SyncTimelinesAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
manageTimelines = new TimelinesDAO(contextReference.get(), db).getAllTimelines();
|
manageTimelines = new TimelinesDAO(contextReference.get(), db).getAllTimelines();
|
||||||
//First time that the timeline is created
|
//First time that the timeline is created
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class UpdateAccountInfoAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
account.setClient_secret(client_secret);
|
account.setClient_secret(client_secret);
|
||||||
account.setRefresh_token(refresh_token);
|
account.setRefresh_token(refresh_token);
|
||||||
account.setInstance(instance);
|
account.setInstance(instance);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
boolean userExists = new AccountDAO(this.contextReference.get(), db).userExist(account);
|
boolean userExists = new AccountDAO(this.contextReference.get(), db).userExist(account);
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class UpdateAccountInfoByIDAsyncTask extends AsyncTask<Void, Void, Void>
|
||||||
if (account == null)
|
if (account == null)
|
||||||
return null;
|
return null;
|
||||||
account.setInstance(Helper.getLiveInstance(contextReference.get()));
|
account.setInstance(Helper.getLiveInstance(contextReference.get()));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(this.contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
boolean userExists = new AccountDAO(this.contextReference.get(), db).userExist(account);
|
boolean userExists = new AccountDAO(this.contextReference.get(), db).userExist(account);
|
||||||
if (userExists) {
|
if (userExists) {
|
||||||
Account accountDb = new AccountDAO(this.contextReference.get(), db).getUniqAccount(userId, instance);
|
Account accountDb = new AccountDAO(this.contextReference.get(), db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class API {
|
||||||
if (Helper.getLiveInstance(context) != null)
|
if (Helper.getLiveInstance(context) != null)
|
||||||
this.instance = Helper.getLiveInstance(context);
|
this.instance = Helper.getLiveInstance(context);
|
||||||
else {
|
else {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
@ -1360,7 +1360,7 @@ public class API {
|
||||||
account.setUsername(resobj.get("username").toString());
|
account.setUsername(resobj.get("username").toString());
|
||||||
account.setAcct(resobj.get("acct").toString());
|
account.setAcct(resobj.get("acct").toString());
|
||||||
account.setDisplay_name(resobj.get("display_name").toString());
|
account.setDisplay_name(resobj.get("display_name").toString());
|
||||||
if( account.getDisplay_name() == null || account.getDisplay_name().compareTo("") == 0){
|
if (account.getDisplay_name() == null || account.getDisplay_name().compareTo("") == 0) {
|
||||||
account.setDisplay_name(resobj.get("username").toString());
|
account.setDisplay_name(resobj.get("username").toString());
|
||||||
}
|
}
|
||||||
account.setLocked(Boolean.parseBoolean(resobj.get("locked").toString()));
|
account.setLocked(Boolean.parseBoolean(resobj.get("locked").toString()));
|
||||||
|
@ -2452,7 +2452,7 @@ public class API {
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if (e.getStatusCode() == 401 || e.getStatusCode() == 403) {
|
if (e.getStatusCode() == 401 || e.getStatusCode() == 403) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account targetedAccount = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account targetedAccount = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
if (targetedAccount == null)
|
if (targetedAccount == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -2843,7 +2843,7 @@ public class API {
|
||||||
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
||||||
String response = httpsConnection.get(getAbsoluteUrl(String.format("/statuses/%s", statusId)), 10, null, prefKeyOauthTokenT);
|
String response = httpsConnection.get(getAbsoluteUrl(String.format("/statuses/%s", statusId)), 10, null, prefKeyOauthTokenT);
|
||||||
Status status = parseStatuses(context, new JSONObject(response));
|
Status status = parseStatuses(context, new JSONObject(response));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
new TimelineCacheDAO(context, db).update(status.getId(), response, account.getId(), account.getInstance());
|
new TimelineCacheDAO(context, db).update(status.getId(), response, account.getId(), account.getInstance());
|
||||||
statuses.add(status);
|
statuses.add(status);
|
||||||
|
@ -3030,7 +3030,7 @@ public class API {
|
||||||
*/
|
*/
|
||||||
public APIResponse getHomeTimelineCache(String max_id) {
|
public APIResponse getHomeTimelineCache(String max_id) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
statuses = new TimelineCacheDAO(context, db).get(max_id);
|
statuses = new TimelineCacheDAO(context, db).get(max_id);
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
@ -4341,7 +4341,7 @@ public class API {
|
||||||
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
||||||
intentBC.putExtras(b);
|
intentBC.putExtras(b);
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
|
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
Status indb = new TimelineCacheDAO(context, db).getSingle(targetedId);
|
Status indb = new TimelineCacheDAO(context, db).getSingle(targetedId);
|
||||||
if (indb != null) {
|
if (indb != null) {
|
||||||
|
@ -4371,7 +4371,7 @@ public class API {
|
||||||
httpsConnection.delete(getAbsoluteUrl(action), 10, null, prefKeyOauthTokenT);
|
httpsConnection.delete(getAbsoluteUrl(action), 10, null, prefKeyOauthTokenT);
|
||||||
actionCode = httpsConnection.getActionCode();
|
actionCode = httpsConnection.getActionCode();
|
||||||
if (statusAction != StatusAction.REMOVE_REACTION && statusAction != StatusAction.REMOVE_PLEROMA_REACTION) {
|
if (statusAction != StatusAction.REMOVE_REACTION && statusAction != StatusAction.REMOVE_PLEROMA_REACTION) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new TimelineCacheDAO(context, db).remove(targetedId);
|
new TimelineCacheDAO(context, db).remove(targetedId);
|
||||||
}
|
}
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
@ -4533,7 +4533,7 @@ public class API {
|
||||||
b.putParcelable("status", status);
|
b.putParcelable("status", status);
|
||||||
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
||||||
intentBC.putExtras(b);
|
intentBC.putExtras(b);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Status alreadyCached = new TimelineCacheDAO(context, db).getSingle(status.getId());
|
Status alreadyCached = new TimelineCacheDAO(context, db).getSingle(status.getId());
|
||||||
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
if (alreadyCached != null) {
|
if (alreadyCached != null) {
|
||||||
|
@ -5655,7 +5655,7 @@ public class API {
|
||||||
* @return List<Status>
|
* @return List<Status>
|
||||||
*/
|
*/
|
||||||
private List<Status> parseStatusesForCache(Context context, JSONArray jsonArray) {
|
private List<Status> parseStatusesForCache(Context context, JSONArray jsonArray) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
List<Status> statuses = new ArrayList<>();
|
List<Status> statuses = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -678,7 +678,7 @@ public class ManageTimelines {
|
||||||
PopupMenu popup = new PopupMenu(context, tabStrip.getChildAt(position));
|
PopupMenu popup = new PopupMenu(context, tabStrip.getChildAt(position));
|
||||||
TabLayout tabLayout = ((MainActivity) context).findViewById(R.id.tabLayout);
|
TabLayout tabLayout = ((MainActivity) context).findViewById(R.id.tabLayout);
|
||||||
tabLayout.setBackgroundColor(ContextCompat.getColor(Objects.requireNonNull(context), R.color.cyanea_primary));
|
tabLayout.setBackgroundColor(ContextCompat.getColor(Objects.requireNonNull(context), R.color.cyanea_primary));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
int style;
|
int style;
|
||||||
|
@ -879,7 +879,7 @@ public class ManageTimelines {
|
||||||
|
|
||||||
|
|
||||||
PopupMenu popup = new PopupMenu(context, tabStrip.getChildAt(position));
|
PopupMenu popup = new PopupMenu(context, tabStrip.getChildAt(position));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
int style;
|
int style;
|
||||||
|
|
|
@ -17,6 +17,7 @@ package app.fedilab.android.client.Entities;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,17 @@ import java.util.List;
|
||||||
|
|
||||||
public class Poll implements Parcelable {
|
public class Poll implements Parcelable {
|
||||||
|
|
||||||
|
public static final Creator<Poll> CREATOR = new Creator<Poll>() {
|
||||||
|
@Override
|
||||||
|
public Poll createFromParcel(Parcel source) {
|
||||||
|
return new Poll(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Poll[] newArray(int size) {
|
||||||
|
return new Poll[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
private String id;
|
private String id;
|
||||||
private Date expires_at;
|
private Date expires_at;
|
||||||
private int expires_in;
|
private int expires_in;
|
||||||
|
@ -39,6 +50,22 @@ public class Poll implements Parcelable {
|
||||||
public Poll() {
|
public Poll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Poll(Parcel in) {
|
||||||
|
this.id = in.readString();
|
||||||
|
long tmpExpires_at = in.readLong();
|
||||||
|
this.expires_at = tmpExpires_at == -1 ? null : new Date(tmpExpires_at);
|
||||||
|
this.expires_in = in.readInt();
|
||||||
|
this.expired = in.readByte() != 0;
|
||||||
|
this.multiple = in.readByte() != 0;
|
||||||
|
this.votes_count = in.readInt();
|
||||||
|
this.voters_count = in.readInt();
|
||||||
|
this.voted = in.readByte() != 0;
|
||||||
|
this.optionsList = in.createTypedArrayList(PollOptions.CREATOR);
|
||||||
|
this.emojis = in.createTypedArrayList(Emojis.CREATOR);
|
||||||
|
this.own_votes = new ArrayList<>();
|
||||||
|
in.readList(this.own_votes, Integer.class.getClassLoader());
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -146,32 +173,4 @@ public class Poll implements Parcelable {
|
||||||
dest.writeTypedList(this.emojis);
|
dest.writeTypedList(this.emojis);
|
||||||
dest.writeList(this.own_votes);
|
dest.writeList(this.own_votes);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Poll(Parcel in) {
|
|
||||||
this.id = in.readString();
|
|
||||||
long tmpExpires_at = in.readLong();
|
|
||||||
this.expires_at = tmpExpires_at == -1 ? null : new Date(tmpExpires_at);
|
|
||||||
this.expires_in = in.readInt();
|
|
||||||
this.expired = in.readByte() != 0;
|
|
||||||
this.multiple = in.readByte() != 0;
|
|
||||||
this.votes_count = in.readInt();
|
|
||||||
this.voters_count = in.readInt();
|
|
||||||
this.voted = in.readByte() != 0;
|
|
||||||
this.optionsList = in.createTypedArrayList(PollOptions.CREATOR);
|
|
||||||
this.emojis = in.createTypedArrayList(Emojis.CREATOR);
|
|
||||||
this.own_votes = new ArrayList<>();
|
|
||||||
in.readList(this.own_votes, Integer.class.getClassLoader());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<Poll> CREATOR = new Creator<Poll>() {
|
|
||||||
@Override
|
|
||||||
public Poll createFromParcel(Parcel source) {
|
|
||||||
return new Poll(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Poll[] newArray(int size) {
|
|
||||||
return new Poll[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ public class Status implements Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void fillSpan(Context context, Status status){
|
public static void fillSpan(Context context, Status status) {
|
||||||
Status.transform(context, status);
|
Status.transform(context, status);
|
||||||
Status.makeEmojis(context, status);
|
Status.makeEmojis(context, status);
|
||||||
Status.makeImage(context, status);
|
Status.makeImage(context, status);
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class GNUAPI {
|
||||||
if (Helper.getLiveInstance(context) != null)
|
if (Helper.getLiveInstance(context) != null)
|
||||||
this.instance = Helper.getLiveInstance(context);
|
this.instance = Helper.getLiveInstance(context);
|
||||||
else {
|
else {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
|
@ -1598,11 +1598,11 @@ public class GNUAPI {
|
||||||
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
||||||
intentBC.putExtras(b);
|
intentBC.putExtras(b);
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
|
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
new TimelineCacheDAO(context, db).update(targetedId, resp, account.getId(), account.getToken());
|
new TimelineCacheDAO(context, db).update(targetedId, resp, account.getId(), account.getToken());
|
||||||
} else if (statusAction == API.StatusAction.UNSTATUS) {
|
} else if (statusAction == API.StatusAction.UNSTATUS) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new TimelineCacheDAO(context, db).remove(targetedId);
|
new TimelineCacheDAO(context, db).remove(targetedId);
|
||||||
}
|
}
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
@ -1640,7 +1640,7 @@ public class GNUAPI {
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
//Current user
|
//Current user
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account currentAccount = new AccountDAO(context, db).getUniqAccount(userId, Helper.getLiveInstance(context));
|
Account currentAccount = new AccountDAO(context, db).getUniqAccount(userId, Helper.getLiveInstance(context));
|
||||||
params.put("user_id", currentAccount.getId());
|
params.put("user_id", currentAccount.getId());
|
||||||
params.put("screen_name", currentAccount.getAcct());
|
params.put("screen_name", currentAccount.getAcct());
|
||||||
|
@ -1727,7 +1727,7 @@ public class GNUAPI {
|
||||||
String url = null;
|
String url = null;
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
//Current user
|
//Current user
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class PeertubeAPI {
|
||||||
if (Helper.getLiveInstance(context) != null)
|
if (Helper.getLiveInstance(context) != null)
|
||||||
this.instance = Helper.getLiveInstance(context);
|
this.instance = Helper.getLiveInstance(context);
|
||||||
else {
|
else {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
@ -662,7 +662,7 @@ public class PeertubeAPI {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
if (e.getStatusCode() == 401 || e.getStatusCode() == 403) {
|
if (e.getStatusCode() == 401 || e.getStatusCode() == 403) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account targetedAccount = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account targetedAccount = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
if (targetedAccount != null) {
|
if (targetedAccount != null) {
|
||||||
HashMap<String, String> values = refreshToken(targetedAccount.getClient_id(), targetedAccount.getClient_secret(), targetedAccount.getRefresh_token());
|
HashMap<String, String> values = refreshToken(targetedAccount.getClient_id(), targetedAccount.getClient_secret(), targetedAccount.getRefresh_token());
|
||||||
|
@ -1057,7 +1057,7 @@ public class PeertubeAPI {
|
||||||
return getTL("/users/me/subscriptions/videos", "-publishedAt", null, max_id, null, null);
|
return getTL("/users/me/subscriptions/videos", "-publishedAt", null, max_id, null, null);
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
if (e.getStatusCode() == 401 || e.getStatusCode() == 403) {
|
if (e.getStatusCode() == 401 || e.getStatusCode() == 403) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account targetedAccount = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
Account targetedAccount = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
|
||||||
HashMap<String, String> values = refreshToken(targetedAccount.getClient_id(), targetedAccount.getClient_secret(), targetedAccount.getRefresh_token());
|
HashMap<String, String> values = refreshToken(targetedAccount.getClient_id(), targetedAccount.getClient_secret(), targetedAccount.getRefresh_token());
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class PixelfedAPI {
|
||||||
if (Helper.getLiveInstance(context) != null)
|
if (Helper.getLiveInstance(context) != null)
|
||||||
this.instance = Helper.getLiveInstance(context);
|
this.instance = Helper.getLiveInstance(context);
|
||||||
else {
|
else {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -305,7 +305,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
}
|
}
|
||||||
if (statusAction == API.StatusAction.FOLLOW) {
|
if (statusAction == API.StatusAction.FOLLOW) {
|
||||||
if (action == RetrieveAccountsAsyncTask.Type.CHANNELS) {
|
if (action == RetrieveAccountsAsyncTask.Type.CHANNELS) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new InstancesDAO(context, db).insertInstance(accounts.get(0).getAcct().split("@")[1], accounts.get(0).getAcct().split("@")[0], "PEERTUBE_CHANNEL");
|
new InstancesDAO(context, db).insertInstance(accounts.get(0).getAcct().split("@")[1], accounts.get(0).getAcct().split("@")[0], "PEERTUBE_CHANNEL");
|
||||||
} else {
|
} else {
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
||||||
|
|
||||||
if (owner) {
|
if (owner) {
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account currentAccount = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account currentAccount = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
|
||||||
if (status.getId().equals(targetedId)) {
|
if (status.getId().equals(targetedId)) {
|
||||||
statuses.remove(status);
|
statuses.remove(status);
|
||||||
statusListAdapter.notifyItemRemoved(position);
|
statusListAdapter.notifyItemRemoved(position);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//Remove the status from cache also
|
//Remove the status from cache also
|
||||||
try {
|
try {
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class DraftsListAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
|
||||||
if (this.clickable) {
|
if (this.clickable) {
|
||||||
if (draft.getStatus().getContent().length() > 300)
|
if (draft.getStatus().getContent().length() > 300)
|
||||||
|
|
|
@ -14,6 +14,7 @@ package app.fedilab.android.drawers;
|
||||||
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
|
@ -128,7 +129,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
private NotificationsListAdapter.ViewHolder holder;
|
private NotificationsListAdapter.ViewHolder holder;
|
||||||
private int style;
|
private int style;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private List<NotificationsListAdapter.ViewHolder> lstHolders;
|
|
||||||
private Runnable updateAnimatedEmoji = new Runnable() {
|
private Runnable updateAnimatedEmoji = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -136,17 +137,11 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
if (mRecyclerView != null && (mRecyclerView.getLayoutManager()) != null) {
|
if (mRecyclerView != null && (mRecyclerView.getLayoutManager()) != null) {
|
||||||
int firstPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
|
int firstPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
|
||||||
int lastPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findLastCompletelyVisibleItemPosition();
|
int lastPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findLastCompletelyVisibleItemPosition();
|
||||||
|
for (int i = firstPosition; i <= lastPosition; i++) {
|
||||||
for (NotificationsListAdapter.ViewHolder holder : lstHolders) {
|
if (mRecyclerView.findViewHolderForAdapterPosition(i) != null) {
|
||||||
|
((ViewHolder) Objects.requireNonNull(mRecyclerView.findViewHolderForAdapterPosition(i))).updateAnimatedEmoji();
|
||||||
if (holder.getLayoutPosition() >= firstPosition && holder.getLayoutPosition() <= lastPosition) {
|
|
||||||
holder.updateAnimatedEmoji();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (NotificationsListAdapter.ViewHolder holder : lstHolders) {
|
|
||||||
holder.updateAnimatedEmoji();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,8 +154,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
notificationsListAdapter = this;
|
notificationsListAdapter = this;
|
||||||
this.isOnWifi = isOnWifi;
|
this.isOnWifi = isOnWifi;
|
||||||
this.behaviorWithAttachments = behaviorWithAttachments;
|
this.behaviorWithAttachments = behaviorWithAttachments;
|
||||||
lstHolders = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +177,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_notification, parent, false));
|
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_notification, parent, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
|
|
||||||
|
@ -191,9 +185,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
context = holder.status_document_container.getContext();
|
context = holder.status_document_container.getContext();
|
||||||
|
|
||||||
|
|
||||||
synchronized (lock) {
|
|
||||||
lstHolders.add(holder);
|
|
||||||
}
|
|
||||||
holder.startUpdateTimer();
|
holder.startUpdateTimer();
|
||||||
final Notification notification = notifications.get(position);
|
final Notification notification = notifications.get(position);
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
@ -537,7 +528,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
if (pollOption.getVotes_count() > greaterValue)
|
if (pollOption.getVotes_count() > greaterValue)
|
||||||
greaterValue = pollOption.getVotes_count();
|
greaterValue = pollOption.getVotes_count();
|
||||||
}
|
}
|
||||||
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
|
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
|
||||||
holder.rated.removeAllViews();
|
holder.rated.removeAllViews();
|
||||||
List<Integer> ownvotes = poll.getOwn_votes();
|
List<Integer> ownvotes = poll.getOwn_votes();
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -547,11 +538,11 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
TextView poll_item_percent = item.findViewById(R.id.poll_item_percent);
|
TextView poll_item_percent = item.findViewById(R.id.poll_item_percent);
|
||||||
TextView poll_item_text = item.findViewById(R.id.poll_item_text);
|
TextView poll_item_text = item.findViewById(R.id.poll_item_text);
|
||||||
ProgressBar poll_item_value = item.findViewById(R.id.poll_item_value);
|
ProgressBar poll_item_value = item.findViewById(R.id.poll_item_value);
|
||||||
poll_item_percent.setText(String.format("%s %%", String.valueOf((int)value)));
|
poll_item_percent.setText(String.format("%s %%", String.valueOf((int) value)));
|
||||||
poll_item_text.setText(pollOption.getTitle(), TextView.BufferType.SPANNABLE);
|
poll_item_text.setText(pollOption.getTitle(), TextView.BufferType.SPANNABLE);
|
||||||
poll_item_value.setProgress((int)value);
|
poll_item_value.setProgress((int) value);
|
||||||
holder.rated.addView(item);
|
holder.rated.addView(item);
|
||||||
if( pollOption.getVotes_count() == greaterValue ){
|
if (pollOption.getVotes_count() == greaterValue) {
|
||||||
poll_item_percent.setTypeface(null, Typeface.BOLD);
|
poll_item_percent.setTypeface(null, Typeface.BOLD);
|
||||||
poll_item_text.setTypeface(null, Typeface.BOLD);
|
poll_item_text.setTypeface(null, Typeface.BOLD);
|
||||||
}
|
}
|
||||||
|
@ -687,9 +678,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
holder.status_reblog_count.setVisibility(View.VISIBLE);
|
holder.status_reblog_count.setVisibility(View.VISIBLE);
|
||||||
holder.spark_button_reblog.setVisibility(View.VISIBLE);
|
holder.spark_button_reblog.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
holder.status_reblog_count.setVisibility(View.VISIBLE);
|
|
||||||
holder.spark_button_reblog.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||||
if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0) {
|
if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
long id = new StatusStoredDAO(context, db).insertStatus(toot, apiResponse.getStatuses().get(0));
|
long id = new StatusStoredDAO(context, db).insertStatus(toot, apiResponse.getStatuses().get(0));
|
||||||
Intent intentToot = new Intent(context, PixelfedComposeActivity.class);
|
Intent intentToot = new Intent(context, PixelfedComposeActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
@ -470,7 +470,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
comment_content.setInputType(newInputType);
|
comment_content.setInputType(newInputType);
|
||||||
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
||||||
|
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
|
@ -750,7 +750,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
case R.id.action_bookmark:
|
case R.id.action_bookmark:
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS) {
|
if (type != RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS) {
|
||||||
status.setBookmarked(!status.isBookmarked());
|
status.setBookmarked(!status.isBookmarked());
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
try {
|
try {
|
||||||
if (status.isBookmarked()) {
|
if (status.isBookmarked()) {
|
||||||
new StatusCacheDAO(context, db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, status);
|
new StatusCacheDAO(context, db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, status);
|
||||||
|
@ -770,7 +770,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
if (statustmp.getId().equals(status.getId())) {
|
if (statustmp.getId().equals(status.getId())) {
|
||||||
statuses.remove(status);
|
statuses.remove(status);
|
||||||
pixelfedListAdapter.notifyItemRemoved(position);
|
pixelfedListAdapter.notifyItemRemoved(position);
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.BOOKMARK_CACHE, statustmp);
|
new StatusCacheDAO(context, db).remove(StatusCacheDAO.BOOKMARK_CACHE, statustmp);
|
||||||
Toasty.success(context, context.getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
Toasty.success(context, context.getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
||||||
break;
|
break;
|
||||||
|
@ -899,7 +899,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
} else if (status.getReblog() != null && status.getReblog().getPoll() != null) {
|
} else if (status.getReblog() != null && status.getReblog().getPoll() != null) {
|
||||||
toot.setPoll(status.getPoll());
|
toot.setPoll(status.getPoll());
|
||||||
}
|
}
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
long id = new StatusStoredDAO(context, db).insertStatus(toot, null);
|
long id = new StatusStoredDAO(context, db).insertStatus(toot, null);
|
||||||
Intent intentToot = new Intent(context, PixelfedComposeActivity.class);
|
Intent intentToot = new Intent(context, PixelfedComposeActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
@ -1114,7 +1114,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
tootContent = comment_content.getText().toString().trim();
|
tootContent = comment_content.getText().toString().trim();
|
||||||
Status toot = new Status();
|
Status toot = new Status();
|
||||||
toot.setSensitive(false);
|
toot.setSensitive(false);
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
toot.setVisibility(visibility);
|
toot.setVisibility(visibility);
|
||||||
toot.setIn_reply_to_id(in_reply_to_status);
|
toot.setIn_reply_to_id(in_reply_to_status);
|
||||||
|
@ -1148,7 +1148,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
if (status.getId().equals(targetedId)) {
|
if (status.getId().equals(targetedId)) {
|
||||||
statuses.remove(status);
|
statuses.remove(status);
|
||||||
pixelfedListAdapter.notifyItemRemoved(position);
|
pixelfedListAdapter.notifyItemRemoved(position);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//Remove the status from cache also
|
//Remove the status from cache also
|
||||||
try {
|
try {
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
||||||
|
@ -1235,7 +1235,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
||||||
//Store the toot as draft first
|
//Store the toot as draft first
|
||||||
String targeted_id = status.getAccount().getId();
|
String targeted_id = status.getAccount().getId();
|
||||||
Date date_mute = new Date(time);
|
Date date_mute = new Date(time);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class ReorderTabAdapter extends RecyclerView.Adapter<ReorderTabAdapter.It
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.hideView.setOnClickListener(v -> {
|
holder.hideView.setOnClickListener(v -> {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
int count = new TimelinesDAO(context, db).countVisibleTimelines();
|
int count = new TimelinesDAO(context, db).countVisibleTimelines();
|
||||||
if (count > 2 || !tl.isDisplayed()) {
|
if (count > 2 || !tl.isDisplayed()) {
|
||||||
tl.setDisplayed(!tl.isDisplayed());
|
tl.setDisplayed(!tl.isDisplayed());
|
||||||
|
@ -216,7 +216,7 @@ public class ReorderTabAdapter extends RecyclerView.Adapter<ReorderTabAdapter.It
|
||||||
public boolean onItemMove(int fromPosition, int toPosition) {
|
public boolean onItemMove(int fromPosition, int toPosition) {
|
||||||
Collections.swap(mItems, fromPosition, toPosition);
|
Collections.swap(mItems, fromPosition, toPosition);
|
||||||
notifyItemMoved(fromPosition, toPosition);
|
notifyItemMoved(fromPosition, toPosition);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ManageTimelines timelines : mItems) {
|
for (ManageTimelines timelines : mItems) {
|
||||||
timelines.setPosition(i);
|
timelines.setPosition(i);
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class ScheduledTootsListAdapter extends BaseAdapter implements OnPostActi
|
||||||
holder.scheduled_toot_privacy.setImageResource(R.drawable.ic_mail_outline);
|
holder.scheduled_toot_privacy.setImageResource(R.drawable.ic_mail_outline);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
int style;
|
int style;
|
||||||
if (theme == Helper.THEME_DARK) {
|
if (theme == Helper.THEME_DARK) {
|
||||||
style = R.style.DialogDark;
|
style = R.style.DialogDark;
|
||||||
|
|
|
@ -108,6 +108,7 @@ import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
@ -223,10 +224,10 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
private Status tootReply;
|
private Status tootReply;
|
||||||
private long currentToId;
|
private long currentToId;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private List<ViewHolder> lstHolders;
|
|
||||||
private List<Emojis> emojisPicker;
|
private List<Emojis> emojisPicker;
|
||||||
private Status statusForQuickReply;
|
private Status statusForQuickReply;
|
||||||
private String instanceType;
|
private String instanceType;
|
||||||
|
|
||||||
private Runnable updateAnimatedEmoji = new Runnable() {
|
private Runnable updateAnimatedEmoji = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -234,15 +235,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if (mRecyclerView != null && (mRecyclerView.getLayoutManager()) != null) {
|
if (mRecyclerView != null && (mRecyclerView.getLayoutManager()) != null) {
|
||||||
int firstPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
|
int firstPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
|
||||||
int lastPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findLastCompletelyVisibleItemPosition();
|
int lastPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findLastCompletelyVisibleItemPosition();
|
||||||
for (ViewHolder holder : lstHolders) {
|
for (int i = firstPosition; i <= lastPosition; i++) {
|
||||||
if (holder.getLayoutPosition() >= firstPosition && holder.getLayoutPosition() <= lastPosition) {
|
if (mRecyclerView.findViewHolderForAdapterPosition(i) != null) {
|
||||||
holder.updateAnimatedEmoji();
|
((ViewHolder) Objects.requireNonNull(mRecyclerView.findViewHolderForAdapterPosition(i))).updateAnimatedEmoji();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (ViewHolder holder : lstHolders) {
|
|
||||||
holder.updateAnimatedEmoji();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +256,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
tagTimeline = statusDrawerParams.getTagTimeline();
|
tagTimeline = statusDrawerParams.getTagTimeline();
|
||||||
conversationPosition = statusDrawerParams.getPosition();
|
conversationPosition = statusDrawerParams.getPosition();
|
||||||
redraft = false;
|
redraft = false;
|
||||||
lstHolders = new ArrayList<>();
|
|
||||||
toot_content = null;
|
toot_content = null;
|
||||||
toot_cw_content = null;
|
toot_cw_content = null;
|
||||||
tootReply = null;
|
tootReply = null;
|
||||||
|
@ -318,7 +314,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh(Status refreshedStatus) {
|
public void onRefresh(Status refreshedStatus) {
|
||||||
if (refreshedStatus.getCreated_at() == null) {
|
if (refreshedStatus.getCreated_at() == null) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new TimelineCacheDAO(context, db).remove(refreshedStatus.getId());
|
new TimelineCacheDAO(context, db).remove(refreshedStatus.getId());
|
||||||
new PostActionAsyncTask(context, API.StatusAction.UNSTATUS, refreshedStatus.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, API.StatusAction.UNSTATUS, refreshedStatus.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
@ -500,7 +496,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0)
|
if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0)
|
||||||
toot.setIn_reply_to_id(apiResponse.getStatuses().get(0).getId());
|
toot.setIn_reply_to_id(apiResponse.getStatuses().get(0).getId());
|
||||||
toot.setContent(context, tootContent);
|
toot.setContent(context, tootContent);
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
new PostStatusAsyncTask(context, social, account, toot, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostStatusAsyncTask(context, social, account, toot, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
return;
|
return;
|
||||||
|
@ -579,9 +575,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED && type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
|
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED && type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
|
||||||
return COMPACT_STATUS;
|
return COMPACT_STATUS;
|
||||||
} else {
|
} else {
|
||||||
if( instanceType == null || instanceType.compareTo("NITTER") != 0 ) {
|
if (instanceType == null || instanceType.compareTo("NITTER") != 0) {
|
||||||
return statuses.get(position).getViewType();
|
return statuses.get(position).getViewType();
|
||||||
}else{
|
} else {
|
||||||
return COMPACT_STATUS;
|
return COMPACT_STATUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,7 +602,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
return new ViewHolderEmpty(layoutInflater.inflate(R.layout.drawer_empty, parent, false));
|
return new ViewHolderEmpty(layoutInflater.inflate(R.layout.drawer_empty, parent, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"})
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
|
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
@ -614,10 +610,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
context = viewHolder.itemView.getContext();
|
context = viewHolder.itemView.getContext();
|
||||||
if (viewHolder.getItemViewType() != HIDDEN_STATUS) {
|
if (viewHolder.getItemViewType() != HIDDEN_STATUS) {
|
||||||
final ViewHolder holder = (ViewHolder) viewHolder;
|
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||||
synchronized (lock) {
|
|
||||||
lstHolders.add(holder);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
holder.startUpdateTimer();
|
holder.startUpdateTimer();
|
||||||
final Status status = statuses.get(i);
|
final Status status = statuses.get(i);
|
||||||
|
@ -748,7 +740,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if (pollOption.getVotes_count() > greaterValue)
|
if (pollOption.getVotes_count() > greaterValue)
|
||||||
greaterValue = pollOption.getVotes_count();
|
greaterValue = pollOption.getVotes_count();
|
||||||
}
|
}
|
||||||
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
|
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
|
||||||
holder.rated.removeAllViews();
|
holder.rated.removeAllViews();
|
||||||
List<Integer> ownvotes = poll.getOwn_votes();
|
List<Integer> ownvotes = poll.getOwn_votes();
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -758,11 +750,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
TextView poll_item_percent = item.findViewById(R.id.poll_item_percent);
|
TextView poll_item_percent = item.findViewById(R.id.poll_item_percent);
|
||||||
TextView poll_item_text = item.findViewById(R.id.poll_item_text);
|
TextView poll_item_text = item.findViewById(R.id.poll_item_text);
|
||||||
ProgressBar poll_item_value = item.findViewById(R.id.poll_item_value);
|
ProgressBar poll_item_value = item.findViewById(R.id.poll_item_value);
|
||||||
poll_item_percent.setText(String.format("%s %%", String.valueOf((int)value)));
|
poll_item_percent.setText(String.format("%s %%", String.valueOf((int) value)));
|
||||||
poll_item_text.setText(pollOption.getTitle(), TextView.BufferType.SPANNABLE);
|
poll_item_text.setText(pollOption.getTitle(), TextView.BufferType.SPANNABLE);
|
||||||
poll_item_value.setProgress((int)value);
|
poll_item_value.setProgress((int) value);
|
||||||
holder.rated.addView(item);
|
holder.rated.addView(item);
|
||||||
if( pollOption.getVotes_count() == greaterValue ){
|
if (pollOption.getVotes_count() == greaterValue) {
|
||||||
poll_item_percent.setTypeface(null, Typeface.BOLD);
|
poll_item_percent.setTypeface(null, Typeface.BOLD);
|
||||||
poll_item_text.setTypeface(null, Typeface.BOLD);
|
poll_item_text.setTypeface(null, Typeface.BOLD);
|
||||||
}
|
}
|
||||||
|
@ -927,7 +919,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
style = R.style.Dialog;
|
style = R.style.Dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
emojisPicker = new CustomEmojiDAO(context, db).getAllEmojis(Helper.getLiveInstance(context));
|
emojisPicker = new CustomEmojiDAO(context, db).getAllEmojis(Helper.getLiveInstance(context));
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
|
||||||
int paddingPixel = 15;
|
int paddingPixel = 15;
|
||||||
|
@ -1012,8 +1004,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
iconColor = ThemeHelper.getAttColor(context, R.attr.iconColor);
|
iconColor = ThemeHelper.getAttColor(context, R.attr.iconColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA ){
|
if (type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS ) {
|
if (type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS) {
|
||||||
holder.status_account_profile.setVisibility(View.GONE);
|
holder.status_account_profile.setVisibility(View.GONE);
|
||||||
holder.status_account_displayname_owner.setVisibility(View.GONE);
|
holder.status_account_displayname_owner.setVisibility(View.GONE);
|
||||||
holder.status_account_username.setVisibility(View.GONE);
|
holder.status_account_username.setVisibility(View.GONE);
|
||||||
|
@ -1036,18 +1028,18 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}).setOnEmojiClickListener((emoji, imageView) -> {
|
}).setOnEmojiClickListener((emoji, imageView) -> {
|
||||||
String emojiStr = imageView.getUnicode();
|
String emojiStr = imageView.getUnicode();
|
||||||
boolean alreadyAdded = false;
|
boolean alreadyAdded = false;
|
||||||
for(Reaction reaction: status.getReactions()){
|
for (Reaction reaction : status.getReactions()) {
|
||||||
if( reaction.getName().compareTo(emojiStr) == 0){
|
if (reaction.getName().compareTo(emojiStr) == 0) {
|
||||||
alreadyAdded = true;
|
alreadyAdded = true;
|
||||||
reaction.setCount(reaction.getCount()-1);
|
reaction.setCount(reaction.getCount() - 1);
|
||||||
if( reaction.getCount() == 0) {
|
if (reaction.getCount() == 0) {
|
||||||
status.getReactions().remove(reaction);
|
status.getReactions().remove(reaction);
|
||||||
}
|
}
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !alreadyAdded){
|
if (!alreadyAdded) {
|
||||||
Reaction reaction = new Reaction();
|
Reaction reaction = new Reaction();
|
||||||
reaction.setMe(true);
|
reaction.setMe(true);
|
||||||
reaction.setCount(1);
|
reaction.setCount(1);
|
||||||
|
@ -1056,21 +1048,21 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
API.StatusAction statusAction;
|
API.StatusAction statusAction;
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS ) {
|
if (type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS) {
|
||||||
statusAction = alreadyAdded ? API.StatusAction.REMOVE_REACTION : API.StatusAction.ADD_REACTION;
|
statusAction = alreadyAdded ? API.StatusAction.REMOVE_REACTION : API.StatusAction.ADD_REACTION;
|
||||||
}else{
|
} else {
|
||||||
statusAction = alreadyAdded ? API.StatusAction.REMOVE_PLEROMA_REACTION : API.StatusAction.ADD_PLEROMA_REACTION;
|
statusAction = alreadyAdded ? API.StatusAction.REMOVE_PLEROMA_REACTION : API.StatusAction.ADD_PLEROMA_REACTION;
|
||||||
}
|
}
|
||||||
new PostActionAsyncTask(context, statusAction, status.getId(), null,emojiStr, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, statusAction, status.getId(), null, emojiStr, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
})
|
})
|
||||||
.build(holder.fake_edittext);
|
.build(holder.fake_edittext);
|
||||||
emojiPopup.toggle();
|
emojiPopup.toggle();
|
||||||
});
|
});
|
||||||
if( social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||||
holder.status_add_custom_emoji.setVisibility(View.GONE);
|
holder.status_add_custom_emoji.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
holder.status_add_custom_emoji.setOnClickListener(v -> {
|
holder.status_add_custom_emoji.setOnClickListener(v -> {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
List<Emojis> emojis = new CustomEmojiDAO(context, db).getAllEmojis(account.getInstance());
|
List<Emojis> emojis = new CustomEmojiDAO(context, db).getAllEmojis(account.getInstance());
|
||||||
|
@ -1093,18 +1085,18 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
gridView.setNumColumns(5);
|
gridView.setNumColumns(5);
|
||||||
gridView.setOnItemClickListener((parent, view, position, id) -> {
|
gridView.setOnItemClickListener((parent, view, position, id) -> {
|
||||||
boolean alreadyAdded = false;
|
boolean alreadyAdded = false;
|
||||||
for(Reaction reaction: status.getReactions()){
|
for (Reaction reaction : status.getReactions()) {
|
||||||
if( reaction.getName().compareTo(emojis.get(position).getShortcode()) == 0){
|
if (reaction.getName().compareTo(emojis.get(position).getShortcode()) == 0) {
|
||||||
alreadyAdded = true;
|
alreadyAdded = true;
|
||||||
reaction.setCount(reaction.getCount()-1);
|
reaction.setCount(reaction.getCount() - 1);
|
||||||
if( reaction.getCount() == 0) {
|
if (reaction.getCount() == 0) {
|
||||||
status.getReactions().remove(reaction);
|
status.getReactions().remove(reaction);
|
||||||
}
|
}
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !alreadyAdded){
|
if (!alreadyAdded) {
|
||||||
Reaction reaction = new Reaction();
|
Reaction reaction = new Reaction();
|
||||||
reaction.setMe(true);
|
reaction.setMe(true);
|
||||||
reaction.setCount(1);
|
reaction.setCount(1);
|
||||||
|
@ -1114,9 +1106,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
API.StatusAction statusAction;
|
API.StatusAction statusAction;
|
||||||
if( type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS ) {
|
if (type == RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS) {
|
||||||
statusAction = alreadyAdded ? API.StatusAction.REMOVE_REACTION : API.StatusAction.ADD_REACTION;
|
statusAction = alreadyAdded ? API.StatusAction.REMOVE_REACTION : API.StatusAction.ADD_REACTION;
|
||||||
}else{
|
} else {
|
||||||
statusAction = alreadyAdded ? API.StatusAction.REMOVE_PLEROMA_REACTION : API.StatusAction.ADD_PLEROMA_REACTION;
|
statusAction = alreadyAdded ? API.StatusAction.REMOVE_PLEROMA_REACTION : API.StatusAction.ADD_PLEROMA_REACTION;
|
||||||
}
|
}
|
||||||
new PostActionAsyncTask(context, statusAction, status.getId(), null, emojis.get(position).getShortcode(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, statusAction, status.getId(), null, emojis.get(position).getShortcode(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
@ -1597,7 +1589,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
|
|
||||||
//Displays name & emoji in toot header
|
//Displays name & emoji in toot header
|
||||||
final Account accountForUrl;
|
final Account accountForUrl;
|
||||||
SpannableString displayNameSpan = status.getReblog() != null ? status.getReblog().getAccount().getDisplayNameSpan():status.getAccount().getDisplayNameSpan();
|
SpannableString displayNameSpan = status.getReblog() != null ? status.getReblog().getAccount().getDisplayNameSpan() : status.getAccount().getDisplayNameSpan();
|
||||||
if (status.getReblog() != null) {
|
if (status.getReblog() != null) {
|
||||||
accountForUrl = status.getReblog().getAccount();
|
accountForUrl = status.getReblog().getAccount();
|
||||||
holder.status_account_displayname.setVisibility(View.VISIBLE);
|
holder.status_account_displayname.setVisibility(View.VISIBLE);
|
||||||
|
@ -1661,7 +1653,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
holder.fetch_more.setEnabled(false);
|
holder.fetch_more.setEnabled(false);
|
||||||
holder.fetch_more.setVisibility(View.GONE);
|
holder.fetch_more.setVisibility(View.GONE);
|
||||||
if (context instanceof BaseMainActivity) {
|
if (context instanceof BaseMainActivity) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<ManageTimelines> timelines = new TimelinesDAO(context, db).getDisplayedTimelines();
|
List<ManageTimelines> timelines = new TimelinesDAO(context, db).getDisplayedTimelines();
|
||||||
for (ManageTimelines tl : timelines) {
|
for (ManageTimelines tl : timelines) {
|
||||||
if (tl.getType() == ManageTimelines.Type.HOME && mPageReferenceMap != null) {
|
if (tl.getType() == ManageTimelines.Type.HOME && mPageReferenceMap != null) {
|
||||||
|
@ -1680,7 +1672,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
holder.fetch_more.setEnabled(false);
|
holder.fetch_more.setEnabled(false);
|
||||||
holder.fetch_more.setVisibility(View.GONE);
|
holder.fetch_more.setVisibility(View.GONE);
|
||||||
if (context instanceof BaseMainActivity) {
|
if (context instanceof BaseMainActivity) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<ManageTimelines> timelines = new TimelinesDAO(context, db).getDisplayedTimelines();
|
List<ManageTimelines> timelines = new TimelinesDAO(context, db).getDisplayedTimelines();
|
||||||
for (ManageTimelines tl : timelines) {
|
for (ManageTimelines tl : timelines) {
|
||||||
if (tl.getType() == ManageTimelines.Type.HOME && mPageReferenceMap != null) {
|
if (tl.getType() == ManageTimelines.Type.HOME && mPageReferenceMap != null) {
|
||||||
|
@ -2409,7 +2401,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
||||||
tootReply = status;
|
tootReply = status;
|
||||||
|
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
|
@ -2626,7 +2618,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
toot.setSpoiler_text(status.getSpoiler_text().trim());
|
toot.setSpoiler_text(status.getSpoiler_text().trim());
|
||||||
toot.setVisibility(status.getVisibility());
|
toot.setVisibility(status.getVisibility());
|
||||||
toot.setContent(context, status.getContent());
|
toot.setContent(context, status.getContent());
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
long id = new StatusStoredDAO(context, db).insertStatus(toot, null);
|
long id = new StatusStoredDAO(context, db).insertStatus(toot, null);
|
||||||
Intent intentToot = new Intent(context, TootActivity.class);
|
Intent intentToot = new Intent(context, TootActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
@ -2820,7 +2812,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
case R.id.action_bookmark:
|
case R.id.action_bookmark:
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS) {
|
if (type != RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS) {
|
||||||
status.setBookmarked(!status.isBookmarked());
|
status.setBookmarked(!status.isBookmarked());
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
try {
|
try {
|
||||||
if (status.isBookmarked()) {
|
if (status.isBookmarked()) {
|
||||||
new StatusCacheDAO(context, db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, status);
|
new StatusCacheDAO(context, db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, status);
|
||||||
|
@ -2840,7 +2832,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if (statustmp.getId().equals(status.getId())) {
|
if (statustmp.getId().equals(status.getId())) {
|
||||||
statuses.remove(status);
|
statuses.remove(status);
|
||||||
statusListAdapter.notifyItemRemoved(position);
|
statusListAdapter.notifyItemRemoved(position);
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.BOOKMARK_CACHE, statustmp);
|
new StatusCacheDAO(context, db).remove(StatusCacheDAO.BOOKMARK_CACHE, statustmp);
|
||||||
Toasty.success(context, context.getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
Toasty.success(context, context.getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
||||||
break;
|
break;
|
||||||
|
@ -3002,7 +2994,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
} else if (status.getReblog() != null && status.getReblog().getPoll() != null) {
|
} else if (status.getReblog() != null && status.getReblog().getPoll() != null) {
|
||||||
toot.setPoll(status.getPoll());
|
toot.setPoll(status.getPoll());
|
||||||
}
|
}
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
long id = new StatusStoredDAO(context, db).insertStatus(toot, null);
|
long id = new StatusStoredDAO(context, db).insertStatus(toot, null);
|
||||||
Intent intentToot = new Intent(context, TootActivity.class);
|
Intent intentToot = new Intent(context, TootActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
@ -3346,6 +3338,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
DrawableTransitionOptions.withCrossFade();
|
DrawableTransitionOptions.withCrossFade();
|
||||||
imageView.setImageBitmap(resource);
|
imageView.setImageBitmap(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
|
||||||
|
@ -3361,7 +3354,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
.thumbnail(0.1f)
|
.thumbnail(0.1f)
|
||||||
// .override(640, 480)
|
// .override(640, 480)
|
||||||
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
|
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
|
||||||
.transition(DrawableTransitionOptions.withCrossFade())
|
// .transition(DrawableTransitionOptions.withCrossFade())
|
||||||
.into(imageView);
|
.into(imageView);
|
||||||
} else {
|
} else {
|
||||||
Glide.with(imageView.getContext())
|
Glide.with(imageView.getContext())
|
||||||
|
@ -3369,7 +3362,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
.thumbnail(0.1f)
|
.thumbnail(0.1f)
|
||||||
// .override(640, 480)
|
// .override(640, 480)
|
||||||
.apply(new RequestOptions().transform(new BlurTransformation(50, 3), new RoundedCorners(10)))
|
.apply(new RequestOptions().transform(new BlurTransformation(50, 3), new RoundedCorners(10)))
|
||||||
.transition(DrawableTransitionOptions.withCrossFade())
|
// .transition(DrawableTransitionOptions.withCrossFade())
|
||||||
.into(imageView);
|
.into(imageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3415,9 +3408,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
boolean long_press_media = sharedpreferences.getBoolean(Helper.SET_LONG_PRESS_MEDIA, true);
|
boolean long_press_media = sharedpreferences.getBoolean(Helper.SET_LONG_PRESS_MEDIA, true);
|
||||||
if (long_press_media) {
|
if (long_press_media) {
|
||||||
String finalUrl;
|
String finalUrl;
|
||||||
if( attachment.getUrl() == null ){
|
if (attachment.getUrl() == null) {
|
||||||
finalUrl = attachment.getRemote_url();
|
finalUrl = attachment.getRemote_url();
|
||||||
}else{
|
} else {
|
||||||
finalUrl = attachment.getUrl();
|
finalUrl = attachment.getUrl();
|
||||||
}
|
}
|
||||||
imageView.setOnLongClickListener(v -> {
|
imageView.setOnLongClickListener(v -> {
|
||||||
|
@ -3511,7 +3504,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
//Store the toot as draft first
|
//Store the toot as draft first
|
||||||
String targeted_id = status.getAccount().getId();
|
String targeted_id = status.getAccount().getId();
|
||||||
Date date_mute = new Date(time);
|
Date date_mute = new Date(time);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
@ -3728,7 +3721,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if (content_type != null)
|
if (content_type != null)
|
||||||
toot.setContentType(content_type);
|
toot.setContentType(content_type);
|
||||||
toot.setSensitive(false);
|
toot.setSensitive(false);
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
if (toot_cw_content.getText().toString().trim().length() > 0)
|
if (toot_cw_content.getText().toString().trim().length() > 0)
|
||||||
toot.setSpoiler_text(toot_cw_content.getText().toString().trim());
|
toot.setSpoiler_text(toot_cw_content.getText().toString().trim());
|
||||||
|
@ -3748,7 +3741,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
|
|
||||||
if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0) {
|
if (apiResponse.getStatuses() != null && apiResponse.getStatuses().size() > 0) {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
long id = new StatusStoredDAO(context, db).insertStatus(toot, apiResponse.getStatuses().get(0));
|
long id = new StatusStoredDAO(context, db).insertStatus(toot, apiResponse.getStatuses().get(0));
|
||||||
Intent intentToot = new Intent(context, TootActivity.class);
|
Intent intentToot = new Intent(context, TootActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
@ -3807,7 +3800,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if (status.getId().equals(targetedId)) {
|
if (status.getId().equals(targetedId)) {
|
||||||
statuses.remove(status);
|
statuses.remove(status);
|
||||||
statusListAdapter.notifyItemRemoved(position);
|
statusListAdapter.notifyItemRemoved(position);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//Remove the status from cache also
|
//Remove the status from cache also
|
||||||
try {
|
try {
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
||||||
|
@ -3972,7 +3965,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}
|
}
|
||||||
|
|
||||||
toot.setIn_reply_to_id(tootReply.getId());
|
toot.setIn_reply_to_id(tootReply.getId());
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
try {
|
try {
|
||||||
if (currentToId == -1) {
|
if (currentToId == -1) {
|
||||||
currentToId = new StatusStoredDAO(context, db).insertStatus(toot, tootReply);
|
currentToId = new StatusStoredDAO(context, db).insertStatus(toot, tootReply);
|
||||||
|
@ -4241,9 +4234,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateAnimatedEmoji() {
|
void updateAnimatedEmoji() {
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.CONVERSATION) {
|
|
||||||
status_account_displayname.invalidate();
|
status_account_displayname.invalidate();
|
||||||
}
|
|
||||||
status_content.invalidate();
|
status_content.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class TagsEditAdapter extends RecyclerView.Adapter {
|
||||||
final String[] tag = {tags.get(viewHolder.getAdapterPosition())};
|
final String[] tag = {tags.get(viewHolder.getAdapterPosition())};
|
||||||
ViewHolder holder = (ViewHolder) viewHolder;
|
ViewHolder holder = (ViewHolder) viewHolder;
|
||||||
holder.tag_name.setText(String.format("#%s", tag[0]));
|
holder.tag_name.setText(String.format("#%s", tag[0]));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
holder.save_tag.setOnClickListener(v -> {
|
holder.save_tag.setOnClickListener(v -> {
|
||||||
if (holder.tag_name.getText() != null && holder.tag_name.getText().toString().trim().replaceAll("#", "").length() > 0) {
|
if (holder.tag_name.getText() != null && holder.tag_name.getText().toString().trim().replaceAll("#", "").length() > 0) {
|
||||||
String tagToInsert = holder.tag_name.getText().toString().trim().replaceAll("#", "");
|
String tagToInsert = holder.tag_name.getText().toString().trim().replaceAll("#", "");
|
||||||
|
|
|
@ -442,7 +442,7 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat implements S
|
||||||
String title = getString(R.string.data_export_theme);
|
String title = getString(R.string.data_export_theme);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getActivity()));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getActivity()));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getActivity(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getActivity().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(getActivity(), db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(getActivity(), db).getUniqAccount(userId, instance);
|
||||||
Helper.notify_user(getActivity(), account, intentOpen, BitmapFactory.decodeResource(getResources(),
|
Helper.notify_user(getActivity(), account, intentOpen, BitmapFactory.decodeResource(getResources(),
|
||||||
Helper.getMainLogo(getActivity())), Helper.NotifType.BACKUP, title, message);
|
Helper.getMainLogo(getActivity())), Helper.NotifType.BACKUP, title, message);
|
||||||
|
|
|
@ -1521,7 +1521,7 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
||||||
|
|
||||||
|
|
||||||
LinearLayout toot_visibility_container = rootView.findViewById(R.id.toot_visibility_container);
|
LinearLayout toot_visibility_container = rootView.findViewById(R.id.toot_visibility_container);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
|
||||||
final Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
final Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
final ImageView set_toot_visibility = rootView.findViewById(R.id.set_toot_visibility);
|
final ImageView set_toot_visibility = rootView.findViewById(R.id.set_toot_visibility);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class DisplayBookmarksPixelfedFragment extends Fragment implements OnRetr
|
||||||
@Override
|
@Override
|
||||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||||
|
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
mainLoader.setVisibility(View.GONE);
|
mainLoader.setVisibility(View.GONE);
|
||||||
FloatingActionButton delete_all = null;
|
FloatingActionButton delete_all = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class DisplayDraftsFragment extends Fragment {
|
||||||
} else {
|
} else {
|
||||||
Helper.changeDrawableColor(context, R.drawable.ic_cancel, R.color.black);
|
Helper.changeDrawableColor(context, R.drawable.ic_cancel, R.color.black);
|
||||||
}
|
}
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//Removes all scheduled toots that have sent
|
//Removes all scheduled toots that have sent
|
||||||
new StatusStoredDAO(context, db).removeAllSent();
|
new StatusStoredDAO(context, db).removeAllSent();
|
||||||
drafts = new StatusStoredDAO(context, db).getAllDrafts();
|
drafts = new StatusStoredDAO(context, db).getAllDrafts();
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class DisplayFavoritesPeertubeFragment extends Fragment implements OnRetr
|
||||||
@Override
|
@Override
|
||||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||||
|
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
mainLoader.setVisibility(View.GONE);
|
mainLoader.setVisibility(View.GONE);
|
||||||
FloatingActionButton delete_all = null;
|
FloatingActionButton delete_all = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -266,7 +266,7 @@ public class DisplayFiltersFragment extends Fragment implements OnFilterActionIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainActivity.filters = apiResponse.getFilters();
|
MainActivity.filters = apiResponse.getFilters();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<ManageTimelines> timelines = new TimelinesDAO(context, db).getDisplayedTimelines();
|
List<ManageTimelines> timelines = new TimelinesDAO(context, db).getDisplayedTimelines();
|
||||||
if (mPageReferenceMap == null) {
|
if (mPageReferenceMap == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -251,7 +251,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
swipeRefreshLayout.setEnabled(true);
|
swipeRefreshLayout.setEnabled(true);
|
||||||
if (context == null)
|
if (context == null)
|
||||||
return;
|
return;
|
||||||
if( getUserVisibleHint()){
|
if (getUserVisibleHint()) {
|
||||||
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
assert mNotificationManager != null;
|
assert mNotificationManager != null;
|
||||||
mNotificationManager.cancelAll();
|
mNotificationManager.cancelAll();
|
||||||
|
@ -312,7 +312,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account accountdb = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account accountdb = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
LiveNotificationDelayedService.since_ids.put(accountdb.getAcct() + "@" + accountdb.getInstance(), notifications.get(0).getId());
|
LiveNotificationDelayedService.since_ids.put(accountdb.getAcct() + "@" + accountdb.getInstance(), notifications.get(0).getId());
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
if (MainActivity.lastNotificationId != null && notifications.get(0).getId().compareTo(MainActivity.lastNotificationId) > 0) {
|
if (MainActivity.lastNotificationId != null && notifications.get(0).getId().compareTo(MainActivity.lastNotificationId) > 0) {
|
||||||
LiveNotificationDelayedService.since_ids.put(account.getAcct() + "@" + account.getInstance(), notifications.get(0).getId());
|
LiveNotificationDelayedService.since_ids.put(account.getAcct() + "@" + account.getInstance(), notifications.get(0).getId());
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class DisplayScheduledTootsFragment extends Fragment implements OnRetriev
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
mainLoader.setVisibility(View.VISIBLE);
|
||||||
storedStatuses = new ArrayList<>();
|
storedStatuses = new ArrayList<>();
|
||||||
//Removes all scheduled toots that have sent
|
//Removes all scheduled toots that have sent
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (type == typeOfSchedule.TOOT)
|
if (type == typeOfSchedule.TOOT)
|
||||||
new StatusStoredDAO(context, db).removeAllSent();
|
new StatusStoredDAO(context, db).removeAllSent();
|
||||||
else if (type == typeOfSchedule.BOOST)
|
else if (type == typeOfSchedule.BOOST)
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||||
type = RetrieveFeedsAsyncTask.Type.CHANNEL;
|
type = RetrieveFeedsAsyncTask.Type.CHANNEL;
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//instanceType should not be null only for Peertube accounts
|
//instanceType should not be null only for Peertube accounts
|
||||||
|
|
||||||
if (remoteInstance != null && !remoteInstance.equals("") && instanceType == null) {
|
if (remoteInstance != null && !remoteInstance.equals("") && instanceType == null) {
|
||||||
|
@ -750,7 +750,8 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||||
if (lv_status != null) {
|
if (lv_status != null) {
|
||||||
try {
|
try {
|
||||||
lv_status.setAdapter(null);
|
lv_status.setAdapter(null);
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
rootView = null;
|
rootView = null;
|
||||||
|
|
|
@ -16,7 +16,6 @@ package app.fedilab.android.helper;
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
@ -76,7 +75,7 @@ public class CrossActions {
|
||||||
*/
|
*/
|
||||||
private static List<Account> connectedAccounts(Context context, Status status, boolean limitedToOwner) {
|
private static List<Account> connectedAccounts(Context context, Status status, boolean limitedToOwner) {
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Account> accountstmp = new AccountDAO(context, db).getAllAccountCrossAction();
|
List<Account> accountstmp = new AccountDAO(context, db).getAllAccountCrossAction();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
|
@ -148,7 +147,7 @@ public class CrossActions {
|
||||||
if ((type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE || type == RetrieveFeedsAsyncTask.Type.NEWS) && limitedToOwner) {
|
if ((type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE || type == RetrieveFeedsAsyncTask.Type.NEWS) && limitedToOwner) {
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account currentAccount = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account currentAccount = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
if (confirmation && status.getContent() != null)
|
if (confirmation && status.getContent() != null)
|
||||||
displayConfirmationDialogCrossAction(context, currentAccount, doAction, status, onPostActionInterface, baseAdapter);
|
displayConfirmationDialogCrossAction(context, currentAccount, doAction, status, onPostActionInterface, baseAdapter);
|
||||||
|
@ -228,19 +227,12 @@ public class CrossActions {
|
||||||
accountArray[i] = account;
|
accountArray[i] = account;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
@Override
|
builderSingle.setAdapter(accountsSearchAdapter, (dialog, which) -> {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderSingle.setAdapter(accountsSearchAdapter, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
Account selectedAccount = accountArray[which];
|
Account selectedAccount = accountArray[which];
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account loggedAccount = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account loggedAccount = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
if (targetedAccount == null) {
|
if (targetedAccount == null) {
|
||||||
if (loggedAccount.getInstance().equals(selectedAccount.getInstance())) {
|
if (loggedAccount.getInstance().equals(selectedAccount.getInstance())) {
|
||||||
|
@ -274,7 +266,6 @@ public class CrossActions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
}
|
}
|
||||||
|
@ -318,7 +309,7 @@ public class CrossActions {
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@ -410,7 +401,7 @@ public class CrossActions {
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@ -459,7 +450,7 @@ public class CrossActions {
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@ -506,7 +497,7 @@ public class CrossActions {
|
||||||
if (accounts.size() == 1 || limitedToOwner) {
|
if (accounts.size() == 1 || limitedToOwner) {
|
||||||
status.setBookmarked(!status.isBookmarked());
|
status.setBookmarked(!status.isBookmarked());
|
||||||
try {
|
try {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (status.isBookmarked()) {
|
if (status.isBookmarked()) {
|
||||||
doAction = API.StatusAction.BOOKMARK;
|
doAction = API.StatusAction.BOOKMARK;
|
||||||
new StatusCacheDAO(context, db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, status);
|
new StatusCacheDAO(context, db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, status);
|
||||||
|
@ -532,16 +523,9 @@ public class CrossActions {
|
||||||
accountArray[i] = account;
|
accountArray[i] = account;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Status finalStatus = status;
|
Status finalStatus = status;
|
||||||
builderSingle.setAdapter(accountsSearchAdapter, new DialogInterface.OnClickListener() {
|
builderSingle.setAdapter(accountsSearchAdapter, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(final DialogInterface dialog, int which) {
|
|
||||||
final Account account = accountArray[which];
|
final Account account = accountArray[which];
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
Results response;
|
Results response;
|
||||||
|
@ -568,25 +552,24 @@ public class CrossActions {
|
||||||
}
|
}
|
||||||
List<app.fedilab.android.client.Entities.Status> statuses = response.getStatuses();
|
List<app.fedilab.android.client.Entities.Status> statuses = response.getStatuses();
|
||||||
if (statuses != null && statuses.size() > 0) {
|
if (statuses != null && statuses.size() > 0) {
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
final SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
app.fedilab.android.client.Entities.Status statusBookmarked = new StatusCacheDAO(contextReference.get(), db).getStatus(StatusCacheDAO.BOOKMARK_CACHE, statuses.get(0).getId(), account.getId(), account.getInstance());
|
app.fedilab.android.client.Entities.Status statusBookmarked = new StatusCacheDAO(contextReference.get(), db).getStatus(StatusCacheDAO.BOOKMARK_CACHE, statuses.get(0).getId(), account.getId(), account.getInstance());
|
||||||
API.StatusAction doAction;
|
API.StatusAction doAction1;
|
||||||
if (statusBookmarked == null) {
|
if (statusBookmarked == null) {
|
||||||
doAction = API.StatusAction.BOOKMARK;
|
doAction1 = API.StatusAction.BOOKMARK;
|
||||||
new StatusCacheDAO(contextReference.get(), db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, statuses.get(0), account.getId(), account.getInstance());
|
new StatusCacheDAO(contextReference.get(), db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, statuses.get(0), account.getId(), account.getInstance());
|
||||||
Toasty.success(contextReference.get(), contextReference.get().getString(R.string.status_bookmarked), Toast.LENGTH_LONG).show();
|
Toasty.success(contextReference.get(), contextReference.get().getString(R.string.status_bookmarked), Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
doAction = API.StatusAction.UNBOOKMARK;
|
doAction1 = API.StatusAction.UNBOOKMARK;
|
||||||
new StatusCacheDAO(contextReference.get(), db).remove(StatusCacheDAO.BOOKMARK_CACHE, statuses.get(0), account.getId(), account.getInstance());
|
new StatusCacheDAO(contextReference.get(), db).remove(StatusCacheDAO.BOOKMARK_CACHE, statuses.get(0), account.getId(), account.getInstance());
|
||||||
Toasty.success(contextReference.get(), contextReference.get().getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
Toasty.success(contextReference.get(), contextReference.get().getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
new PostActionAsyncTask(context, account, finalStatus, doAction, null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, account, finalStatus, doAction1, null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
statusListAdapter.notifyStatusChanged(statuses.get(0));
|
statusListAdapter.notifyStatusChanged(statuses.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
}
|
}
|
||||||
|
@ -624,15 +607,8 @@ public class CrossActions {
|
||||||
accountArray[i] = account;
|
accountArray[i] = account;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
@Override
|
builderSingle.setAdapter(accountsSearchAdapter, (dialog, which) -> {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderSingle.setAdapter(accountsSearchAdapter, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(final DialogInterface dialog, int which) {
|
|
||||||
final Account account = accountArray[which];
|
final Account account = accountArray[which];
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@ -710,14 +686,13 @@ public class CrossActions {
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
} else {
|
} else {
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@ -789,15 +764,8 @@ public class CrossActions {
|
||||||
accountArray[i] = account;
|
accountArray[i] = account;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
@Override
|
builderSingle.setAdapter(accountsSearchAdapter, (dialog, which) -> {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builderSingle.setAdapter(accountsSearchAdapter, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(final DialogInterface dialog, int which) {
|
|
||||||
final Account account = accountArray[which];
|
final Account account = accountArray[which];
|
||||||
Intent intentToot = new Intent(context, TootActivity.class);
|
Intent intentToot = new Intent(context, TootActivity.class);
|
||||||
bundle.putString("accountReplyToken", account.getId() + "|" + account.getInstance());
|
bundle.putString("accountReplyToken", account.getId() + "|" + account.getInstance());
|
||||||
|
@ -805,7 +773,6 @@ public class CrossActions {
|
||||||
context.startActivity(intentToot);
|
context.startActivity(intentToot);
|
||||||
((BaseActivity) context).finish();
|
((BaseActivity) context).finish();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
builderSingle.show();
|
builderSingle.show();
|
||||||
}
|
}
|
||||||
|
@ -839,13 +806,10 @@ public class CrossActions {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
builder.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
builder.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||||
else
|
else
|
||||||
//noinspection deprecation
|
|
||||||
builder.setMessage(Html.fromHtml(status.getContent()));
|
builder.setMessage(Html.fromHtml(status.getContent()));
|
||||||
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
if (action == API.StatusAction.REBLOG || action == API.StatusAction.UNREBLOG)
|
if (action == API.StatusAction.REBLOG || action == API.StatusAction.UNREBLOG)
|
||||||
reblogAction(context, status, onPostActionInterface);
|
reblogAction(context, status, onPostActionInterface);
|
||||||
else if (action == API.StatusAction.FAVOURITE || action == API.StatusAction.UNFAVOURITE)
|
else if (action == API.StatusAction.FAVOURITE || action == API.StatusAction.UNFAVOURITE)
|
||||||
|
@ -879,15 +843,8 @@ public class CrossActions {
|
||||||
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,13 +877,10 @@ public class CrossActions {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
builder.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
builder.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||||
else
|
else
|
||||||
//noinspection deprecation
|
|
||||||
builder.setMessage(Html.fromHtml(status.getContent()));
|
builder.setMessage(Html.fromHtml(status.getContent()));
|
||||||
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
if (action == API.StatusAction.FAVOURITE || action == API.StatusAction.UNFAVOURITE) {
|
if (action == API.StatusAction.FAVOURITE || action == API.StatusAction.UNFAVOURITE) {
|
||||||
if (action == API.StatusAction.FAVOURITE) {
|
if (action == API.StatusAction.FAVOURITE) {
|
||||||
status.setFavourited(true);
|
status.setFavourited(true);
|
||||||
|
@ -954,34 +908,11 @@ public class CrossActions {
|
||||||
}
|
}
|
||||||
new PostActionAsyncTask(context, currentAccount, status, action, onPostActionInterface).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, currentAccount, status, action, onPostActionInterface).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Follow/Unfollow an account
|
|
||||||
*
|
|
||||||
* @param account Account
|
|
||||||
*/
|
|
||||||
private static void followAction(Context context, Account account, RecyclerView.Adapter baseAdapter, OnPostActionInterface onPostActionInterface) {
|
|
||||||
if (account.isFollowing()) {
|
|
||||||
new PostActionAsyncTask(context, API.StatusAction.UNFOLLOW, account.getId(), onPostActionInterface).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
account.setFollowing(false);
|
|
||||||
} else {
|
|
||||||
new PostActionAsyncTask(context, API.StatusAction.FOLLOW, account.getId(), onPostActionInterface).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
account.setFollowing(true);
|
|
||||||
}
|
|
||||||
baseAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Favourites/Unfavourites a status
|
* Favourites/Unfavourites a status
|
||||||
*
|
*
|
||||||
|
|
|
@ -137,7 +137,6 @@ import net.gotev.uploadservice.okhttp.OkHttpStack;
|
||||||
import org.conscrypt.Conscrypt;
|
import org.conscrypt.Conscrypt;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -147,7 +146,6 @@ import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
@ -580,7 +578,6 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Check if the user is connected to Internet
|
* Check if the user is connected to Internet
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
@ -627,7 +624,7 @@ public class Helper {
|
||||||
public static void logoutCurrentUser(Activity activity) {
|
public static void logoutCurrentUser(Activity activity) {
|
||||||
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
//Current user
|
//Current user
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(activity));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(activity));
|
||||||
Account account = new AccountDAO(activity, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(activity, db).getUniqAccount(userId, instance);
|
||||||
|
@ -1302,7 +1299,7 @@ public class Helper {
|
||||||
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
if (!menuAccountsOpened) {
|
if (!menuAccountsOpened) {
|
||||||
arrow.setImageResource(R.drawable.ic_arrow_drop_up);
|
arrow.setImageResource(R.drawable.ic_arrow_drop_up);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
final List<Account> accounts = new AccountDAO(activity, db).getAllAccount();
|
final List<Account> accounts = new AccountDAO(activity, db).getAllAccount();
|
||||||
String lastInstance = "";
|
String lastInstance = "";
|
||||||
navigationView.getMenu().clear();
|
navigationView.getMenu().clear();
|
||||||
|
@ -1462,7 +1459,7 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
MainMenuItem mainMenuItem = new MainMenuDAO(activity, db).getMainMenu();
|
MainMenuItem mainMenuItem = new MainMenuDAO(activity, db).getMainMenu();
|
||||||
if (mainMenuItem == null) {
|
if (mainMenuItem == null) {
|
||||||
mainMenuItem = new MainMenuItem();
|
mainMenuItem = new MainMenuItem();
|
||||||
|
@ -1546,7 +1543,7 @@ public class Helper {
|
||||||
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
||||||
hideMenuItem(activity, navigationView.getMenu());
|
hideMenuItem(activity, navigationView.getMenu());
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(activity, db).getUniqAccount(userID, instance);
|
Account account = new AccountDAO(activity, db).getUniqAccount(userID, instance);
|
||||||
//Can happen when an account has been deleted and there is a click on an old notification
|
//Can happen when an account has been deleted and there is a click on an old notification
|
||||||
if (account == null)
|
if (account == null)
|
||||||
|
@ -1698,7 +1695,7 @@ public class Helper {
|
||||||
ImageView icon;
|
ImageView icon;
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
final List<Account> accounts = new AccountDAO(activity, db).getAllAccount();
|
final List<Account> accounts = new AccountDAO(activity, db).getAllAccount();
|
||||||
if (activity.isFinishing())
|
if (activity.isFinishing())
|
||||||
return;
|
return;
|
||||||
|
@ -2870,7 +2867,7 @@ public class Helper {
|
||||||
TabLayout tableLayout = activity.findViewById(R.id.tabLayout);
|
TabLayout tableLayout = activity.findViewById(R.id.tabLayout);
|
||||||
String userID = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userID = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(activity.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(activity, db).getUniqAccount(userID, instance);
|
Account account = new AccountDAO(activity, db).getUniqAccount(userID, instance);
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
if (social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA && social != UpdateAccountInfoAsyncTask.SOCIAL.GNU) {
|
if (social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA && social != UpdateAccountInfoAsyncTask.SOCIAL.GNU) {
|
||||||
|
@ -3698,6 +3695,7 @@ public class Helper {
|
||||||
private static void removeOnGlobalLayoutListener(View v, ViewTreeObserver.OnGlobalLayoutListener listener) {
|
private static void removeOnGlobalLayoutListener(View v, ViewTreeObserver.OnGlobalLayoutListener listener) {
|
||||||
v.getViewTreeObserver().removeOnGlobalLayoutListener(listener);
|
v.getViewTreeObserver().removeOnGlobalLayoutListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int languageSpinnerPosition(Context context) {
|
public static int languageSpinnerPosition(Context context) {
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
String defaultLocaleString = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, "NOT_DEFINED");
|
String defaultLocaleString = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, "NOT_DEFINED");
|
||||||
|
@ -3902,7 +3900,7 @@ public class Helper {
|
||||||
intent.setAction(android.content.Intent.ACTION_VIEW);
|
intent.setAction(android.content.Intent.ACTION_VIEW);
|
||||||
Uri uri = Uri.parse("file://" + file.getAbsolutePath());
|
Uri uri = Uri.parse("file://" + file.getAbsolutePath());
|
||||||
intent.setDataAndType(uri, mime);
|
intent.setDataAndType(uri, mime);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
@ -3986,7 +3984,7 @@ public class Helper {
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
Uri uri = Uri.fromFile(backupFile);
|
Uri uri = Uri.fromFile(backupFile);
|
||||||
intent.setDataAndType(uri, mime);
|
intent.setDataAndType(uri, mime);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
@ -4000,7 +3998,8 @@ public class Helper {
|
||||||
shareIntent.setType(mime);
|
shareIntent.setType(mime);
|
||||||
try {
|
try {
|
||||||
context.startActivity(shareIntent);
|
context.startActivity(shareIntent);
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -4229,7 +4228,7 @@ public class Helper {
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
Uri uri = Uri.fromFile(new File(filename));
|
Uri uri = Uri.fromFile(new File(filename));
|
||||||
intent.setDataAndType(uri, "text/csv");
|
intent.setDataAndType(uri, "text/csv");
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
|
@ -4506,7 +4505,7 @@ public class Helper {
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
Helper.deleteDir(dir);
|
Helper.deleteDir(dir);
|
||||||
}
|
}
|
||||||
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new StatusCacheDAO(contextReference.get(), db).removeDuplicate();
|
new StatusCacheDAO(contextReference.get(), db).removeDuplicate();
|
||||||
if (clean_all.isChecked()) {
|
if (clean_all.isChecked()) {
|
||||||
if (cache_timeline.isChecked()) {
|
if (cache_timeline.isChecked()) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class BackupNotificationsSyncJob extends Job {
|
||||||
* Task in background starts here.
|
* Task in background starts here.
|
||||||
*/
|
*/
|
||||||
private void backupService() {
|
private void backupService() {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getContext().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
final List<Account> accounts = new AccountDAO(getContext(), db).getAllAccount();
|
final List<Account> accounts = new AccountDAO(getContext(), db).getAllAccount();
|
||||||
SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class BackupStatusesSyncJob extends Job {
|
||||||
* Task in background starts here.
|
* Task in background starts here.
|
||||||
*/
|
*/
|
||||||
private void backupService() {
|
private void backupService() {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getContext().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
final List<Account> accounts = new AccountDAO(getContext(), db).getAllAccount();
|
final List<Account> accounts = new AccountDAO(getContext(), db).getAllAccount();
|
||||||
SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class NotificationsSyncJob extends Job {
|
||||||
if (liveNotifications != Helper.NOTIF_NONE) {
|
if (liveNotifications != Helper.NOTIF_NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getContext().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//If an Internet connection and user agrees with notification refresh
|
//If an Internet connection and user agrees with notification refresh
|
||||||
final SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
//Check which notifications the user wants to see
|
//Check which notifications the user wants to see
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class ScheduledBoostsSyncJob extends Job {
|
||||||
|
|
||||||
long startMs = (timestampScheduling - new Date().getTime());
|
long startMs = (timestampScheduling - new Date().getTime());
|
||||||
long endMs = startMs + TimeUnit.MINUTES.toMillis(5);
|
long endMs = startMs + TimeUnit.MINUTES.toMillis(5);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
|
||||||
int jobId = new JobRequest.Builder(ScheduledBoostsSyncJob.SCHEDULED_BOOST)
|
int jobId = new JobRequest.Builder(ScheduledBoostsSyncJob.SCHEDULED_BOOST)
|
||||||
.setExecutionWindow(startMs, endMs)
|
.setExecutionWindow(startMs, endMs)
|
||||||
|
@ -69,7 +69,7 @@ public class ScheduledBoostsSyncJob extends Job {
|
||||||
|
|
||||||
long startMs = (timestampScheduling - new Date().getTime());
|
long startMs = (timestampScheduling - new Date().getTime());
|
||||||
long endMs = startMs + TimeUnit.MINUTES.toMillis(5);
|
long endMs = startMs + TimeUnit.MINUTES.toMillis(5);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
|
||||||
int jobId = new JobRequest.Builder(ScheduledTootsSyncJob.SCHEDULED_TOOT)
|
int jobId = new JobRequest.Builder(ScheduledTootsSyncJob.SCHEDULED_TOOT)
|
||||||
.setExecutionWindow(startMs, endMs)
|
.setExecutionWindow(startMs, endMs)
|
||||||
|
@ -87,7 +87,7 @@ public class ScheduledBoostsSyncJob extends Job {
|
||||||
protected Result onRunJob(@NonNull Params params) {
|
protected Result onRunJob(@NonNull Params params) {
|
||||||
//Code refresh here
|
//Code refresh here
|
||||||
int jobId = params.getId();
|
int jobId = params.getId();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getContext().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//Retrieves the stored status
|
//Retrieves the stored status
|
||||||
StoredStatus storedStatus = new BoostScheduleDAO(getContext(), db).getStatusScheduled(jobId);
|
StoredStatus storedStatus = new BoostScheduleDAO(getContext(), db).getStatusScheduled(jobId);
|
||||||
if (storedStatus != null) {
|
if (storedStatus != null) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class ScheduledTootsSyncJob extends Job {
|
||||||
|
|
||||||
long startMs = (timestampScheduling - new Date().getTime());
|
long startMs = (timestampScheduling - new Date().getTime());
|
||||||
long endMs = startMs + TimeUnit.MINUTES.toMillis(5);
|
long endMs = startMs + TimeUnit.MINUTES.toMillis(5);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
|
||||||
int jobId = new JobRequest.Builder(ScheduledTootsSyncJob.SCHEDULED_TOOT)
|
int jobId = new JobRequest.Builder(ScheduledTootsSyncJob.SCHEDULED_TOOT)
|
||||||
.setExecutionWindow(startMs, endMs)
|
.setExecutionWindow(startMs, endMs)
|
||||||
|
@ -70,7 +70,7 @@ public class ScheduledTootsSyncJob extends Job {
|
||||||
protected Result onRunJob(@NonNull Params params) {
|
protected Result onRunJob(@NonNull Params params) {
|
||||||
//Code refresh here
|
//Code refresh here
|
||||||
int jobId = params.getId();
|
int jobId = params.getId();
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getContext().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
//Retrieves the stored status
|
//Retrieves the stored status
|
||||||
StoredStatus storedStatus = new StatusStoredDAO(getContext(), db).getStatusScheduled(jobId);
|
StoredStatus storedStatus = new StatusStoredDAO(getContext(), db).getStatusScheduled(jobId);
|
||||||
if (storedStatus != null) {
|
if (storedStatus != null) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class BackupNotificationInDataBaseService extends IntentService {
|
||||||
}
|
}
|
||||||
instanceRunning++;
|
instanceRunning++;
|
||||||
String message;
|
String message;
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BackupNotificationInDataBaseService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(BackupNotificationInDataBaseService.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BackupNotificationInDataBaseService.this, db).getUniqAccount(userId, instance);
|
||||||
API api = new API(BackupNotificationInDataBaseService.this, account.getInstance(), account.getToken());
|
API api = new API(BackupNotificationInDataBaseService.this, account.getInstance(), account.getToken());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class BackupStatusInDataBaseService extends IntentService {
|
||||||
}
|
}
|
||||||
instanceRunning++;
|
instanceRunning++;
|
||||||
String message;
|
String message;
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BackupStatusInDataBaseService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(BackupStatusInDataBaseService.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BackupStatusInDataBaseService.this, db).getUniqAccount(userId, instance);
|
||||||
API api = new API(BackupStatusInDataBaseService.this, account.getInstance(), account.getToken());
|
API api = new API(BackupStatusInDataBaseService.this, account.getInstance(), account.getToken());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class BackupStatusService extends IntentService {
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(BackupStatusService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
Account account = new AccountDAO(BackupStatusService.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(BackupStatusService.this, db).getUniqAccount(userId, instance);
|
||||||
API api = new API(BackupStatusService.this, account.getInstance(), account.getToken());
|
API api = new API(BackupStatusService.this, account.getInstance(), account.getToken());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class LiveNotificationDelayedService extends Service {
|
||||||
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
|
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(LiveNotificationDelayedService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Account> accountStreams = new AccountDAO(LiveNotificationDelayedService.this, db).getAllAccountCrossAction();
|
List<Account> accountStreams = new AccountDAO(LiveNotificationDelayedService.this, db).getAllAccountCrossAction();
|
||||||
totalAccount = 0;
|
totalAccount = 0;
|
||||||
if (accountStreams != null) {
|
if (accountStreams != null) {
|
||||||
|
@ -181,7 +181,7 @@ public class LiveNotificationDelayedService extends Service {
|
||||||
|
|
||||||
private void startStream() {
|
private void startStream() {
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(LiveNotificationDelayedService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (Helper.liveNotifType(LiveNotificationDelayedService.this) == Helper.NOTIF_DELAYED) {
|
if (Helper.liveNotifType(LiveNotificationDelayedService.this) == Helper.NOTIF_DELAYED) {
|
||||||
List<Account> accountStreams = new AccountDAO(LiveNotificationDelayedService.this, db).getAllAccountCrossAction();
|
List<Account> accountStreams = new AccountDAO(LiveNotificationDelayedService.this, db).getAllAccountCrossAction();
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class LiveNotificationService extends Service implements NetworkStateRece
|
||||||
|
|
||||||
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
|
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
|
||||||
}
|
}
|
||||||
SQLiteDatabase db = Sqlite.getInstance(LiveNotificationService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Account> accountStreams = new AccountDAO(LiveNotificationService.this, db).getAllAccountCrossAction();
|
List<Account> accountStreams = new AccountDAO(LiveNotificationService.this, db).getAllAccountCrossAction();
|
||||||
totalAccount = 0;
|
totalAccount = 0;
|
||||||
if (accountStreams != null) {
|
if (accountStreams != null) {
|
||||||
|
@ -155,7 +155,7 @@ public class LiveNotificationService extends Service implements NetworkStateRece
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
boolean liveNotifications = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
|
boolean liveNotifications = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(LiveNotificationService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
if (liveNotifications) {
|
if (liveNotifications) {
|
||||||
List<Account> accountStreams = new AccountDAO(LiveNotificationService.this, db).getAllAccountCrossAction();
|
List<Account> accountStreams = new AccountDAO(LiveNotificationService.this, db).getAllAccountCrossAction();
|
||||||
if (accountStreams != null) {
|
if (accountStreams != null) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class StreamingFederatedTimelineService extends IntentService {
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account accountStream = null;
|
Account accountStream = null;
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(StreamingFederatedTimelineService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
accountStream = new AccountDAO(StreamingFederatedTimelineService.this, db).getUniqAccount(userId, instance);
|
accountStream = new AccountDAO(StreamingFederatedTimelineService.this, db).getUniqAccount(userId, instance);
|
||||||
}
|
}
|
||||||
if (accountStream != null) {
|
if (accountStream != null) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class StreamingHomeTimelineService extends IntentService {
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account accountStream = null;
|
Account accountStream = null;
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(StreamingHomeTimelineService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
accountStream = new AccountDAO(StreamingHomeTimelineService.this, db).getUniqAccount(userId, instance);
|
accountStream = new AccountDAO(StreamingHomeTimelineService.this, db).getUniqAccount(userId, instance);
|
||||||
}
|
}
|
||||||
if (accountStream != null) {
|
if (accountStream != null) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class StreamingLocalTimelineService extends IntentService {
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account accountStream = null;
|
Account accountStream = null;
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(StreamingLocalTimelineService.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
accountStream = new AccountDAO(StreamingLocalTimelineService.this, db).getUniqAccount(userId, instance);
|
accountStream = new AccountDAO(StreamingLocalTimelineService.this, db).getUniqAccount(userId, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ public class Sqlite extends SQLiteOpenHelper {
|
||||||
intent.setAction(android.content.Intent.ACTION_VIEW);
|
intent.setAction(android.content.Intent.ACTION_VIEW);
|
||||||
Uri uri = Uri.fromFile(dbDest);
|
Uri uri = Uri.fromFile(dbDest);
|
||||||
intent.setDataAndType(uri, "*/*");
|
intent.setDataAndType(uri, "*/*");
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||||
|
@ -555,8 +555,6 @@ public class Sqlite extends SQLiteOpenHelper {
|
||||||
if (db != null && db.isOpen()) {
|
if (db != null && db.isOpen()) {
|
||||||
db.close();
|
db.close();
|
||||||
}
|
}
|
||||||
sInstance = null;
|
|
||||||
db = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue