Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

Commit

Permalink
Redesigned the ControlsActivity
Browse files Browse the repository at this point in the history
Chnaged the Color Theme
Redesigned the ControlActivity Layout
Updated Login and Signup Activity Layouts
SignalRService made ForegroundService with Notificaiton Actions
  • Loading branch information
pishangujeniya committed Oct 20, 2018
1 parent 231b4b7 commit 4f96ade
Show file tree
Hide file tree
Showing 14 changed files with 275 additions and 148 deletions.
4 changes: 2 additions & 2 deletions ClipSyncAndroid/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "com.pishangujeniya.clipsync"
minSdkVersion 23
targetSdkVersion 28
versionCode 14
versionName "1.4"
versionCode 15
versionName "1.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
Expand Down
2 changes: 1 addition & 1 deletion ClipSyncAndroid/app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"x86"}],"versionCode":14,"versionName":"1.4","enabled":true,"filterName":"x86","outputFile":"app-x86-release.apk","fullName":"x86Release","baseName":"x86-release"},"path":"app-x86-release.apk","properties":{}},{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"armeabi-v7a"}],"versionCode":14,"versionName":"1.4","enabled":true,"filterName":"armeabi-v7a","outputFile":"app-armeabi-v7a-release.apk","fullName":"armeabi-v7aRelease","baseName":"armeabi-v7a-release"},"path":"app-armeabi-v7a-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"x86"}],"versionCode":15,"versionName":"1.5","enabled":true,"filterName":"x86","outputFile":"app-x86-release.apk","fullName":"x86Release","baseName":"x86-release"},"path":"app-x86-release.apk","properties":{}},{"outputType":{"type":"APK"},"apkInfo":{"type":"FULL_SPLIT","splits":[{"filterType":"ABI","value":"armeabi-v7a"}],"versionCode":15,"versionName":"1.5","enabled":true,"filterName":"armeabi-v7a","outputFile":"app-armeabi-v7a-release.apk","fullName":"armeabi-v7aRelease","baseName":"armeabi-v7a-release"},"path":"app-armeabi-v7a-release.apk","properties":{}}]
9 changes: 7 additions & 2 deletions ClipSyncAndroid/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@
<service
android:name=".service.ClipBoardMonitor"
android:exported="false"
android:label="Clipboard Monitor" />
android:label="Clipboard Monitor"
/>
<service
android:name=".service.SignalRService"
android:exported="false"
android:label="ClipSync SignalR" />
android:label="ClipSync SignalR"

/>

<activity android:name=".ControlsActivity"></activity>
</application>



</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.ActivityManager;
import android.content.ClipboardManager;
import android.content.Intent;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
Expand All @@ -17,11 +18,11 @@

public class ControlsActivity extends AppCompatActivity {

private TextView status_text_veiw;
private Button start_service_button;
private Button stop_service_button;
private Button logout_button;
private Button refresh_button;

private FloatingActionButton start_service_button;
private FloatingActionButton stop_service_button;
private FloatingActionButton logout_button;


private Utility utility;
private final String TAG = ControlsActivity.class.getSimpleName();
Expand All @@ -31,48 +32,38 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_controls);

start_service_button = findViewById(R.id.activity_controls_service_start_button);
stop_service_button = findViewById(R.id.activity_controls_service_stop_button);
logout_button = findViewById(R.id.activity_controls_log_out_button);
status_text_veiw = findViewById(R.id.activity_controls_status_text_view);
refresh_button = findViewById(R.id.activity_controls_status_refresh_button);

refresh_button.setVisibility(View.INVISIBLE);
status_text_veiw.setVisibility(View.INVISIBLE);
utility = new Utility(this);

start_service_button = findViewById(R.id.activity_controls_service_start_fab);
stop_service_button = findViewById(R.id.activity_controls_service_stop_fab);
logout_button = findViewById(R.id.activity_controls_log_out_fab);

start_service_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

Intent signalRServiceIntent = new Intent(ControlsActivity.this, SignalRService.class);
signalRServiceIntent.setAction(GlobalValues.START_SERVICE);
startService(signalRServiceIntent);

// Always Call after SignalR Service Started
startService(new Intent(ControlsActivity.this, ClipBoardMonitor.class));

updateStatusText();

start_service_button.setVisibility(View.INVISIBLE);
start_service_button.hide();
stop_service_button.show();

}
});

stop_service_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
stopServices();

updateStatusText();

start_service_button.setVisibility(View.VISIBLE);
}
});
stop_service_button.hide();
start_service_button.show();

refresh_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
updateStatusText();
stopServices();
}
});

Expand All @@ -90,8 +81,8 @@ private boolean isServiceRunning(String classgetName) {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
assert manager != null;
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
Log.e(TAG,service.service.getClassName());
Log.e(TAG,"ClassName" +service.service.getClassName());
Log.e(TAG, service.service.getClassName());
Log.e(TAG, "ClassName" + service.service.getClassName());
if (classgetName.equals(service.service.getClassName())) {
return true;
}
Expand All @@ -101,28 +92,16 @@ private boolean isServiceRunning(String classgetName) {

private void stopServices() {
Intent signalRServiceIntent = new Intent(ControlsActivity.this, SignalRService.class);
signalRServiceIntent.setAction(GlobalValues.STOP_SERVICE);
stopService(signalRServiceIntent);

// Always Call after SignalR Service Started
stopService(new Intent(ControlsActivity.this, ClipBoardMonitor.class));
}

private void updateStatusText(){
String text_to_display = "Status : ";

if (isServiceRunning(SignalRService.class.getName()) && isServiceRunning(ClipboardManager.class.getName())) {
text_to_display = text_to_display + "Yes";
} else {
text_to_display = text_to_display + "No";
}

status_text_veiw.setText(text_to_display);
}

@Override
protected void onResume() {
super.onResume();
updateStatusText();
}

private void logout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ public class GlobalValues {
public static String send_copied_text_signalr_method_name = "SendCopiedText";
public static String copied_water_mark = "- Copied By ClipSync";

public static String STOP_SERVICE = "STOP_SERVICE";
public static String START_SERVICE = "START_SERVICE";

public static int SIGNALR_SERVICE_NOTIFICATION_ID = 1001;



}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void onServiceConnected(ComponentName className, IBinder service) {
Log.e(TAG, "Inside service connected - Activity ");
// We've bound to SignalRService, cast the IBinder and get SignalRService instance
SignalRService.LocalBinder binder = (SignalRService.LocalBinder) service;
mService = binder.getService();
mService = (SignalRService) binder.getService();
mBound = true;
Log.e(TAG, "bound status - " + mBound);
}
Expand Down
Loading

0 comments on commit 4f96ade

Please sign in to comment.