Advertisement
Guest User

Cydia Violet Example Consolidate Code

a guest
Jun 20th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. package com.example.cydiaexample;
  2.  
  3. import java.lang.reflect.Method;
  4.  
  5. import android.content.res.Resources;
  6. import android.util.Log;
  7.  
  8. import com.saurik.substrate.MS;
  9.  
  10.  
  11. public class Main {
  12.     static void initialize() {
  13.         MS.hookClassLoad("android.content.res.Resources", new MS.ClassLoadHook() {
  14.             public void classLoaded(Class<?> resources) {
  15.            
  16.                  Method getColor; try {
  17.                     getColor = resources.getMethod("getColor", Integer.TYPE);
  18.                 } catch (NoSuchMethodException e) {
  19.                     getColor = null;
  20.                 }
  21.  
  22.                 if (getColor != null) {
  23.                     MS.hookMethod(resources, getColor,
  24.                 new MS.MethodAlteration<Resources, Integer>() {
  25.                         public Integer invoked(Resources resources, Object... args)
  26.                             throws Throwable
  27.                         {
  28.                             return invoke(resources, args) & ~0x00ff6600;
  29.                         }
  30.                     });
  31.                 }
  32.             }      
  33.         });
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement