Browse Source

Rename main activity to MainActivity

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
0b183c5ab5
  1. 2
      .idea/runConfigurations/app.xml
  2. 34
      app/src/main/AndroidManifest.xml
  3. 813
      app/src/main/java/awais/instagrabber/MainHelper.java
  4. 10
      app/src/main/java/awais/instagrabber/activities/MainActivity.java
  5. 7
      app/src/main/java/awais/instagrabber/activities/PostViewer.java
  6. 7
      app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java
  7. 14
      app/src/main/java/awais/instagrabber/utils/Utils.java
  8. 2
      app/src/main/res/layout/activity_main.xml

2
.idea/runConfigurations/app.xml

@ -45,7 +45,7 @@
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" /> <option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
</Profilers> </Profilers>
<option name="DEEP_LINK" value="" /> <option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="awais.instagrabber.activities.Main" />
<option name="ACTIVITY_CLASS" value="awais.instagrabber.activities.MainActivity" />
<method v="2"> <method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" /> <option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method> </method>

34
app/src/main/AndroidManifest.xml

@ -19,7 +19,7 @@
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
<activity <activity
android:name=".activities.Main"
android:name=".activities.MainActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:taskAffinity=".Main" android:taskAffinity=".Main"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
@ -134,11 +134,11 @@
<activity <activity
android:name=".activities.PostViewer" android:name=".activities.PostViewer"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<activity <activity
@ -152,29 +152,29 @@
<activity <activity
android:name=".activities.StoryViewer" android:name=".activities.StoryViewer"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.FollowViewer" android:name=".activities.FollowViewer"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.ProfilePicViewer" android:name=".activities.ProfilePicViewer"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<activity <activity
@ -188,39 +188,39 @@
<activity <activity
android:name=".activities.SavedViewer" android:name=".activities.SavedViewer"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.NotificationsViewer" android:name=".activities.NotificationsViewer"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.Login" android:name=".activities.Login"
android:label="@string/login" android:label="@string/login"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.DirectMessagesActivity" android:name=".activities.DirectMessagesActivity"
android:parentActivityName=".activities.Main">
android:parentActivityName=".activities.MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.Main" />
android:value=".activities.MainActivity" />
</activity> </activity>
<provider <provider

813
app/src/main/java/awais/instagrabber/MainHelper.java
File diff suppressed because it is too large
View File

10
app/src/main/java/awais/instagrabber/activities/Main.java → app/src/main/java/awais/instagrabber/activities/MainActivity.java

@ -69,7 +69,7 @@ import static awais.instagrabber.utils.Utils.CHANNEL_ID;
import static awais.instagrabber.utils.Utils.notificationManager; import static awais.instagrabber.utils.Utils.notificationManager;
import static awais.instagrabber.utils.Utils.settingsHelper; import static awais.instagrabber.utils.Utils.settingsHelper;
public final class Main extends BaseLanguageActivity {
public final class MainActivity extends BaseLanguageActivity {
private static final int INITIAL_DELAY_MILLIS = 200; private static final int INITIAL_DELAY_MILLIS = 200;
public static FetchListener<String> scanHack; public static FetchListener<String> scanHack;
public static ItemGetter itemGetter; public static ItemGetter itemGetter;
@ -90,13 +90,13 @@ public final class Main extends BaseLanguageActivity {
new iStoryStatusFetcher(highlightModel.getId(), null, false, false, new iStoryStatusFetcher(highlightModel.getId(), null, false, false,
(!mainHelper.isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> { (!mainHelper.isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> {
if (result != null && result.length > 0) if (result != null && result.length > 0)
startActivity(new Intent(Main.this, StoryViewer.class)
startActivity(new Intent(MainActivity.this, StoryViewer.class)
.putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", "")) .putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
.putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle()) .putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle())
.putExtra(Constants.EXTRAS_STORIES, result) .putExtra(Constants.EXTRAS_STORIES, result)
); );
else else
Toast.makeText(Main.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
Toast.makeText(MainActivity.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
} }
@ -264,7 +264,7 @@ public final class Main extends BaseLanguageActivity {
final GetActivityAsyncTask activityAsyncTask = new GetActivityAsyncTask(uid, cookie, result -> { final GetActivityAsyncTask activityAsyncTask = new GetActivityAsyncTask(uid, cookie, result -> {
if (result == null) { if (result == null) {
if (!Utils.isEmpty(cookie)) { if (!Utils.isEmpty(cookie)) {
Toast.makeText(Main.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
Toast.makeText(MainActivity.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
} }
return; return;
} }
@ -293,7 +293,7 @@ public final class Main extends BaseLanguageActivity {
final String join = TextUtils.join(", ", list); final String join = TextUtils.join(", ", list);
final String notificationString = getString(R.string.activity_count_prefix) + " " + join + "."; final String notificationString = getString(R.string.activity_count_prefix) + " " + join + ".";
final Intent intent = new Intent(getApplicationContext(), NotificationsViewer.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); final Intent intent = new Intent(getApplicationContext(), NotificationsViewer.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
final Notification notification = new NotificationCompat.Builder(Main.this, CHANNEL_ID)
final Notification notification = new NotificationCompat.Builder(MainActivity.this, CHANNEL_ID)
.setCategory(NotificationCompat.CATEGORY_STATUS) .setCategory(NotificationCompat.CATEGORY_STATUS)
.setSmallIcon(R.drawable.ic_notif) .setSmallIcon(R.drawable.ic_notif)
.setAutoCancel(true) .setAutoCancel(true)

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

@ -243,8 +243,7 @@ public final class PostViewer extends BaseLanguageActivity {
} }
} }
setupPostInfoBar("@"+viewerPostModel.getUsername(), viewerPostModel.getItemType(),
viewerPostModel.getLocation() == null ? null : viewerPostModel.getLocation());
setupPostInfoBar("@"+viewerPostModel.getUsername(), viewerPostModel.getItemType(), viewerPostModel.getLocation());
postCaption = postModel.getPostCaption(); postCaption = postModel.getPostCaption();
viewerCaptionParent.setVisibility(View.VISIBLE); viewerCaptionParent.setVisibility(View.VISIBLE);
@ -323,8 +322,8 @@ public final class PostViewer extends BaseLanguageActivity {
itemGetterItems = SavedViewer.itemGetter.get(itemGetType); itemGetterItems = SavedViewer.itemGetter.get(itemGetType);
isMainSwipe = !(itemGetterItems.size() < 1 || itemGetType == ItemGetType.SAVED_ITEMS && isFromShare); isMainSwipe = !(itemGetterItems.size() < 1 || itemGetType == ItemGetType.SAVED_ITEMS && isFromShare);
} }
else if (itemGetType != null && Main.itemGetter != null) {
itemGetterItems = Main.itemGetter.get(itemGetType);
else if (itemGetType != null && MainActivity.itemGetter != null) {
itemGetterItems = MainActivity.itemGetter.get(itemGetType);
isMainSwipe = !(itemGetterItems.size() < 1 || itemGetType == ItemGetType.MAIN_ITEMS && isFromShare); isMainSwipe = !(itemGetterItems.size() < 1 || itemGetType == ItemGetType.MAIN_ITEMS && isFromShare);
} else { } else {
itemGetterItems = null; itemGetterItems = null;

7
app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java

@ -6,7 +6,6 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
@ -22,7 +21,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.ArrayList; import java.util.ArrayList;
import awais.instagrabber.R; import awais.instagrabber.R;
import awais.instagrabber.activities.Main;
import awais.instagrabber.activities.MainActivity;
import awais.instagrabber.adapters.SimpleAdapter; import awais.instagrabber.adapters.SimpleAdapter;
import awais.instagrabber.utils.Constants; import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.DataBox; import awais.instagrabber.utils.DataBox;
@ -113,8 +112,8 @@ public final class QuickAccessDialog extends BottomSheetDialogFragment implement
else Utils.showImportExportDialog(v.getContext()); else Utils.showImportExportDialog(v.getContext());
} else if (tag instanceof DataBox.FavoriteModel) { } else if (tag instanceof DataBox.FavoriteModel) {
if (Main.scanHack != null) {
Main.scanHack.onResult(((DataBox.FavoriteModel) tag).getQuery());
if (MainActivity.scanHack != null) {
MainActivity.scanHack.onResult(((DataBox.FavoriteModel) tag).getQuery());
dismiss(); dismiss();
} }

14
app/src/main/java/awais/instagrabber/utils/Utils.java

@ -70,7 +70,7 @@ import javax.crypto.spec.SecretKeySpec;
import awais.instagrabber.BuildConfig; import awais.instagrabber.BuildConfig;
import awais.instagrabber.R; import awais.instagrabber.R;
import awais.instagrabber.activities.Main;
import awais.instagrabber.activities.MainActivity;
import awais.instagrabber.activities.ProfileViewer; import awais.instagrabber.activities.ProfileViewer;
import awais.instagrabber.activities.SavedViewer; import awais.instagrabber.activities.SavedViewer;
import awais.instagrabber.asyncs.DownloadAsync; import awais.instagrabber.asyncs.DownloadAsync;
@ -941,7 +941,7 @@ public final class Utils {
dir = new File(dir, username); dir = new File(dir, username);
if (dir.exists() || dir.mkdirs()) { if (dir.exists() || dir.mkdirs()) {
final Main main = method != DownloadMethod.DOWNLOAD_FEED && context instanceof Main ? (Main) context : null;
final MainActivity mainActivity = method != DownloadMethod.DOWNLOAD_FEED && context instanceof MainActivity ? (MainActivity) context : null;
final ProfileViewer pv = method == DownloadMethod.DOWNLOAD_MAIN && context instanceof ProfileViewer ? (ProfileViewer) context : null; final ProfileViewer pv = method == DownloadMethod.DOWNLOAD_MAIN && context instanceof ProfileViewer ? (ProfileViewer) context : null;
final SavedViewer saved = method == DownloadMethod.DOWNLOAD_SAVED && context instanceof SavedViewer ? (SavedViewer) context : null; final SavedViewer saved = method == DownloadMethod.DOWNLOAD_SAVED && context instanceof SavedViewer ? (SavedViewer) context : null;
@ -951,7 +951,7 @@ public final class Utils {
for (int i = itemsToDownloadSize - 1; i >= 0; i--) { for (int i = itemsToDownloadSize - 1; i >= 0; i--) {
final BasePostModel selectedItem = itemsToDownload.get(i); final BasePostModel selectedItem = itemsToDownload.get(i);
if (main == null && saved == null && pv == null) {
if (mainActivity == null && saved == null && pv == null) {
new DownloadAsync(context, new DownloadAsync(context,
selectedItem.getDisplayUrl(), selectedItem.getDisplayUrl(),
getDownloadSaveFile(finalDir, selectedItem, ""), getDownloadSaveFile(finalDir, selectedItem, ""),
@ -973,13 +973,13 @@ public final class Utils {
file -> { file -> {
model.setDownloaded(true); model.setDownloaded(true);
if (saved != null) saved.deselectSelection(selectedItem); if (saved != null) saved.deselectSelection(selectedItem);
else if (main != null) main.mainHelper.deselectSelection(selectedItem);
else if (mainActivity != null) mainActivity.mainHelper.deselectSelection(selectedItem);
else if (pv != null) pv.deselectSelection(selectedItem); else if (pv != null) pv.deselectSelection(selectedItem);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
} else { } else {
if (saved != null) saved.deselectSelection(selectedItem); if (saved != null) saved.deselectSelection(selectedItem);
else if (main != null) main.mainHelper.deselectSelection(selectedItem);
else if (mainActivity != null) mainActivity.mainHelper.deselectSelection(selectedItem);
else if (pv != null) pv.deselectSelection(selectedItem); else if (pv != null) pv.deselectSelection(selectedItem);
} }
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -1014,7 +1014,7 @@ public final class Utils {
dir = new File(dir, username); dir = new File(dir, username);
if (dir.exists() || dir.mkdirs()) { if (dir.exists() || dir.mkdirs()) {
final Main main = method != DownloadMethod.DOWNLOAD_FEED && context instanceof Main ? (Main) context : null;
final MainActivity mainActivity = method != DownloadMethod.DOWNLOAD_FEED && context instanceof MainActivity ? (MainActivity) context : null;
final int itemsToDownloadSize = itemsToDownload.size(); final int itemsToDownloadSize = itemsToDownload.size();
@ -1022,7 +1022,7 @@ public final class Utils {
for (int i = itemsToDownloadSize - 1; i >= 0; i--) { for (int i = itemsToDownloadSize - 1; i >= 0; i--) {
final DirectItemMediaModel selectedItem = itemsToDownload.get(i); final DirectItemMediaModel selectedItem = itemsToDownload.get(i);
if (main == null) {
if (mainActivity == null) {
new DownloadAsync(context, new DownloadAsync(context,
selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl(), selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl(),
getDownloadSaveFileDm(finalDir, selectedItem, ""), getDownloadSaveFileDm(finalDir, selectedItem, ""),

2
app/src/main/res/layout/activity_main.xml

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".activities.Main">
tools:context=".activities.MainActivity">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

Loading…
Cancel
Save