Limits some actions

This commit is contained in:
Thomas 2020-12-01 16:09:14 +01:00
parent 9fdffc9709
commit 6911fbd124
2 changed files with 20 additions and 9 deletions

View File

@ -46,30 +46,40 @@ android {
buildConfigField "String", "version", "\"fdroid_acad\""
buildConfigField "boolean", "full_instances", "false"
buildConfigField "boolean", "google_restriction", "false"
buildConfigField "boolean", "surfing_mode", "false"
buildConfigField "boolean", "sepia_search", "false"
}
google_acad {
applicationId "app.fedilab.fedilabtube"
buildConfigField "String", "version", "\"google_acad\""
buildConfigField "boolean", "full_instances", "false"
buildConfigField "boolean", "google_restriction", "true"
buildConfigField "boolean", "surfing_mode", "false"
buildConfigField "boolean", "sepia_search", "false"
}
fdroid_full {
applicationId "app.fedilab.tubelab"
buildConfigField "String", "version", "\"fdroid_full\""
buildConfigField "boolean", "full_instances", "true"
buildConfigField "boolean", "google_restriction", "false"
buildConfigField "boolean", "surfing_mode", "true"
buildConfigField "boolean", "sepia_search", "true"
}
google_full {
applicationId "app.fedilab.tubelab"
buildConfigField "String", "version", "\"google_full\""
buildConfigField "boolean", "full_instances", "true"
buildConfigField "boolean", "google_restriction", "true"
buildConfigField "boolean", "surfing_mode", "true"
buildConfigField "boolean", "sepia_search", "true"
}
bittube {
applicationId "app.fedilab.bittube"
buildConfigField "String", "version", "\"google_full\""
buildConfigField "boolean", "full_instances", "true"
buildConfigField "boolean", "google_restriction", "true"
buildConfigField "boolean", "surfing_mode", "false"
buildConfigField "boolean", "sepia_search", "false"
}
}

View File

@ -28,7 +28,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
@ -265,6 +264,9 @@ public class MainActivity extends AppCompatActivity {
toolbar.setOnClickListener(v -> {
if (binding.viewpager.getAdapter() == null) {
return;
}
if (binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof DisplayVideosFragment) {
((DisplayVideosFragment) binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem())).scrollToTop();
} else if (binding.viewpager.getAdapter().instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof DisplayOverviewFragment) {
@ -446,18 +448,17 @@ public class MainActivity extends AppCompatActivity {
MenuItem instanceItem = menu.findItem(R.id.action_change_instance);
MenuItem accountItem = menu.findItem(R.id.action_account);
Toolbar toolbar = findViewById(R.id.toolbar);
ImageView instances = toolbar.findViewById(R.id.instances);
if (BuildConfig.full_instances && ((Helper.isLoggedIn(MainActivity.this) && typeOfConnection == NORMAL) || typeOfConnection == SURFING)) {
instances.setVisibility(View.VISIBLE);
instances.setOnClickListener(null);
instances.setOnClickListener(v -> {
if (BuildConfig.surfing_mode && ((Helper.isLoggedIn(MainActivity.this) && typeOfConnection == NORMAL) || typeOfConnection == SURFING)) {
binding.instances.setVisibility(View.VISIBLE);
binding.instances.setOnClickListener(null);
binding.instances.setOnClickListener(v -> {
Intent intent = new Intent(MainActivity.this, ManageInstancesActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
});
} else {
instances.setVisibility(View.GONE);
binding.instances.setVisibility(View.GONE);
}
switch (typeOfConnection) {
case UNKNOWN:
@ -510,7 +511,7 @@ public class MainActivity extends AppCompatActivity {
}
if (!BuildConfig.full_instances) {
if (!BuildConfig.sepia_search) {
sepiaSearchItem.setVisible(false);
}
return true;