Android Open Source - CustomFontManager Font Install Service






From Project

Back to project page CustomFontManager.

License

The source code is released under:

MIT License

If you think the Android project CustomFontManager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tetsu31415.customfont;
//  w w w.  j  a  v  a2 s. c o m
import java.io.File;

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;

public class FontInstallService extends Service{
  private BroadcastReceiver receiver;
  
  @Override
  public IBinder onBind(Intent intent) {
    return null;
  }
  
  @Override
  public void onCreate(){
    super.onCreate();
    receiver = new BroadcastReceiver(){
      @Override
      public void onReceive(Context context, Intent intent) {
        Commands commands = new Commands(context);
        
        File inputFile = commands.getFilePath(Strings.CUSTOM_FONT_FILE);
        File outputFile;
        if (commands.getManufacturer()==0) {
          outputFile = new File(Strings.FONT_PATH_SHARP);
        }else {
          outputFile = new File(Strings.FONT_PATH_FUJITSU);
        }
        commands.copyFile(inputFile, outputFile);
        commands.execCommand("rm "+inputFile.getPath());
      }
    };
    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_SHUTDOWN);
    registerReceiver(receiver, filter);    
  }
  
}




Java Source Code List

com.tetsu31415.customfont.Commands.java
com.tetsu31415.customfont.FontInstallService.java
com.tetsu31415.customfont.MainActivity.java
com.tetsu31415.customfont.NewApiMethod.java
com.tetsu31415.customfont.OpenIntents.java
com.tetsu31415.customfont.SelectFontActivity.java
com.tetsu31415.customfont.Strings.java