Created
September 2, 2013 16:44
-
-
Save ec84b4/6414850 to your computer and use it in GitHub Desktop.
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
package com.hiser.test; | |
import java.util.ArrayList; | |
import java.util.List; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.graphics.Color; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.AdapterView; | |
import android.widget.ArrayAdapter; | |
import android.widget.SeekBar; | |
import android.widget.TextView; | |
import android.widget.Toast; | |
import android.widget.AdapterView.OnItemSelectedListener; | |
import android.widget.SeekBar.OnSeekBarChangeListener; | |
import android.widget.Spinner; | |
public class MainActivity extends Activity { | |
int p = 0; | |
public static String font = "tahoma.ttf"; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
// TODO Auto-generated method stub | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
String item1 = "font1"; | |
String item2 = "font2"; | |
//String item3 = "فونت سه"; | |
ArrayAdapter<String> ad = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item); | |
ad.add(item1); | |
ad.add(item2); | |
Spinner sp = (Spinner) findViewById(R.id.spinner1); | |
sp.setAdapter(ad); | |
sp.setOnItemSelectedListener(new OnItemSelectedListener() { | |
@Override | |
public void onItemSelected(AdapterView<?> parent, View selectedItemView, | |
int position, long id) { | |
// TODO Auto-generated method stub | |
//boolean selected = false; | |
if (position == 0) { | |
font = "tahoma.ttf"; | |
} else if (position == 1) { | |
font = "QuranTaha.ttf"; | |
} | |
} | |
@Override | |
public void onNothingSelected(AdapterView<?> arg0) { | |
// TODO Auto-generated method stub | |
} | |
}); | |
// TODO Auto-generated method stub | |
final SeekBar sk = (SeekBar) findViewById(R.id.seekBar1); | |
//final SharedPreferences size; | |
//int sh=0 ; | |
sk.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { | |
public void onStartTrackingTouch(SeekBar seekBar) { | |
// TODO Auto-generated method stub | |
} | |
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | |
// TODO Auto-generated method stub | |
p = progress; | |
} | |
public void onStopTrackingTouch(SeekBar seekBar) { | |
// TODO Auto-generated method stub | |
SharedPreferences size = getSharedPreferences("settings", Context.MODE_PRIVATE); | |
SharedPreferences.Editor ed = size.edit(); | |
ed.putInt("size?", p); | |
ed.commit(); | |
Toast.makeText(getBaseContext(), String.valueOf(p), Toast.LENGTH_SHORT).show(); | |
} | |
}); | |
} | |
public String getFont() { | |
// TODO Auto-generated method stub | |
return font; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment