Browse Source

turkish, plus lgtm & compability fixes

legacy v17.2
Austin Huang 4 years ago
parent
commit
af458ce6c6
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 6
      app/src/main/java/awais/instagrabber/MainHelper.java
  2. 16
      app/src/main/java/awais/instagrabber/activities/PostViewer.java
  3. 2
      app/src/main/java/awais/instagrabber/activities/StoryViewer.java
  4. 3
      app/src/main/java/awais/instagrabber/adapters/MessageItemsAdapter.java
  5. 1
      app/src/main/java/awais/instagrabber/asyncs/PostsFetcher.java
  6. 6
      app/src/main/java/awais/instagrabber/utils/DataBox.java
  7. 1
      app/src/main/java/awais/instagrabber/utils/LocaleUtils.java
  8. 1
      app/src/main/res/values/arrays.xml

6
app/src/main/java/awais/instagrabber/MainHelper.java

@ -218,10 +218,11 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override @Override
public void onResult(final FeedStoryModel[] result) { public void onResult(final FeedStoryModel[] result) {
feedStoriesAdapter.setData(result); feedStoriesAdapter.setData(result);
if (result != null && result.length > 0)
if (result != null && result.length > 0) {
main.mainBinding.feedStories.setVisibility(View.VISIBLE); main.mainBinding.feedStories.setVisibility(View.VISIBLE);
stories = result; stories = result;
} }
}
}; };
private final MentionClickListener mentionClickListener = new MentionClickListener() { private final MentionClickListener mentionClickListener = new MentionClickListener() {
@Override @Override
@ -976,14 +977,13 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
currentlyExecuting = new LocationFetcher(main.userQuery.split("/")[0], locationModel -> { currentlyExecuting = new LocationFetcher(main.userQuery.split("/")[0], locationModel -> {
main.locationModel = locationModel; main.locationModel = locationModel;
main.mainBinding.toolbar.toolbar.setTitle(locationModel.getName());
if (locationModel == null) { if (locationModel == null) {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show(); Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name); main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return; return;
} }
main.mainBinding.toolbar.toolbar.setTitle(locationModel.getName());
final String profileId = locationModel.getId(); final String profileId = locationModel.getId();

16
app/src/main/java/awais/instagrabber/activities/PostViewer.java

@ -632,23 +632,23 @@ public final class PostViewer extends BaseLanguageActivity {
postModel.setBookmark(viewerPostModel.getBookmark()); postModel.setBookmark(viewerPostModel.getBookmark());
if (viewerPostModel.getLike() == true) { if (viewerPostModel.getLike() == true) {
viewerBinding.btnLike.setText(resources.getString(R.string.unlike, viewerPostModel.getLikes())); viewerBinding.btnLike.setText(resources.getString(R.string.unlike, viewerPostModel.getLikes()));
viewerBinding.btnLike.setBackgroundTintList(ColorStateList.valueOf(resources.getColor(
R.color.btn_pink_background, null)));
viewerBinding.btnLike.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
getApplicationContext(), R.color.btn_pink_background)));
} }
else { else {
viewerBinding.btnLike.setText(resources.getString(R.string.like, viewerPostModel.getLikes())); viewerBinding.btnLike.setText(resources.getString(R.string.like, viewerPostModel.getLikes()));
viewerBinding.btnLike.setBackgroundTintList(ColorStateList.valueOf(resources.getColor(
R.color.btn_lightpink_background, null)));
viewerBinding.btnLike.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
getApplicationContext(), R.color.btn_lightpink_background)));
} }
if (viewerPostModel.getBookmark() == true) { if (viewerPostModel.getBookmark() == true) {
viewerBinding.btnBookmark.setText(R.string.unbookmark); viewerBinding.btnBookmark.setText(R.string.unbookmark);
viewerBinding.btnBookmark.setBackgroundTintList(ColorStateList.valueOf(resources.getColor(
R.color.btn_orange_background, null)));
viewerBinding.btnBookmark.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
getApplicationContext(), R.color.btn_orange_background)));
} }
else { else {
viewerBinding.btnBookmark.setText(R.string.bookmark); viewerBinding.btnBookmark.setText(R.string.bookmark);
viewerBinding.btnBookmark.setBackgroundTintList(ColorStateList.valueOf(resources.getColor(
R.color.btn_lightorange_background, null)));
viewerBinding.btnBookmark.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
getApplicationContext(), R.color.btn_lightorange_background)));
} }
} }

2
app/src/main/java/awais/instagrabber/activities/StoryViewer.java

@ -479,7 +479,7 @@ public final class StoryViewer extends BaseLanguageActivity {
storyViewerBinding.mention.setTag(mentions); storyViewerBinding.mention.setTag(mentions);
quiz = currentStory.getQuiz(); quiz = currentStory.getQuiz();
storyViewerBinding.quiz.setVisibility((quiz != null && mentions.length > 0) ? View.VISIBLE : View.GONE);
storyViewerBinding.quiz.setVisibility(quiz != null ? View.VISIBLE : View.GONE);
storyViewerBinding.quiz.setTag(quiz); storyViewerBinding.quiz.setTag(quiz);
releasePlayer(); releasePlayer();

3
app/src/main/java/awais/instagrabber/adapters/MessageItemsAdapter.java

@ -389,10 +389,11 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
@Nullable @Nullable
private ProfileModel getUser(final long userId) { private ProfileModel getUser(final long userId) {
if (users != null) { if (users != null) {
for (final ProfileModel user : users)
for (final ProfileModel user : users) {
if (Long.toString(userId).equals(user.getId())) return user; if (Long.toString(userId).equals(user.getId())) return user;
return myProfileHolder; return myProfileHolder;
} }
}
return null; return null;
} }
} }

1
app/src/main/java/awais/instagrabber/asyncs/PostsFetcher.java

@ -52,7 +52,6 @@ public final class PostsFetcher extends AsyncTask<Void, Void, PostModel[]> {
final boolean isHashTag = id.charAt(0) == '#'; final boolean isHashTag = id.charAt(0) == '#';
final boolean isSaved = id.charAt(0) == '$'; final boolean isSaved = id.charAt(0) == '$';
final boolean isTagged = id.charAt(0) == '%'; final boolean isTagged = id.charAt(0) == '%';
//final boolean isLiked = id.charAt(0) == '^';
final boolean isLocation = id.contains("/"); final boolean isLocation = id.contains("/");
final String url; final String url;

6
app/src/main/java/awais/instagrabber/utils/DataBox.java

@ -86,12 +86,10 @@ public final class DataBox extends SQLiteOpenHelper {
try (final SQLiteDatabase db = getWritableDatabase()) { try (final SQLiteDatabase db = getWritableDatabase()) {
db.beginTransaction(); db.beginTransaction();
try { try {
final int rowsDeleted = db.delete(TABLE_FAVORITES, KEY_QUERY_TEXT + "=? AND "
+ KEY_DATE_ADDED + "=?",
final int rowsDeleted = db.delete(TABLE_FAVORITES, "query_text=? AND date_added=?",
new String[]{query, Long.toString(favoriteModel.getDate())}); new String[]{query, Long.toString(favoriteModel.getDate())});
final int rowsDeletedTwo = db.delete(TABLE_FAVORITES, KEY_QUERY_TEXT + "=? AND "
+ KEY_DATE_ADDED + "=?",
final int rowsDeletedTwo = db.delete(TABLE_FAVORITES, "query_text=? AND date_added=?",
new String[]{query.replaceAll("@", ""), Long.toString(favoriteModel.getDate())}); new String[]{query.replaceAll("@", ""), Long.toString(favoriteModel.getDate())});
if (rowsDeleted > 0 || rowsDeletedTwo > 0) db.setTransactionSuccessful(); if (rowsDeleted > 0 || rowsDeletedTwo > 0) db.setTransactionSuccessful();

1
app/src/main/java/awais/instagrabber/utils/LocaleUtils.java

@ -65,6 +65,7 @@ public final class LocaleUtils {
if (appLanguageIndex == 6) return "it"; if (appLanguageIndex == 6) return "it";
if (appLanguageIndex == 7) return "de"; if (appLanguageIndex == 7) return "de";
if (appLanguageIndex == 8) return "pl"; if (appLanguageIndex == 8) return "pl";
if (appLanguageIndex == 9) return "tr";
return null; return null;
} }

1
app/src/main/res/values/arrays.xml

@ -10,6 +10,7 @@
<item>Italian [Thanks to @RAR_Ramar (Telegram)]</item> <item>Italian [Thanks to @RAR_Ramar (Telegram)]</item>
<item>German [Thanks to @peterge1998 (GitHub)]</item> <item>German [Thanks to @peterge1998 (GitHub)]</item>
<item>Polish [Thanks to @Lego8486 (GitHub)]</item> <item>Polish [Thanks to @Lego8486 (GitHub)]</item>
<item>Turkish [Thanks to @faydin90 (Telegram)]</item>
</string-array> </string-array>
<string-array name="theme_presets"> <string-array name="theme_presets">
<item>Auto / Follow System</item> <item>Auto / Follow System</item>

Loading…
Cancel
Save