From: Marius Gavrilescu Date: Tue, 11 Jun 2013 10:11:46 +0000 (+0300) Subject: Clean up previous commit X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=724f9857beb10b810e8cad7ca513d74641e60f6c;p=unical.git Clean up previous commit --- diff --git a/.pmd b/.pmd index 5b88d72..4644f28 100644 --- a/.pmd +++ b/.pmd @@ -4,671 +4,563 @@ .ruleset - LooseCoupling - Type Resolution Rules - - - CloneMethodMustImplementCloneable - Type Resolution Rules - - - UnusedImports - Type Resolution Rules - - - SignatureDeclareThrowsException - Type Resolution Rules - - - IfStmtsMustUseBraces - Braces Rules - - - WhileLoopsMustUseBraces - Braces Rules - - - IfElseStmtsMustUseBraces - Braces Rules - - - ForLoopsMustUseBraces - Braces Rules - - - UseSingleton - Design Rules - - - SimplifyBooleanReturns - Design Rules - - - SimplifyBooleanExpressions - Design Rules - - - SwitchStmtsShouldHaveDefault - Design Rules - - - AvoidDeeplyNestedIfStmts - Design Rules - - - AvoidReassigningParameters - Design Rules - - - SwitchDensity - Design Rules - - - ConstructorCallsOverridableMethod - Design Rules - - - AccessorClassGeneration - Design Rules - - - FinalFieldCouldBeStatic - Design Rules - - - CloseResource - Design Rules - - - NonStaticInitializer - Design Rules - - - DefaultLabelNotLastInSwitchStmt - Design Rules - - - NonCaseLabelInSwitchStatement - Design Rules - - - OptimizableToArrayCall - Design Rules - - - BadComparison - Design Rules - - - EqualsNull - Design Rules - - - ConfusingTernary - Design Rules - - - InstantiationToGetClass - Design Rules - - - IdempotentOperations - Design Rules + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules - SimpleDateFormatNeedsLocale - Design Rules + AvoidMultipleUnaryOperators + Basic Rules - ImmutableField - Design Rules + AvoidThreadGroup + Basic Rules - UseLocaleWithCaseConversions - Design Rules + AvoidUsingHardCodedIP + Basic Rules - AvoidProtectedFieldInFinalClass - Design Rules + AvoidUsingOctalValues + Basic Rules - AssignmentToNonFinalStatic - Design Rules + BigIntegerInstantiation + Basic Rules - MissingStaticMethodInNonInstantiatableClass - Design Rules + BooleanInstantiation + Basic Rules - AvoidSynchronizedAtMethodLevel - Design Rules + BrokenNullCheck + Basic Rules - MissingBreakInSwitch - Design Rules + CheckResultSet + Basic Rules - UseNotifyAllInsteadOfNotify - Design Rules + ClassCastExceptionWithToArray + Basic Rules - AvoidInstanceofChecksInCatchClause - Design Rules + CollapsibleIfStatements + Basic Rules - AbstractClassWithoutAbstractMethod - Design Rules + DoubleCheckedLocking + Basic Rules - SimplifyConditional - Design Rules + EmptyCatchBlock + Basic Rules - CompareObjectsWithEquals - Design Rules + EmptyFinallyBlock + Basic Rules - PositionLiteralsFirstInComparisons - Design Rules + EmptyIfStmt + Basic Rules - UnnecessaryLocalBeforeReturn - Design Rules + EmptyInitializer + Basic Rules - NonThreadSafeSingleton - Design Rules + EmptyStatementNotInLoop + Basic Rules - UncommentedEmptyMethod - Design Rules + EmptyStaticInitializer + Basic Rules - UncommentedEmptyConstructor - Design Rules + EmptySwitchStatements + Basic Rules - AvoidConstantsInterface - Design Rules + EmptySynchronizedBlock + Basic Rules - UnsynchronizedStaticDateFormatter - Design Rules + EmptyTryBlock + Basic Rules - PreserveStackTrace - Design Rules + EmptyWhileStmt + Basic Rules - UseCollectionIsEmpty - Design Rules + ForLoopShouldBeWhileLoop + Basic Rules - ClassWithOnlyPrivateConstructorsShouldBeFinal - Design Rules + JumbledIncrementer + Basic Rules - EmptyMethodInAbstractClassShouldBeAbstract - Design Rules + MisplacedNullCheck + Basic Rules - SingularField - Design Rules + OverrideBothEqualsAndHashcode + Basic Rules - ReturnEmptyArrayRatherThanNull - Design Rules + ReturnFromFinallyBlock + Basic Rules - AbstractClassWithoutAnyMethod - Design Rules + UnconditionalIfStatement + Basic Rules - TooFewBranchesForASwitchStatement - Design Rules + UnnecessaryConversionTemporary + Basic Rules - AvoidCatchingThrowable - Strict Exception Rules + UnnecessaryFinalModifier + Basic Rules - SignatureDeclareThrowsException - Type Resolution Rules + UnnecessaryReturn + Basic Rules - ExceptionAsFlowControl - Strict Exception Rules + UnusedNullCheckInEquals + Basic Rules - AvoidCatchingNPE - Strict Exception Rules + UselessOperationOnImmutable + Basic Rules - AvoidThrowingRawExceptionTypes - Strict Exception Rules + UselessOverridingMethod + Basic Rules - AvoidThrowingNullPointerException - Strict Exception Rules + IfElseStmtsMustUseBraces + Braces Rules - AvoidRethrowingException - Strict Exception Rules + CloneThrowsCloneNotSupportedException + Clone Implementation Rules - DoNotExtendJavaLangError - Strict Exception Rules + ProperCloneImplementation + Clone Implementation Rules - DoNotThrowExceptionInFinally - Strict Exception Rules + CyclomaticComplexity + Code Size Rules - AvoidThrowingNewInstanceOfSameException - Strict Exception Rules + ExcessiveClassLength + Code Size Rules - UnusedPrivateField - Unused Code Rules + ExcessiveMethodLength + Code Size Rules - UnusedLocalVariable - Unused Code Rules + ExcessiveParameterList + Code Size Rules - UnusedPrivateMethod - Unused Code Rules + ExcessivePublicCount + Code Size Rules - UnusedFormalParameter - Unused Code Rules + NcssConstructorCount + Code Size Rules - MoreThanOneLogger - Java Logging Rules + NcssMethodCount + Code Size Rules - LoggerIsNotStaticFinal - Java Logging Rules + NcssTypeCount + Code Size Rules - SystemPrintln - Java Logging Rules + TooManyFields + Code Size Rules - AvoidPrintStackTrace - Java Logging Rules + TooManyMethods + Code Size Rules - AvoidDuplicateLiterals - String and StringBuffer Rules + AssignmentInOperand + Controversial Rules - StringInstantiation - String and StringBuffer Rules + AtLeastOneConstructor + Controversial Rules - StringToString - String and StringBuffer Rules + AvoidAccessibilityAlteration + Controversial Rules - InefficientStringBuffering - String and StringBuffer Rules + AvoidFinalLocalVariable + Controversial Rules - UnnecessaryCaseChange - String and StringBuffer Rules + AvoidUsingNativeCode + Controversial Rules - UseStringBufferLength - String and StringBuffer Rules + AvoidUsingShortType + Controversial Rules - AppendCharacterWithChar - String and StringBuffer Rules + AvoidUsingVolatile + Controversial Rules - ConsecutiveLiteralAppends - String and StringBuffer Rules + BooleanInversion + Controversial Rules - UseIndexOfChar - String and StringBuffer Rules + CallSuperInConstructor + Controversial Rules - InefficientEmptyStringCheck - String and StringBuffer Rules + DefaultPackage + Controversial Rules - InsufficientStringBufferDeclaration - String and StringBuffer Rules + DoNotCallGarbageCollectionExplicitly + Controversial Rules - UselessStringValueOf - String and StringBuffer Rules + DontImportSun + Controversial Rules - StringBufferInstantiationWithChar - String and StringBuffer Rules + NullAssignment + Controversial Rules - UseEqualsToCompareStrings - String and StringBuffer Rules + SuspiciousOctalEscape + Controversial Rules - AvoidStringBufferField - String and StringBuffer Rules + UnnecessaryConstructor + Controversial Rules - ReplaceVectorWithList - Migration Rules + UnnecessaryParentheses + Controversial Rules - ReplaceHashtableWithMap - Migration Rules + UnusedModifier + Controversial Rules - ReplaceEnumerationWithIterator - Migration Rules + CouplingBetweenObjects + Coupling Rules - AvoidEnumAsIdentifier - Migration Rules + ExcessiveImports + Coupling Rules - AvoidAssertAsIdentifier - Migration Rules + AbstractClassWithoutAbstractMethod + Design Rules - IntegerInstantiation - Migration Rules + AbstractClassWithoutAnyMethod + Design Rules - ByteInstantiation - Migration Rules + AccessorClassGeneration + Design Rules - ShortInstantiation - Migration Rules + AssignmentToNonFinalStatic + Design Rules - LongInstantiation - Migration Rules + AvoidConstantsInterface + Design Rules - JUnit4TestShouldUseBeforeAnnotation - Migration Rules + AvoidDeeplyNestedIfStmts + Design Rules - JUnit4TestShouldUseAfterAnnotation - Migration Rules + AvoidInstanceofChecksInCatchClause + Design Rules - JUnit4TestShouldUseTestAnnotation - Migration Rules + AvoidProtectedFieldInFinalClass + Design Rules - JUnit4SuitesShouldUseSuiteAnnotation - Migration Rules + AvoidReassigningParameters + Design Rules - JUnitUseExpected - Migration Rules + AvoidSynchronizedAtMethodLevel + Design Rules - UseProperClassLoader - J2EE Rules + BadComparison + Design Rules - MDBAndSessionBeanNamingConvention - J2EE Rules + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules - RemoteSessionInterfaceNamingConvention - J2EE Rules + CloseResource + Design Rules - LocalInterfaceSessionNamingConvention - J2EE Rules + CompareObjectsWithEquals + Design Rules - LocalHomeNamingConvention - J2EE Rules + ConfusingTernary + Design Rules - RemoteInterfaceNamingConvention - J2EE Rules + ConstructorCallsOverridableMethod + Design Rules - DoNotCallSystemExit - J2EE Rules + DefaultLabelNotLastInSwitchStmt + Design Rules - StaticEJBFieldShouldBeFinal - J2EE Rules + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules - DoNotUseThreads - J2EE Rules + EqualsNull + Design Rules - LocalVariableCouldBeFinal - Optimization Rules + FinalFieldCouldBeStatic + Design Rules - MethodArgumentCouldBeFinal - Optimization Rules + IdempotentOperations + Design Rules - AvoidInstantiatingObjectsInLoops - Optimization Rules + ImmutableField + Design Rules - UseArrayListInsteadOfVector - Optimization Rules + InstantiationToGetClass + Design Rules - SimplifyStartsWith - Optimization Rules + MissingBreakInSwitch + Design Rules - UseStringBufferForStringAppends - Optimization Rules + MissingStaticMethodInNonInstantiatableClass + Design Rules - UseArraysAsList - Optimization Rules + NonCaseLabelInSwitchStatement + Design Rules - AvoidArrayLoops - Optimization Rules + NonStaticInitializer + Design Rules - UnnecessaryWrapperObjectCreation - Optimization Rules + NonThreadSafeSingleton + Design Rules - AddEmptyString - Optimization Rules + OptimizableToArrayCall + Design Rules - EmptyCatchBlock - Basic Rules + PositionLiteralsFirstInComparisons + Design Rules - EmptyIfStmt - Basic Rules + PreserveStackTrace + Design Rules - EmptyWhileStmt - Basic Rules + ReturnEmptyArrayRatherThanNull + Design Rules - EmptyTryBlock - Basic Rules + SimpleDateFormatNeedsLocale + Design Rules - EmptyFinallyBlock - Basic Rules + SimplifyBooleanExpressions + Design Rules - EmptySwitchStatements - Basic Rules + SimplifyBooleanReturns + Design Rules - JumbledIncrementer - Basic Rules + SimplifyConditional + Design Rules - ForLoopShouldBeWhileLoop - Basic Rules + SingularField + Design Rules - UnnecessaryConversionTemporary - Basic Rules + SwitchDensity + Design Rules - OverrideBothEqualsAndHashcode - Basic Rules + SwitchStmtsShouldHaveDefault + Design Rules - DoubleCheckedLocking - Basic Rules + UncommentedEmptyConstructor + Design Rules - ReturnFromFinallyBlock - Basic Rules + UncommentedEmptyMethod + Design Rules - EmptySynchronizedBlock - Basic Rules + UnnecessaryLocalBeforeReturn + Design Rules - UnnecessaryReturn - Basic Rules + UnsynchronizedStaticDateFormatter + Design Rules - EmptyStaticInitializer - Basic Rules + UseCollectionIsEmpty + Design Rules - UnconditionalIfStatement - Basic Rules + UseLocaleWithCaseConversions + Design Rules - EmptyStatementNotInLoop - Basic Rules + UseNotifyAllInsteadOfNotify + Design Rules - BooleanInstantiation - Basic Rules + UseSingleton + Design Rules - UnnecessaryFinalModifier - Basic Rules + AvoidCallingFinalize + Finalizer Rules - CollapsibleIfStatements - Basic Rules + EmptyFinalizer + Finalizer Rules - UselessOverridingMethod - Basic Rules + FinalizeDoesNotCallSuperFinalize + Finalizer Rules - ClassCastExceptionWithToArray - Basic Rules + FinalizeOnlyCallsSuperFinalize + Finalizer Rules - AvoidDecimalLiteralsInBigDecimalConstructor - Basic Rules + FinalizeOverloaded + Finalizer Rules - UselessOperationOnImmutable - Basic Rules + FinalizeShouldBeProtected + Finalizer Rules - MisplacedNullCheck - Basic Rules + DontImportJavaLang + Import Statement Rules - UnusedNullCheckInEquals - Basic Rules + DuplicateImports + Import Statement Rules - AvoidThreadGroup - Basic Rules + ImportFromSamePackage + Import Statement Rules - BrokenNullCheck - Basic Rules + TooManyStaticImports + Import Statement Rules - BigIntegerInstantiation - Basic Rules + DoNotCallSystemExit + J2EE Rules - AvoidUsingOctalValues - Basic Rules + DoNotUseThreads + J2EE Rules - AvoidUsingHardCodedIP - Basic Rules + LocalHomeNamingConvention + J2EE Rules - CheckResultSet - Basic Rules + LocalInterfaceSessionNamingConvention + J2EE Rules - AvoidMultipleUnaryOperators - Basic Rules + MDBAndSessionBeanNamingConvention + J2EE Rules - EmptyInitializer - Basic Rules + RemoteInterfaceNamingConvention + J2EE Rules - MethodReturnsInternalArray - Security Code Guidelines + RemoteSessionInterfaceNamingConvention + J2EE Rules - ArrayIsStoredDirectly - Security Code Guidelines + StaticEJBFieldShouldBeFinal + J2EE Rules - CouplingBetweenObjects - Coupling Rules + UseProperClassLoader + J2EE Rules - ExcessiveImports - Coupling Rules + ProperLogger + Jakarta Commons Logging Rules - LooseCoupling - Type Resolution Rules + UseCorrectExceptionLogging + Jakarta Commons Logging Rules - DuplicateImports - Import Statement Rules + AvoidPrintStackTrace + Java Logging Rules - DontImportJavaLang - Import Statement Rules + LoggerIsNotStaticFinal + Java Logging Rules - UnusedImports - Type Resolution Rules + MoreThanOneLogger + Java Logging Rules - ImportFromSamePackage - Import Statement Rules + SystemPrintln + Java Logging Rules - TooManyStaticImports - Import Statement Rules + MissingSerialVersionUID + JavaBean Rules - JUnitStaticSuite + JUnitAssertionsShouldIncludeMessage JUnit Rules @@ -676,7 +568,7 @@ JUnit Rules - JUnitAssertionsShouldIncludeMessage + JUnitStaticSuite JUnit Rules @@ -684,19 +576,19 @@ JUnit Rules - TestClassWithoutTestCases + SimplifyBooleanAssertion JUnit Rules - UnnecessaryBooleanAssertion + TestClassWithoutTestCases JUnit Rules - UseAssertEqualsInsteadOfAssertTrue + UnnecessaryBooleanAssertion JUnit Rules - UseAssertSameInsteadOfAssertTrue + UseAssertEqualsInsteadOfAssertTrue JUnit Rules @@ -704,87 +596,87 @@ JUnit Rules - SimplifyBooleanAssertion + UseAssertSameInsteadOfAssertTrue JUnit Rules - UnnecessaryConstructor - Controversial Rules + AvoidAssertAsIdentifier + Migration Rules - NullAssignment - Controversial Rules + AvoidEnumAsIdentifier + Migration Rules - UnusedModifier - Controversial Rules + ByteInstantiation + Migration Rules - AssignmentInOperand - Controversial Rules + IntegerInstantiation + Migration Rules - AtLeastOneConstructor - Controversial Rules + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules - DontImportSun - Controversial Rules + JUnit4TestShouldUseAfterAnnotation + Migration Rules - SuspiciousOctalEscape - Controversial Rules + JUnit4TestShouldUseBeforeAnnotation + Migration Rules - CallSuperInConstructor - Controversial Rules + JUnit4TestShouldUseTestAnnotation + Migration Rules - UnnecessaryParentheses - Controversial Rules + JUnitUseExpected + Migration Rules - DefaultPackage - Controversial Rules + LongInstantiation + Migration Rules - BooleanInversion - Controversial Rules + ReplaceEnumerationWithIterator + Migration Rules - DataflowAnomalyAnalysis - Controversial Rules + ReplaceHashtableWithMap + Migration Rules - AvoidFinalLocalVariable - Controversial Rules + ReplaceVectorWithList + Migration Rules - AvoidUsingShortType - Controversial Rules + ShortInstantiation + Migration Rules - AvoidUsingVolatile - Controversial Rules + AbstractNaming + Naming Rules - AvoidUsingNativeCode - Controversial Rules + AvoidDollarSigns + Naming Rules - AvoidAccessibilityAlteration - Controversial Rules + AvoidFieldNameMatchingMethodName + Naming Rules - DoNotCallGarbageCollectionExplicitly - Controversial Rules + AvoidFieldNameMatchingTypeName + Naming Rules - ShortMethodName + BooleanGetMethodName Naming Rules - VariableNamingConventions + ClassNamingConventions Naming Rules @@ -792,23 +684,23 @@ Naming Rules - ClassNamingConventions + MethodWithSameNameAsEnclosingClass Naming Rules - AbstractNaming + MisleadingVariableName Naming Rules - AvoidDollarSigns + NoPackage Naming Rules - MethodWithSameNameAsEnclosingClass + PackageCase Naming Rules - SuspiciousHashcodeMethodName + ShortMethodName Naming Rules @@ -820,126 +712,186 @@ Naming Rules - AvoidFieldNameMatchingTypeName + SuspiciousHashcodeMethodName Naming Rules - AvoidFieldNameMatchingMethodName + VariableNamingConventions Naming Rules - NoPackage - Naming Rules + AddEmptyString + Optimization Rules - PackageCase - Naming Rules + AvoidArrayLoops + Optimization Rules - MisleadingVariableName - Naming Rules + LocalVariableCouldBeFinal + Optimization Rules - BooleanGetMethodName - Naming Rules + MethodArgumentCouldBeFinal + Optimization Rules - NPathComplexity - Code Size Rules + SimplifyStartsWith + Optimization Rules - ExcessiveMethodLength - Code Size Rules + UnnecessaryWrapperObjectCreation + Optimization Rules - ExcessiveParameterList - Code Size Rules + UseArrayListInsteadOfVector + Optimization Rules - ExcessiveClassLength - Code Size Rules + UseArraysAsList + Optimization Rules - CyclomaticComplexity - Code Size Rules + UseStringBufferForStringAppends + Optimization Rules - ExcessivePublicCount - Code Size Rules + ArrayIsStoredDirectly + Security Code Guidelines - TooManyFields - Code Size Rules + MethodReturnsInternalArray + Security Code Guidelines - NcssMethodCount - Code Size Rules + AvoidCatchingNPE + Strict Exception Rules - NcssTypeCount - Code Size Rules + AvoidCatchingThrowable + Strict Exception Rules - NcssConstructorCount - Code Size Rules + AvoidRethrowingException + Strict Exception Rules - TooManyMethods - Code Size Rules + AvoidThrowingNewInstanceOfSameException + Strict Exception Rules - EmptyFinalizer - Finalizer Rules + AvoidThrowingNullPointerException + Strict Exception Rules - FinalizeOnlyCallsSuperFinalize - Finalizer Rules + AvoidThrowingRawExceptionTypes + Strict Exception Rules - FinalizeOverloaded - Finalizer Rules + DoNotExtendJavaLangError + Strict Exception Rules - FinalizeDoesNotCallSuperFinalize - Finalizer Rules + DoNotThrowExceptionInFinally + Strict Exception Rules - FinalizeShouldBeProtected - Finalizer Rules + ExceptionAsFlowControl + Strict Exception Rules - AvoidCallingFinalize - Finalizer Rules + AppendCharacterWithChar + String and StringBuffer Rules - UseCorrectExceptionLogging - Jakarta Commons Logging Rules + AvoidDuplicateLiterals + String and StringBuffer Rules - ProperLogger - Jakarta Commons Logging Rules + AvoidStringBufferField + String and StringBuffer Rules - BeanMembersShouldSerialize - JavaBean Rules + ConsecutiveLiteralAppends + String and StringBuffer Rules - MissingSerialVersionUID - JavaBean Rules + InefficientEmptyStringCheck + String and StringBuffer Rules - ProperCloneImplementation - Clone Implementation Rules + InefficientStringBuffering + String and StringBuffer Rules - CloneThrowsCloneNotSupportedException - Clone Implementation Rules + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + StringInstantiation + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules CloneMethodMustImplementCloneable Type Resolution Rules + + LooseCoupling + Type Resolution Rules + + + SignatureDeclareThrowsException + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnusedFormalParameter + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + false - true + false diff --git a/src/ro/ieval/unical/AddEventActivity.java b/src/ro/ieval/unical/AddEventActivity.java index 0fc26ab..caa9015 100644 --- a/src/ro/ieval/unical/AddEventActivity.java +++ b/src/ro/ieval/unical/AddEventActivity.java @@ -2,15 +2,10 @@ package ro.ieval.unical; import android.app.ActionBar; import android.app.Activity; import android.app.Fragment; -import android.app.FragmentTransaction; -import android.app.ActionBar.Tab; -import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import android.widget.TabHost; -import android.widget.TabHost.TabSpec; public final class AddEventActivity extends Activity { @Override @@ -18,15 +13,15 @@ public final class AddEventActivity extends Activity { super.onCreate(savedInstanceState); setContentView(R.layout.add_event); setTitle(R.string.addeventtitle); - ActionBar actionBar = getActionBar(); + final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - ActionBar.Tab t1 = actionBar.newTab().setText(this.getString(R.string.addevtab1)); - ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2)); - ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3)); + final ActionBar.Tab t1 = actionBar.newTab().setText(this.getString(R.string.addevtab1)); + final ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2)); + final ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3)); - Fragment f1 = new AddEventBasicTabFragment(); - Fragment f2 = new AddEventDetailsTabFragment(); - Fragment f3 = new AddEventOtherTabFragment(); + final Fragment f1 = new TrivialFragment(R.layout.add_event_basic_tab); + final Fragment f2 = new TrivialFragment(R.layout.add_event_details_tab); + final Fragment f3 = new TrivialFragment(R.layout.add_event_other_tab); t1.setTabListener(new AddEventTabListener(f1)); t2.setTabListener(new AddEventTabListener(f2)); diff --git a/src/ro/ieval/unical/AddEventBasicTabFragment.java b/src/ro/ieval/unical/AddEventBasicTabFragment.java deleted file mode 100644 index 53596d2..0000000 --- a/src/ro/ieval/unical/AddEventBasicTabFragment.java +++ /dev/null @@ -1,16 +0,0 @@ -package ro.ieval.unical; -import ro.ieval.unical.R; -import android.app.Fragment; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - - -public class AddEventBasicTabFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.add_event_basic_tab, container, false); - } -} diff --git a/src/ro/ieval/unical/AddEventDetailsTabFragment.java b/src/ro/ieval/unical/AddEventDetailsTabFragment.java deleted file mode 100644 index 20def85..0000000 --- a/src/ro/ieval/unical/AddEventDetailsTabFragment.java +++ /dev/null @@ -1,15 +0,0 @@ -package ro.ieval.unical; - -import android.app.Fragment; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -public class AddEventDetailsTabFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.add_event_details_tab, container, false); - } -} diff --git a/src/ro/ieval/unical/AddEventOtherTabFragment.java b/src/ro/ieval/unical/AddEventOtherTabFragment.java deleted file mode 100644 index 5e28544..0000000 --- a/src/ro/ieval/unical/AddEventOtherTabFragment.java +++ /dev/null @@ -1,15 +0,0 @@ -package ro.ieval.unical; - -import android.app.Fragment; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -public class AddEventOtherTabFragment extends Fragment { - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.add_event_other_tab, container, false); - } -} diff --git a/src/ro/ieval/unical/AddEventTabListener.java b/src/ro/ieval/unical/AddEventTabListener.java index 1a4661a..61ac236 100644 --- a/src/ro/ieval/unical/AddEventTabListener.java +++ b/src/ro/ieval/unical/AddEventTabListener.java @@ -8,22 +8,22 @@ import android.app.FragmentTransaction; public class AddEventTabListener implements ActionBar.TabListener { public Fragment fragment; - public AddEventTabListener(Fragment fragment) { + public AddEventTabListener(final Fragment fragment) { this.fragment = fragment; } @Override - public void onTabSelected(Tab tab, FragmentTransaction ft) { + public void onTabSelected(final Tab tab, final FragmentTransaction ft) { ft.replace(R.id.fragment_container, fragment); } @Override - public void onTabUnselected(Tab tab, FragmentTransaction ft) { + public void onTabUnselected(final Tab tab, final FragmentTransaction ft) { ft.remove(fragment); } @Override - public void onTabReselected(Tab tab, FragmentTransaction ft) { + public void onTabReselected(final Tab tab, final FragmentTransaction ft) { // TODO Auto-generated method stub } diff --git a/src/ro/ieval/unical/TrivialFragment.java b/src/ro/ieval/unical/TrivialFragment.java new file mode 100644 index 0000000..727814a --- /dev/null +++ b/src/ro/ieval/unical/TrivialFragment.java @@ -0,0 +1,19 @@ +package ro.ieval.unical; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +public final class TrivialFragment extends Fragment { + private final int layout; + public TrivialFragment(final int layout){ + this.layout=layout; + } + + @Override + public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { + return inflater.inflate(layout, container, false); + } +}