Skip to content

Updating launcher icon, cleaning some codes, translating strings in french #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# binaryClock: an android binary clock widget fully customizable

The hours, minuts and seconds are displayed on 2 columns in binary.
The digits' skin are customizable in shape (circle and rectangle) and color.

The devices targetted must have an API level of 21 or higher, which corresponds to Lolipop in version 5.0 or higher.
35 changes: 18 additions & 17 deletions app/src/main/java/team23/binaryclock/ClockFace.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@ public ClockFace(){
this.bitGrid = new ArrayList<>(6);
for (int i=0; i < 6 ; i++){
ArrayList<NfBitTuple> row = new ArrayList<NfBitTuple>(4);
if (i/2 == 0) {
row.add(new NfBitTuple(this.h, 7-(i%2)*4));
row.add(new NfBitTuple(this.h, 6-(i%2)*4));
row.add(new NfBitTuple(this.h, 5-(i%2)*4));
row.add(new NfBitTuple(this.h, 4-(i%2)*4));
}
else if(i/2 == 1){
row.add(new NfBitTuple(this.m, 7-(i%2)*4));
row.add(new NfBitTuple(this.m, 6-(i%2)*4));
row.add(new NfBitTuple(this.m, 5-(i%2)*4));
row.add(new NfBitTuple(this.m, 4-(i%2)*4));
}
else if(i/2 == 2){
row.add(new NfBitTuple(this.s, 7-(i%2)*4));
row.add(new NfBitTuple(this.s, 6-(i%2)*4));
row.add(new NfBitTuple(this.s, 5-(i%2)*4));
row.add(new NfBitTuple(this.s, 4-(i%2)*4));
switch(i/2) {
case(0):
row = this.addRows(row, i, this.h);
break;
case(1):
row = this.addRows(row, i, this.m);
break;
case(2):
row = this.addRows(row, i, this.s);
break;
}
this.bitGrid.add(row);
}

}

/* Factorised Method to add bit tuple in an Array */
private ArrayList<NfBitTuple> addRows(ArrayList<NfBitTuple> row, int i, NumberFace timeValue) {
row.add(new NfBitTuple(timeValue, 7-(i%2)*4));
row.add(new NfBitTuple(timeValue, 6-(i%2)*4));
row.add(new NfBitTuple(timeValue, 5-(i%2)*4));
row.add(new NfBitTuple(timeValue, 4-(i%2)*4));
}

public void setTime(){
Calendar now = Calendar.getInstance();
int hour = now.get(Calendar.HOUR_OF_DAY);
Expand Down
28 changes: 0 additions & 28 deletions app/src/main/java/team23/binaryclock/ClockService.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class ClockWidgetItemFactory implements RemoteViewsFactory{
}
@Override
public void onCreate() {
//Log.i("callback", "onCreate()");

loadSkinFromPreferences(true);
loadSkinFromPreferences(false);
Expand All @@ -73,7 +72,6 @@ public void run() {
Thread.sleep(500);
//tries to land on the top of each second
while (true) {
//Log.i("Thread", "TICK");
Calendar c = Calendar.getInstance();
int offset = c.get(Calendar.MILLISECOND);

Expand Down Expand Up @@ -110,7 +108,6 @@ private void loadSkinFromPreferences(Boolean on){
}

public void setSkin(BitSkin bitSkin, Boolean on){
//Log.i("ClockService", "setSkin");
for (int i=0; i < bitList.size() ; i++){
bitList.get(i).setSkin(bitSkin, on);
}
Expand All @@ -125,77 +122,52 @@ private void askUpdate(){

@Override
public void onDataSetChanged() {
//Log.i("callback", "onDatasetChanged()");
}

@Override
public void onDestroy() {
//Log.i("callback", "onDestroy()");
this.t.interrupt();
}

@Override
public int getCount() {
//Log.i("callback", "getCount()");

return bitList.size();
}

@Override
public RemoteViews getViewAt(int position) {
//Log.i("callback", "getViewAt("+position+")");
if (position == AdapterView.INVALID_POSITION){
return null;
}
RemoteViews view = new RemoteViews(context.getPackageName(), R.layout.bit);



////// To load an image from the external storage
//Bitmap bm = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + "/icon.png");
//view.setImageViewBitmap(R.id.bitImage, bm);
////////


boolean on = this.clockFace.get(position%6, position/6);
view.setImageViewBitmap(R.id.bitImage, bitList.get(position).getBitmap(on));
//Log.i("getViewAt","x:"+position%6 +", y:"+position/6+", pos:" + position + ", on:"+on);
return view;
}

/*
public Bitmap convertToBitmap(Drawable drawable, int widthPixels, int heightPixels) {
Bitmap mutableBitmap = Bitmap.createBitmap(widthPixels, heightPixels, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(mutableBitmap);
drawable.setBounds(0, 0, widthPixels, heightPixels);
drawable.draw(canvas);

return mutableBitmap;
}*/

@Override
public RemoteViews getLoadingView() {
//Log.i("callback", "getLoadingView()");

return null;
}

@Override
public int getViewTypeCount() {
//Log.i("callback", "getViewTypeCount()");

return 1;
}

@Override
public long getItemId(int position) {
//Log.i("callback", "getItemId() -> "+5000+position);
return 5000+position;
}

@Override
public boolean hasStableIds() {
//Log.i("callback", "hasStableIds()");
return true;
}
}
Expand Down
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<resources>
<string name="app_name">Horloge Binaire</string>
<string name="dot">Point</string>
<string name="add_widget">Ajouter un Widget</string>
<string name="title">Paramètres de l'horloge binaire</string>
<string name="bit_on_title">Visuel du bit 1</string>
<string name="color">Couleur</string>
<string name="shape">Forme</string>
<string name="plus">+</string>
<string name="color_hint">ARGB (FFAA9922)</string>
<string name="bit_off_title">Visuel du bit 0</string>
<string name="reload">recharger</string>

</resources>