Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement on connectivity issues #1256

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;

import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.core.content.ContextCompat;
Expand Down Expand Up @@ -73,6 +75,7 @@ public abstract class BaseListActivity extends DrawerActivity implements MultiPa
@Inject SessionManager mSessionManager;
@Inject CustomTabsDelegate mCustomTabsDelegate;
@Inject KeyDelegate mKeyDelegate;
@Synthetic CoordinatorLayout mCoordinatorLayout;
private AppBarLayout mAppBar;
private TabLayout mTabLayout;
private FloatingActionButton mReplyButton;
Expand Down Expand Up @@ -148,8 +151,22 @@ protected void onCreate(Bundle savedInstanceState) {
R.string.pref_external,
R.string.pref_story_display,
R.string.pref_multi_window);

mCoordinatorLayout = findViewById(R.id.content_frame);
}

@Override
protected void onResume(){
super.onResume();
if (!AppUtils.hasConnection(this)) {
Snackbar.make(mCoordinatorLayout, R.string.offline_notice, Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View v) {

}
}).show();
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
Expand Down
26 changes: 22 additions & 4 deletions app/src/main/java/io/github/hidroh/materialistic/ItemActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ protected void onCreate(Bundle savedInstanceState) {
new ItemResponseListener(this));
}
if (!AppUtils.hasConnection(this)) {
Snackbar.make(mCoordinatorLayout, R.string.offline_notice, Snackbar.LENGTH_LONG).show();
Snackbar.make(mCoordinatorLayout, R.string.offline_notice, Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View v) {

}
}).show();
}
}

Expand Down Expand Up @@ -220,9 +225,22 @@ public boolean onOptionsItemSelected(MenuItem item) {
return true;
}
if (item.getItemId() == R.id.menu_share) {
View anchor = findViewById(R.id.menu_share);
AppUtils.share(this, mPopupMenu, anchor == null ?
findViewById(R.id.toolbar) : anchor, mItem);

if (!AppUtils.hasConnection(this)) {
Snackbar.make(mCoordinatorLayout, R.string.offline_notice, Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View v) {

}
}).show();
}
else
{
View anchor = findViewById(R.id.menu_share);
AppUtils.share(this, mPopupMenu, anchor == null ?
findViewById(R.id.toolbar) : anchor, mItem);
}

return true;
}
return super.onOptionsItemSelected(item);
Expand Down