-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from BlinkID/fix/resourcesAndroid
Fix/resources android
- Loading branch information
Showing
15 changed files
with
169 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
BlinkMoto/src/android/java/com/phonegap/plugins/blinkid/FakeR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.phonegap.plugins.blinkid; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
|
||
/** | ||
* Replacement for android resources <b>R</b> in PhoneGap plugins.<br/> | ||
* Used for resources added with a plugin. Since the application has its own <b>R</b> the plugin must fetch its resources through the activity's context. | ||
*/ | ||
public class FakeR { | ||
private Context context; | ||
private String packageName; | ||
|
||
public FakeR(Activity activity) { | ||
context = activity.getApplicationContext(); | ||
packageName = context.getPackageName(); | ||
} | ||
|
||
public FakeR(Context context) { | ||
this.context = context; | ||
packageName = context.getPackageName(); | ||
} | ||
|
||
/** | ||
* Get resource identifier from given group. | ||
* | ||
* @param group id, string, layout, dimen, bool, etc. | ||
* @param key Resource key | ||
* @return Resource identifier | ||
*/ | ||
public int getIdFrom(String group, String key) { | ||
return context.getResources().getIdentifier(key, group, packageName); | ||
} | ||
|
||
/** | ||
* Get resource identifier from group <b>id</b>. | ||
* | ||
* @param key Resource key | ||
* @return Resource value | ||
*/ | ||
public int getId(String key) { | ||
return getIdFrom("id", key); | ||
} | ||
|
||
/** | ||
* Get resource identifier from group <b>string</b>. | ||
* | ||
* @param key Resource key | ||
* @return Resource value | ||
*/ | ||
public String getString(String key) { | ||
return context.getResources().getString(getIdFrom("string", key)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
BlinkMoto/src/android/res/drawable/blinkid_button_accent_text_color.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_enabled="false" android:color="@color/blinkid_btn_accent_text_color_disabled" /> | ||
<item android:color="@color/blinkid_btn_accent_text_color" /> | ||
</selector> |
2 changes: 1 addition & 1 deletion
2
...rc/android/res/drawable/button_normal.xml → ...id/res/drawable/blinkid_button_normal.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<corners android:radius="0dp" /> | ||
<solid android:color="@color/btn_background" /> | ||
<solid android:color="@color/blinkid_btn_background" /> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
BlinkMoto/src/android/res/drawable/button_accent_text_color.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.