Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
V3rB0se committed Apr 9, 2023
1 parent 8902964 commit e57f7b4
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions app/src/main/java/com/stfu/social/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,45 +66,27 @@ protected void onCreate(Bundle savedInstanceState) {
Facebook);


button.setOnClickListener((new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
})
button.setOnClickListener((view -> finish())
);

Reddit.setOnCheckedChangeListener((materialSwitch, isChecked) -> {
toggleApp(REDDIT_PACKAGE, R.id.reddit_desc, isChecked, Reddit);
});
Reddit.setOnCheckedChangeListener((materialSwitch, isChecked) -> toggleApp(REDDIT_PACKAGE, R.id.reddit_desc, isChecked, Reddit));

Telegram.setOnCheckedChangeListener((materialSwitch, isChecked) -> {
toggleApp(TELEGRAM_PACKAGE, R.id.telegram_desc, isChecked, Telegram);
});
Telegram.setOnCheckedChangeListener((materialSwitch, isChecked) -> toggleApp(TELEGRAM_PACKAGE, R.id.telegram_desc, isChecked, Telegram));

Instagram.setOnCheckedChangeListener((materialSwitch, isChecked) -> {
toggleApp(INSTAGRAM_PACKAGE, R.id.instagram_desc, isChecked, Instagram);
});
Instagram.setOnCheckedChangeListener((materialSwitch, isChecked) -> toggleApp(INSTAGRAM_PACKAGE, R.id.instagram_desc, isChecked, Instagram));

Snapchat.setOnCheckedChangeListener((materialSwitch, isChecked) -> {
toggleApp(SNAPCHAT_PACKAGE, R.id.snapchat_desc, isChecked, Snapchat);
});
Snapchat.setOnCheckedChangeListener((materialSwitch, isChecked) -> toggleApp(SNAPCHAT_PACKAGE, R.id.snapchat_desc, isChecked, Snapchat));

Whatsapp.setOnCheckedChangeListener((materialSwitch, isChecked) -> {
toggleApp(WHATSAPP_PACKAGE, R.id.whatsapp_desc, isChecked, Whatsapp);
});
Whatsapp.setOnCheckedChangeListener((materialSwitch, isChecked) -> toggleApp(WHATSAPP_PACKAGE, R.id.whatsapp_desc, isChecked, Whatsapp));

Facebook.setOnCheckedChangeListener((materialSwitch, isChecked) -> {
toggleApp(FACEBOOK_PACKAGE, R.id.facebook_desc, isChecked, Facebook);
});
Facebook.setOnCheckedChangeListener((materialSwitch, isChecked) -> toggleApp(FACEBOOK_PACKAGE, R.id.facebook_desc, isChecked, Facebook));

Discord.setOnCheckedChangeListener((materialSwitch, isChecked) -> {
toggleApp(DISCORD_PACKAGE, R.id.discord_desc, isChecked, Discord);
});
Discord.setOnCheckedChangeListener((materialSwitch, isChecked) -> toggleApp(DISCORD_PACKAGE, R.id.discord_desc, isChecked, Discord));

}


@SuppressLint("SetTextI18n")
public void toggleApp(String packageName, int id, boolean isChecked, View view) {
TextView tv = findViewById(id);

Expand Down Expand Up @@ -193,6 +175,7 @@ public void checkApps(Context context, MaterialSwitch Instagram, MaterialSwitch
}


@SuppressLint("SetTextI18n")
public void ChangeStateMessage(int tid, Boolean isAppInstalled, MaterialSwitch switcher){

TextView tv = findViewById(tid);
Expand Down

0 comments on commit e57f7b4

Please sign in to comment.