-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue[19][20][25] solved. #33
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string-array name="backgroundColorEntries"> | ||
<item name="Dark">Dark</item> | ||
<item name="Light">Light</item> | ||
<item name="Transparent">Glass</item> | ||
</string-array> | ||
<string-array name="backgroundValues"> | ||
<item name="Dark">1</item> | ||
<item name="Light">2</item> | ||
<item name="Transparent">3</item> | ||
</string-array> | ||
</resources> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
package us.bmark.android; | ||
|
||
|
||
import us.bmark.android.R; | ||
import us.bmark.android.prefs.SharedPrefsBackedUserSettings; | ||
import us.bmark.android.utils.IntentConstants; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
@@ -13,8 +17,6 @@ | |
import com.google.gson.JsonParseException; | ||
import com.google.gson.JsonSyntaxException; | ||
|
||
import us.bmark.android.prefs.SharedPrefsBackedUserSettings; | ||
import us.bmark.android.utils.IntentConstants; | ||
import us.bmark.bookieclient.Bookmark; | ||
import us.bmark.bookieclient.Tag; | ||
|
||
|
@@ -46,6 +48,8 @@ private void dealWithIntents() { | |
populateFields(bmark); | ||
} catch (JsonSyntaxException e) { | ||
Log.e(TAG, "Error getting bookmark detail", e); | ||
Toast.makeText(getActivity(),"Some error occured while fetching bookmark details" , | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a string resource instead of hard-coding a string |
||
Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
|
||
|
@@ -90,7 +94,7 @@ private TableRow createTagRow(CharSequence tagText) { | |
} | ||
|
||
private UserSettings userSettings() { | ||
return new SharedPrefsBackedUserSettings(this); | ||
return (UserSettings) new SharedPrefsBackedUserSettings(this); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
package us.bmark.android; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import us.bmark.android.prefs.SettingsActivity; | ||
import android.app.ActionBar; | ||
import android.app.FragmentTransaction; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.content.SharedPreferences.Editor; | ||
import android.graphics.Color; | ||
import android.graphics.drawable.ColorDrawable; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentActivity; | ||
|
@@ -13,14 +21,11 @@ | |
import android.view.Menu; | ||
import android.view.MenuInflater; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.Window; | ||
import android.widget.ImageView; | ||
import android.widget.SearchView; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import us.bmark.android.prefs.SettingsActivity; | ||
|
||
public class BookmarkListsActivity extends FragmentActivity { | ||
|
||
private static final String TAG = BookmarkListsActivity.class.getName(); | ||
|
@@ -31,7 +36,7 @@ public class BookmarkListsActivity extends FragmentActivity { | |
private BookmarkListFragment allFragment; | ||
private SearchBookmarkFragment searchFragment; | ||
private ViewPager pager; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing whitespace |
||
private ActionBar.TabListener tabListener = new ActionBar.TabListener() { | ||
|
||
@Override | ||
|
@@ -51,19 +56,33 @@ public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { | |
}; | ||
private MultiRefreshStateObserver observer; | ||
private BookmarkListsActivity.BookiePagerAdapter tabsPagerAdapter; | ||
|
||
String id="something"; | ||
SharedPreferences settings; | ||
Editor editor; | ||
String col; | ||
ActionBar actionBar; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These fields (id, settings, editor, col, actionbar) can be local variables |
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); | ||
setContentView(R.layout.main); | ||
pager = (ViewPager) findViewById(R.id.pager); | ||
createFragments(savedInstanceState); | ||
|
||
final ActionBar actionBar = getActionBar(); | ||
id = getIntent().getStringExtra("caller"); | ||
//Get Sharedpreferences | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These comments can be removed |
||
settings = getSharedPreferences("mypref", MODE_PRIVATE); | ||
//Get editor | ||
editor = settings.edit(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. editor appears unused |
||
//always set col to the color saved last time user had chosen it(for the first time 1--dark) | ||
col = settings.getString("mycolor", "1"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if it won't be clearer to the color or theme names as string constants instead of |
||
|
||
actionBar = getActionBar(); | ||
actionBar.setDisplayHomeAsUpEnabled(false); // Hides the '<' button in the ActionBar | ||
actionBar.setHomeButtonEnabled(true); // Enables the 'B' icon to be tappable on the list Activity | ||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); | ||
|
||
//always change color to that. | ||
ChangeColor(col); | ||
|
||
pager.setOnPageChangeListener( | ||
new ViewPager.SimpleOnPageChangeListener() { | ||
|
@@ -76,6 +95,25 @@ public void onPageSelected(int position) { | |
}); | ||
|
||
} | ||
//changing theme color of main | ||
public void ChangeColor(String a){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo, I think it should be |
||
View v = findViewById(R.id.main); | ||
if(a.equals("1")) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bracket goes on same line, to match style of rest of project |
||
v.setBackgroundColor(Color.BLACK); | ||
actionBar.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); | ||
} | ||
else if(a.equals("2")) | ||
{ | ||
v.setBackgroundColor(Color.GRAY); | ||
actionBar.setBackgroundDrawable(new ColorDrawable(Color.GRAY)); | ||
} | ||
else if(a.equals("3")) | ||
{ | ||
v.setBackgroundColor(Color.TRANSPARENT); | ||
actionBar.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
|
@@ -209,7 +247,6 @@ public Fragment getItem(int position) { | |
return fragments[position]; | ||
} | ||
|
||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
return getString(titleIds[position]); | ||
} | ||
|
@@ -270,4 +307,5 @@ private void refreshActiveFragment() { | |
(BookmarkListFragment) tabsPagerAdapter.getFragments()[pager.getCurrentItem()]; | ||
activeFragment.refresh(); | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting should use spaces, not tabs