mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Merge pull request #6109 from sauravrao637/codeImrovement
Replaced if/else with switch in ErrorActivity, supress false lint warning
This commit is contained in:
		| @@ -66,6 +66,9 @@ android { | |||||||
|         // Or, if you prefer, you can continue to check for errors in release builds, |         // Or, if you prefer, you can continue to check for errors in release builds, | ||||||
|         // but continue the build even when errors are found: |         // but continue the build even when errors are found: | ||||||
|         abortOnError false |         abortOnError false | ||||||
|  |         // suppress false warning ("Resource IDs will be non-final in Android Gradle Plugin version | ||||||
|  |         // 5.0, avoid using them in switch case statements"), which affects only library projects | ||||||
|  |         disable 'NonConstantResourceId' | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     compileOptions { |     compileOptions { | ||||||
|   | |||||||
| @@ -190,15 +190,16 @@ public class ErrorActivity extends AppCompatActivity { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean onOptionsItemSelected(final MenuItem item) { |     public boolean onOptionsItemSelected(final MenuItem item) { | ||||||
|         final int id = item.getItemId(); |         switch (item.getItemId()) { | ||||||
|         if (id == android.R.id.home) { |             case R.id.home: | ||||||
|             onBackPressed(); |                 onBackPressed(); | ||||||
|         } else if (id == R.id.menu_item_share_error) { |                 return true; | ||||||
|             ShareUtils.shareText(this, getString(R.string.error_report_title), buildJson()); |             case R.id.menu_item_share_error: | ||||||
|         } else { |                 ShareUtils.shareText(this, getString(R.string.error_report_title), buildJson()); | ||||||
|             return false; |                 return true; | ||||||
|  |             default: | ||||||
|  |                 return false; | ||||||
|         } |         } | ||||||
|         return true; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void openPrivacyPolicyDialog(final Context context, final String action) { |     private void openPrivacyPolicyDialog(final Context context, final String action) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Robin
					Robin