Some changes
This commit is contained in:
parent
bfe8b22b7c
commit
6732e1dc72
|
@ -15,6 +15,7 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -260,27 +261,26 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
|
||||
List<Entry> boostsEntry = new ArrayList<>();
|
||||
|
||||
|
||||
Iterator it = charts.getReblogs().entrySet().iterator();
|
||||
Iterator<Map.Entry<Long, Integer>> it = charts.getReblogs().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
boostsEntry.add(new Entry((long) pair.getKey(), (int) pair.getValue()));
|
||||
Map.Entry<Long, Integer> pair = it.next();
|
||||
boostsEntry.add(new Entry(pair.getKey(), pair.getValue()));
|
||||
it.remove();
|
||||
}
|
||||
|
||||
List<Entry> favEntry = new ArrayList<>();
|
||||
it = charts.getFavourites().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
favEntry.add(new Entry((long) pair.getKey(), (int) pair.getValue()));
|
||||
Map.Entry<Long, Integer> pair = it.next();
|
||||
favEntry.add(new Entry(pair.getKey(), pair.getValue()));
|
||||
it.remove();
|
||||
}
|
||||
|
||||
List<Entry> mentionEntry = new ArrayList<>();
|
||||
it = charts.getMentions().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
mentionEntry.add(new Entry((long) pair.getKey(), (int) pair.getValue()));
|
||||
Map.Entry<Long, Integer> pair = it.next();
|
||||
mentionEntry.add(new Entry(pair.getKey(), pair.getValue()));
|
||||
it.remove();
|
||||
}
|
||||
|
||||
|
@ -288,8 +288,8 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
List<Entry> followEntry = new ArrayList<>();
|
||||
it = charts.getFollows().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
followEntry.add(new Entry((long) pair.getKey(), (int) pair.getValue()));
|
||||
Map.Entry<Long, Integer> pair = it.next();
|
||||
followEntry.add(new Entry(pair.getKey(), pair.getValue()));
|
||||
it.remove();
|
||||
}
|
||||
|
||||
|
@ -482,6 +482,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@SuppressLint("ViewConstructor")
|
||||
public static class CustomMarkerView extends MarkerView {
|
||||
private TextView tvContent;
|
||||
private MPPointF mOffset;
|
||||
|
@ -503,7 +504,7 @@ public class OwnerNotificationChartsActivity extends BaseActivity implements OnR
|
|||
@Override
|
||||
public MPPointF getOffset() {
|
||||
if (mOffset == null) {
|
||||
mOffset = new MPPointF(-(getWidth() / 2), -getHeight());
|
||||
mOffset = new MPPointF(-((float)getWidth() / 2), -getHeight());
|
||||
}
|
||||
return mOffset;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
|||
import app.fedilab.android.asynctasks.RetrieveStatsAsyncTask;
|
||||
import app.fedilab.android.client.APIResponse;
|
||||
import app.fedilab.android.client.Entities.Account;
|
||||
import app.fedilab.android.client.Entities.Instance;
|
||||
import app.fedilab.android.client.Entities.Statistics;
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||
|
@ -522,11 +523,11 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
frequency.setText(getString(R.string.toot_per_day, df.format(statistics.getFrequency())));
|
||||
|
||||
if (statistics.getTagsTrend() != null && statistics.getTagsTrend().size() > 0) {
|
||||
Iterator it = statistics.getTagsTrend().entrySet().iterator();
|
||||
Iterator<Map.Entry<String, Integer>> it = statistics.getTagsTrend().entrySet().iterator();
|
||||
StringBuilder text = new StringBuilder();
|
||||
int i = 1;
|
||||
while (it.hasNext() && i <= 10) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, Integer> pair = it.next();
|
||||
System.out.println(pair.getKey() + " = " + pair.getValue());
|
||||
text.append(i).append(" - ").append(pair.getKey()).append(" → ").append(pair.getValue()).append("\r\n");
|
||||
i++;
|
||||
|
|
|
@ -639,26 +639,18 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
|||
@Override
|
||||
public void onConfigurationChanged(@NotNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
|
||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
|
||||
openFullscreenDialog();
|
||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
}
|
||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
if (mode != Helper.VIDEO_MODE_WEBVIEW) {
|
||||
closeFullscreenDialog();
|
||||
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
||||
}
|
||||
change();
|
||||
} else {
|
||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
setFullscreen(FullScreenMediaController.fullscreen.ON);
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
||||
}
|
||||
change();
|
||||
|
||||
|
||||
setFullscreen(FullScreenMediaController.fullscreen.OFF);
|
||||
}
|
||||
change();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
private String videoId;
|
||||
private Account channel;
|
||||
|
||||
@SuppressWarnings("SuspiciousMethodCalls")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -168,12 +167,12 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
||||
//Populate catgories
|
||||
String[] categoriesA = new String[categories.size()];
|
||||
Iterator it = categories.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (translations == null || translations.size() == 0 || !translations.containsKey(pair.getValue()))
|
||||
categoriesA[i] = (String) pair.getValue();
|
||||
categoriesA[i] = pair.getValue();
|
||||
else
|
||||
categoriesA[i] = translations.get(pair.getValue());
|
||||
it.remove();
|
||||
|
@ -189,9 +188,9 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
it = licences.entrySet().iterator();
|
||||
i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (translations == null || translations.size() == 0 || !translations.containsKey(pair.getValue()))
|
||||
licensesA[i] = (String) pair.getValue();
|
||||
licensesA[i] = pair.getValue();
|
||||
else
|
||||
licensesA[i] = translations.get(pair.getValue());
|
||||
it.remove();
|
||||
|
@ -204,12 +203,12 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
|
||||
//Populate languages
|
||||
String[] languagesA = new String[languages.size()];
|
||||
it = languages.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> itl = languages.entrySet().iterator();
|
||||
i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> pair = itl.next();
|
||||
if (translations == null || translations.size() == 0 || !translations.containsKey(pair.getValue()))
|
||||
languagesA[i] = (String) pair.getValue();
|
||||
languagesA[i] = pair.getValue();
|
||||
else
|
||||
languagesA[i] = translations.get(pair.getValue());
|
||||
it.remove();
|
||||
|
@ -225,9 +224,9 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
it = privacies.entrySet().iterator();
|
||||
i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (translations == null || translations.size() == 0 || !translations.containsKey(pair.getValue()))
|
||||
privaciesA[i] = (String) pair.getValue();
|
||||
privaciesA[i] = pair.getValue();
|
||||
else
|
||||
privaciesA[i] = translations.get(pair.getValue());
|
||||
it.remove();
|
||||
|
@ -347,9 +346,9 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
|
||||
int languagePosition = 0;
|
||||
if (languages.containsValue(language)) {
|
||||
Iterator it = languages.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = languages.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
if (pair.getValue().equals(language))
|
||||
break;
|
||||
it.remove();
|
||||
|
@ -358,9 +357,9 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
}
|
||||
int privacyPosition = 0;
|
||||
if (privacy != null && privacies.containsValue(privacy)) {
|
||||
Iterator it = privacies.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = privacies.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (pair.getValue().equals(privacy))
|
||||
break;
|
||||
it.remove();
|
||||
|
@ -369,9 +368,9 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
}
|
||||
int licensePosition = 0;
|
||||
if (license != null && licences.containsValue(license)) {
|
||||
Iterator it = licences.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = licences.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (pair.getValue().equals(license))
|
||||
break;
|
||||
it.remove();
|
||||
|
@ -380,9 +379,9 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
}
|
||||
int categoryPosition = 0;
|
||||
if (category != null && categories.containsValue(category)) {
|
||||
Iterator it = categories.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (pair.getValue().equals(category))
|
||||
break;
|
||||
it.remove();
|
||||
|
@ -395,13 +394,13 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
LinkedHashMap<Integer, String> privaciesCheck = new LinkedHashMap<>(peertubeInformation.getPrivacies());
|
||||
Iterator it = privaciesCheck.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = privaciesCheck.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (i == position) {
|
||||
privacyToSend = new HashMap<>();
|
||||
privacyToSend.put((Integer) pair.getKey(), (String) pair.getValue());
|
||||
privacyToSend.put(pair.getKey(), pair.getValue());
|
||||
break;
|
||||
}
|
||||
it.remove();
|
||||
|
@ -418,13 +417,13 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
LinkedHashMap<Integer, String> licensesCheck = new LinkedHashMap<>(peertubeInformation.getLicences());
|
||||
Iterator it = licensesCheck.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = licensesCheck.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (i == position) {
|
||||
licenseToSend = new HashMap<>();
|
||||
licenseToSend.put((Integer) pair.getKey(), (String) pair.getValue());
|
||||
licenseToSend.put(pair.getKey(), pair.getValue());
|
||||
break;
|
||||
}
|
||||
it.remove();
|
||||
|
@ -442,13 +441,13 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
LinkedHashMap<Integer, String> categoriesCheck = new LinkedHashMap<>(peertubeInformation.getCategories());
|
||||
Iterator it = categoriesCheck.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = categoriesCheck.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (i == position) {
|
||||
categoryToSend = new HashMap<>();
|
||||
categoryToSend.put((Integer) pair.getKey(), (String) pair.getValue());
|
||||
categoryToSend.put(pair.getKey(), pair.getValue());
|
||||
break;
|
||||
}
|
||||
it.remove();
|
||||
|
@ -467,13 +466,13 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
LinkedHashMap<String, String> languagesCheck = new LinkedHashMap<>(peertubeInformation.getLanguages());
|
||||
Iterator it = languagesCheck.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = languagesCheck.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
if (i == position) {
|
||||
languageToSend = new HashMap<>();
|
||||
languageToSend.put((String) pair.getKey(), (String) pair.getValue());
|
||||
languageToSend.put(pair.getKey(), pair.getValue());
|
||||
break;
|
||||
}
|
||||
it.remove();
|
||||
|
@ -491,13 +490,13 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
LinkedHashMap<String, String> channelsCheck = new LinkedHashMap<>(channels);
|
||||
Iterator it = channelsCheck.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = channelsCheck.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
if (i == position) {
|
||||
channelToSend = new HashMap<>();
|
||||
channelToSend.put((String) pair.getKey(), (String) pair.getValue());
|
||||
channelToSend.put(pair.getKey(), pair.getValue());
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -540,8 +539,7 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
|
||||
List<String> tags = peertube.getTags();
|
||||
if (tags != null && tags.size() > 0) {
|
||||
//noinspection ToArrayCallWithZeroLengthArrayArgument
|
||||
String[] tagsA = tags.toArray(new String[tags.size()]);
|
||||
String[] tagsA = tags.toArray(new String[0]);
|
||||
p_video_tags.setTags(tagsA);
|
||||
}
|
||||
|
||||
|
@ -578,12 +576,12 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
|||
int channelPosition = 0;
|
||||
if (channels.containsKey(channel.getUsername())) {
|
||||
LinkedHashMap<String, String> channelsIterator = new LinkedHashMap<>(channels);
|
||||
Iterator it = channelsIterator.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = channelsIterator.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
if (pair.getKey().equals(channel.getUsername())) {
|
||||
channelToSend = new HashMap<>();
|
||||
channelToSend.put((String) pair.getKey(), (String) pair.getValue());
|
||||
channelToSend.put(pair.getKey(), pair.getValue());
|
||||
break;
|
||||
}
|
||||
it.remove();
|
||||
|
|
|
@ -194,7 +194,6 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("SuspiciousMethodCalls")
|
||||
@Override
|
||||
public void onRetrievePeertubeChannels(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) {
|
||||
|
@ -237,12 +236,12 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
|||
LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies());
|
||||
//Populate privacies
|
||||
String[] privaciesA = new String[privacies.size()];
|
||||
Iterator it = privacies.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = privacies.entrySet().iterator();
|
||||
i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (translations == null || translations.size() == 0 || !translations.containsKey(pair.getValue()))
|
||||
privaciesA[i] = (String) pair.getValue();
|
||||
privaciesA[i] = pair.getValue();
|
||||
else
|
||||
privaciesA[i] = translations.get(pair.getValue());
|
||||
it.remove();
|
||||
|
@ -258,13 +257,13 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
LinkedHashMap<Integer, String> privaciesCheck = new LinkedHashMap<>(peertubeInformation.getPrivacies());
|
||||
Iterator it = privaciesCheck.entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, String>> it = privaciesCheck.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<Integer, String> pair = it.next();
|
||||
if (i == position) {
|
||||
privacyToSend = new HashMap<>();
|
||||
privacyToSend.put((Integer) pair.getKey(), (String) pair.getValue());
|
||||
privacyToSend.put(pair.getKey(), pair.getValue());
|
||||
break;
|
||||
}
|
||||
it.remove();
|
||||
|
@ -309,13 +308,13 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
LinkedHashMap<String, String> channelsCheck = new LinkedHashMap<>(channels);
|
||||
Iterator it = channelsCheck.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = channelsCheck.entrySet().iterator();
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
if (i == position) {
|
||||
channelToSend = new HashMap<>();
|
||||
channelToSend.put((String) pair.getKey(), (String) pair.getValue());
|
||||
channelToSend.put(pair.getKey(), pair.getValue());
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -357,11 +357,8 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
|
|||
if (s.toString().length() == 0)
|
||||
currentCursorPosition[0] = 0;
|
||||
//Only check last 15 characters before cursor position to avoid lags
|
||||
if (currentCursorPosition[0] < searchDeep) { //Less than 15 characters are written before the cursor position
|
||||
searchLength[0] = currentCursorPosition[0];
|
||||
} else {
|
||||
searchLength[0] = searchDeep;
|
||||
}
|
||||
//Less than 15 characters are written before the cursor position
|
||||
searchLength[0] = Math.min(currentCursorPosition[0], searchDeep);
|
||||
|
||||
|
||||
int totalChar = countLength(social, toot_content);
|
||||
|
|
|
@ -81,9 +81,6 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
|
|||
case Helper.THEME_LIGHT:
|
||||
setTheme(R.style.AppTheme_NoActionBar_Fedilab);
|
||||
break;
|
||||
case Helper.THEME_DARK:
|
||||
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||
break;
|
||||
case Helper.THEME_BLACK:
|
||||
setTheme(R.style.AppThemeBlack_NoActionBar);
|
||||
break;
|
||||
|
@ -102,12 +99,7 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
|
|||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
|
||||
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
toolbar_close.setOnClickListener(v -> finish());
|
||||
toolbar_title.setText(R.string.upload_video);
|
||||
|
||||
}
|
||||
|
@ -140,7 +132,6 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
|
|||
|
||||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
boolean isOnWifi = Helper.isOnWIFI(PlaylistsActivity.this);
|
||||
|
||||
peertubeAdapter = new PeertubeAdapter(Helper.getLiveInstance(PlaylistsActivity.this), false, this.peertubes);
|
||||
|
||||
|
@ -181,16 +172,13 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
|
|||
});
|
||||
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
MainActivity.countNewStatus = 0;
|
||||
new ManagePlaylistsAsyncTask(PlaylistsActivity.this, GET_LIST_VIDEOS, playlist, null, null, PlaylistsActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
swipeRefreshLayout.setOnRefreshListener(() -> {
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
MainActivity.countNewStatus = 0;
|
||||
new ManagePlaylistsAsyncTask(PlaylistsActivity.this, GET_LIST_VIDEOS, playlist, null, null, PlaylistsActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
});
|
||||
|
||||
new ManagePlaylistsAsyncTask(PlaylistsActivity.this, GET_LIST_VIDEOS, playlist, null, null, PlaylistsActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -199,19 +187,16 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActionDone(ManagePlaylistsAsyncTask.action actionType, APIResponse apiResponse, int statusCode) {
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
//Discards 404 - error which can often happen due to toots which have been deleted
|
||||
|
@ -236,9 +221,7 @@ public class PlaylistsActivity extends BaseActivity implements OnPlaylistActionI
|
|||
|
||||
if (swiped) {
|
||||
if (previousPosition > 0) {
|
||||
for (int i = 0; i < previousPosition; i++) {
|
||||
this.peertubes.remove(0);
|
||||
}
|
||||
this.peertubes.subList(0, previousPosition).clear();
|
||||
peertubeAdapter.notifyItemRangeRemoved(0, previousPosition);
|
||||
}
|
||||
swiped = false;
|
||||
|
|
|
@ -60,13 +60,10 @@ public class ProxyActivity extends BaseActivity {
|
|||
boolean enable_proxy = sharedpreferences.getBoolean(Helper.SET_PROXY_ENABLED, false);
|
||||
final CheckBox set_enable_proxy = findViewById(R.id.enable_proxy);
|
||||
set_enable_proxy.setChecked(enable_proxy);
|
||||
set_enable_proxy.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_PROXY_ENABLED, set_enable_proxy.isChecked());
|
||||
editor.apply();
|
||||
}
|
||||
set_enable_proxy.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_PROXY_ENABLED, set_enable_proxy.isChecked());
|
||||
editor.apply();
|
||||
});
|
||||
|
||||
Button save = findViewById(R.id.set_proxy_save);
|
||||
|
@ -112,34 +109,29 @@ public class ProxyActivity extends BaseActivity {
|
|||
|
||||
}
|
||||
});
|
||||
save.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String hostVal = host.getText().toString().trim();
|
||||
String portVal = port.getText().toString().trim();
|
||||
String proxy_loginVal = proxy_login.getText().toString().trim();
|
||||
String proxy_passwordVal = proxy_password.getText().toString().trim();
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.SET_PROXY_HOST, hostVal);
|
||||
if (portVal.matches("\\d+"))
|
||||
editor.putInt(Helper.SET_PROXY_PORT, Integer.parseInt(portVal));
|
||||
editor.putString(Helper.SET_PROXY_LOGIN, proxy_loginVal);
|
||||
editor.putString(Helper.SET_PROXY_PASSWORD, proxy_passwordVal);
|
||||
editor.apply();
|
||||
finish();
|
||||
}
|
||||
save.setOnClickListener(view -> {
|
||||
String hostVal1 = host.getText().toString().trim();
|
||||
String portVal1 = port.getText().toString().trim();
|
||||
String proxy_loginVal = proxy_login.getText().toString().trim();
|
||||
String proxy_passwordVal = proxy_password.getText().toString().trim();
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.SET_PROXY_HOST, hostVal1);
|
||||
if (portVal1.matches("\\d+"))
|
||||
editor.putInt(Helper.SET_PROXY_PORT, Integer.parseInt(portVal1));
|
||||
editor.putString(Helper.SET_PROXY_LOGIN, proxy_loginVal);
|
||||
editor.putString(Helper.SET_PROXY_PASSWORD, proxy_passwordVal);
|
||||
editor.apply();
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
package app.fedilab.android.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
@ -33,7 +32,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.ImageView;
|
||||
|
@ -138,212 +136,174 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
|
|||
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
|
||||
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||
ImageView add_remote_instance = actionBar.getCustomView().findViewById(R.id.add_remote_instance);
|
||||
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
toolbar_close.setOnClickListener(v -> finish());
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
add_remote_instance.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
add_remote_instance.setVisibility(View.GONE);
|
||||
}
|
||||
add_remote_instance.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ReorderTimelinesActivity.this, style);
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.search_instance, null);
|
||||
dialogBuilder.setView(dialogView);
|
||||
add_remote_instance.setOnClickListener(v -> {
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ReorderTimelinesActivity.this, style);
|
||||
LayoutInflater inflater1 = getLayoutInflater();
|
||||
@SuppressLint("InflateParams") View dialogView = inflater1.inflate(R.layout.search_instance, null);
|
||||
dialogBuilder.setView(dialogView);
|
||||
|
||||
AutoCompleteTextView instance_list = dialogView.findViewById(R.id.search_instance);
|
||||
//Manage download of attachments
|
||||
RadioGroup radioGroup = dialogView.findViewById(R.id.set_attachment_group);
|
||||
radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
if (checkedId == R.id.twitter_accounts) {
|
||||
instance_list.setHint(R.string.list_of_twitter_accounts);
|
||||
} else {
|
||||
instance_list.setHint(R.string.instance);
|
||||
}
|
||||
});
|
||||
instance_list.setFilters(new InputFilter[]{new InputFilter.LengthFilter(60)});
|
||||
dialogBuilder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
String instanceName = instance_list.getText().toString().trim().replace("@", "");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (radioGroup.getCheckedRadioButtonId() == R.id.mastodon_instance)
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/v1/timelines/public?local=true", 10, null, null);
|
||||
else if (radioGroup.getCheckedRadioButtonId() == R.id.peertube_instance)
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/v1/videos/", 10, null, null);
|
||||
else if (radioGroup.getCheckedRadioButtonId() == R.id.pixelfed_instance) {
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/v1/timelines/public", 10, null, null);
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.misskey_instance) {
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).post("https://" + instanceName + "/api/notes/local-timeline", 10, null, null);
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.gnu_instance) {
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/statuses/public_timeline.json", 10, null, null);
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
dialog.dismiss();
|
||||
if (radioGroup.getCheckedRadioButtonId() == R.id.mastodon_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "MASTODON");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.peertube_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "PEERTUBE");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.pixelfed_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "PIXELFED");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.misskey_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "MISSKEY");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.gnu_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "GNU");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.twitter_accounts) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "NITTER");
|
||||
}
|
||||
if (timelines != null && adapter != null) {
|
||||
List<RemoteInstance> instance = new InstancesDAO(ReorderTimelinesActivity.this, db).getInstanceByName(instanceName);
|
||||
if (instance != null && instance.size() > 0) {
|
||||
ManageTimelines manageTimelines = new ManageTimelines();
|
||||
manageTimelines.setRemoteInstance(instance.get(0));
|
||||
manageTimelines.setPosition(timelines.size());
|
||||
manageTimelines.setDisplayed(true);
|
||||
manageTimelines.setType(ManageTimelines.Type.INSTANCE);
|
||||
timelines.add(manageTimelines);
|
||||
adapter.notifyItemInserted((timelines.size() - 1));
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
Toasty.warning(ReorderTimelinesActivity.this, getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
AutoCompleteTextView instance_list = dialogView.findViewById(R.id.search_instance);
|
||||
//Manage download of attachments
|
||||
RadioGroup radioGroup = dialogView.findViewById(R.id.set_attachment_group);
|
||||
radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
|
||||
if (checkedId == R.id.twitter_accounts) {
|
||||
instance_list.setHint(R.string.list_of_twitter_accounts);
|
||||
} else {
|
||||
instance_list.setHint(R.string.instance);
|
||||
}
|
||||
});
|
||||
instance_list.setFilters(new InputFilter[]{new InputFilter.LengthFilter(60)});
|
||||
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> {
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
String instanceName = instance_list.getText().toString().trim().replace("@", "");
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (radioGroup.getCheckedRadioButtonId() == R.id.mastodon_instance)
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/v1/timelines/public?local=true", 10, null, null);
|
||||
else if (radioGroup.getCheckedRadioButtonId() == R.id.peertube_instance)
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/v1/videos/", 10, null, null);
|
||||
else if (radioGroup.getCheckedRadioButtonId() == R.id.pixelfed_instance) {
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/v1/timelines/public", 10, null, null);
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.misskey_instance) {
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).post("https://" + instanceName + "/api/notes/local-timeline", 10, null, null);
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.gnu_instance) {
|
||||
new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://" + instanceName + "/api/statuses/public_timeline.json", 10, null, null);
|
||||
}
|
||||
runOnUiThread(() -> {
|
||||
dialog.dismiss();
|
||||
if (radioGroup.getCheckedRadioButtonId() == R.id.mastodon_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "MASTODON");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.peertube_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "PEERTUBE");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.pixelfed_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "PIXELFED");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.misskey_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "MISSKEY");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.gnu_instance) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "GNU");
|
||||
} else if (radioGroup.getCheckedRadioButtonId() == R.id.twitter_accounts) {
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).insertInstance(instanceName, "NITTER");
|
||||
}
|
||||
if (timelines != null && adapter != null) {
|
||||
List<RemoteInstance> instance = new InstancesDAO(ReorderTimelinesActivity.this, db).getInstanceByName(instanceName);
|
||||
if (instance != null && instance.size() > 0) {
|
||||
ManageTimelines manageTimelines = new ManageTimelines();
|
||||
manageTimelines.setRemoteInstance(instance.get(0));
|
||||
manageTimelines.setPosition(timelines.size());
|
||||
manageTimelines.setDisplayed(true);
|
||||
manageTimelines.setType(ManageTimelines.Type.INSTANCE);
|
||||
timelines.add(manageTimelines);
|
||||
adapter.notifyItemInserted((timelines.size() - 1));
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
runOnUiThread(() -> Toasty.warning(ReorderTimelinesActivity.this, getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show());
|
||||
}
|
||||
});
|
||||
AlertDialog alertDialog = dialogBuilder.create();
|
||||
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialogInterface) {
|
||||
//Hide keyboard
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
assert imm != null;
|
||||
imm.hideSoftInputFromWindow(instance_list.getWindowToken(), 0);
|
||||
}
|
||||
});
|
||||
if (alertDialog.getWindow() != null)
|
||||
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
alertDialog.show();
|
||||
}).start();
|
||||
});
|
||||
AlertDialog alertDialog = dialogBuilder.create();
|
||||
alertDialog.setOnDismissListener(dialogInterface -> {
|
||||
//Hide keyboard
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
assert imm != null;
|
||||
imm.hideSoftInputFromWindow(instance_list.getWindowToken(), 0);
|
||||
});
|
||||
if (alertDialog.getWindow() != null)
|
||||
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
alertDialog.show();
|
||||
|
||||
instance_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
String oldSearch = parent.getItemAtPosition(position).toString().trim();
|
||||
}
|
||||
});
|
||||
instance_list.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
instance_list.setOnItemClickListener((parent, view1, position, id) -> {
|
||||
});
|
||||
instance_list.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (radioGroup.getCheckedRadioButtonId() != R.id.twitter_accounts) {
|
||||
Pattern host = Pattern.compile("([\\da-z\\.-]+\\.[a-z\\.]{2,12})");
|
||||
Matcher matcher = host.matcher(s.toString().trim());
|
||||
if (s.toString().trim().length() == 0 || !matcher.find()) {
|
||||
alertDialog.getButton(
|
||||
AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
} else {
|
||||
// Something into edit text. Enable the button.
|
||||
alertDialog.getButton(
|
||||
AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
}
|
||||
if (s.length() > 2 && !isLoadingInstance) {
|
||||
final String action = "/instances/search";
|
||||
final HashMap<String, String> parameters = new HashMap<>();
|
||||
parameters.put("q", s.toString().trim());
|
||||
parameters.put("count", String.valueOf(1000));
|
||||
parameters.put("name", String.valueOf(true));
|
||||
isLoadingInstance = true;
|
||||
|
||||
if (oldSearch == null || !oldSearch.equals(s.toString().trim()))
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final String response = new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://instances.social/api/1.0" + action, 30, parameters, Helper.THEKINRAR_SECRET_TOKEN);
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
isLoadingInstance = false;
|
||||
String[] instances;
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(response);
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("instances");
|
||||
if (jsonArray != null) {
|
||||
int length = 0;
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
if (!jsonArray.getJSONObject(i).get("name").toString().contains("@") && jsonArray.getJSONObject(i).get("up").toString().equals("true"))
|
||||
length++;
|
||||
}
|
||||
instances = new String[length];
|
||||
int j = 0;
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
if (!jsonArray.getJSONObject(i).get("name").toString().contains("@") && jsonArray.getJSONObject(i).get("up").toString().equals("true")) {
|
||||
instances[j] = jsonArray.getJSONObject(i).get("name").toString();
|
||||
j++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
instances = new String[]{};
|
||||
}
|
||||
instance_list.setAdapter(null);
|
||||
ArrayAdapter<String> adapter =
|
||||
new ArrayAdapter<>(ReorderTimelinesActivity.this, android.R.layout.simple_list_item_1, instances);
|
||||
instance_list.setAdapter(adapter);
|
||||
if (instance_list.hasFocus() && !ReorderTimelinesActivity.this.isFinishing())
|
||||
instance_list.showDropDown();
|
||||
oldSearch = s.toString().trim();
|
||||
|
||||
} catch (JSONException ignored) {
|
||||
isLoadingInstance = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||
isLoadingInstance = false;
|
||||
} catch (Exception e) {
|
||||
isLoadingInstance = false;
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
else
|
||||
isLoadingInstance = false;
|
||||
}
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (radioGroup.getCheckedRadioButtonId() != R.id.twitter_accounts) {
|
||||
Pattern host = Pattern.compile("([\\da-z.-]+\\.[a-z.]{2,12})");
|
||||
Matcher matcher = host.matcher(s.toString().trim());
|
||||
if (s.toString().trim().length() == 0 || !matcher.find()) {
|
||||
alertDialog.getButton(
|
||||
AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
} else {
|
||||
// Something into edit text. Enable the button.
|
||||
alertDialog.getButton(
|
||||
AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
}
|
||||
if (s.length() > 2 && !isLoadingInstance) {
|
||||
final String action = "/instances/search";
|
||||
final HashMap<String, String> parameters = new HashMap<>();
|
||||
parameters.put("q", s.toString().trim());
|
||||
parameters.put("count", String.valueOf(1000));
|
||||
parameters.put("name", String.valueOf(true));
|
||||
isLoadingInstance = true;
|
||||
|
||||
if (oldSearch == null || !oldSearch.equals(s.toString().trim()))
|
||||
new Thread(() -> {
|
||||
try {
|
||||
final String response = new HttpsConnection(ReorderTimelinesActivity.this, null).get("https://instances.social/api/1.0" + action, 30, parameters, Helper.THEKINRAR_SECRET_TOKEN);
|
||||
runOnUiThread(() -> {
|
||||
isLoadingInstance = false;
|
||||
String[] instances;
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(response);
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("instances");
|
||||
int length = 0;
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
if (!jsonArray.getJSONObject(i).get("name").toString().contains("@") && jsonArray.getJSONObject(i).get("up").toString().equals("true"))
|
||||
length++;
|
||||
}
|
||||
instances = new String[length];
|
||||
int j = 0;
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
if (!jsonArray.getJSONObject(i).get("name").toString().contains("@") && jsonArray.getJSONObject(i).get("up").toString().equals("true")) {
|
||||
instances[j] = jsonArray.getJSONObject(i).get("name").toString();
|
||||
j++;
|
||||
}
|
||||
}
|
||||
instance_list.setAdapter(null);
|
||||
ArrayAdapter<String> adapter =
|
||||
new ArrayAdapter<>(ReorderTimelinesActivity.this, android.R.layout.simple_list_item_1, instances);
|
||||
instance_list.setAdapter(adapter);
|
||||
if (instance_list.hasFocus() && !ReorderTimelinesActivity.this.isFinishing())
|
||||
instance_list.showDropDown();
|
||||
oldSearch = s.toString().trim();
|
||||
|
||||
} catch (JSONException ignored) {
|
||||
isLoadingInstance = false;
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
isLoadingInstance = false;
|
||||
}
|
||||
}).start();
|
||||
else
|
||||
isLoadingInstance = false;
|
||||
}
|
||||
} else {
|
||||
alertDialog.getButton(
|
||||
AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
toolbar_title.setText(R.string.action_reorder_timeline);
|
||||
}
|
||||
|
@ -390,40 +350,34 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
|
|||
break;
|
||||
}
|
||||
undo_action.setPaintFlags(undo_action.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
undo_container.setVisibility(View.GONE);
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
switch (manageTimelines.getType()) {
|
||||
case TAG:
|
||||
new SearchDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines.getTagTimeline().getName());
|
||||
new TimelinesDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines);
|
||||
break;
|
||||
case INSTANCE:
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines.getRemoteInstance().getHost());
|
||||
new TimelinesDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines);
|
||||
break;
|
||||
case LIST:
|
||||
timeline = manageTimelines;
|
||||
new ManageListsAsyncTask(ReorderTimelinesActivity.this, ManageListsAsyncTask.action.DELETE_LIST, null, null, manageTimelines.getListTimeline().getId(), null, ReorderTimelinesActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new TimelinesDAO(ReorderTimelinesActivity.this, db).remove(timeline);
|
||||
refresh_list = true;
|
||||
break;
|
||||
}
|
||||
updated = true;
|
||||
Runnable runnable = () -> {
|
||||
undo_container.setVisibility(View.GONE);
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
switch (manageTimelines.getType()) {
|
||||
case TAG:
|
||||
new SearchDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines.getTagTimeline().getName());
|
||||
new TimelinesDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines);
|
||||
break;
|
||||
case INSTANCE:
|
||||
new InstancesDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines.getRemoteInstance().getHost());
|
||||
new TimelinesDAO(ReorderTimelinesActivity.this, db).remove(manageTimelines);
|
||||
break;
|
||||
case LIST:
|
||||
timeline = manageTimelines;
|
||||
new ManageListsAsyncTask(ReorderTimelinesActivity.this, ManageListsAsyncTask.action.DELETE_LIST, null, null, manageTimelines.getListTimeline().getId(), null, ReorderTimelinesActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new TimelinesDAO(ReorderTimelinesActivity.this, db).remove(timeline);
|
||||
refresh_list = true;
|
||||
break;
|
||||
}
|
||||
updated = true;
|
||||
};
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(runnable, 4000);
|
||||
undo_action.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
timelines.add(position, manageTimelines);
|
||||
adapter.notifyItemInserted(position);
|
||||
undo_container.setVisibility(View.GONE);
|
||||
handler.removeCallbacks(runnable);
|
||||
}
|
||||
undo_action.setOnClickListener(v -> {
|
||||
timelines.add(position, manageTimelines);
|
||||
adapter.notifyItemInserted(position);
|
||||
undo_container.setVisibility(View.GONE);
|
||||
handler.removeCallbacks(runnable);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -545,14 +545,14 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
if ((MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) && account.getFields() != null && account.getFields().size() > 0) {
|
||||
LinkedHashMap<String, String> fields = account.getFields();
|
||||
LinkedHashMap<String, Boolean> fieldsVerified = account.getFieldsVerified();
|
||||
Iterator it = fields.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> it = fields.entrySet().iterator();
|
||||
int i = 1;
|
||||
LinearLayout fields_container = findViewById(R.id.fields_container);
|
||||
if (fields_container != null)
|
||||
fields_container.setVisibility(View.VISIBLE);
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
String label = (String) pair.getKey();
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
String label = pair.getKey();
|
||||
if (label != null && fieldsVerified != null && fieldsVerified.containsKey(label)) {
|
||||
boolean verified = fieldsVerified.get(label);
|
||||
|
||||
|
@ -962,24 +962,20 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
LinkedHashMap<String, Boolean> fieldsVerified = account.getFieldsVerified();
|
||||
if (account.getFieldsSpan() != null && account.getFieldsSpan().size() > 0) {
|
||||
HashMap<SpannableString, SpannableString> fieldsSpan = account.getFieldsSpan();
|
||||
Iterator it = fieldsSpan.entrySet().iterator();
|
||||
|
||||
Iterator<Map.Entry<SpannableString, SpannableString>> it = fieldsSpan.entrySet().iterator();
|
||||
int i = 1;
|
||||
LinearLayout fields_container = findViewById(R.id.fields_container);
|
||||
if (fields_container != null)
|
||||
fields_container.setVisibility(View.VISIBLE);
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
SpannableString label = (SpannableString) pair.getKey();
|
||||
SpannableString value = (SpannableString) pair.getValue();
|
||||
Map.Entry<SpannableString, SpannableString> pair = it.next();
|
||||
SpannableString label = pair.getKey();
|
||||
SpannableString value = pair.getValue();
|
||||
LinearLayout field;
|
||||
TextView labelView;
|
||||
TextView valueView;
|
||||
switch (i) {
|
||||
case 1:
|
||||
field = findViewById(R.id.field1);
|
||||
labelView = findViewById(R.id.label1);
|
||||
valueView = findViewById(R.id.value1);
|
||||
break;
|
||||
case 2:
|
||||
field = findViewById(R.id.field2);
|
||||
labelView = findViewById(R.id.label2);
|
||||
|
@ -1166,7 +1162,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
tags = new ArrayList<>(featuredTagsSet);
|
||||
}
|
||||
tags.add(0, getString(R.string.no_tags));
|
||||
String[] tagsString = tags.toArray(new String[tags.size()]);
|
||||
String[] tagsString = tags.toArray(new String[0]);
|
||||
List<String> finalTags = tags;
|
||||
String tag = sharedpreferences.getString(Helper.SET_FEATURED_TAG_ACTION, null);
|
||||
int checkedposition = 0;
|
||||
|
|
|
@ -19,7 +19,6 @@ import android.content.SharedPreferences;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
|
@ -70,40 +69,34 @@ public class TagCacheActivity extends BaseActivity {
|
|||
EditText tag_add = findViewById(R.id.tag_add);
|
||||
ImageButton save_tag = findViewById(R.id.save_tag);
|
||||
|
||||
save_tag.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (tag_add.getText() != null && tag_add.getText().toString().trim().replaceAll("\\#", "").length() > 0) {
|
||||
String tagToInsert = tag_add.getText().toString().trim().replaceAll("\\#", "");
|
||||
boolean isPresent = new TagsCacheDAO(TagCacheActivity.this, db).isPresent(tagToInsert);
|
||||
if (isPresent)
|
||||
Toasty.warning(TagCacheActivity.this, getString(R.string.tags_already_stored), Toast.LENGTH_LONG).show();
|
||||
else {
|
||||
new TagsCacheDAO(TagCacheActivity.this, db).insert(tagToInsert);
|
||||
int position = tags.size();
|
||||
tags.add(tagToInsert);
|
||||
Toasty.success(TagCacheActivity.this, getString(R.string.tags_stored), Toast.LENGTH_LONG).show();
|
||||
tag_add.setText("");
|
||||
tagsEditAdapter.notifyItemInserted(position);
|
||||
}
|
||||
save_tag.setOnClickListener(v -> {
|
||||
if (tag_add.getText() != null && tag_add.getText().toString().trim().replaceAll("#", "").length() > 0) {
|
||||
String tagToInsert = tag_add.getText().toString().trim().replaceAll("#", "");
|
||||
boolean isPresent = new TagsCacheDAO(TagCacheActivity.this, db).isPresent(tagToInsert);
|
||||
if (isPresent)
|
||||
Toasty.warning(TagCacheActivity.this, getString(R.string.tags_already_stored), Toast.LENGTH_LONG).show();
|
||||
else {
|
||||
new TagsCacheDAO(TagCacheActivity.this, db).insert(tagToInsert);
|
||||
int position = tags.size();
|
||||
tags.add(tagToInsert);
|
||||
Toasty.success(TagCacheActivity.this, getString(R.string.tags_stored), Toast.LENGTH_LONG).show();
|
||||
tag_add.setText("");
|
||||
tagsEditAdapter.notifyItemInserted(position);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTitle(R.string.manage_tags);
|
||||
AsyncTask.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AsyncTask.execute(() -> {
|
||||
|
||||
List<String> tagsTemp = new TagsCacheDAO(TagCacheActivity.this, db).getAll();
|
||||
if (tagsTemp != null)
|
||||
tags = tagsTemp;
|
||||
if (tags != null) {
|
||||
tagsEditAdapter = new TagsEditAdapter(tags);
|
||||
tag_list.setAdapter(tagsEditAdapter);
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(TagCacheActivity.this);
|
||||
tag_list.setLayoutManager(mLayoutManager);
|
||||
}
|
||||
List<String> tagsTemp = new TagsCacheDAO(TagCacheActivity.this, db).getAll();
|
||||
if (tagsTemp != null)
|
||||
tags = tagsTemp;
|
||||
if (tags != null) {
|
||||
tagsEditAdapter = new TagsEditAdapter(tags);
|
||||
tag_list.setAdapter(tagsEditAdapter);
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(TagCacheActivity.this);
|
||||
tag_list.setLayoutManager(mLayoutManager);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -436,11 +436,8 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
if (s.toString().length() == 0)
|
||||
currentCursorPosition[0] = 0;
|
||||
//Only check last 15 characters before cursor position to avoid lags
|
||||
if (currentCursorPosition[0] < searchDeep) { //Less than 15 characters are written before the cursor position
|
||||
searchLength[0] = currentCursorPosition[0];
|
||||
} else {
|
||||
searchLength[0] = searchDeep;
|
||||
}
|
||||
//Less than 15 characters are written before the cursor position
|
||||
searchLength[0] = Math.min(currentCursorPosition[0], searchDeep);
|
||||
|
||||
|
||||
int totalChar = countLength(social, toot_content, toot_cw_content);
|
||||
|
@ -894,12 +891,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
if (s.toString().length() == 0)
|
||||
currentCursorPosition = 0;
|
||||
//Only check last 15 characters before cursor position to avoid lags
|
||||
int searchLength;
|
||||
if (currentCursorPosition < searchDeep) { //Less than 15 characters are written before the cursor position
|
||||
searchLength = currentCursorPosition;
|
||||
} else {
|
||||
searchLength = searchDeep;
|
||||
}
|
||||
int searchLength = Math.min(currentCursorPosition, searchDeep);
|
||||
int totalChar = countLength(wysiwyg, toot_cw_content);
|
||||
toot_space_left.setText(String.valueOf(totalChar));
|
||||
if (currentCursorPosition - (searchLength - 1) < 0 || currentCursorPosition == 0 || currentCursorPosition > s.toString().length())
|
||||
|
@ -1018,6 +1010,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
if (tootReply.getAccount() != null && tootReply.getAccount().getMoved_to_account() != null) {
|
||||
warning_message.setVisibility(View.VISIBLE);
|
||||
}
|
||||
assert tootReply.getAccount() != null;
|
||||
new RetrieveRelationshipAsyncTask(TootActivity.this, tootReply.getAccount().getId(), TootActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
if (scheduledstatus != null)
|
||||
|
@ -1333,11 +1326,11 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
if (social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||
if (successfullyUploadedFiles != null && successfullyUploadedFiles.size() > 0) {
|
||||
|
||||
Iterator it = filesMap.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, Uri>> it = filesMap.entrySet().iterator();
|
||||
Uri fileName = null;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
fileName = (Uri) pair.getValue();
|
||||
Map.Entry<String, Uri> pair = it.next();
|
||||
fileName = pair.getValue();
|
||||
it.remove();
|
||||
}
|
||||
if (fileName != null) {
|
||||
|
@ -1373,11 +1366,11 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
imageView.setImageBitmap(resource);
|
||||
if (displayWYSIWYG()) {
|
||||
url_for_media = finalUrl;
|
||||
Iterator it = filesMap.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, Uri>> it = filesMap.entrySet().iterator();
|
||||
String fileName = null;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
fileName = (String) pair.getKey();
|
||||
Map.Entry<String, Uri> pair = it.next();
|
||||
fileName = pair.getKey();
|
||||
it.remove();
|
||||
}
|
||||
if (fileName != null && fileName.contains("fedilabins_")) {
|
||||
|
@ -3220,9 +3213,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
}
|
||||
});
|
||||
imageView.setTag(attachment.getId());
|
||||
imageView.setOnClickListener(view -> {
|
||||
imageView.setOnClickListener(view1 -> showAddDescription(attachment));
|
||||
});
|
||||
imageView.setOnClickListener(view -> imageView.setOnClickListener(view1 -> showAddDescription(attachment)));
|
||||
imageView.setOnLongClickListener(view -> {
|
||||
showRemove(imageView.getId());
|
||||
return false;
|
||||
|
@ -3352,12 +3343,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
ownerTootVisibility = 1;
|
||||
break;
|
||||
}
|
||||
int tootVisibility;
|
||||
if (ownerTootVisibility >= initialTootVisibility) {
|
||||
tootVisibility = initialTootVisibility;
|
||||
} else {
|
||||
tootVisibility = ownerTootVisibility;
|
||||
}
|
||||
int tootVisibility = Math.min(ownerTootVisibility, initialTootVisibility);
|
||||
switch (tootVisibility) {
|
||||
case 4:
|
||||
visibility = "public";
|
||||
|
|
|
@ -126,9 +126,7 @@ public class WebviewConnectActivity extends BaseActivity {
|
|||
clearCookies(WebviewConnectActivity.this);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
|
||||
if (user_agent != null) {
|
||||
webView.getSettings().setUserAgentString(user_agent);
|
||||
}
|
||||
webView.getSettings().setUserAgentString(user_agent);
|
||||
if (android.os.Build.VERSION.SDK_INT >= 21) {
|
||||
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
|
||||
} else {
|
||||
|
|
|
@ -79,9 +79,6 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
case Helper.THEME_LIGHT:
|
||||
setTheme(R.style.AppTheme_NoActionBar_Fedilab);
|
||||
break;
|
||||
case Helper.THEME_DARK:
|
||||
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||
break;
|
||||
case Helper.THEME_BLACK:
|
||||
setTheme(R.style.AppThemeBlack_NoActionBar);
|
||||
break;
|
||||
|
@ -146,51 +143,41 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
}
|
||||
|
||||
Button follow_accounts_select = findViewById(R.id.follow_accounts_select);
|
||||
follow_accounts_select.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (follow_accounts_select.getText().equals(getString(R.string.select_all))) {
|
||||
follow_accounts_select.setText(R.string.unselect_all);
|
||||
for (TrunkAccount trunkAccount : trunkAccounts) {
|
||||
trunkAccount.setChecked(true);
|
||||
}
|
||||
whoToFollowAccountsAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
follow_accounts_select.setText(R.string.select_all);
|
||||
for (TrunkAccount trunkAccount : trunkAccounts) {
|
||||
trunkAccount.setChecked(false);
|
||||
}
|
||||
whoToFollowAccountsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
follow_accounts_select.setOnClickListener(v -> {
|
||||
if (follow_accounts_select.getText().equals(getString(R.string.select_all))) {
|
||||
follow_accounts_select.setText(R.string.unselect_all);
|
||||
} else {
|
||||
follow_accounts_select.setText(R.string.select_all);
|
||||
}
|
||||
for (TrunkAccount trunkAccount : trunkAccounts) {
|
||||
trunkAccount.setChecked(false);
|
||||
}
|
||||
whoToFollowAccountsAdapter.notifyDataSetChanged();
|
||||
});
|
||||
Button follow_accounts = findViewById(R.id.follow_accounts);
|
||||
follow_accounts.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
follow_accounts.setEnabled(false);
|
||||
follow_accounts_select.setEnabled(false);
|
||||
progess_action.setVisibility(View.VISIBLE);
|
||||
toFollowdId = new ArrayList<>();
|
||||
for (TrunkAccount trunkAccount : trunkAccounts) {
|
||||
if (trunkAccount.isChecked()) {
|
||||
toFollowdId.add(trunkAccount.getAcct());
|
||||
}
|
||||
follow_accounts.setOnClickListener(v -> {
|
||||
follow_accounts.setEnabled(false);
|
||||
follow_accounts_select.setEnabled(false);
|
||||
progess_action.setVisibility(View.VISIBLE);
|
||||
toFollowdId = new ArrayList<>();
|
||||
for (TrunkAccount trunkAccount : trunkAccounts) {
|
||||
if (trunkAccount.isChecked()) {
|
||||
toFollowdId.add(trunkAccount.getAcct());
|
||||
}
|
||||
if (toFollowdId.size() > 0) {
|
||||
Account account = new Account();
|
||||
String[] val = toFollowdId.get(0).split("@");
|
||||
progess_action.setText(getString(R.string.follow_trunk, toFollowdId.get(0)));
|
||||
if (val.length > 1) {
|
||||
account.setAcct(val[0]);
|
||||
account.setInstance(val[1]);
|
||||
new PostActionAsyncTask(WhoToFollowActivity.this, null, account, API.StatusAction.FOLLOW, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
Toasty.error(WhoToFollowActivity.this, getString(R.string.toast_impossible_to_follow), Toast.LENGTH_LONG).show();
|
||||
follow_accounts.setEnabled(true);
|
||||
follow_accounts_select.setEnabled(true);
|
||||
progess_action.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (toFollowdId.size() > 0) {
|
||||
Account account = new Account();
|
||||
String[] val = toFollowdId.get(0).split("@");
|
||||
progess_action.setText(getString(R.string.follow_trunk, toFollowdId.get(0)));
|
||||
if (val.length > 1) {
|
||||
account.setAcct(val[0]);
|
||||
account.setInstance(val[1]);
|
||||
new PostActionAsyncTask(WhoToFollowActivity.this, null, account, API.StatusAction.FOLLOW, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
Toasty.error(WhoToFollowActivity.this, getString(R.string.toast_impossible_to_follow), Toast.LENGTH_LONG).show();
|
||||
follow_accounts.setEnabled(true);
|
||||
follow_accounts_select.setEnabled(true);
|
||||
progess_action.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -199,13 +186,11 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -237,6 +222,7 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
new ManageListsAsyncTask(WhoToFollowActivity.this, ManageListsAsyncTask.action.CREATE_LIST, null, null, null, item, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
Account account = new Account();
|
||||
assert followedId != null;
|
||||
String[] val = toFollowdId.get(followedId.size()).split("@");
|
||||
progess_action.setText(getString(R.string.follow_trunk, toFollowdId.get(followedId.size())));
|
||||
if (val.length > 1) {
|
||||
|
@ -253,7 +239,6 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
|
||||
List<app.fedilab.android.client.Entities.List> lists = apiResponse.getLists();
|
||||
if (lists != null && lists.size() > 0 && actionType == ManageListsAsyncTask.action.CREATE_LIST) {
|
||||
String[] accountsId = followedId.toArray(new String[0]);
|
||||
progess_action.setText(R.string.add_account_list_trunk);
|
||||
listId = lists.get(0).getId();
|
||||
listTitle = lists.get(0).getTitle();
|
||||
|
@ -264,18 +249,14 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo
|
|||
if (accountListId.size() >= followedId.size() - 1) {
|
||||
progess_action.setText(R.string.account_added_list_trunk);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Intent intent = new Intent(WhoToFollowActivity.this, ListActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("id", listId);
|
||||
b.putString("title", listTitle);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
handler.postDelayed(() -> {
|
||||
Intent intent = new Intent(WhoToFollowActivity.this, ListActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("id", listId);
|
||||
b.putString("title", listTitle);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -266,7 +266,7 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat implements S
|
|||
|
||||
}
|
||||
List<String> array = Arrays.asList(getResources().getStringArray(R.array.settings_theme));
|
||||
CharSequence[] entries = array.toArray(new CharSequence[array.size()]);
|
||||
CharSequence[] entries = array.toArray(new CharSequence[0]);
|
||||
CharSequence[] entryValues = new CharSequence[3];
|
||||
final SharedPreferences sharedpref = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int theme = sharedpref.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
|
|
|
@ -1538,7 +1538,7 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
|||
if (featuredTagsSet != null) {
|
||||
tags = new ArrayList<>(featuredTagsSet);
|
||||
}
|
||||
String[] tagsString = tags.toArray(new String[tags.size()]);
|
||||
String[] tagsString = tags.toArray(new String[0]);
|
||||
set_featured_tags.setTags(tagsString);
|
||||
|
||||
set_featured_tags.setTagsListener(new TagsEditText.TagsEditListener() {
|
||||
|
|
Loading…
Reference in New Issue