diff --git a/res/drawable-hdpi/ic_menu_info_details.png b/res/drawable-hdpi/ic_menu_info_details.png new file mode 100644 index 0000000..6a7a1e9 Binary files /dev/null and b/res/drawable-hdpi/ic_menu_info_details.png differ diff --git a/res/drawable-mdpi/ic_menu_info_details.png b/res/drawable-mdpi/ic_menu_info_details.png new file mode 100755 index 0000000..18b15b5 Binary files /dev/null and b/res/drawable-mdpi/ic_menu_info_details.png differ diff --git a/res/drawable-xhdpi/ic_menu_info_details.png b/res/drawable-xhdpi/ic_menu_info_details.png new file mode 100644 index 0000000..24ea543 Binary files /dev/null and b/res/drawable-xhdpi/ic_menu_info_details.png differ diff --git a/res/layout/about_dialog.xml b/res/layout/about_dialog.xml new file mode 100644 index 0000000..e923212 --- /dev/null +++ b/res/layout/about_dialog.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + diff --git a/res/menu/list_menu.xml b/res/menu/list_menu.xml index 5f1aad9..2e6db69 100644 --- a/res/menu/list_menu.xml +++ b/res/menu/list_menu.xml @@ -30,4 +30,11 @@ android:showAsAction="never|withText" android:title="@string/action_select_all"/> + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index ea94da6..9c293af 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9,6 +9,7 @@ Add Host Reload host entries Select all hosts + About Add Hostname @@ -58,4 +59,9 @@ Toggling entry Toggling entries + + About Hosts Editor + This app lets you modify your /etc/hosts file on Android.\nYou might need to reboot to clear your DNS cache after any change. + 2013 - www.nilhcem.com + GitHub diff --git a/src/com/nilhcem/hostseditor/about/AboutDialogFragment.java b/src/com/nilhcem/hostseditor/about/AboutDialogFragment.java new file mode 100644 index 0000000..8e19b4c --- /dev/null +++ b/src/com/nilhcem/hostseditor/about/AboutDialogFragment.java @@ -0,0 +1,37 @@ +package com.nilhcem.hostseditor.about; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import butterknife.InjectView; +import butterknife.Views; + +import com.actionbarsherlock.app.SherlockDialogFragment; +import com.nilhcem.hostseditor.R; + +public class AboutDialogFragment extends SherlockDialogFragment implements View.OnClickListener { + public static final String TAG = "AboutDialogFragment"; + private static final String GITHUB_URL = "https://github.com/Nilhcem/hosts-editor-android"; + + @InjectView(R.id.aboutGitHub) Button mGitHubBtn; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.about_dialog, container, false); + Views.inject(this, view); + getDialog().setTitle(R.string.about_title); + + mGitHubBtn.setOnClickListener(this); + return view; + } + + @Override + public void onClick(View v) { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(GITHUB_URL)); + startActivity(browserIntent); + } +} diff --git a/src/com/nilhcem/hostseditor/list/ListHostsActivity.java b/src/com/nilhcem/hostseditor/list/ListHostsActivity.java index 45803ba..0966ebb 100644 --- a/src/com/nilhcem/hostseditor/list/ListHostsActivity.java +++ b/src/com/nilhcem/hostseditor/list/ListHostsActivity.java @@ -19,6 +19,7 @@ import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.widget.SearchView; import com.nilhcem.hostseditor.R; +import com.nilhcem.hostseditor.about.AboutDialogFragment; import com.nilhcem.hostseditor.addedit.AddEditHostActivity; import com.nilhcem.hostseditor.bus.event.LoadingEvent; import com.nilhcem.hostseditor.bus.event.StartAddEditActivityEvent; @@ -120,6 +121,9 @@ public boolean onOptionsItemSelected(MenuItem item) { case R.id.action_select_all: mFragment.selectAll(); return true; + case R.id.action_about: + displayAboutDialog(); + return true; default: return super.onOptionsItemSelected(item); } @@ -210,4 +214,10 @@ private void setActionBarTitle() { } getSupportActionBar().setTitle(titleRes); } + + private void displayAboutDialog() { + FragmentManager fm = getSupportFragmentManager(); + AboutDialogFragment dialog = new AboutDialogFragment(); + dialog.show(fm, AboutDialogFragment.TAG); + } }