Skip to content

Commit

Permalink
basic material design
Browse files Browse the repository at this point in the history
  • Loading branch information
draplater committed Oct 21, 2018
1 parent 96c74ba commit fd6feb3
Show file tree
Hide file tree
Showing 19 changed files with 260 additions and 173 deletions.
30 changes: 22 additions & 8 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,58 @@
<application android:label="@string/app_name" android:icon="@drawable/backup2">
<activity android:name="cn.drapl.backup.OAndBackup"
android:label="@string/app_name"
android:launchMode="singleTop">
android:launchMode="singleTop"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="cn.drapl.backup.BatchActivity"
android:label="@string/app_name"
android:parentActivityName="cn.drapl.backup.OAndBackup" >
android:parentActivityName="cn.drapl.backup.OAndBackup"
android:theme="@style/AppTheme">
</activity>
<activity android:name="cn.drapl.backup.Preferences"
android:label="@string/prefs_title"
android:parentActivityName="cn.drapl.backup.OAndBackup"
android:launchMode="singleTop">
android:launchMode="singleTop"
android:theme="@style/AppPreferenceTheme"
>
</activity>
<activity android:name="cn.drapl.backup.schedules.Scheduler"
android:label="@string/sched_title"
android:windowSoftInputMode="stateHidden"
android:parentActivityName="cn.drapl.backup.OAndBackup" >
android:parentActivityName="cn.drapl.backup.OAndBackup"
android:theme="@style/AppTheme"
>
</activity>
<activity android:name="cn.drapl.backup.ui.Help"
android:label="@string/help_title"
android:windowSoftInputMode="stateHidden"
android:parentActivityName="cn.drapl.backup.OAndBackup" >
android:parentActivityName="cn.drapl.backup.OAndBackup"
android:theme="@style/AppTheme"
>
</activity>
<activity android:name="cn.drapl.backup.Tools"
android:label="@string/tools_title"
android:windowSoftInputMode="stateHidden"
android:parentActivityName="cn.drapl.backup.OAndBackup"
android:launchMode="singleTop">
android:launchMode="singleTop"
android:theme="@style/AppTheme"
>
</activity>
<activity android:name="cn.drapl.backup.ui.FileBrowser"
android:label="@string/filebrowser_title"
android:parentActivityName="cn.drapl.backup.Preferences" >
android:parentActivityName="cn.drapl.backup.Preferences"
android:theme="@style/AppTheme"
>
</activity>
<activity android:name="cn.drapl.backup.LogViewer"
android:label="logviewer"
android:parentActivityName="cn.drapl.backup.Tools" >
android:parentActivityName="cn.drapl.backup.Tools"
android:theme="@style/AppTheme"
>
</activity>
<receiver android:name="cn.drapl.backup.schedules.AlarmReceiver" />
<receiver android:name="cn.drapl.backup.schedules.BootReceiver">
Expand Down
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
Expand All @@ -11,13 +15,18 @@ apply plugin: 'com.android.application'

repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}

dependencies {
compile 'org.sufficientlysecure:openpgp-api:9.0'
compile 'com.jaredrummler:apk-parser:1.0.2'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'

compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:preference-v7:27.0.1'
}

android {
Expand Down
2 changes: 1 addition & 1 deletion res/layout/listlayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.6"
android:textColor="#fff"
android:textColor="#000000"
android:textSize="16sp"
/>
<TextView
Expand Down
11 changes: 11 additions & 0 deletions res/layout/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<fragment
android:name="cn.drapl.backup.PreferenceFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="cn.drapl.backup.PreferenceFragment"/>
</FrameLayout>
2 changes: 1 addition & 1 deletion res/layout/toolslayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@android:id/list"
android:id="@+id/tools_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
Expand Down
4 changes: 2 additions & 2 deletions res/layout/toolslist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
android:id="@+id/tools_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#fff"
android:textColor="#000000"
android:textSize="20sp"
android:paddingBottom="5sp"
/>
<TextView
android:id="@+id/tools_description"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#eee"
android:textColor="#333333"
android:textSize="16sp"
android:paddingLeft="10sp"
/>
Expand Down
18 changes: 9 additions & 9 deletions res/menu/mainmenu.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/search"
android:orderInCategory="100"
android:title="@string/search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="always" />
<item android:id="@+id/refresh"
android:title="@string/refresh"
android:icon="@drawable/ic_menu_refresh"
android:showAsAction="ifRoom" />
app:showAsAction="ifRoom"/>
<item android:id="@+id/batchbackup"
android:title="@string/batchbackup" />
<item android:id="@+id/batchrestore"
android:title="@string/batchrestore" />
<item android:id="@+id/search"
android:title="@string/search"
android:icon="@drawable/ic_search_category_default"
android:showAsAction="always|collapseActionView"
android:actionViewClass="android.widget.SearchView"
android:iconifiedByDefault="true"
/>
<item android:id="@+id/sortingsubmenu"
android:title="@string/sort" >
<menu>
Expand Down
4 changes: 4 additions & 0 deletions res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#99CCCC</color>
</resources>
13 changes: 13 additions & 0 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- inherit from the AppCompat theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- your app branding color for the app bar -->
<item name="colorPrimary">@color/primary</item>
</style>

<style name="AppPreferenceTheme" parent="AppTheme">
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
...
</style>
</resources>
10 changes: 5 additions & 5 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@
android:title="@string/prefs_cryptoUserIds"
android:summary="@string/prefs_summaryCryptoUserIds"
/>
<org.openintents.openpgp.util.OpenPgpAppPreference
android:key="openpgpProviderList"
android:title="@string/prefs_openpgpProviderList"
/>
<!--<org.openintents.openpgp.util.OpenPgpAppPreference-->
<!--android:key="openpgpProviderList"-->
<!--android:title="@string/prefs_openpgpProviderList"-->
<!--/>-->
</PreferenceScreen>
<PreferenceCategory
android:title="@string/prefs_pathscategory"
android:key="pathscategory" >
<cn.drapl.backup.FileBrowserEditTextPreference
<EditTextPreference
android:key="pathBackupFolder"
android:title="@string/prefs_pathBackupFolder"
android:summary="@string/prefs_summaryBackupFolder"
Expand Down
13 changes: 10 additions & 3 deletions src/cn/drapl/backup/BaseActivity.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package cn.drapl.backup;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;

import cn.drapl.backup.ui.LanguageHelper;
import org.openintents.openpgp.util.OpenPgpApi;

public class BaseActivity extends Activity
public class BaseActivity extends AppCompatActivity
{
final static String TAG = "oandbackup";
public static final int OPENPGP_REQUEST_ENCRYPT = 3;
Expand All @@ -23,7 +25,12 @@ public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
if(android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN && getParentActivityIntent() != null)
{
getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(getResources().getColor(R.color.primary));
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String langCode = prefs.getString(Constants.PREFS_LANGUAGES,
Expand Down
64 changes: 32 additions & 32 deletions src/cn/drapl/backup/FileBrowserEditTextPreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
import android.preference.DialogPreference;
import android.support.v7.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -51,37 +51,37 @@ protected void onSetInitialValue(boolean restoreValue, Object defaultValue)
{
setText(restoreValue ? getPersistedString(mText) : (String) defaultValue);
}
@Override
protected void onDialogClosed(boolean positiveResult)
{
super.onDialogClosed(positiveResult);
if(positiveResult)
{
String value = mEditText.getText().toString();
if(callChangeListener(value))
setText(value);
}
}
@Override
protected void onBindDialogView(View view)
{
super.onBindDialogView(view);

EditText editText = mEditText;
editText.setText(getText());
button.setText("...");

ViewParent oldParent = editText.getParent();
if(oldParent != view)
{
if (oldParent != null)
{
((ViewGroup) oldParent).removeView(button);
((ViewGroup) oldParent).removeView(editText);
}
onAddViewsToDialogView(view, editText, button);
}
}
// @Override
// protected void onDialogClosed(boolean positiveResult)
// {
// super.onDialogClosed(positiveResult);
// if(positiveResult)
// {
// String value = mEditText.getText().toString();
// if(callChangeListener(value))
// setText(value);
// }
// }
// @Override
// protected void onBindDialogView(View view)
// {
// super.onBindDialogView(view);
//
// EditText editText = mEditText;
// editText.setText(getText());
// button.setText("...");
//
// ViewParent oldParent = editText.getParent();
// if(oldParent != view)
// {
// if (oldParent != null)
// {
// ((ViewGroup) oldParent).removeView(button);
// ((ViewGroup) oldParent).removeView(editText);
// }
// onAddViewsToDialogView(view, editText, button);
// }
// }
/*
* saving and restoring instance state is based on code from
* the android development documentation:
Expand Down
Loading

0 comments on commit fd6feb3

Please sign in to comment.