Skip to content

Commit

Permalink
Use card view
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Sep 22, 2014
1 parent fad879f commit e8ee365
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 56 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,11 @@ Testing:
* [Elixir 2](https://play.google.com/store/apps/details?id=com.bartat.android.elixir)
* [Network Info II](https://play.google.com/store/apps/details?id=aws.apps.networkInfoIi)

Material design:

* [How to use the v21 support libs on older versions ...](http://www.reddit.com/r/androiddev/comments/297xli/howto_use_the_v21_support_libs_on_older_versions/)
* [CardView library project](https://github.com/yongjhih/CardView)

Serious contributors do not have to donate for the [pro version](http://www.xprivacy.eu/).
New translations are considered as a serious contribution, but translating a few lines of text is not.

Expand Down
3 changes: 2 additions & 1 deletion project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-19
target=android-21
android.library=false
android.library.reference.1=../CardView
13 changes: 0 additions & 13 deletions res/drawable/card_dark.xml

This file was deleted.

61 changes: 32 additions & 29 deletions res/layout/mainlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,46 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<LinearLayout
android:id="@+id/llHeader"
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cvHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dip"
android:layout_marginBottom="6dip"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:background="?attr/drawable_card"
android:orientation="horizontal"
android:paddingBottom="6dip"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:paddingTop="6dip" >

<Spinner
android:id="@+id/spRestriction"
android:layout_width="0dip"
android:layout_height="37dip"
android:layout_marginLeft="3dip"
android:layout_weight="1" />

<ImageView
android:id="@+id/imgInfo"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center_vertical"
android:layout_marginRight="3dip"
android:clickable="true"
android:contentDescription="@string/help_application"
android:focusable="true"
android:src="?attr/icon_info" />
</LinearLayout>
card_view:cardCornerRadius="6dip" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<Spinner
android:id="@+id/spRestriction"
android:layout_width="0dip"
android:layout_height="37dip"
android:layout_gravity="center_vertical"
android:layout_weight="1" />

<ImageView
android:id="@+id/imgInfo"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dip"
android:layout_marginRight="3dip"
android:clickable="true"
android:contentDescription="@string/help_application"
android:focusable="true"
android:src="?attr/icon_info" />
</LinearLayout>
</android.support.v7.widget.CardView>

<ScrollView
android:id="@+id/svTutorialHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/llHeader"
android:layout_alignTop="@id/cvHeader"
android:orientation="vertical"
android:visibility="gone" >

Expand Down
4 changes: 0 additions & 4 deletions res/values-v14/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<item name="icon_restricted">@drawable/check_holo_dark</item>
<item name="icon_frozen">@drawable/frozen_holo_dark</item>
<item name="icon_unsafe">@drawable/padlock_question_dark</item>
<item name="drawable_background">@android:color/black</item>
<item name="drawable_card">@drawable/card_dark</item>
<item name="color_dangerous">@color/color_dangerous_dark</item>
<item name="color_dangerous_off">@color/color_dangerous_off_dark</item>
<item name="color_dangerous_user">@color/color_dangerous_user_dark</item>
Expand All @@ -41,8 +39,6 @@
<item name="icon_restricted">@drawable/check_holo_light</item>
<item name="icon_frozen">@drawable/frozen_holo_light</item>
<item name="icon_unsafe">@drawable/padlock_question_light</item>
<item name="drawable_background">@color/color_home_background_light</item>
<item name="drawable_card">@drawable/card_light</item>
<item name="color_dangerous">@color/color_dangerous_light</item>
<item name="color_dangerous_off">@color/color_dangerous_off_light</item>
<item name="color_dangerous_user">@color/color_dangerous_user_light</item>
Expand Down
4 changes: 0 additions & 4 deletions res/values-v21/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<item name="icon_restricted">@drawable/check_holo_dark</item>
<item name="icon_frozen">@drawable/frozen_holo_dark</item>
<item name="icon_unsafe">@drawable/padlock_question_dark</item>
<item name="drawable_background">@android:color/black</item>
<item name="drawable_card">@drawable/card_dark</item>
<item name="color_dangerous">@color/color_dangerous_dark</item>
<item name="color_dangerous_off">@color/color_dangerous_off_dark</item>
<item name="color_dangerous_user">@color/color_dangerous_user_dark</item>
Expand All @@ -41,8 +39,6 @@
<item name="icon_restricted">@drawable/check_holo_light</item>
<item name="icon_frozen">@drawable/frozen_holo_light</item>
<item name="icon_unsafe">@drawable/padlock_question_light</item>
<item name="drawable_background">@color/color_home_background_light</item>
<item name="drawable_card">@drawable/card_light</item>
<item name="color_dangerous">@color/color_dangerous_light</item>
<item name="color_dangerous_off">@color/color_dangerous_off_light</item>
<item name="color_dangerous_user">@color/color_dangerous_user_light</item>
Expand Down
2 changes: 0 additions & 2 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<attr name="icon_clear_grayed" format="reference" />
<attr name="icon_frozen" format="reference" />
<attr name="icon_unsafe" format="reference" />
<attr name="drawable_background" format="reference" />
<attr name="drawable_card" format="reference" />
<attr name="color_dangerous" format="reference" />
<attr name="color_dangerous_off" format="reference" />
<attr name="color_dangerous_user" format="reference" />
Expand Down
3 changes: 0 additions & 3 deletions res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
<color name="color_dangerous_off_dark">#20F83A3A</color>
<color name="color_dangerous_user_light">#3CF8743A</color>
<color name="color_dangerous_user_dark">#50F8743A</color>
<color name="color_filter_background_start">#30404040</color>
<color name="color_filter_background_end">#30D0D0D0</color>
<color name="color_home_background_light">#FFE5E5E5</color>
<color name="color_state_attention_light">#FFC800</color>
<color name="color_state_attention_dark">#FF8C00</color>
<color name="color_state_restricted_light">#C8C8C8</color>
Expand Down
4 changes: 4 additions & 0 deletions src/biz/bokhorst/xprivacy/ActivityBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

public boolean isDarkTheme() {
return (mThemeId == R.style.CustomTheme);
}

private boolean isUpdating() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))
Expand Down
7 changes: 7 additions & 0 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import android.os.Environment;
import android.os.Handler;
import android.os.Process;
import android.support.v7.widget.CardView;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -191,6 +192,12 @@ protected void onCreate(Bundle savedInstanceState) {
// Annotate
Meta.annotate(this.getResources());

// Hack
if (isDarkTheme()) {
CardView card = (CardView) findViewById(R.id.cvHeader);
card.setBackgroundColor(Color.parseColor("#30404040"));
}

// Get localized restriction name
List<String> listRestrictionName = new ArrayList<String>(PrivacyManager.getRestrictions(this).navigableKeySet());
listRestrictionName.add(0, getString(R.string.menu_all));
Expand Down

0 comments on commit e8ee365

Please sign in to comment.