mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Change about
This commit is contained in:
@@ -21,35 +21,39 @@ package com.keepassdroid;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.keepass.R;
|
||||
|
||||
public class AboutDialog extends Dialog {
|
||||
|
||||
public AboutDialog(Context context) {
|
||||
super(context);
|
||||
}
|
||||
public class AboutDialog extends DialogFragment {
|
||||
|
||||
private View root;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.about);
|
||||
setTitle(R.string.app_name);
|
||||
|
||||
setVersion();
|
||||
|
||||
Button okButton = (Button) findViewById(R.id.about_button);
|
||||
okButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
|
||||
root = inflater.inflate(R.layout.about, null);
|
||||
|
||||
setVersion();
|
||||
|
||||
builder.setView(root)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
private void setVersion() {
|
||||
@@ -62,7 +66,7 @@ public class AboutDialog extends Dialog {
|
||||
e.printStackTrace();
|
||||
version = "";
|
||||
}
|
||||
TextView tv = (TextView) findViewById(R.id.version);
|
||||
TextView tv = (TextView) root.findViewById(R.id.version);
|
||||
tv.setText(version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.keepassdroid.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
@@ -19,7 +19,7 @@ public class MenuUtil {
|
||||
inflater.inflate(R.menu.default_menu, menu);
|
||||
}
|
||||
|
||||
public static boolean onDefaultMenuOptionsItemSelected(Activity activity, MenuItem item) {
|
||||
public static boolean onDefaultMenuOptionsItemSelected(AppCompatActivity activity, MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_donate:
|
||||
try {
|
||||
@@ -28,17 +28,17 @@ public class MenuUtil {
|
||||
Toast.makeText(activity, R.string.error_failed_to_launch_link, Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
case R.id.menu_about:
|
||||
AboutDialog dialog = new AboutDialog(activity);
|
||||
dialog.show();
|
||||
return true;
|
||||
|
||||
case R.id.menu_app_settings:
|
||||
SettingsActivity.Launch(activity);
|
||||
return true;
|
||||
|
||||
case R.id.menu_about:
|
||||
AboutDialog dialog = new AboutDialog();
|
||||
dialog.show(activity.getSupportFragmentManager(), "aboutDialog");
|
||||
return true;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_margin="@dimen/default_margin"
|
||||
android:padding="@dimen/default_margin"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView android:id="@+id/about_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/AboutText"/>
|
||||
<ImageView android:id="@+id/divider1"
|
||||
android:layout_width="match_parent"
|
||||
@@ -36,7 +37,8 @@
|
||||
<TextView android:id="@+id/version_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/version_label"/>
|
||||
android:text="@string/version_label"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title"/>
|
||||
<TextView android:id="@+id/version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -50,7 +52,8 @@
|
||||
<TextView android:id="@+id/homepage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_homepage"/>
|
||||
android:text="@string/about_homepage"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title"/>
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -62,7 +65,8 @@
|
||||
<TextView android:id="@+id/feedback"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about_feedback"/>
|
||||
android:text="@string/about_feedback"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title"/>
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/issues"
|
||||
@@ -79,12 +83,6 @@
|
||||
<TextView android:id="@+id/disclaimer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/disclaimer_formal"/>
|
||||
<Button android:id="@+id/about_button"
|
||||
android:layout_margin="@dimen/button_margin"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@android:string/ok"
|
||||
android:width="100sp"/>
|
||||
android:text="@string/disclaimer_formal"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TinyText"/>
|
||||
</LinearLayout>
|
||||
@@ -95,6 +95,9 @@
|
||||
</style>
|
||||
<style name="KeepassDXStyle.TextAppearance.SecondaryText" parent="KeepassDXStyle.TextAppearance">
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
<style name="KeepassDXStyle.TextAppearance.TinyText" parent="KeepassDXStyle.TextAppearance">
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
<style name="KeepassDXStyle.TextAppearance.WarningTextStyle" parent="KeepassDXStyle.TextAppearance">
|
||||
<item name="android:textColor">@color/colorAccent</item>
|
||||
|
||||
Reference in New Issue
Block a user