Browse Source
Fix DM fragments, comment out deprecated activities
renovate/org.robolectric-robolectric-4.x
Fix DM fragments, comment out deprecated activities
renovate/org.robolectric-robolectric-4.x
Ammar Githam
4 years ago
22 changed files with 4258 additions and 4180 deletions
-
8app/src/main/java/awais/instagrabber/InstaGrabberApplication.java
-
3042app/src/main/java/awais/instagrabber/MainHelper.java
-
188app/src/main/java/awais/instagrabber/activities/DirectMessagesActivity.java
-
3app/src/main/java/awais/instagrabber/activities/MainActivity.java
-
1214app/src/main/java/awais/instagrabber/activities/MainActivityBackup.java
-
9app/src/main/java/awais/instagrabber/activities/NotificationsViewer.java
-
1572app/src/main/java/awais/instagrabber/activities/PostViewer.java
-
1900app/src/main/java/awais/instagrabber/activities/ProfileViewer.java
-
22app/src/main/java/awais/instagrabber/adapters/viewholder/DirectMessageInboxItemViewHolder.java
-
10app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java
-
5app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
-
6app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java
-
86app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java
-
117app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
-
4app/src/main/java/awais/instagrabber/fragments/main/DiscoverFragment.java
-
27app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
-
78app/src/main/res/layout/layout_dm_inbox_item.xml
-
14app/src/main/res/menu/dm_thread_menu.xml
-
15app/src/main/res/menu/main_menu.xml
-
12app/src/main/res/menu/profile_menu.xml
-
2app/src/main/res/values/strings.xml
3042
app/src/main/java/awais/instagrabber/MainHelper.java
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,94 +1,94 @@ |
|||||
package awais.instagrabber.activities; |
|
||||
|
|
||||
import android.os.Bundle; |
|
||||
import android.view.View; |
|
||||
import android.widget.TextView; |
|
||||
|
|
||||
import androidx.annotation.NonNull; |
|
||||
import androidx.annotation.Nullable; |
|
||||
import androidx.appcompat.widget.AppCompatImageView; |
|
||||
import androidx.appcompat.widget.Toolbar; |
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout; |
|
||||
import androidx.navigation.NavController; |
|
||||
import androidx.navigation.NavDestination; |
|
||||
import androidx.navigation.Navigation; |
|
||||
import androidx.navigation.ui.AppBarConfiguration; |
|
||||
import androidx.navigation.ui.NavigationUI; |
|
||||
|
|
||||
import awais.instagrabber.R; |
|
||||
import awais.instagrabber.databinding.ActivityDirectMessagesBinding; |
|
||||
import awais.instagrabber.fragments.directmessages.DirectMessageThreadFragmentArgs; |
|
||||
import awais.instagrabber.utils.Constants; |
|
||||
import static awais.instagrabber.utils.Utils.settingsHelper; |
|
||||
|
|
||||
@Deprecated |
|
||||
public class DirectMessagesActivity extends BaseLanguageActivity implements NavController.OnDestinationChangedListener { |
|
||||
|
|
||||
private TextView toolbarTitle; |
|
||||
private AppCompatImageView dmInfo, dmSeen; |
|
||||
|
|
||||
@Override |
|
||||
protected void onCreate(Bundle savedInstanceState) { |
|
||||
super.onCreate(savedInstanceState); |
|
||||
final ActivityDirectMessagesBinding binding = ActivityDirectMessagesBinding.inflate(getLayoutInflater()); |
|
||||
final CoordinatorLayout root = binding.getRoot(); |
|
||||
setContentView(root); |
|
||||
|
|
||||
toolbarTitle = binding.toolbarTitle; |
|
||||
|
|
||||
final Toolbar toolbar = binding.toolbar; |
|
||||
setSupportActionBar(toolbar); |
|
||||
|
|
||||
dmInfo = binding.dmInfo; |
|
||||
dmSeen = binding.dmSeen; |
|
||||
|
|
||||
final NavController navController = Navigation.findNavController(this, R.id.direct_messages_nav_host_fragment); |
|
||||
navController.addOnDestinationChangedListener(this); |
|
||||
final AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build(); |
|
||||
NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void onDestinationChanged(@NonNull final NavController controller, |
|
||||
@NonNull final NavDestination destination, |
|
||||
@Nullable final Bundle arguments) { |
|
||||
switch (destination.getId()) { |
|
||||
case R.id.directMessagesInboxFragment: |
|
||||
setToolbarTitle(R.string.action_dms); |
|
||||
dmInfo.setVisibility(View.GONE); |
|
||||
dmSeen.setVisibility(View.GONE); |
|
||||
return; |
|
||||
case R.id.directMessagesThreadFragment: |
|
||||
if (arguments == null) { |
|
||||
return; |
|
||||
} |
|
||||
final String title = DirectMessageThreadFragmentArgs.fromBundle(arguments).getTitle(); |
|
||||
setToolbarTitle(title); |
|
||||
dmInfo.setVisibility(View.VISIBLE); |
|
||||
dmSeen.setVisibility(settingsHelper.getBoolean(Constants.DM_MARK_AS_SEEN) ? View.GONE : View.VISIBLE); |
|
||||
return; |
|
||||
case R.id.directMessagesSettingsFragment: |
|
||||
if (arguments == null) { |
|
||||
return; |
|
||||
} |
|
||||
setToolbarTitle(R.string.action_settings); |
|
||||
dmInfo.setVisibility(View.GONE); |
|
||||
dmSeen.setVisibility(View.GONE); |
|
||||
return; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void setToolbarTitle(final String text) { |
|
||||
if (toolbarTitle == null) { |
|
||||
return; |
|
||||
} |
|
||||
toolbarTitle.setText(text); |
|
||||
} |
|
||||
|
|
||||
private void setToolbarTitle(final int resourceId) { |
|
||||
if (toolbarTitle == null) { |
|
||||
return; |
|
||||
} |
|
||||
toolbarTitle.setText(resourceId); |
|
||||
} |
|
||||
} |
|
||||
|
// package awais.instagrabber.activities; |
||||
|
// |
||||
|
// import android.os.Bundle; |
||||
|
// import android.view.View; |
||||
|
// import android.widget.TextView; |
||||
|
// |
||||
|
// import androidx.annotation.NonNull; |
||||
|
// import androidx.annotation.Nullable; |
||||
|
// import androidx.appcompat.widget.AppCompatImageView; |
||||
|
// import androidx.appcompat.widget.Toolbar; |
||||
|
// import androidx.coordinatorlayout.widget.CoordinatorLayout; |
||||
|
// import androidx.navigation.NavController; |
||||
|
// import androidx.navigation.NavDestination; |
||||
|
// import androidx.navigation.Navigation; |
||||
|
// import androidx.navigation.ui.AppBarConfiguration; |
||||
|
// import androidx.navigation.ui.NavigationUI; |
||||
|
// |
||||
|
// import awais.instagrabber.R; |
||||
|
// import awais.instagrabber.databinding.ActivityDirectMessagesBinding; |
||||
|
// import awais.instagrabber.fragments.directmessages.DirectMessageThreadFragmentArgs; |
||||
|
// import awais.instagrabber.utils.Constants; |
||||
|
// import static awais.instagrabber.utils.Utils.settingsHelper; |
||||
|
// |
||||
|
// @Deprecated |
||||
|
// public class DirectMessagesActivity extends BaseLanguageActivity implements NavController.OnDestinationChangedListener { |
||||
|
// |
||||
|
// private TextView toolbarTitle; |
||||
|
// private AppCompatImageView dmInfo, dmSeen; |
||||
|
// |
||||
|
// @Override |
||||
|
// protected void onCreate(Bundle savedInstanceState) { |
||||
|
// super.onCreate(savedInstanceState); |
||||
|
// final ActivityDirectMessagesBinding binding = ActivityDirectMessagesBinding.inflate(getLayoutInflater()); |
||||
|
// final CoordinatorLayout root = binding.getRoot(); |
||||
|
// setContentView(root); |
||||
|
// |
||||
|
// toolbarTitle = binding.toolbarTitle; |
||||
|
// |
||||
|
// final Toolbar toolbar = binding.toolbar; |
||||
|
// setSupportActionBar(toolbar); |
||||
|
// |
||||
|
// dmInfo = binding.dmInfo; |
||||
|
// dmSeen = binding.dmSeen; |
||||
|
// |
||||
|
// final NavController navController = Navigation.findNavController(this, R.id.direct_messages_nav_host_fragment); |
||||
|
// navController.addOnDestinationChangedListener(this); |
||||
|
// final AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build(); |
||||
|
// NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration); |
||||
|
// } |
||||
|
// |
||||
|
// @Override |
||||
|
// public void onDestinationChanged(@NonNull final NavController controller, |
||||
|
// @NonNull final NavDestination destination, |
||||
|
// @Nullable final Bundle arguments) { |
||||
|
// switch (destination.getId()) { |
||||
|
// case R.id.directMessagesInboxFragment: |
||||
|
// setToolbarTitle(R.string.action_dms); |
||||
|
// dmInfo.setVisibility(View.GONE); |
||||
|
// dmSeen.setVisibility(View.GONE); |
||||
|
// return; |
||||
|
// case R.id.directMessagesThreadFragment: |
||||
|
// if (arguments == null) { |
||||
|
// return; |
||||
|
// } |
||||
|
// final String title = DirectMessageThreadFragmentArgs.fromBundle(arguments).getTitle(); |
||||
|
// setToolbarTitle(title); |
||||
|
// dmInfo.setVisibility(View.VISIBLE); |
||||
|
// dmSeen.setVisibility(settingsHelper.getBoolean(Constants.DM_MARK_AS_SEEN) ? View.GONE : View.VISIBLE); |
||||
|
// return; |
||||
|
// case R.id.directMessagesSettingsFragment: |
||||
|
// if (arguments == null) { |
||||
|
// return; |
||||
|
// } |
||||
|
// setToolbarTitle(R.string.action_settings); |
||||
|
// dmInfo.setVisibility(View.GONE); |
||||
|
// dmSeen.setVisibility(View.GONE); |
||||
|
// return; |
||||
|
// } |
||||
|
// } |
||||
|
// |
||||
|
// private void setToolbarTitle(final String text) { |
||||
|
// if (toolbarTitle == null) { |
||||
|
// return; |
||||
|
// } |
||||
|
// toolbarTitle.setText(text); |
||||
|
// } |
||||
|
// |
||||
|
// private void setToolbarTitle(final int resourceId) { |
||||
|
// if (toolbarTitle == null) { |
||||
|
// return; |
||||
|
// } |
||||
|
// toolbarTitle.setText(resourceId); |
||||
|
// } |
||||
|
// } |
1214
app/src/main/java/awais/instagrabber/activities/MainActivityBackup.java
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1572
app/src/main/java/awais/instagrabber/activities/PostViewer.java
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1900
app/src/main/java/awais/instagrabber/activities/ProfileViewer.java
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,14 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"> |
||||
|
<item |
||||
|
android:id="@+id/info" |
||||
|
android:icon="@drawable/ic_outline_info_24" |
||||
|
android:title="@string/dm_thread_info" |
||||
|
app:showAsAction="always" /> |
||||
|
<item |
||||
|
android:id="@+id/mark_as_seen" |
||||
|
android:icon="@drawable/ic_outline_views_24" |
||||
|
android:title="@string/mark_as_seen" |
||||
|
app:showAsAction="ifRoom" /> |
||||
|
</menu> |
@ -0,0 +1,12 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"> |
||||
|
<item |
||||
|
android:id="@+id/favourites" |
||||
|
android:enabled="true" |
||||
|
android:icon="@drawable/ic_star_24" |
||||
|
android:title="@string/title_favorites" |
||||
|
android:visible="false" |
||||
|
app:showAsAction="ifRoom" /> |
||||
|
|
||||
|
</menu> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue