added "settings" button to main view. Removed options menu from main view.

This commit is contained in:
Kevin Meyer 2014-08-20 10:53:12 +02:00
parent 111a29b414
commit 7fcd254b80
4 changed files with 24 additions and 31 deletions

View File

@ -84,6 +84,7 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
Button btnDone;
Button btnGetPost;
Button btnSync;
Button btnSettings;
EditText editPocheUrl;
SharedPreferences settings;
static String apiUsername;
@ -95,7 +96,6 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
/** Called when the activity is first created.
* Will act differently depending on whether sharing or
* displaying information page. */
@ -196,6 +196,13 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
}
});
btnSettings = (Button)findViewById(R.id.btnSettings);
btnSettings.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getBaseContext(), Settings.class));
}
});
}
}
@ -236,23 +243,6 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.option, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuSettings:
startActivity(new Intent(getBaseContext(), Settings.class));
default:
return super.onOptionsItemSelected(item);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
@ -268,7 +258,7 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(getApplicationContext());
database = helper.getReadableDatabase();
int news = database.query(ARTICLE_TABLE, null, ARCHIVE + "=0", null, null, null, null).getCount();
btnGetPost.setText(getString(R.string.btnGetPost) + " - " + news + " unread");
btnGetPost.setText(String.format(getString(R.string.btnGetPost), news));
}
});
}

View File

@ -30,7 +30,8 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="@string/hello"
android:textSize="25sp" />
android:textSize="25sp"
android:visibility="gone" />
<View
android:id="@+id/view1"
@ -55,6 +56,13 @@
android:layout_weight="1"
android:text="@string/btnSync" />
<Button
android:id="@+id/btnSettings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/btnSettings"/>
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/menuSettings"
android:icon="@android:drawable/ic_menu_preferences" android:enabled="true" android:menuCategory="system" android:visible="true" android:title="@string/menuSettings"/>
</menu>

View File

@ -4,16 +4,16 @@
<string name="app_name">wallabag</string>
<string name="label_name">Bag it!</string>
<string name="author">GAULUPEAU Jonathan - 2013</string>
<string name="instructions">To save a web page to wallabag, open the page in a browser then tap <i>Share</i> and tap on <i>Bag it!</i>. \nYou could then see your wallabag login page. \nAnd it\'s done ! \nMore infos about wallabag at http://www.wallabag.org</string>
<string name="instructions">To save a web page to wallabag, open the page in a browser then tap <i>Share</i> and tap on <i>Bag it!</i>. \nYou could then see your wallabag login page. \nAnd it\'s done ! \nMore infos about wallabag at:\n http://www.wallabag.org</string>
<string name="btnDone">Save</string>
<string name="which_browser">Which browser would you like to use?</string>
<string name="authorSite">http://cv.gaulupeau.fr</string>
<string name="url_label"><b><u>Your wallabag URL :</u></b></string>
<string name="url_help">Examples:\n<i>http://wallabag.example.fr</i>\n<i>http://www.example.fr/wallabag</i></string>
<string name="btnGetPost">List articles</string>
<string name="btnGetPost">List articles - %1$d unread</string>
<string name="btnSync">Synchronize</string>
<string name="btnMarkRead">Mark as Read</string>
<string name="menuSettings">Settings</string>
<string name="btnSettings">Settings</string>
<string name="menuShowAll">Show All</string>
<string name="menuWipeDb">Wipe Database</string>
<string name="txtSyncDone">Synchronize done !</string>