|
|
@ -35,8 +35,6 @@ import com.mikepenz.materialdrawer.Drawer; |
|
|
|
import com.mikepenz.materialdrawer.DrawerBuilder; |
|
|
|
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; |
|
|
|
import com.mikepenz.materialdrawer.model.ProfileDrawerItem; |
|
|
|
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; |
|
|
|
import com.mikepenz.materialdrawer.model.interfaces.IProfile; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.util.ArrayList; |
|
|
@ -329,9 +327,7 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
|
.withDrawerWidthDp((int) BaseApplication.getInstance().getDpWidth() / 2) |
|
|
|
.withSliderBackgroundColor(ContextCompat.getColor(this, R.color.primary_light)) |
|
|
|
.withAccountHeader(accountHeader) |
|
|
|
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { |
|
|
|
@Override |
|
|
|
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { |
|
|
|
.withOnDrawerItemClickListener((view, position, drawerItem) -> { |
|
|
|
if (drawerItem.equals(HOME_ID)) { |
|
|
|
if (!(BaseActivity.this instanceof MainActivity)) { |
|
|
|
Intent intent = new Intent(BaseActivity.this, MainActivity.class); |
|
|
@ -354,6 +350,7 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
|
} else if (drawerItem.equals(BOOKMARKS_ID)) { |
|
|
|
if (!(BaseActivity.this instanceof BookmarkActivity)) { |
|
|
|
Intent intent = new Intent(BaseActivity.this, BookmarkActivity.class); |
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
} else if (drawerItem.equals(LOG_ID)) { |
|
|
@ -364,18 +361,19 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
|
} else if (drawerItem.equals(ABOUT_ID)) { |
|
|
|
if (!(BaseActivity.this instanceof AboutActivity)) { |
|
|
|
Intent intent = new Intent(BaseActivity.this, AboutActivity.class); |
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
} else if (drawerItem.equals(SETTINGS_ID)) { |
|
|
|
if (!(BaseActivity.this instanceof SettingsActivity)) { |
|
|
|
Intent intent = new Intent(BaseActivity.this, SettingsActivity.class); |
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
drawer.closeDrawer(); |
|
|
|
return true; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if (sessionManager.isLoggedIn()) |
|
|
@ -388,12 +386,9 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
|
if (!(BaseActivity.this instanceof MainActivity)) |
|
|
|
drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false); |
|
|
|
|
|
|
|
drawer.setOnDrawerNavigationListener(new Drawer.OnDrawerNavigationListener() { |
|
|
|
@Override |
|
|
|
public boolean onNavigationClickListener(View clickedView) { |
|
|
|
drawer.setOnDrawerNavigationListener(clickedView -> { |
|
|
|
onBackPressed(); |
|
|
|
return true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -696,15 +691,8 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
|
Button cancelButton = view.findViewById(R.id.cancel); |
|
|
|
Button openButton = view.findViewById(R.id.open); |
|
|
|
Button downloadButton = view.findViewById(R.id.download); |
|
|
|
cancelButton.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
dialog.dismiss(); |
|
|
|
} |
|
|
|
}); |
|
|
|
openButton.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
cancelButton.setOnClickListener(v -> dialog.dismiss()); |
|
|
|
openButton.setOnClickListener(v -> { |
|
|
|
dialog.dismiss(); |
|
|
|
try { |
|
|
|
String fileName = thmmyFile.getFilename(); |
|
|
@ -718,14 +706,10 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
|
Toast.makeText(getBaseContext(), "Couldn't open file...", Toast.LENGTH_SHORT).show(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
downloadButton.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
downloadButton.setOnClickListener(v -> { |
|
|
|
dialog.dismiss(); |
|
|
|
DownloadHelper.enqueueDownload(thmmyFile); |
|
|
|
} |
|
|
|
}); |
|
|
|
dialog.show(); |
|
|
|
} |
|
|
@ -738,7 +722,6 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
|
private void startLoginActivity(){ |
|
|
|
Intent intent = new Intent(BaseActivity.this, LoginActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
finish(); |
|
|
|
overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); |
|
|
|
} |
|
|
|
} |
|
|
|